diff --git a/dist/main.js b/dist/main.js
index 90822ef..24a5c16 100644
--- a/dist/main.js
+++ b/dist/main.js
@@ -1,7 +1,16706 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MCUClientEngine=t():e.MCUClientEngine=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,i){r.apply(this,[e,t,i].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){e.exports=n(23)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){n(this,e),this.sdkInfo=t||"",this.id=this.initId()}return r(e,[{key:"initId",value:function(){var e=this.sdkInfo.constructor.name.toLowerCase();return"string"===e?this.sdkInfo:"object"===e?this.sdkInfo.mid||"":""}},{key:"log",value:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.LOG,n)}},{key:"warn",value:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.WARN,n)}},{key:"error",value:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.ERROR,n)}},{key:"_log",value:function(t,n){n=JSON.stringify(n);var r=this.id+" -> "+n;if(t>=e.logLevel)switch(t){case e.LOG:console.log(r);break;case e.WARN:console.warn(r);break;case e.ERROR:console.error(r)}}}]),e}();i.LOG=0,i.WARN=1,i.ERROR=2,i.NO=1/0,i.logLevel=i.LOG;var s={getLoger:function(e){return new i(e)},setLogLevel:function(e){i.logLevel=e},LOG:i.LOG,WARN:i.WARN,ERROR:i.ERROR,NO:i.NO};t.default=s;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"Loger","D:/work/McuClient/src/Loger.js"),__REACT_HOT_LOADER__.register(s,"default","D:/work/McuClient/src/Loger.js"))})()},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0}),n.CLASS_INIT_SUCCESS="class.init.success",n.CLASS_INIT_FAILED="class.init.failed",n.CLASS_JOIN_FAILED="join.class.failed",n.CLASS_JOIN_SUCCESS="join.class.success",n.CLASS_SHOW_DETAIL="class_detail.message",n.CLASS_SHOW_ROSTER_NUM="roster_num.message",n.CLASS_EXIT="class.exit",n.CHAT_RECEIVE="chat.message",n.VIDEO_SHOW="video.message",n.DOC_SHOW="document.message",n.DOC_SWITCH="document.switch",n.DOC_UPDATE="document.update",n.DOC_DEL="document.delete",n.DOC_ANNO="document.anno",n.ANNO_UPDATE="anno_update",n.AUDIO_SHOW="audio.message",n.NET_ERROR="net_error",n.PRO_ERROR="pro_error",n.ERROR_NET="网络异常",n.ERROR_PARAM="参数不正确",n.ERROR_CLASS_JOIN_FULL="class.join,full",n.ERROR_CLASS_JOIN_CONFILICT="class.join.conflict",n.ERROR_CLASS_PASSWORD_WRONG="class.password.wrong",n.ERROR_CLASS_MD5_WRONG="class.md5.wrong",n.ERROR_CLASS_PROTOCOL_WRONG="class.protocol.wrong";var r=n;t.default=r;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(n,"MessageTypes","D:/work/McuClient/src/MessageTypes.js"),__REACT_HOT_LOADER__.register(r,"default","D:/work/McuClient/src/MessageTypes.js"))})()},function(e,t){"use strict";function n(e){for(var t in n)if(n[t]===e)return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.NR_GUEST=0,n.NR_NORMAL=1,n.NR_ADMIN=2,n.NR_MASTER=4,n.NR_SLAVE=8,n.NR_ASSISTANT=16,n.NR_INVISIBLE=32,n.INVALIDATE_CHANNEL_ID=-1,n.INVALIDATE_NODE_ID=-1,n.DOCUMENT_LOAD=0,n.DOCUMENT_DEL=1,n.CGS_RELEASED=0,n.CGS_PENDING=1,n.CGS_OPENNED=2,n.CGS_GRABBING=3,n.CONFERENCE_SESSION_ID=11,n.CHAT_SESSION_ID=12,n.GIFT_SESSION_ID=13,n.AUDIO_SESSION_ID=14,n.VIDEO_SESSION_ID=15,n.WEBSHARING_SESSION_ID=16,n.DOCSHARING_SESSION_ID=17,n.WHITEBOARD_SESSION_ID=18,n.MEDIA_SESSION_ID=19,n.SCREENSHARING_SESSION_ID=20,n.POLL_SESSION_ID=21,n.BROADCAST_CHANNEL_ID=0,n.CONFERENCE_CHANNEL_ID=n.CONFERENCE_SESSION_ID,n.CHAT_CHANNEL_ID=n.CHAT_SESSION_ID,n.GIFT_CHANNEL_ID=n.GIFT_SESSION_ID,n.WEBSHARING_CHANNEL_ID=n.WEBSHARING_SESSION_ID,n.DOCSHARING_CHANNEL_ID=n.DOCSHARING_SESSION_ID,n.WHITEBOARD_CHANNEL_ID=n.WHITEBOARD_SESSION_ID,n.MEDIA_CHANNEL_ID=n.MEDIA_SESSION_ID,n.SCREENSHARING_CHANNEL_ID=n.SCREENSHARING_SESSION_ID,n.CONFERENCE_SESSION_NAME="conference app",n.CHAT_SESSION_NAME="chat app",n.GIFT_SESSION_NAME="gift app",n.AUDIO_SESSION_NAME="audio app",n.VIDEO_SESSION_NAME="video app",n.WEBSHARING_SESSION_NAME="web sharing app",n.DOCSHARING_SESSION_NAME="doc sharing app",n.WHITEBOARD_SESSION_NAME="whiteboard app",n.MEDIA_SESSION_NAME="media sharing app",n.SCREENSHARING_SESSION_NAME="screen sharing app",n.CONFERENCE_SESSION_TAG="con-tag",n.CHAT_SESSION_TAG="cha-tag",n.GIFT_SESSION_TAG="gif-tag",n.AUDIO_SESSION_TAG="aud-tag",n.VIDEO_SESSION_TAG="vid-tag",n.WEBSHARING_SESSION_TAG="web-tag",n.DOCSHARING_SESSION_TAG="doc-tag",n.WHITEBOARD_SESSION_TAG="wbd-tag",n.MEDIA_SESSION_TAG="med-tag",n.SCREENSHARING_SESSION_TAG="scr-tag",n.CONFERENCE_OBJ_ROSTER_ID=(n.CONFERENCE_SESSION_ID<<16)+1,n.CONFERENCE_OBJ_ROSTER_NAME="node list",n.CONFERENCE_OBJ_ROSTER_TAG="node list tag",n.CONFERENCE_OBJ_QUEUE_ID=(n.CONFERENCE_SESSION_ID<<16)+2,n.CONFERENCE_OBJ_QUEUE_NAME="mic list",n.CONFERENCE_OBJ_QUEUE_TAG="mic list tag",n.CONFERENCE_OBJ_TABLE_ID=(n.CONFERENCE_SESSION_ID<<16)+3,n.CONFERENCE_OBJ_TABLE_NAME="tabbar list",n.CONFERENCE_OBJ_TABLE_TAG="tabbar list tag",n.CONFERENCE_OBJ_COUNTER_ID=(n.CONFERENCE_SESSION_ID<<16)+4,n.CONFERENCE_OBJ_COUNTER_NAME="id list",n.CONFERENCE_OBJ_COUNTER_TAG="id list tag",n.WEBSHARING_OBJ_TABLE_ID=(n.WEBSHARING_SESSION_ID<<16)+1,n.WEBSHARING_OBJ_TABLE_NAME="web list",n.WEBSHARING_OBJ_TABLE_TAG="web list tag",n.DOCSHARING_OBJ_TABLE_ID=(n.DOCSHARING_SESSION_ID<<16)+1,n.DOCSHARING_OBJ_TABLE_NAME="doc list",n.DOCSHARING_OBJ_TABLE_TAG="doc list tag",n.DOCSHARING_OBJ_TABLE_ID_H5=(n.DOCSHARING_SESSION_ID<<16)+2,n.DOCSHARING_OBJ_TABLE_NAME_H5="doc list h5",n.DOCSHARING_OBJ_TABLE_TAG_H5="doc list tag h5",n.WHITEBOARD_OBJ_TABLE_ID=(n.WHITEBOARD_SESSION_ID<<16)+1,n.WHITEBOARD_OBJ_TABLE_NAME="wbd list",n.WHITEBOARD_OBJ_TABLE_TAG="wbd list tag",n.MEDIA_OBJ_TABLE_ID=(n.MEDIA_SESSION_ID<<16)+1,n.MEDIA_OBJ_TABLE_NAME="med list",n.MEDIA_OBJ_TABLE_TAG="med list tag",n.CHAT_OBJ_TABLE_ID=(n.CHAT_SESSION_ID<<16)+1,n.CHAT_OBJ_TABLE_NAME="chat list",n.CHAT_OBJ_TABLE_TAG="chat list tag",n.AUDIO_OBJ_TABLE_ID=(n.AUDIO_SESSION_ID<<16)+1,n.AUDIO_OBJ_TABLE_NAME="audio channel list",n.AUDIO_OBJ_TABLE_TAG="audio channel list tag",n.VIDEO_OBJ_TABLE_ID=(n.VIDEO_SESSION_ID<<16)+1,n.VIDEO_OBJ_TABLE_NAME="video channel list",n.VIDEO_OBJ_TABLE_TAG="video channel list tag",n.SCREENSHARING_OBJ_TABLE_ID=(n.SCREENSHARING_SESSION_ID<<16)+1,n.SCREEN_OBJ_TABLE_NAME="scr list",n.SCREEN_OBJ_TABLE_TAG="scr list tag",n.POLL_OBJ_TABLE_ID=(n.POLL_SESSION_ID<<16)+1,n.VOTE_OBJ_TABLE_ID=(n.POLL_SESSION_ID<<16)+2,n.RECORD_OBJ_TABLE_ID=(n.POLL_SESSION_ID<<16)+3,n.SHAMLIVE_OBJ_TABLE_ID=(n.POLL_SESSION_ID<<16)+4,n.POLL_OBJ_TABLE_NAME="poll list",n.POLL_OBJ_TABLE_TAG="poll list tag",n.REG_TABLE_INSERT_TAIL=16777215,n.REG_TABLE_DELETE_ALL=16777215,n.CJS_RELEASED=0,n.CJS_JOINNING=1,n.CJS_JOINNED=2,n.WBA_CLOSE=1,n.WBA_CHANGE=2,n.WBA_OPEN=3,n.WBA_DOC_ANNOTATION=4,n.WBA_LASER_PEN=5;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(n,"ApeConsts","D:/work/McuClient/src/apes/ApeConsts.js")})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n,r,i,s,o,a,u,f,l){var h=new E.RCSendDataPdu;return h.set("type",e),h.set("subType",t),h.set("initiator",n),h.set("confId",r),h.set("sessionId",i),h.set("channelId",s),h.set("upward",o),h.set("reliability",a),h.set("priority",u),h.set("peer",f),h.set("seg",l),h}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(36),a=r(o),u=n(30),f=r(u),l=n(15),h=r(l),d=n(8),c=r(d),_=a.default.newBuilder({convertFieldsToCamelCase:!0});a.default.loadProto(f.default,_);var E=_.build();E.decode_pdu=function(e){return E.RCSendDataPdu.decode(e)},E.create_connect_provider_request_pdu=function(e,t,n,r,s,o,a,u,f){return i(h.default.RCPDU_CONNECT_PROVIDER_REQUEST,e,t,n,r,s,!0,o,a,u,f)},E.create_uniform_pdu=function(e,t,n,r,s,o,a,u,f){return i(h.default.RCPDU_UNIFORM_SEND_DATA_REQUEST,e,t,n,r,s,!0,o,a,u,f)},E.create_normal_pdu=function(e,t,n,r,s,o,a,u,f,l){return i(h.default.RCPDU_SEND_DATA_REQUEST,e,t,n,r,s,o,a,u,f,l)},E.id2type=function(e){for(var t in h.default)if(h.default[t]===e)return t},E=s({},E,h.default,c.default);var p=E;t.default=p;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(_,"builder","D:/work/McuClient/src/pdu/index.js"),__REACT_HOT_LOADER__.register(E,"pdu","D:/work/McuClient/src/pdu/index.js"),__REACT_HOT_LOADER__.register(i,"create_pdu","D:/work/McuClient/src/pdu/index.js"),__REACT_HOT_LOADER__.register(p,"default","D:/work/McuClient/src/pdu/index.js"))})()},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e),this.MAPS={}}return r(e,[{key:"on",value:function(e,t){if(e&&t){var n=this.MAPS[e];if(!n)return this.MAPS[e]=[t];n.push(t)}}},{key:"off",value:function(e,t){if(e){var n=this.MAPS[e];if(n){if(t)return n.splice(n.indexOf(t),1);n.length=0}}}},{key:"_emit",value:function(e,t){if(e){var n=this.MAPS["*"];n&&n.length&&n.forEach(function(n){n(e,t)});var r=this.MAPS[e];r&&r.length&&r.forEach(function(e){e(t)})}}}]),e}(),s=i;t.default=s;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"Emiter","D:/work/McuClient/src/Emiter.js"),__REACT_HOT_LOADER__.register(s,"default","D:/work/McuClient/src/Emiter.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),f=r(u),l=n(5),h=r(l),d=n(14),c=r(d),_=n(1),E=r(_),p=n(2),g=r(p),R=n(3),y=r(R),C=n(13),T=r(C),S=n(8),I=r(S),m=E.default.getLoger("Ape"),v=function(e){function t(e,n,r){i(this,t);var o=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o._session_id=e,o._channel_id=e,o._session_name=n,o._session_tag=r,o._session_channels={},o._adapter_pdu=new f.default.RCAdapterPdu,o._confInfo=null,o._rCArrayBufferUtil=T.default,o._apeDelayed=!1,o._apeDelayedMsgs=[],o._apeDelayedTimer=0,o.on(f.default.RCPDU_SESSION_JOIN_RESPONSE,o._joinSessionHandler.bind(o)),o.on(f.default.RCPDU_CHANNEL_JOIN_RESPONSE,o._joinChannelHandler.bind(o)),o.on(f.default.RCPDU_REG_ADAPTER,o._pduMessageHandler.bind(o)),o.mcu=c.default,o.mcu.on(g.default.CLASS_JOIN_SUCCESS,o._mcuConferenceJoinSuccessHandler.bind(o)),o.mcu.registerApe(o),o}return o(t,e),a(t,[{key:"regResponsePduHandler",value:function(){}},{key:"_pduMessageHandler",value:function(e){var t=this;return this._apeDelayed?void setTimeout(function(){t._pduRegAdapterHandler(e)},this._confInfo.mcuDelay||12e3):void this._pduRegAdapterHandler(e)}},{key:"_pduRegAdapterHandler",value:function(e){var t=f.default.RCAdapterPdu.decode(e),n=t.item,r=n.length;m.log(this._session_name+"数据同步消息.同步条数",r);for(var i=0;i<r;++i){var s=n[i],o=s.type,a=s.itemData;if(f.default.RCPDU_REG_UPDATE_OBJ===o){var u=f.default.RCRegistryUpdateObjPdu.decode(a),l=u.subType,h=u.objId,d=u.userData;switch(m.log("REG OBJECT EVENT ->",f.default.id2type(l)),l){case f.default.RCPDU_REG_ROSTER_INSERT_PDU:for(var c=f.default.RCRegstryRosterInsertItemPdu.decode(d),_=c.items,E=_.length,p=0;p<E;++p){var g=_[p],R=g.item_id,y=f.default.RCNodeInfoRecordPdu.decode(g.item_data);this.rosterInsertHandler(R,y)}break;case f.default.RCPDU_REG_ROSTER_DELETE_PDU:var C=f.default.RCRegistryRosterDeleteItemPdu.decode(d);this.rosterDelHandler(C.nodeId);break;case f.default.RCPDU_REG_ROSTER_UPDATE_PDU:for(var T=f.default.RCRegistryRosterUpdateItemPdu.decode(d),S=T.items,I=S.length,v=0;v<I;++v){var b=S[v],A=b.nodeId,O=f.default.RCNodeInfoRecordPdu.decode(b.nodeData);this.rosterUpdateHandler(A,O)}break;case f.default.RCPDU_REG_TABLE_INSERT_PDU:for(var N=f.default.RCRegistryTableInsertItemPdu.decode(d),P=N.items,w=P.length,D=0;D<w;++D){var U=P[D];this.tableInsertHandler(U.owner,U.itemIdx,U.itemData)}break;case f.default.RCPDU_REG_TABLE_DELETE_PDU:var L=f.default.RCRegistryTableDeleteItemPdu.decode(d);this.tableDeleteHandler(h,L);break;case f.default.RCPDU_REG_TABLE_UPDATE_PDU:for(var k=f.default.RCRegistryTableUpdateItemPdu.decode(d),M=k.items,B=M.length,G=0;G<B;++G){var H=M[G];this.tableUpdateHandler(H.owner,H.itemIdx,H.itemData)}break;case f.default.RCPDU_REG_QUEUE_UPDATE_PDU:case f.default.RCPDU_REG_QUEUE_DELETE_PDU:case f.default.RCPDU_REG_QUEUE_INSERT_PDU:m.warn("REG QUEUE ARE IGNORED")}}else if(f.default.RCPDU_REG_RESPONSE_OBJ==o){var F=f.default.RCRegistryResponseObjPdu.decode(a);this.regResponsePduHandler(F)}}}},{key:"rosterInsertHandler",value:function(e,t){m.warn(this._session_name+" rosterInsertHandler 应有子类具体覆盖处理.")}},{key:"rosterUpdateHandler",value:function(e,t){m.warn(this._session_name+" rosterUpdateHandler 应有子类具体覆盖处理.")}},{key:"rosterDelHandler",value:function(e){m.warn(this._session_name+" rosterDelHandler 应有子类具体覆盖处理.")}},{key:"tableInsertHandler",value:function(e,t){m.warn(this._session_name+" tableInsertHandler 应有子类具体覆盖处理.")}},{key:"tableUpdateHandler",value:function(e,t,n){m.warn(this._session_name+" tableUpdateHandler 应有子类具体覆盖处理.")}},{key:"tableDeleteHandler",value:function(e,t){m.warn(this._session_name+" tableDelHandler 应有子类具体覆盖处理.")}},{key:"_joinSessionHandler",value:function(e){m.log(this._session_name," -> 加入Session")}},{key:"_joinChannelHandler",value:function(e){var t=f.default.RCChannelJoinResponsePdu.decode(e);t.result===f.default.RET_SUCCESS?(m.log(this._session_name," -> 加入Channel成功. ChannelId",t.requestedChannelId),this._session_channels[t.requestedChannelId]=y.default.CJS_JOINNED):m.log(this._session_name," -> 加入Channel失败.",t)}},{key:"_mcuConferenceJoinSuccessHandler",value:function(e){m.log("创建Ape->","SessionId",this._session_id,"SessionName",this._session_name,"SessionTag",this._session_tag),this._confInfo=e;var t=new f.default.RCSessionJoinRequestPdu;t.id=this._session_id,t.name=this._session_name,t.tag=this._session_tag,t.sessionData=this._adapter_pdu.toArrayBuffer(),this.sendUniform(t,!0);var n=new f.default.RCChannelJoinRequestPdu;n.initiator=this.mcu.confInfo.nodeId,n.channelId=this._session_id,this.send(n)}},{key:"registerKey",value:function(e,t,n,r){var i=new f.default.RCAdapterItemPdu;i.type=f.default.RCPDU_REG_REGISTER_KEY;var s=new f.default.RCRegistryRegisterKeyPdu;s.id=e,s.name=t,s.tag=n,r.length&&(s.userData=r),i.itemData=s.toArrayBuffer(),this._adapter_pdu.item.push(i)}},{key:"registerObj",value:function(e,t,n,r,i,s){var o=new f.default.RCAdapterItemPdu;o.type=f.default.RCPDU_REG_REGISTER_OBJ;var a=new f.default.RCRegistryRegisterObjPdu;a.type=e,a.objId=t,a.name=n,a.tag=r,i&&(a.owner=i),s.length&&(a.userData=s),o.itemData=a.toArrayBuffer(),this._adapter_pdu.item.push(o)}},{key:"send",value:function(e){m.log("Ape发送数据NORMAL PDU",e);var t=f.default.create_normal_pdu(e.type,this._confInfo.nodeId,this._confInfo.confId,this._session_id,this._channel_id,!0,!0,I.default.DP_TOP,this._confInfo.topNodeID,I.default.SEG_ONCE);t.data=e.toArrayBuffer(),this.mcu.send(t)}},{key:"sendUniform",value:function(e,t){m.log("Ape发送数据UNIFORM PDU",e);var n=f.default.create_uniform_pdu(e.type,this._confInfo.nodeId,this._confInfo.confId,this._session_id,t?y.default.BROADCAST_CHANNEL_ID:this._channel_id,!0,I.default.DP_TOP,t?this._confInfo.topNodeID:e.peer||0,I.default.SEG_ONCE);n.data=e.toArrayBuffer(),this.mcu.send(n)}}]),t}(h.default),b=v;t.default=b;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(m,"loger","D:/work/McuClient/src/apes/Ape.js"),__REACT_HOT_LOADER__.register(v,"Ape","D:/work/McuClient/src/apes/Ape.js"),__REACT_HOT_LOADER__.register(b,"default","D:/work/McuClient/src/apes/Ape.js"))})()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.NT_TERMINAL=0,n.NT_MULTIPORT_TERMINAL=1,n.NT_MCU=2,n.DP_TOP=0,n.DP_HIGH=1,n.DP_MEDIUM=2,n.DP_LOW=3,n.SEG_BEGIN=0,n.SEG_END=1,n.SEG_ONCE=2,n.RET_SUCCESS=0,n.RET_USER_REJECTED=1,n.RET_INVALID_CONFERENCE=2,n.RET_INVALID_PASSWORD=3,n.RET_INVALID_CONVENER_PASSWORD=4,n.RET_CHALLENGE_RESPONSE_REQUIRED=5,n.RET_INVALID_CHALLENGE_RESPONSE=6,n.RET_NO_CONNECTION=7,n.RET_FULL_CAPACITY=8;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(n,"PduConsts","D:/work/McuClient/src/pdu/PduConsts.js")})()},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"isEmptyObject",value:function(e){for(var t in e)return!1;return!0}}]),e}(),s=i;t.default=s;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"EngineUtils","D:/work/McuClient/src/EngineUtils.js"),__REACT_HOT_LOADER__.register(s,"default","D:/work/McuClient/src/EngineUtils.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(1),a=r(o),u=a.default.getLoger("GlobalConfig"),f=function(){function e(){i(this,e)}return s(e,null,[{key:"setDebugData",value:function(e){this.isDebug=!0,this.deBugData=e}},{key:"getConfInfo",value:function(){return this.isDebug?(this.deBugData.MCUServerIP=this.MCUServerIP,this.deBugData.MCUServerPort=this.MCUServerPort,this.deBugData.maxVideoChannels=this.maxVideoChannels,this.deBugData.maxAudioChannels=this.maxAudioChannels,this.deBugData.maxMediaChannels=this.maxMediaChannels,this.deBugData):{siteId:this.siteId,confId:this.confId,h5Module:this.h5Module,nodeId:this.nodeId,topNodeID:this.topNodeID,userRole:this.userRole,role:this.role,isHost:this.isHost,classRole:this.classRole,userId:this.userId,userName:this.userName,password:this.password,userType:this.userType,passwordRequired:this.passwordRequired,md5:this.md5,msType:this.msType,portal:this.portal,mcuDelay:this.mcuDelay,MCUServerIP:this.MCUServerIP,MCUServerPort:this.MCUServerPort,maxVideoChannels:this.maxVideoChannels,maxAudioChannels:this.maxAudioChannels,maxMediaChannels:this.maxMediaChannels}}}]),e}();f.siteId="gust",f.confId=1653304953,f.nodeId=1483947664,f.topNodeID=101,f.userRole="normal",f.role=1,f.isHost=!1,f.classRole=0,f.userId=0,f.userName="",f.password="",f.userType=8,f.h5Module=0,f.passwordRequired=!1,f.md5="",f.msType=1,f.mcuDelay=3e3,f.portal="112.126.80.182:80",f.ip="112.126.80.182",f.port="80",f.MCUServerIP="114.215.195.70",f.MCUServerPort=9003,f.maxVideoChannels=1,f.maxAudioChannels=1,f.maxMediaChannels=2,f.isDebug=!1,f.deBugData={},f.meetingParam={};var l=f;t.default=l;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(u,"loger","D:/work/McuClient/src/GlobalConfig.js"),__REACT_HOT_LOADER__.register(f,"GlobalConfig","D:/work/McuClient/src/GlobalConfig.js"),__REACT_HOT_LOADER__.register(l,"default","D:/work/McuClient/src/GlobalConfig.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),f=r(u),l=n(3),h=r(l),d=n(2),c=r(d),_=n(4),E=r(_),p=n(20),g=n(19),R=r(g),y=n(1),C=r(y),T=C.default.getLoger("ConferApe"),S=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.default.CONFERENCE_SESSION_ID,h.default.CONFERENCE_SESSION_NAME,h.default.CONFERENCE_SESSION_TAG));return e.hostNodeId=-1,e.hostUserId="",e.rosters={},e.activeDocId="",e.registerKey(e._session_id,e._session_name,e._session_tag,new ArrayBuffer),e.registerObj(E.default.RCPDU_REG_REGISTER_ROSTER,h.default.CONFERENCE_OBJ_ROSTER_ID,h.default.CONFERENCE_OBJ_ROSTER_NAME,h.default.CONFERENCE_OBJ_ROSTER_TAG,0,new ArrayBuffer),e.registerObj(E.default.RCPDU_REG_REGISTER_QUEUE,h.default.CONFERENCE_OBJ_QUEUE_ID,h.default.CONFERENCE_OBJ_QUEUE_NAME,h.default.CONFERENCE_OBJ_QUEUE_TAG,0,new ArrayBuffer),e.registerObj(E.default.RCPDU_REG_REGISTER_TABLE,h.default.CONFERENCE_OBJ_TABLE_ID,h.default.CONFERENCE_OBJ_TABLE_NAME,h.default.CONFERENCE_OBJ_TABLE_TAG,0,new ArrayBuffer),e.registerObj(E.default.RCPDU_REG_REGISTER_COUNTER,h.default.CONFERENCE_OBJ_COUNTER_ID,h.default.CONFERENCE_OBJ_COUNTER_NAME,h.default.CONFERENCE_OBJ_COUNTER_TAG,0,new ArrayBuffer),e.on(E.default.RCPDU_SESSION_JOIN_RESPONSE,e._joinSessionHandler.bind(e)),e}return o(t,e),a(t,[{key:"_joinSessionHandler",value:function(e){var t=this.mcu.mcuConfInfo.self,n=new E.default.RCNodeInfoUserDataPdu;n.qq="",n.skype="",n.mobile="",t.userData=n.toArrayBuffer(),t.deviceType=3;var r=new E.default.RCRegistryRosterItemPdu;r.nodeId=t.nodeId,r.nodeData=t.toArrayBuffer();var i=new E.default.RCRegistryRosterUpdateItemPdu;i.type=E.default.RCPDU_REG_ROSTER_UPDATE_PDU,i.items.push(r);var s=new E.default.RCRegistryUpdateObjPdu;s.objId=h.default.CONFERENCE_OBJ_ROSTER_ID,s.subType=i.type,s.userData=i.toArrayBuffer();var o=new E.default.RCAdapterItemPdu;o.type=E.default.RCPDU_REG_UPDATE_OBJ,o.itemData=s.toArrayBuffer();var a=new E.default.RCAdapterPdu;a.type=E.default.RCPDU_REG_ADAPTER,a.item.push(o),this.sendUniform(a,!0)}},{key:"tableUpdateHandler",value:function(e,t,n){try{var r=E.default.RCTabUpdateDataRequestPdu.decode(n),i=new p.Zlib.Inflate(r.action.compact().view).decompress(),s=R.default.getStringFromBytes(i),o=s.match(/<TabType>(.+)<\/TabType>/);o.length>1&&"show.docsharing"==o[1]&&"true"==s.match(/<visible>(.+)<\/visible>/)[1]&&(this.activeDocId=s.match(/<TabID>(.+)<\/TabID>/)[1],this._emit(c.default.DOC_SWITCH,this.activeDocId))}catch(e){T.warn("ConferApe table update got exception.")}}},{key:"rosterInsertHandler",value:function(e,t){this.rosterUpdateHandler(e,t)}},{key:"rosterUpdateHandler",value:function(e,t){t.role!==h.default.NR_MASTER&&t.role!==h.default.NR_SLAVE||(this.hostNodeId=t.nodeId,this.hostUserId=t.userId),t.role===h.default.NR_NORMAL&&this.hostNodeId===t.nodeId&&(this.hostNodeId=-1,this.hostUserId="");var n=this.rosters[e];this.rosters[e]=t,n||this.emitRosterChange()}},{key:"rosterDelHandler",value:function(e){delete this.rosters[e],this.emitRosterChange(),e==this._confInfo.nodeId&&this._emit(c.default.CLASS_EXIT)}},{key:"emitRosterChange",value:function(){this._emit(c.default.CLASS_SHOW_ROSTER_NUM,Object.keys(this.rosters).length)}}]),t}(f.default),I=S;t.default=I;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(T,"loger","D:/work/McuClient/src/apes/ConferApe.js"),__REACT_HOT_LOADER__.register(S,"ConferApe","D:/work/McuClient/src/apes/ConferApe.js"),__REACT_HOT_LOADER__.register(I,"default","D:/work/McuClient/src/apes/ConferApe.js"))})()},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"ab2str",value:function(e){return String.fromCharCode.apply(null,new Uint16Array(e))}},{key:"str2ab",value:function(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint16Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t}},{key:"strToUint8Array",value:function(e){var t=void 0,n=void 0,r=void 0,i=void 0;t="",r=e.length;var s=[];for(n=0;n<r;n++)i=e.charCodeAt(n),i>=1&&i<=127?s.push(i):i>2047?(s.push(224|i>>12&15),s.push(128|i>>6&63),s.push(128|i>>0&63)):(s.push(192|i>>6&31),s.push(128|i>>0&63));return new Uint8Array(s)}},{key:"uint8ArrayToStr",value:function(e,t){var n=void 0,r=void 0,i=void 0,s=void 0,o=void 0,a=void 0;for(n="",i=e.buffer.byteLength,r=e.offset+t;r<e.limit;)switch(s=e.view[r++],s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(e.view[r-1]);break;case 12:case 13:o=e.view[r++],n+=String.fromCharCode((31&s)<<6|63&o);break;case 14:o=e.view[r++],a=e.view[r++],n+=String.fromCharCode((15&s)<<12|(63&o)<<6|(63&a)<<0)}return n}}]),e}(),s=i;t.default=s;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(i,"ArrayBufferUtil","D:/work/McuClient/src/libs/ArrayBufferUtil.js"),__REACT_HOT_LOADER__.register(s,"default","D:/work/McuClient/src/libs/ArrayBufferUtil.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),f=r(u),l=n(2),h=r(l),d=n(1),c=r(d),_=n(29),E=r(_),p=n(4),g=r(p),R=n(15),y=r(R),C=n(8),T=r(C),S=n(3),I=r(S),m=n(12),v=(r(m),n(13)),b=r(v),A=n(32),O=r(A),N=c.default.getLoger("MCU"),P=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._apes={},e._everSocket=E.default,e._everSocket.on(E.default.OPEN,e._everSocketOpenHandler.bind(e)),e._everSocket.on(E.default.MESSAGE,e._everSocketMsgReceivedHandler.bind(e)),e}return o(t,e),a(t,[{key:"registerApe",value:function(e){this._apes[e._session_id]=e}},{key:"_everSocketOpenHandler",value:function(){N.log("MCU-发送加入会议请求.");var e=this.confInfo;e.nodeId=parseInt(Date.now()/1e3);var t=new g.default.RCConferenceJoinRequestPdu;t.type=2,t.initiator=e.nodeId,t.nodeType=T.default.NT_TERMINAL;var n=new g.default.RCConferenceDescriptorPdu;n.id=e.confId,n.name=new ArrayBuffer,n.mode=0,n.capacity=1,t.confDesc=n;var r=g.default.create_connect_provider_request_pdu(t.type,e.nodeId,e.confId,0,I.default.BROADCAST_CHANNEL_ID,!0,T.default.DP_TOP,e.topNodeID,T.default.SEG_ONCE);r.set("site",e.siteId),r.set("userId",e.userId),r.set("userName",O.default.fromByteArray(b.default.strToUint8Array(e.userName))),r.set("userRole",e.userRole),r.set("deviceType",""),r.set("data",t.toArrayBuffer()),this._everSocket.send(r.toArrayBuffer())}},{key:"_everSocketMsgReceivedHandler",value:function(e){var t=g.default.decode_pdu(e),n=t.get("type"),r=t.get("data");switch(N.log("MCU-FirstLayer封装消息","type",g.default.id2type(t.type),t.type,"sessionId",(0,I.default)(t.sessionId),t.sessionId),n){case y.default.RCPDU_CONNECT_PROVIDER_RESPONSE:var i=g.default.RCConferenceJoinResponsePdu.decode(r),s=i.get("result");switch(s){case T.default.RET_SUCCESS:this._updateMCUConfInfoDesc(i.get("confDesc")),this._emit(h.default.CLASS_JOIN_SUCCESS,this.confInfo);break;case T.default.RET_FULL_CAPACITY:this._emit(h.default.CLASS_JOIN_FAILED,h.default.ERROR_CLASS_JOIN_FULL);break;default:N.warn("JoinConfPdu-未知类型-等待处理.",s)}break;case y.default.RCPDU_SEND_DATA_REQUEST:var o=this._apes[t.sessionId],a=(0,I.default)(t.sessionId);if(o){var u=g.default.id2type(t.subType);N.log("MCU-SecondLayer封装消息","sessionId",a,t.sessionId,"subtype",u,t.subType),o._emit(t.subType,t.data)}else N.warn(a+"尚未注册");break;default:N.warn("PDU-未知类型-等待处理.",n)}}},{key:"_updateMCUConfInfoDesc",value:function(e){var t=this.mcuConfInfo.info;t._conference_name=b.default.uint8ArrayToStr(e.name,0),t._capacity=e.capacity,t._mode=e.mode}},{key:"send",value:function(e){this.connected?(N.log("MCU-发送会议数据....",e),this._everSocket.send(e.toArrayBuffer())):N.log("MCU-发送会议数据失败,MCU底层通道不可用")}},{key:"leaveMCU",value:function(){this._everSocket.end()}},{key:"joinMCU",value:function(e){N.log("开始建立EverSocket通道.",e),e.confId=parseInt(e.confId),this.confInfo=e;var t=new g.default.RCNodeInfoRecordPdu;t.name=this.confInfo.userName,t.nodeId=this.confInfo.nodeId,t.userId=this.confInfo.userId,t.role=1,t.level=0;var n={};n._conference_id=this.confInfo.confId,n._top_node_id=this.confInfo.topNodeID,this.mcuConfInfo={},this.mcuConfInfo.self=t,this.mcuConfInfo.info=n,this.confInfo.mcuConfInfo=this.mcuConfInfo,this._everSocket.begin(this.confInfo.MCUServerIP,this.confInfo.MCUServerPort)}},{key:"connected",get:function(){return!(!this._everSocket||!this._everSocket.connected)}}]),t}(f.default),w=new P;
-t.default=w;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(N,"loger","D:/work/McuClient/src/mcu.js"),__REACT_HOT_LOADER__.register(P,"MCU","D:/work/McuClient/src/mcu.js"),__REACT_HOT_LOADER__.register(w,"default","D:/work/McuClient/src/mcu.js"))})()},function(e,t){"use strict";function n(e){}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.RCPDU_CONNECT_PROVIDER_REQUEST=0,n.RCPDU_CONNECT_PROVIDER_RESPONSE=1,n.RCPDU_CONFERENCE_JOIN_REQUEST=2,n.RCPDU_CONFERENCE_JOIN_RESPONSE=3,n.RCPDU_CONFERENCE_INVITE_REQUEST=10,n.RCPDU_CONFERENCE_INVITE_RESPONSE=11,n.RCPDU_CONFERENCE_LOCK_REQUEST=20,n.RCPDU_CONFERENCE_LOCK_RESPONSE=21,n.RCPDU_CONFERENCE_LOCK_INDICATION=22,n.RCPDU_CONFERENCE_UNLOCK_REQUEST=30,n.RCPDU_CONFERENCE_UNLOCK_RESPONSE=31,n.RCPDU_CONFERENCE_UNLOCK_INDICATION=32,n.RCPDU_CONFERENCE_LEAVE_REQUEST=39,n.RCPDU_CONFERENCE_TERMINATE_REQUEST=40,n.RCPDU_CONFERENCE_TERMINATE_RESPONSE=41,n.RCPDU_CONFERENCE_TERMINATE_INDICATION=42,n.RCPDU_CONFERENCE_EJECT_USER_REQUEST=50,n.RCPDU_CONFERENCE_EJECT_USER_RESPONSE=51,n.RCPDU_CONFERENCE_EJECT_USER_INDICATION=52,n.RCPDU_ROSTER_UPDATE_INDICATION=60,n.RCPDU_REGISTRY_UPDATE_REQUEST=70,n.RCPDU_REGISTRY_UPDATE_RESPONSE=71,n.RCPDU_REGISTRY_UPDATE_INDICATION=72,n.RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE=80,n.RCPDU_SESSION_JOIN_REQUEST=90,n.RCPDU_SESSION_JOIN_RESPONSE=91,n.RCPDU_CHANNEL_GRAB_REQUEST=100,n.RCPDU_CHANNEL_GRAB_RESPONSE=101,n.RCPDU_CHANNEL_GRAB_INDICATION=102,n.RCPDU_CHANNEL_JOIN_REQUEST=103,n.RCPDU_CHANNEL_JOIN_RESPONSE=104,n.RCPDU_CHANNEL_LEAVE_REQUEST=105,n.RCPDU_CHANNEL_RELEASE_REQUEST=106,n.RCPDU_CHANNEL_RELEASE_INDICATION=107,n.RCPDU_SEND_DATA_REQUEST=120,n.RCPDU_SEND_DATA_REQUEST=120,n.RCPDU_SEND_DATA_INDICATION=121,n.RCPDU_UNIFORM_SEND_DATA_REQUEST=125,n.RCPDU_UNIFORM_SEND_DATA_INDICATION=126,n.RCPDU_TOKEN_GRAB_REQUEST=130,n.RCPDU_TOKEN_GRAB_CONFIRM=131,n.RCPDU_TOKEN_INHIBIT_REQUEST=132,n.RCPDU_TOKEN_INHIBIT_CONFIRM=133,n.RCPDU_TOKEN_GIVE_REQUEST=134,n.RCPDU_TOKEN_GIVE_INDICATION=135,n.RCPDU_TOKEN_GIVE_RESPONSE=136,n.RCPDU_TOKEN_GIVE_CONFIRM=137,n.RCPDU_TOKEN_PLEASE_REQUEST=138,n.RCPDU_TOKEN_PLEASE_INDICATION=139,n.RCPDU_TOKEN_RELEASE_REQUEST=140,n.RCPDU_TOKEN_RELEASE_CONFIRM=141,n.RCPDU_TOKEN_TEST_REQUEST=142,n.RCPDU_TOKEN_TEST_CONFIRM=143,n.RCPDU_REG_REGISTER_KEY=200,n.RCPDU_REG_UNREGISTER_KEY=201,n.RCPDU_REG_REGISTER_ROSTER=202,n.RCPDU_REG_REGISTER_TOKEN=203,n.RCPDU_REG_REGISTER_PARAMETER=204,n.RCPDU_REG_REGISTER_COUNTER=205,n.RCPDU_REG_REGISTER_TABLE=206,n.RCPDU_REG_REGISTER_CACHE=207,n.RCPDU_REG_REGISTER_OBJ=208,n.RCPDU_REG_UNREGISTER_OBJ=209,n.RCPDU_REG_UPDATE_OBJ=210,n.RCPDU_REG_ADAPTER=211,n.RCPDU_REG_CLEANUP_NODE=212,n.RCPDU_REG_REGISTER_QUEUE=213,n.RCPDU_REG_TABLE_INSERT_PDU=230,n.RCPDU_REG_TABLE_DELETE_PDU=231,n.RCPDU_REG_TABLE_UPDATE_PDU=232,n.RCPDU_REG_ROSTER_INSERT_PDU=240,n.RCPDU_REG_ROSTER_DELETE_PDU=241,n.RCPDU_REG_ROSTER_UPDATE_PDU=242,n.RCPDU_REG_PARAMETER_UPDATE_PDU=250,n.RCPDU_REG_QUEUE_INSERT_PDU=255,n.RCPDU_REG_QUEUE_DELETE_PDU=256,n.RCPDU_REG_QUEUE_UPDATE_PDU=257,n.RCPDU_CONFERENCE_SEND_DATA_REQUEST=259,n.RCPDU_VIDEO_SEND_DATA_REQUEST=260,n.RCPDU_AUDIO_SEND_DATA_REQUEST=261,n.RCPDU_GIFT_SEND_DATA_REQUEST=262,n.RCPDU_CHAT_SEND_DATA_REQUEST=263,n.RCPDU_VOTING_POLL_RECORD=265,n.RCPDU_REG_REQUEST_OBJ=290,n.RCPDU_REG_RESPONSE_OBJ=291,n.RCPDU_REG_COUNTER_REQUEST_PDU=292,n.RCPDU_REG_COUNTER_RESPONSE_PDU=293,n.RCPDU_INDEX_ADAPTER=300,n.RCPDU_INDEX_SERVER_USERS=301,n.RCPDU_INDEX_CONFERENCE_USER_JOINED=302,n.RCPDU_INDEX_CONFERENCE_USER_EXITED=303,n.RCPDU_INDEX_CONFERENCE_USERS=304;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(n,"RCPduPackage","D:/work/McuClient/src/pdu/PduType.js")})()},function(e,t,n){var r,i,s;(function(e){!function(o,a){n(9).amd?(i=[n(18)],r=a,s="function"==typeof r?r.apply(t,i):r,!(void 0!==s&&(e.exports=s))):"object"==typeof e&&e&&e.exports?e.exports=function(){var e;try{e=n(18)}catch(e){}return a(e)}():(o.dcodeIO=o.dcodeIO||{}).ByteBuffer=a(o.dcodeIO.Long)}(this,function(e){"use strict";function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+u.apply(String,e):(e.length+arguments.length>1024&&(t.push(u.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,f=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,c=e[t+h];for(h+=d,s=c&(1<<-l)-1,c>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=d,l-=8);if(0===s)s=1-f;else{if(s===u)return o?NaN:(c?-1:1)*(1/0);o+=Math.pow(2,r),s-=f}return(c?-1:1)*o*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var o,a,u,f=8*s-i-1,l=(1<<f)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,c=r?0:s-1,_=r?1:-1,E=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),t+=o+h>=1?d/u:d*Math.pow(2,1-h),t*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+c]=255&a,c+=_,a/=256,i-=8);for(o=o<<i|a,f+=i;f>0;e[n+c]=255&o,c+=_,o/=256,f-=8);e[n+c-_]|=128*E}var s=function(e,t,n){if("undefined"==typeof e&&(e=s.DEFAULT_CAPACITY),"undefined"==typeof t&&(t=s.DEFAULT_ENDIAN),"undefined"==typeof n&&(n=s.DEFAULT_NOASSERT),!n){if(e|=0,e<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?a:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};s.VERSION="5.0.1",s.LITTLE_ENDIAN=!0,s.BIG_ENDIAN=!1,s.DEFAULT_CAPACITY=16,s.DEFAULT_ENDIAN=s.BIG_ENDIAN,s.DEFAULT_NOASSERT=!1,s.Long=e||null;var o=s.prototype;o.__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var a=new ArrayBuffer(0),u=String.fromCharCode;s.accessor=function(){return Uint8Array},s.allocate=function(e,t,n){return new s(e,t,n)},s.concat=function(e,t,n,r){"boolean"!=typeof t&&"string"==typeof t||(r=n,n=t,t=void 0);for(var i,o=0,a=0,u=e.length;a<u;++a)s.isByteBuffer(e[a])||(e[a]=s.wrap(e[a],t)),i=e[a].limit-e[a].offset,i>0&&(o+=i);if(0===o)return new s(0,n,r);var f,l=new s(o,n,r);for(a=0;a<u;)f=e[a++],i=f.limit-f.offset,i<=0||(l.view.set(f.view.subarray(f.offset,f.limit),l.offset),l.offset+=i);return l.limit=l.offset,l.offset=0,l},s.isByteBuffer=function(e){return(e&&e.__isByteBuffer__)===!0},s.type=function(){return ArrayBuffer},s.wrap=function(e,t,n,r){if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch("undefined"==typeof t&&(t="utf8"),t){case"base64":return s.fromBase64(e,n);case"hex":return s.fromHex(e,n);case"binary":return s.fromBinary(e,n);case"utf8":return s.fromUTF8(e,n);case"debug":return s.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var i;if(s.isByteBuffer(e))return i=o.clone.call(e),i.markedOffset=-1,i;if(e instanceof Uint8Array)i=new s(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new s(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");i=new s(e.length,n,r),i.limit=e.length;for(var a=0;a<e.length;++a)i.view[a]=e[a]}return i},o.writeBitSet=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var r,i=t,s=e.length,o=s>>3,a=0;for(t+=this.writeVarint32(s,t);o--;)r=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(r,t++);if(a<s){var u=0;for(r=0;a<s;)r|=(1&!!e[a++])<<u++;this.writeByte(r,t++)}return n?(this.offset=t,this):t-i},o.readBitSet=function(e){var t="undefined"==typeof e;t&&(e=this.offset);var n,r=this.readVarint32(e),i=r.value,s=i>>3,o=0,a=[];for(e+=r.length;s--;)n=this.readByte(e++),a[o++]=!!(1&n),a[o++]=!!(2&n),a[o++]=!!(4&n),a[o++]=!!(8&n),a[o++]=!!(16&n),a[o++]=!!(32&n),a[o++]=!!(64&n),a[o++]=!!(128&n);if(o<i){var u=0;for(n=this.readByte(e++);o<i;)a[o++]=!!(n>>u++&1)}return t&&(this.offset=e),a},o.readBytes=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var r=this.slice(t,t+e);return n&&(this.offset+=e),r},o.writeBytes=o.append,o.writeInt8=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view[t]=e,n&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view[e];return 128===(128&n)&&(n=-(255-n+1)),t&&(this.offset+=1),n},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view[t]=e,n&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view[e];return t&&(this.offset+=1),n},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),n&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e],n|=this.view[e+1]<<8):(n=this.view[e]<<8,n|=this.view[e+1]),32768===(32768&n)&&(n=-(65535-n+1)),t&&(this.offset+=2),n},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),n&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e],n|=this.view[e+1]<<8):(n=this.view[e]<<8,n|=this.view[e+1]),t&&(this.offset+=2),n},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),n&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0):(n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),n|=0,t&&(this.offset+=4),n},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),n&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0):(n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),t&&(this.offset+=4),n},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;n>i&&this.resize((i*=2)>n?i:n),n-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[n+3]=s>>>24&255,this.view[n+2]=s>>>16&255,this.view[n+1]=s>>>8&255,this.view[n]=255&s,n+=4,this.view[n+3]=o>>>24&255,this.view[n+2]=o>>>16&255,this.view[n+1]=o>>>8&255,this.view[n]=255&o):(this.view[n]=o>>>24&255,this.view[n+1]=o>>>16&255,this.view[n+2]=o>>>8&255,this.view[n+3]=255&o,n+=4,this.view[n]=s>>>24&255,this.view[n+1]=s>>>16&255,this.view[n+2]=s>>>8&255,this.view[n+3]=255&s),r&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var s=new e(r,i,!1);return n&&(this.offset+=8),s},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;n>i&&this.resize((i*=2)>n?i:n),n-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[n+3]=s>>>24&255,this.view[n+2]=s>>>16&255,this.view[n+1]=s>>>8&255,this.view[n]=255&s,n+=4,this.view[n+3]=o>>>24&255,this.view[n+2]=o>>>16&255,this.view[n+1]=o>>>8&255,this.view[n]=255&o):(this.view[n]=o>>>24&255,this.view[n+1]=o>>>16&255,this.view[n+2]=o>>>8&255,this.view[n+3]=255&o,n+=4,this.view[n]=s>>>24&255,this.view[n+1]=s>>>16&255,this.view[n+2]=s>>>8&255,this.view[n+3]=255&s),r&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var s=new e(r,i,!0);return n&&(this.offset+=8),s},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),n&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=r(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),n},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),n&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var n=r(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),n},o.readDouble=o.readFloat64,s.MAX_VARINT32_BYTES=5,s.calculateVarint32=function(e){return e>>>=0,e<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},s.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},s.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},o.writeVarint32=function(e,t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var r,i=s.calculateVarint32(e);t+=i;var o=this.buffer.byteLength;for(t>o&&this.resize((o*=2)>t?o:t),t-=i,e>>>=0;e>=128;)r=127&e|128,this.view[t++]=r,e>>>=7;return this.view[t++]=e,n?(this.offset=t,this):i},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(s.zigZagEncode32(e),t)},o.readVarint32=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n,r=0,i=0;do{if(!this.noAssert&&e>this.limit){var s=Error("Truncated");throw s.truncated=!0,s}n=this.view[e++],r<5&&(i|=(127&n)<<7*r),++r}while(0!==(128&n));return i|=0,t?(this.offset=e,i):{value:i,length:r}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=s.zigZagDecode32(t.value):t=s.zigZagDecode32(t),t},e&&(s.MAX_VARINT64_BYTES=10,s.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:n<1<<21?3:4:r<16384?r<128?5:6:r<1<<21?7:8:i<128?9:10},s.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):t.unsigned!==!1&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},s.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):t.unsigned!==!1&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):t.unsigned!==!1&&(t=t.toSigned());var i=s.calculateVarint64(t),o=t.toInt()>>>0,a=t.shiftRightUnsigned(28).toInt()>>>0,u=t.shiftRightUnsigned(56).toInt()>>>0;n+=i;var f=this.buffer.byteLength;switch(n>f&&this.resize((f*=2)>n?f:n),n-=i,i){case 10:this.view[n+9]=u>>>7&1;case 9:this.view[n+8]=9!==i?128|u:127&u;case 8:this.view[n+7]=8!==i?a>>>21|128:a>>>21&127;case 7:this.view[n+6]=7!==i?a>>>14|128:a>>>14&127;case 6:this.view[n+5]=6!==i?a>>>7|128:a>>>7&127;case 5:this.view[n+4]=5!==i?128|a:127&a;case 4:this.view[n+3]=4!==i?o>>>21|128:o>>>21&127;case 3:this.view[n+2]=3!==i?o>>>14|128:o>>>14&127;case 2:this.view[n+1]=2!==i?o>>>7|128:o>>>7&127;case 1:this.view[n]=1!==i?128|o:127&o}return r?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(s.zigZagEncode64(e),t)},o.readVarint64=function(t){var n="undefined"==typeof t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: "+t+" (not an integer)");if(t>>>=0,t<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i=0,s=0,o=0,a=0;if(a=this.view[t++],i=127&a,128&a&&(a=this.view[t++],i|=(127&a)<<7,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],i|=(127&a)<<14,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],i|=(127&a)<<21,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],s=127&a,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],s|=(127&a)<<7,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],s|=(127&a)<<14,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],s|=(127&a)<<21,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],o=127&a,(128&a||this.noAssert&&"undefined"==typeof a)&&(a=this.view[t++],o|=(127&a)<<7,128&a||this.noAssert&&"undefined"==typeof a))))))))))throw Error("Buffer overrun");var u=e.fromBits(i|s<<28,s>>>4|o<<24,!1);return n?(this.offset=t,u):{value:u,length:t-r}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=s.zigZagDecode64(n.value):n=s.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r="undefined"==typeof n;r&&(n=this.offset);var i,s=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i<s;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}s=l.calculateUTF16asUTF8(t(e))[1],n+=s+1;var o=this.buffer.byteLength;return n>o&&this.resize((o*=2)>n?o:n),n-=s+1,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,r?(this.offset=n,this):s},o.readCString=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,s=-1;return l.decodeUTF8toUTF16(function(){if(0===s)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return s=this.view[e++],0===s?null:s}.bind(this),r=n(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},o.writeIString=function(e,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,s=n;i=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i;var o=this.buffer.byteLength;if(n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=i>>>24&255,this.view[n+2]=i>>>16&255,this.view[n+1]=i>>>8&255,this.view[n]=255&i):(this.view[n]=i>>>24&255,this.view[n+1]=i>>>16&255,this.view[n+2]=i>>>8&255,this.view[n+3]=255&i),n+=4,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return r?(this.offset=n,this):n-s},o.readIString=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=e,r=this.readUint32(e),i=this.readUTF8String(r,s.METRICS_BYTES,e+=4);return e+=i.length,t?(this.offset=e,i.string):{string:i.string,length:e-n}},s.METRICS_CHARS="c",s.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,s=n;i=l.calculateUTF16asUTF8(t(e))[1],n+=i;var o=this.buffer.byteLength;return n>o&&this.resize((o*=2)>n?o:n),n-=i,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),r?(this.offset=n,this):n-s},o.writeString=o.writeUTF8String,s.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(t(e))[0]},s.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(t(e))[1]},s.calculateString=s.calculateUTF8Bytes,o.readUTF8String=function(e,t,r){"number"==typeof t&&(r=t,t=void 0);var i="undefined"==typeof r;if(i&&(r=this.offset),"undefined"==typeof t&&(t=s.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!==0)throw TypeError("Illegal offset: "+r+" (not an integer)");if(r>>>=0,r<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var o,a=0,u=r;if(t===s.METRICS_CHARS){if(o=n(),l.decodeUTF8(function(){return a<e&&r<this.limit?this.view[r++]:null}.bind(this),function(e){++a,l.UTF8toUTF16(e,o)}),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-u}}if(t===s.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!==0)throw TypeError("Illegal offset: "+r+" (not an integer)");if(r>>>=0,r<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}var f=r+e;if(l.decodeUTF8toUTF16(function(){return r<f?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==f)throw RangeError("Illegal range: Truncated data, "+r+" == "+f);return i?(this.offset=r,o()):{string:o(),length:r-u}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,o,a=n;i=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],o=s.calculateVarint32(i),n+=o+i;var u=this.buffer.byteLength;if(n>u&&this.resize((u*=2)>n?u:n),n-=o+i,n+=this.writeVarint32(i,n),l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==a+i+o)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+o));return r?(this.offset=n,this):n-a},o.readVString=function(e){var t="undefined"==typeof e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");
-if(e>>>=0,e<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=e,r=this.readVarint32(e),i=this.readUTF8String(r.value,s.METRICS_BYTES,e+=r.length);return e+=i.length,t?(this.offset=e,i.string):{string:i.string,length:e-n}},o.append=function(e,t,n){"number"!=typeof t&&"string"==typeof t||(n=t,t=void 0);var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof s||(e=s.wrap(e,t));var i=e.limit-e.offset;if(i<=0)return this;n+=i;var o=this.buffer.byteLength;return n>o&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new s(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var n=t-e;if(0===n)return this.buffer=a,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var r=new ArrayBuffer(n),i=new Uint8Array(r);return i.set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this},o.copy=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new s(0,this.littleEndian,this.noAssert);var n=t-e,r=new s(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o;if(!this.noAssert&&!s.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o="undefined"==typeof t)?e.offset:0|t,n=(i="undefined"==typeof n)?this.offset:0|n,r="undefined"==typeof r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);var a=r-n;return 0===a?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),o&&(e.offset+=a),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r="undefined"==typeof t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),"undefined"==typeof t&&(t=this.offset),"undefined"==typeof n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!==0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;t<n;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e="undefined"==typeof e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal offset: "+e+" (not an integer)");if(e>>>=0,e<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian="undefined"==typeof e||!!e,this},o.BE=function(e){return this.littleEndian="undefined"!=typeof e&&!e,this},o.prepend=function(e,t,n){"number"!=typeof t&&"string"==typeof t||(n=t,t=void 0);var r="undefined"==typeof n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!==0)throw TypeError("Illegal offset: "+n+" (not an integer)");if(n>>>=0,n<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof s||(e=s.wrap(e,t));var i=e.limit-e.offset;if(i<=0)return this;var o=i-n;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),u=new Uint8Array(a);u.set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=u,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o}else{new Uint8Array(this.buffer)}return this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if(e|=0,e<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),n=new Uint8Array(t);n.set(this.view),this.buffer=t,this.view=n}return this},o.reverse=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t?this:(Array.prototype.reverse.call(this.view.subarray(e,t)),this)},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t=this.offset,n=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!==0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!==0)throw TypeError("Illegal limit: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(!e&&0===t&&n===this.buffer.byteLength)return this.buffer;if(t===n)return a;var r=new ArrayBuffer(n-t);return new Uint8Array(r).set(new Uint8Array(this.buffer).subarray(t,n),0),r},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if("undefined"==typeof e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(e="utf8",t=e,n=t),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var f=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],n=[],r=0,i=t.length;r<i;++r)n[t[r]]=r;return e.encode=function(e,n){for(var r,i;null!==(r=e());)n(t[r>>2&63]),i=(3&r)<<4,null!==(r=e())?(i|=r>>4&15,n(t[63&(i|r>>4&15)]),i=(15&r)<<2,null!==(r=e())?(n(t[63&(i|r>>6&3)]),n(t[63&r])):(n(t[63&i]),n(61))):(n(t[63&i]),n(61),n(61))},e.decode=function(e,t){function r(e){throw Error("Illegal character code: "+e)}for(var i,s,o;null!==(i=e());)if(s=n[i],"undefined"==typeof s&&r(i),null!==(i=e())&&(o=n[i],"undefined"==typeof o&&r(i),t(s<<2>>>0|(48&o)>>4),null!==(i=e()))){if(s=n[i],"undefined"==typeof s){if(61===i)break;r(i)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(i=e())){if(o=n[i],"undefined"==typeof o){if(61===i)break;r(i)}t((3&s)<<6>>>0|o)}}},e.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},e}();o.toBase64=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),e|=0,t|=0,e<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return f.encode(function(){return e<t?this.view[e++]:null}.bind(this),r=n()),r()},s.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new s(e.length/4*3,n),i=0;return f.decode(t(e),function(e){r.view[i++]=e}),r.limit=i,r},s.btoa=function(e){return s.fromBinary(e).toBase64()},s.atob=function(e){return s.fromBase64(e).toBinary()},o.toBinary=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),e|=0,t|=0,e<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];e<t;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},s.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new s(i,t);r<i;){if(n=e.charCodeAt(r),n>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",o="";n<r;){if(n!==-1&&(t=this.view[n],i+=t<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16===0&&n!==r){for(;i.length<51;)i+=" ";o+=i+s+"\n",i=s=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";o+=i+s+"\n"}return e?o:i},s.fromDebug=function(e,t,n){for(var r,i,o=e.length,a=new s((o+1)/3|0,t,n),u=0,f=0,l=!1,h=!1,d=!1,c=!1,_=!1;u<o;){switch(r=e.charAt(u++)){case"!":if(!n){if(h||d||c){_=!0;break}h=d=c=!0}a.offset=a.markedOffset=a.limit=f,l=!1;break;case"|":if(!n){if(h||c){_=!0;break}h=c=!0}a.offset=a.limit=f,l=!1;break;case"[":if(!n){if(h||d){_=!0;break}h=d=!0}a.offset=a.markedOffset=f,l=!1;break;case"<":if(!n){if(h){_=!0;break}h=!0}a.offset=f,l=!1;break;case"]":if(!n){if(c||d){_=!0;break}c=d=!0}a.limit=a.markedOffset=f,l=!1;break;case">":if(!n){if(c){_=!0;break}c=!0}a.limit=f,l=!1;break;case"'":if(!n){if(d){_=!0;break}d=!0}a.markedOffset=f,l=!1;break;case" ":l=!1;break;default:if(!n&&l){_=!0;break}if(i=parseInt(r+e.charAt(u++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[f++]=i,l=!0}if(_)throw TypeError("Illegal str: Invalid symbol at "+u)}if(!n){if(!h||!c)throw TypeError("Illegal str: Missing offset or limit");if(f<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+f+" < "+o)}return a},o.toHex=function(e,t){if(e="undefined"==typeof e?this.offset:e,t="undefined"==typeof t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);e<t;)n=this.view[e++],n<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},s.fromHex=function(e,t,n){if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!==0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var r,i=e.length,o=new s(i/2|0,t),a=0,u=0;a<i;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[u++]=r}return o.limit=u,o};var l=function(){var e={};return e.MAX_CODEPOINT=1114111,e.encodeUTF8=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(n>>6&31|192),t(63&n|128)):n<65536?(t(n>>12&15|224),t(n>>6&63|128),t(63&n|128)):(t(n>>18&7|240),t(n>>12&63|128),t(n>>6&63|128),t(63&n|128)),n=null},e.decodeUTF8=function(e,t){for(var n,r,i,s,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0===(128&n))t(n);else if(192===(224&n))null===(r=e())&&o([n,r]),t((31&n)<<6|63&r);else if(224===(240&n))(null===(r=e())||null===(i=e()))&&o([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!==(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(s=e()))&&o([n,r,i,s]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&s)}},e.UTF16toUTF8=function(e,t){for(var n,r=null;;){if(null===(n=null!==r?r:e()))break;n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n)}null!==r&&t(r)},e.UTF8toUTF16=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(n-=65536,t((n>>10)+55296),t(n%1024+56320)),n=null},e.encodeUTF16toUTF8=function(t,n){e.UTF16toUTF8(t,function(t){e.encodeUTF8(t,n)})},e.decodeUTF8toUTF16=function(t,n){e.decodeUTF8(t,function(t){e.UTF8toUTF16(t,n)})},e.calculateCodePoint=function(e){return e<128?1:e<2048?2:e<65536?3:4},e.calculateUTF8=function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},e.calculateUTF16asUTF8=function(t){var n=0,r=0;return e.UTF16toUTF8(t,function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4}),[n,r]},e}();return o.toUTF8=function(e,t){if("undefined"==typeof e&&(e=this.offset),"undefined"==typeof t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!==0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!==0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},s.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new s(l.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return l.encodeUTF16toUTF8(t(e),function(e){i.view[o++]=e}),i.limit=o,i},s})}).call(t,n(7)(e))},function(e,t){var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=n},function(e,t,n){var r,i,s;(function(e){!function(o,a){n(9).amd?(i=[],r=a,s="function"==typeof r?r.apply(t,i):r,!(void 0!==s&&(e.exports=s))):"object"==typeof e&&e&&e.exports?e.exports=a():(o.dcodeIO=o.dcodeIO||{}).Long=a()}(this,function(){"use strict";function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return(e&&e.__isLong__)===!0}function n(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),s&&(a[e]=n),n))}function r(e,t){if(isNaN(e)||!isFinite(e))return t?p:E;if(t){if(e<0)return p;if(e>=d)return T}else{if(e<=-c)return S;if(e+1>=c)return C}return e<0?r(-e,t).neg():i(e%h|0,e/h|0,t)}function i(t,n,r){return new e(t,n,r)}function s(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return E;if("number"==typeof t?(n=t,t=!1):t=!!t,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return s(e.substring(1),t,n).neg();for(var o=r(f(n,8)),a=E,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n);if(l<8){var d=r(f(n,l));a=a.mul(d).add(r(h))}else a=a.mul(o),a=a.add(r(h))}return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var a={},u={};e.fromInt=n,e.fromNumber=r,e.fromBits=i;var f=Math.pow;e.fromString=s,e.fromValue=o;var l=1<<24,h=4294967296,d=0x10000000000000000,c=d/2,_=n(l),E=n(0);e.ZERO=E;var p=n(0,!0);e.UZERO=p;var g=n(1);e.ONE=g;var R=n(1,!0);e.UONE=R;var y=n(-1);e.NEG_ONE=y;var C=i(-1,2147483647,!1);e.MAX_VALUE=C;var T=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=T;var S=i(0,-2147483648,!1);e.MIN_VALUE=S;var I=e.prototype;return I.toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},I.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(S)){var t=r(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var s=r(f(e,6),this.unsigned),o=this,a="";;){var u=o.div(s),l=o.sub(u.mul(s)).toInt()>>>0,h=l.toString(e);if(o=u,o.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},I.isZero=function(){return 0===this.high&&0===this.low},I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1===(1&this.low)},I.isEven=function(){return 0===(1&this.low)},I.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!==1||e.high>>>31!==1)&&(this.high===e.high&&this.low===e.low)},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(g)},I.neg=I.negate,I.add=function(e){t(e)||(e=o(e));var n=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,u=e.high>>>16,f=65535&e.high,l=e.low>>>16,h=65535&e.low,d=0,c=0,_=0,E=0;return E+=a+h,_+=E>>>16,E&=65535,_+=s+l,c+=_>>>16,_&=65535,c+=r+f,d+=c>>>16,c&=65535,d+=n+u,d&=65535,i(_<<16|E,d<<16|c,this.unsigned)},I.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return E;if(t(e)||(e=o(e)),e.isZero())return E;if(this.eq(S))return e.isOdd()?S:E;if(e.eq(S))return this.isOdd()?S:E;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(_)&&e.lt(_))return r(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,s=65535&this.high,a=this.low>>>16,u=65535&this.low,f=e.high>>>16,l=65535&e.high,h=e.low>>>16,d=65535&e.low,c=0,p=0,g=0,R=0;return R+=u*d,g+=R>>>16,R&=65535,g+=a*d,p+=g>>>16,g&=65535,g+=u*h,p+=g>>>16,g&=65535,p+=s*d,c+=p>>>16,p&=65535,p+=a*h,c+=p>>>16,p&=65535,p+=u*l,c+=p>>>16,p&=65535,c+=n*d+s*h+a*l+u*f,c&=65535,i(g<<16|R,c<<16|p,this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:E;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return R;s=p}else{if(this.eq(S)){if(e.eq(g)||e.eq(y))return S;if(e.eq(S))return g;var a=this.shr(1);return n=a.div(e).shl(1),n.eq(E)?e.isNegative()?g:y:(i=this.sub(e.mul(n)),s=n.add(i.div(e)))}if(e.eq(S))return this.unsigned?p:E;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=E}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var u=Math.ceil(Math.log(n)/Math.LN2),l=u<=48?1:f(2,u-48),h=r(n),d=h.mul(e);d.isNegative()||d.gt(i);)n-=l,h=r(n,this.unsigned),d=h.mul(e);h.isZero()&&(h=g),s=s.add(h),i=i.sub(d)}return s},I.div=I.divide,I.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return i(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:e<32?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:e<32?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),e&=63,0===e)return this;var n=this.high;if(e<32){var r=this.low;return i(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?i(n,0,this.unsigned):i(n>>>e-32,0,this.unsigned)},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},I.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})}).call(t,n(7)(e))},function(e,t,n){(function(e){e.require&&(n(37),n(38));var t={isNotUTF8:function(e,n,r){try{t.getStringFromBytes(e,n,r,!0)}catch(e){return!0}return!1},getCharLength:function(e){return 240==(240&e)?4:224==(224&e)?3:192==(192&e)?2:e==(127&e)?1:0},getCharCode:function(e,n,r){var i=0,s="";if(n=n||0,r=r||t.getCharLength(e[n]),0==r)throw new Error(e[n].toString(2)+" is not a significative byte (offset:"+n+").");if(1===r)return e[n];if(s="00000000".slice(0,r)+1+"00000000".slice(r+1),e[n]&parseInt(s,2))throw Error("Index "+n+": A "+r+" bytes encoded char cannot encode the "+(r+1)+"th rank bit to 1.");for(s="0000".slice(0,r+1)+"11111111".slice(r+1),i+=(e[n]&parseInt(s,2))<<6*--r;r;){if(128!==(128&e[n+1])||64===(64&e[n+1]))throw Error("Index "+(n+1)+': Next bytes of encoded char must begin with a "10" bit sequence.');i+=(63&e[++n])<<6*--r}return i},getStringFromBytes:function(e,n,r,i){var s,o=[];for(n|=0,r="number"==typeof r?r:e.byteLength||e.length;n<r;n++){if(s=t.getCharLength(e[n]),n+s>r){if(i)throw Error("Index "+n+": Found a "+s+" bytes encoded char declaration but only "+(r-n)+" bytes are available.")}else o.push(String.fromCodePoint(t.getCharCode(e,n,s,i)));n+=s-1}return o.join("")},getBytesForCharCode:function(e){if(e<128)return 1;if(e<2048)return 2;if(e<65536)return 3;if(e<2097152)return 4;throw new Error("CharCode "+e+" cannot be encoded with UTF8.")},setBytesFromCharCode:function(e,n,r,i){if(e|=0,n=n||[],r|=0,i=i||t.getBytesForCharCode(e),1==i)n[r]=e;else for(n[r++]=(parseInt("1111".slice(0,i),2)<<8-i)+(e>>>6*--i);i>0;)n[r++]=e>>>6*--i&63|128;return n},setBytesFromString:function(e,n,r,i,s){e=e||"",n=n||[],r|=0,i="number"==typeof i?i:n.byteLength||1/0;for(var o=0,a=e.length;o<a;o++){var u=t.getBytesForCharCode(e[o].codePointAt(0));if(s&&r+u>i)throw new Error('Not enought bytes to encode the char "'+e[o]+'" at the offset "'+r+'".');t.setBytesFromCharCode(e[o].codePointAt(0),n,r,u,s),r+=u}return n}};e.exports=t}).call(t,n(7)(e))},function(e,t){(function(){"use strict";function e(e){throw e}function t(e,t){var n=e.split("."),r=S;!(n[0]in r)&&r.execScript&&r.execScript("var "+n[0]);for(var i;n.length&&(i=n.shift());)n.length||t===C?r=r[i]?r[i]:r[i]={}:r[i]=t}function n(t,n){this.index="number"==typeof n?n:0,this.i=0,this.buffer=t instanceof(I?Uint8Array:Array)?t:new(I?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&e(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function r(e){this.buffer=new(I?Uint16Array:Array)(2*e),this.length=0}function i(e){var t,n,r,i,s,o,a,u,f,l,h=e.length,d=0,c=Number.POSITIVE_INFINITY;for(u=0;u<h;++u)e[u]>d&&(d=e[u]),e[u]<c&&(c=e[u]);for(t=1<<d,n=new(I?Uint32Array:Array)(t),r=1,i=0,s=2;r<=d;){for(u=0;u<h;++u)if(e[u]===r){for(o=0,a=i,f=0;f<r;++f)o=o<<1|1&a,a>>=1;for(l=r<<16|u,f=o;f<t;f+=s)n[f]=l;++i}++r,i<<=1,s<<=1}return[n,d,c]}function s(e,t){this.h=w,this.w=0,this.input=I&&e instanceof Array?new Uint8Array(e):e,this.b=0,t&&(t.lazy&&(this.w=t.lazy),"number"==typeof t.compressionType&&(this.h=t.compressionType),t.outputBuffer&&(this.a=I&&t.outputBuffer instanceof Array?new Uint8Array(t.outputBuffer):t.outputBuffer),"number"==typeof t.outputIndex&&(this.b=t.outputIndex)),this.a||(this.a=new(I?Uint8Array:Array)(32768))}function o(e,t){this.length=e,this.H=t}function a(t,n){function r(t,n){var r,i=t.H,s=[],o=0;r=k[t.length],s[o++]=65535&r,s[o++]=r>>16&255,s[o++]=r>>24;var a;switch(T){case 1===i:a=[0,i-1,0];break;case 2===i:a=[1,i-2,0];break;case 3===i:a=[2,i-3,0];break;case 4===i:a=[3,i-4,0];break;case 6>=i:a=[4,i-5,1];break;case 8>=i:a=[5,i-7,1];break;case 12>=i:a=[6,i-9,2];break;case 16>=i:a=[7,i-13,2];break;case 24>=i:a=[8,i-17,3];break;case 32>=i:a=[9,i-25,3];break;case 48>=i:a=[10,i-33,4];break;case 64>=i:a=[11,i-49,4];break;case 96>=i:a=[12,i-65,5];break;case 128>=i:a=[13,i-97,5];break;case 192>=i:a=[14,i-129,6];break;case 256>=i:a=[15,i-193,6];break;case 384>=i:a=[16,i-257,7];break;case 512>=i:a=[17,i-385,7];break;case 768>=i:a=[18,i-513,8];break;case 1024>=i:a=[19,i-769,8];break;case 1536>=i:a=[20,i-1025,9];break;case 2048>=i:a=[21,i-1537,9];break;case 3072>=i:a=[22,i-2049,10];break;case 4096>=i:a=[23,i-3073,10];break;case 6144>=i:a=[24,i-4097,11];break;case 8192>=i:a=[25,i-6145,11];break;case 12288>=i:a=[26,i-8193,12];break;case 16384>=i:a=[27,i-12289,12];break;case 24576>=i:a=[28,i-16385,13];break;case 32768>=i:a=[29,i-24577,13];break;default:e("invalid distance")}r=a,s[o++]=r[0],s[o++]=r[1],s[o++]=r[2];var u,f;for(u=0,f=s.length;u<f;++u)E[p++]=s[u];R[s[0]]++,y[s[3]]++,g=t.length+n-1,d=null}var i,s,o,a,f,l,h,d,c,_={},E=I?new Uint16Array(2*n.length):[],p=0,g=0,R=new(I?Uint32Array:Array)(286),y=new(I?Uint32Array:Array)(30),S=t.w;if(!I){for(o=0;285>=o;)R[o++]=0;for(o=0;29>=o;)y[o++]=0}for(R[256]=1,i=0,s=n.length;i<s;++i){for(o=f=0,a=3;o<a&&i+o!==s;++o)f=f<<8|n[i+o];if(_[f]===C&&(_[f]=[]),l=_[f],!(0<g--)){for(;0<l.length&&32768<i-l[0];)l.shift();if(i+3>=s){for(d&&r(d,-1),o=0,a=s-i;o<a;++o)c=n[i+o],E[p++]=c,++R[c];break}0<l.length?(h=u(n,i,l),d?d.length<h.length?(c=n[i-1],E[p++]=c,++R[c],r(h,0)):r(d,-1):h.length<S?d=h:r(h,0)):d?r(d,-1):(c=n[i],E[p++]=c,++R[c])}l.push(i)}return E[p++]=256,R[256]++,t.M=R,t.L=y,I?E.subarray(0,p):E}function u(e,t,n){var r,i,s,a,u,f,l=0,h=e.length;a=0,f=n.length;e:for(;a<f;a++){if(r=n[f-a-1],s=3,3<l){for(u=l;3<u;u--)if(e[r+u-1]!==e[t+u-1])continue e;s=l}for(;258>s&&t+s<h&&e[r+s]===e[t+s];)++s;if(s>l&&(i=r,l=s),258===s)break}return new o(l,t-i)}function f(e,t){var n,i,s,o,a,u=e.length,f=new r(572),h=new(I?Uint8Array:Array)(u);if(!I)for(o=0;o<u;o++)h[o]=0;for(o=0;o<u;++o)0<e[o]&&f.push(o,e[o]);if(n=Array(f.length/2),i=new(I?Uint32Array:Array)(f.length/2),1===n.length)return h[f.pop().index]=1,h;for(o=0,a=f.length/2;o<a;++o)n[o]=f.pop(),i[o]=n[o].value;for(s=l(i,i.length,t),o=0,a=n.length;o<a;++o)h[n[o].index]=s[o];return h}function l(e,t,n){function r(e){var n=c[e][_[e]];n===t?(r(e+1),r(e+1)):--h[n],++_[e]}var i,s,o,a,u,f=new(I?Uint16Array:Array)(n),l=new(I?Uint8Array:Array)(n),h=new(I?Uint8Array:Array)(t),d=Array(n),c=Array(n),_=Array(n),E=(1<<n)-t,p=1<<n-1;for(f[n-1]=t,s=0;s<n;++s)E<p?l[s]=0:(l[s]=1,E-=p),E<<=1,f[n-2-s]=(f[n-1-s]/2|0)+t;for(f[0]=l[0],d[0]=Array(f[0]),c[0]=Array(f[0]),s=1;s<n;++s)f[s]>2*f[s-1]+l[s]&&(f[s]=2*f[s-1]+l[s]),d[s]=Array(f[s]),c[s]=Array(f[s]);for(i=0;i<t;++i)h[i]=n;for(o=0;o<f[n-1];++o)d[n-1][o]=e[o],c[n-1][o]=o;for(i=0;i<n;++i)_[i]=0;for(1===l[n-1]&&(--h[0],++_[n-1]),s=n-2;0<=s;--s){for(a=i=0,u=_[s+1],o=0;o<f[s];o++)a=d[s+1][u]+d[s+1][u+1],a>e[i]?(d[s][o]=a,c[s][o]=t,u+=2):(d[s][o]=e[i],c[s][o]=i,++i);_[s]=0,1===l[s]&&r(s)}return h}function h(e){var t,n,r,i,s=new(I?Uint16Array:Array)(e.length),o=[],a=[],u=0;for(t=0,n=e.length;t<n;t++)o[e[t]]=(0|o[e[t]])+1;for(t=1,n=16;t<=n;t++)a[t]=u,u+=0|o[t],u<<=1;for(t=0,n=e.length;t<n;t++)for(u=a[e[t]],a[e[t]]+=1,r=s[t]=0,i=e[t];r<i;r++)s[t]=s[t]<<1|1&u,u>>>=1;return s}function d(t,n){switch(this.l=[],this.m=32768,this.e=this.g=this.c=this.q=0,this.input=I?new Uint8Array(t):t,this.s=!1,this.n=B,this.C=!1,!n&&(n={})||(n.index&&(this.c=n.index),n.bufferSize&&(this.m=n.bufferSize),n.bufferType&&(this.n=n.bufferType),n.resize&&(this.C=n.resize)),this.n){case M:this.b=32768,this.a=new(I?Uint8Array:Array)(32768+this.m+258);break;case B:this.b=0,this.a=new(I?Uint8Array:Array)(this.m),this.f=this.K,this.t=this.I,this.o=this.J;break;default:e(Error("invalid inflate mode"))}}function c(t,n){for(var r,i=t.g,s=t.e,o=t.input,a=t.c,u=o.length;s<n;)a>=u&&e(Error("input buffer is broken")),i|=o[a++]<<s,s+=8;return r=i&(1<<n)-1,t.g=i>>>n,t.e=s-n,t.c=a,r}function _(e,t){for(var n,r,i=e.g,s=e.e,o=e.input,a=e.c,u=o.length,f=t[0],l=t[1];s<l&&!(a>=u);)i|=o[a++]<<s,s+=8;return n=f[i&(1<<l)-1],r=n>>>16,e.g=i>>r,e.e=s-r,e.c=a,65535&n}function E(e){function t(e,t,n){var r,i,s,o=this.z;for(s=0;s<e;)switch(r=_(this,t)){case 16:for(i=3+c(this,2);i--;)n[s++]=o;break;
-case 17:for(i=3+c(this,3);i--;)n[s++]=0;o=0;break;case 18:for(i=11+c(this,7);i--;)n[s++]=0;o=0;break;default:o=n[s++]=r}return this.z=o,n}var n,r,s,o,a=c(e,5)+257,u=c(e,5)+1,f=c(e,4)+4,l=new(I?Uint8Array:Array)(j.length);for(o=0;o<f;++o)l[j[o]]=c(e,3);if(!I)for(o=f,f=l.length;o<f;++o)l[j[o]]=0;n=i(l),r=new(I?Uint8Array:Array)(a),s=new(I?Uint8Array:Array)(u),e.z=0,e.o(i(t.call(e,a,n,r)),i(t.call(e,u,n,s)))}function p(e){if("string"==typeof e){var t,n,r=e.split("");for(t=0,n=r.length;t<n;t++)r[t]=(255&r[t].charCodeAt(0))>>>0;e=r}for(var i,s=1,o=0,a=e.length,u=0;0<a;){i=1024<a?1024:a,a-=i;do s+=e[u++],o+=s;while(--i);s%=65521,o%=65521}return(o<<16|s)>>>0}function g(t,n){var r,i;switch(this.input=t,this.c=0,!n&&(n={})||(n.index&&(this.c=n.index),n.verify&&(this.N=n.verify)),r=t[this.c++],i=t[this.c++],15&r){case re:this.method=re;break;default:e(Error("unsupported compression method"))}0!==((r<<8)+i)%31&&e(Error("invalid fcheck flag:"+((r<<8)+i)%31)),32&i&&e(Error("fdict flag is not supported")),this.B=new d(t,{index:this.c,bufferSize:n.bufferSize,bufferType:n.bufferType,resize:n.resize})}function R(e,t){this.input=e,this.a=new(I?Uint8Array:Array)(32768),this.h=ie.k;var n,r={};!t&&(t={})||"number"!=typeof t.compressionType||(this.h=t.compressionType);for(n in t)r[n]=t[n];r.outputBuffer=this.a,this.A=new s(this.input,r)}function y(e,n){var r,i,s,o;if(Object.keys)r=Object.keys(n);else for(i in r=[],s=0,n)r[s++]=i;for(s=0,o=r.length;s<o;++s)i=r[s],t(e+"."+i,n[i])}var C=void 0,T=!0,S=this,I="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;n.prototype.f=function(){var e,t=this.buffer,n=t.length,r=new(I?Uint8Array:Array)(n<<1);if(I)r.set(t);else for(e=0;e<n;++e)r[e]=t[e];return this.buffer=r},n.prototype.d=function(e,t,n){var r,i=this.buffer,s=this.index,o=this.i,a=i[s];if(n&&1<t&&(e=8<t?(N[255&e]<<24|N[e>>>8&255]<<16|N[e>>>16&255]<<8|N[e>>>24&255])>>32-t:N[e]>>8-t),8>t+o)a=a<<t|e,o+=t;else for(r=0;r<t;++r)a=a<<1|e>>t-r-1&1,8===++o&&(o=0,i[s++]=N[a],a=0,s===i.length&&(i=this.f()));i[s]=a,this.buffer=i,this.i=o,this.index=s},n.prototype.finish=function(){var e,t=this.buffer,n=this.index;return 0<this.i&&(t[n]<<=8-this.i,t[n]=N[t[n]],n++),I?e=t.subarray(0,n):(t.length=n,e=t),e};var m,v=new(I?Uint8Array:Array)(256);for(m=0;256>m;++m){for(var b=m,A=b,O=7,b=b>>>1;b;b>>>=1)A<<=1,A|=1&b,--O;v[m]=(A<<O&255)>>>0}var N=v;r.prototype.getParent=function(e){return 2*((e-2)/4|0)},r.prototype.push=function(e,t){var n,r,i,s=this.buffer;for(n=this.length,s[this.length++]=t,s[this.length++]=e;0<n&&(r=this.getParent(n),s[n]>s[r]);)i=s[n],s[n]=s[r],s[r]=i,i=s[n+1],s[n+1]=s[r+1],s[r+1]=i,n=r;return this.length},r.prototype.pop=function(){var e,t,n,r,i,s=this.buffer;for(t=s[0],e=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],i=0;(r=2*i+2,!(r>=this.length))&&(r+2<this.length&&s[r+2]>s[r]&&(r+=2),s[r]>s[i]);)n=s[i],s[i]=s[r],s[r]=n,n=s[i+1],s[i+1]=s[r+1],s[r+1]=n,i=r;return{index:e,value:t,length:this.length}};var P,w=2,D={NONE:0,r:1,k:w,O:3},U=[];for(P=0;288>P;P++)switch(T){case 143>=P:U.push([P+48,8]);break;case 255>=P:U.push([P-144+400,9]);break;case 279>=P:U.push([P-256+0,7]);break;case 287>=P:U.push([P-280+192,8]);break;default:e("invalid literal: "+P)}s.prototype.j=function(){var t,r,i,s,o=this.input;switch(this.h){case 0:for(i=0,s=o.length;i<s;){r=I?o.subarray(i,i+65535):o.slice(i,i+65535),i+=r.length;var u=r,l=i===s,d=C,c=C,_=C,E=C,p=C,g=this.a,R=this.b;if(I){for(g=new Uint8Array(this.a.buffer);g.length<=R+u.length+5;)g=new Uint8Array(g.length<<1);g.set(this.a)}if(d=l?1:0,g[R++]=0|d,c=u.length,_=~c+65536&65535,g[R++]=255&c,g[R++]=c>>>8&255,g[R++]=255&_,g[R++]=_>>>8&255,I)g.set(u,R),R+=u.length,g=g.subarray(0,R);else{for(E=0,p=u.length;E<p;++E)g[R++]=u[E];g.length=R}this.b=R,this.a=g}break;case 1:var y=new n(I?new Uint8Array(this.a.buffer):this.a,this.b);y.d(1,1,T),y.d(1,2,T);var S,m,v,b=a(this,o);for(S=0,m=b.length;S<m;S++)if(v=b[S],n.prototype.d.apply(y,U[v]),256<v)y.d(b[++S],b[++S],T),y.d(b[++S],5),y.d(b[++S],b[++S],T);else if(256===v)break;this.a=y.finish(),this.b=this.a.length;break;case w:var A,O,N,P,D,L,k,M,B,G,H,F,x,j,q,V=new n(I?new Uint8Array(this.a.buffer):this.a,this.b),Y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],J=Array(19);for(A=w,V.d(1,1,T),V.d(A,2,T),O=a(this,o),L=f(this.M,15),k=h(L),M=f(this.L,7),B=h(M),N=286;257<N&&0===L[N-1];N--);for(P=30;1<P&&0===M[P-1];P--);var W,Q,z,K,Z,$,X=N,ee=P,te=new(I?Uint32Array:Array)(X+ee),ne=new(I?Uint32Array:Array)(316),re=new(I?Uint8Array:Array)(19);for(W=Q=0;W<X;W++)te[Q++]=L[W];for(W=0;W<ee;W++)te[Q++]=M[W];if(!I)for(W=0,K=re.length;W<K;++W)re[W]=0;for(W=Z=0,K=te.length;W<K;W+=Q){for(Q=1;W+Q<K&&te[W+Q]===te[W];++Q);if(z=Q,0===te[W])if(3>z)for(;0<z--;)ne[Z++]=0,re[0]++;else for(;0<z;)$=138>z?z:138,$>z-3&&$<z&&($=z-3),10>=$?(ne[Z++]=17,ne[Z++]=$-3,re[17]++):(ne[Z++]=18,ne[Z++]=$-11,re[18]++),z-=$;else if(ne[Z++]=te[W],re[te[W]]++,z--,3>z)for(;0<z--;)ne[Z++]=te[W],re[te[W]]++;else for(;0<z;)$=6>z?z:6,$>z-3&&$<z&&($=z-3),ne[Z++]=16,ne[Z++]=$-3,re[16]++,z-=$}for(t=I?ne.subarray(0,Z):ne.slice(0,Z),G=f(re,7),j=0;19>j;j++)J[j]=G[Y[j]];for(D=19;4<D&&0===J[D-1];D--);for(H=h(G),V.d(N-257,5,T),V.d(P-1,5,T),V.d(D-4,4,T),j=0;j<D;j++)V.d(J[j],3,T);for(j=0,q=t.length;j<q;j++)if(F=t[j],V.d(H[F],G[F],T),16<=F){switch(j++,F){case 16:x=2;break;case 17:x=3;break;case 18:x=7;break;default:e("invalid code: "+F)}V.d(t[j],x,T)}var ie,se,oe,ae,ue,fe,le,he,de=[k,L],ce=[B,M];for(ue=de[0],fe=de[1],le=ce[0],he=ce[1],ie=0,se=O.length;ie<se;++ie)if(oe=O[ie],V.d(ue[oe],fe[oe],T),256<oe)V.d(O[++ie],O[++ie],T),ae=O[++ie],V.d(le[ae],he[ae],T),V.d(O[++ie],O[++ie],T);else if(256===oe)break;this.a=V.finish(),this.b=this.a.length;break;default:e("invalid compression type")}return this.a};var L=function(){function t(t){switch(T){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var n,r,i=[];for(n=3;258>=n;n++)r=t(n),i[n]=r[2]<<24|r[1]<<16|r[0];return i}(),k=I?new Uint32Array(L):L,M=0,B=1,G={F:M,D:B};d.prototype.p=function(){for(;!this.s;){var t=c(this,3);switch(1&t&&(this.s=T),t>>>=1){case 0:var n=this.input,r=this.c,i=this.a,s=this.b,o=n.length,a=C,u=C,f=i.length,l=C;switch(this.e=this.g=0,r+1>=o&&e(Error("invalid uncompressed block header: LEN")),a=n[r++]|n[r++]<<8,r+1>=o&&e(Error("invalid uncompressed block header: NLEN")),u=n[r++]|n[r++]<<8,a===~u&&e(Error("invalid uncompressed block header: length verify")),r+a>n.length&&e(Error("input buffer is broken")),this.n){case M:for(;s+a>i.length;){if(l=f-s,a-=l,I)i.set(n.subarray(r,r+l),s),s+=l,r+=l;else for(;l--;)i[s++]=n[r++];this.b=s,i=this.f(),s=this.b}break;case B:for(;s+a>i.length;)i=this.f({v:2});break;default:e(Error("invalid inflate mode"))}if(I)i.set(n.subarray(r,r+a),s),s+=a,r+=a;else for(;a--;)i[s++]=n[r++];this.c=r,this.b=s,this.a=i;break;case 1:this.o(ee,ne);break;case 2:E(this);break;default:e(Error("unknown BTYPE: "+t))}}return this.t()};var H,F,x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=I?new Uint16Array(x):x,q=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],V=I?new Uint16Array(q):q,Y=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],J=I?new Uint8Array(Y):Y,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Q=I?new Uint16Array(W):W,z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],K=I?new Uint8Array(z):z,Z=new(I?Uint8Array:Array)(288);for(H=0,F=Z.length;H<F;++H)Z[H]=143>=H?8:255>=H?9:279>=H?7:8;var $,X,ee=i(Z),te=new(I?Uint8Array:Array)(30);for($=0,X=te.length;$<X;++$)te[$]=5;var ne=i(te);d.prototype.o=function(e,t){var n=this.a,r=this.b;this.u=e;for(var i,s,o,a,u=n.length-258;256!==(i=_(this,e));)if(256>i)r>=u&&(this.b=r,n=this.f(),r=this.b),n[r++]=i;else for(s=i-257,a=V[s],0<J[s]&&(a+=c(this,J[s])),i=_(this,t),o=Q[i],0<K[i]&&(o+=c(this,K[i])),r>=u&&(this.b=r,n=this.f(),r=this.b);a--;)n[r]=n[r++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},d.prototype.J=function(e,t){var n=this.a,r=this.b;this.u=e;for(var i,s,o,a,u=n.length;256!==(i=_(this,e));)if(256>i)r>=u&&(n=this.f(),u=n.length),n[r++]=i;else for(s=i-257,a=V[s],0<J[s]&&(a+=c(this,J[s])),i=_(this,t),o=Q[i],0<K[i]&&(o+=c(this,K[i])),r+a>u&&(n=this.f(),u=n.length);a--;)n[r]=n[r++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},d.prototype.f=function(){var e,t,n=new(I?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.a;if(I)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=i[e+32768];if(this.l.push(n),this.q+=n.length,I)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},d.prototype.K=function(e){var t,n,r,i,s=this.input.length/this.c+1|0,o=this.input,a=this.a;return e&&("number"==typeof e.v&&(s=e.v),"number"==typeof e.G&&(s+=e.G)),2>s?(n=(o.length-this.c)/this.u[2],i=258*(n/2)|0,r=i<a.length?a.length+i:a.length<<1):r=a.length*s,I?(t=new Uint8Array(r),t.set(a)):t=a,this.a=t},d.prototype.t=function(){var e,t,n,r,i,s=0,o=this.a,a=this.l,u=new(I?Uint8Array:Array)(this.q+(this.b-32768));if(0===a.length)return I?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(t=0,n=a.length;t<n;++t)for(e=a[t],r=0,i=e.length;r<i;++r)u[s++]=e[r];for(t=32768,n=this.b;t<n;++t)u[s++]=o[t];return this.l=[],this.buffer=u},d.prototype.I=function(){var e,t=this.b;return I?this.C?(e=new Uint8Array(t),e.set(this.a.subarray(0,t))):e=this.a.subarray(0,t):(this.a.length>t&&(this.a.length=t),e=this.a),this.buffer=e},g.prototype.p=function(){var t,n,r=this.input;return t=this.B.p(),this.c=this.B.c,this.N&&(n=(r[this.c++]<<24|r[this.c++]<<16|r[this.c++]<<8|r[this.c++])>>>0,n!==p(t)&&e(Error("invalid adler-32 checksum"))),t};var re=8,ie=D;R.prototype.j=function(){var t,n,r,i,s,o,a,u=0;switch(a=this.a,t=re){case re:n=Math.LOG2E*Math.log(32768)-8;break;default:e(Error("invalid compression method"))}switch(r=n<<4|t,a[u++]=r,t){case re:switch(this.h){case ie.NONE:s=0;break;case ie.r:s=1;break;case ie.k:s=2;break;default:e(Error("unsupported compression type"))}break;default:e(Error("invalid compression method"))}return i=s<<6|0,a[u++]=i|31-(256*r+i)%31,o=p(this.input),this.A.b=u,a=this.A.j(),u=a.length,I&&(a=new Uint8Array(a.buffer),a.length<=u+4&&(this.a=new Uint8Array(a.length+4),this.a.set(a),a=this.a),a=a.subarray(0,u+4)),a[u++]=o>>24&255,a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=255&o,a},t("Zlib.Inflate",g),t("Zlib.Inflate.prototype.decompress",g.prototype.p),y("Zlib.Inflate.BufferType",{ADAPTIVE:G.D,BLOCK:G.F}),t("Zlib.Deflate",R),t("Zlib.Deflate.compress",function(e,t){return new R(e,t).j()}),t("Zlib.Deflate.prototype.compress",R.prototype.j),y("Zlib.Deflate.CompressionType",{NONE:ie.NONE,FIXED:ie.r,DYNAMIC:ie.k})}).call(this)},function(e,t){},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),f=r(u),l=n(24),h=r(l),d=n(14),c=r(d),_=n(2),E=r(_),p=n(1),g=r(p),R=n(12),y=r(R),C=n(25),T=r(C),S=n(27),I=r(S),m=n(26),v=r(m),b=n(28),A=r(b),O=n(10),N=r(O),P=n(11),w=r(P),D=g.default.getLoger("MessageEntrance"),U={version:"v1.0.0",author:"www.3mang.com"},L=void 0,k=void 0,M=void 0,B=void 0,G=void 0,H=void 0,F=void 0,x=void 0,j=void 0,q=void 0,V=void 0,Y=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.sdkInfo=U,D.log(e.sdkInfo),e.on(E.default.CLASS_INIT_FAILED,e._sassInitFailedHandler.bind(e)),e.on(E.default.CLASS_JOIN_FAILED,e._joinClassFailureHandler.bind(e)),e.on(E.default.DOC_SHOW,e.docShowHandler.bind(e)),L=h.default,L.on("*",function(t,n){return e._emit(t,n)}),L.on(L.SUCCESS,e._sassVerifySuccessHandler.bind(e)),L.on(L.CLASS_INIT_SUCCESS,e._sassInitSuccessHandler.bind(e)),L.on(L.CLASS_INIT_FAILED,e._sassInitFailedHandler.bind(e)),L.on(L.CLASS_GET_MEETING_PARAM,e._h5SassGetMeetingParaSuccessHandler),k=c.default,k.on("*",function(t,n){return e._emit(t,n)}),k.on(E.default.CLASS_JOIN_SUCCESS,e._joinClassSuccessHandler.bind(e)),M=new y.default,M.on("*",function(t,n){return e._emit(t,n)}),M.on(E.default.DOC_SWITCH,e.docSwitchHandler.bind(e)),B=new T.default,B.on("*",function(t,n){return e._emit(t,n)}),G=new I.default,G.on("*",function(t,n){return e._emit(t,n)}),H=new v.default,H.on("*",function(t,n){return e._emit(t,n)}),H.on(E.default.DOC_UPDATE,e.docUpdateHandler.bind(e)),H.on(E.default.DOC_DEL,e.docDeleteHandler.bind(e)),F=new A.default,F.on("*",function(t,n){return e._emit(t,n)}),F.on(E.default.ANNO_UPDATE,e.annoUpdateHandler.bind(e)),e.init=e._init,e.joinClass=e._joinClass,e.sendChatMsg=e._sendChatMsg,e.setDebugData=e._setDebugData,e}return o(t,e),a(t,[{key:"_init",value:function(e,t,n){return x=t,j=n,null==e||N.default.isEmptyObject(e)?(D.log("init初始化失败1",E.default.ERROR_PARAM),void this._emit(E.default.CLASS_INIT_FAILED,E.default.ERROR_PARAM)):null==e.meetingNumber||isNaN(e.meetingNumber)||null==e.portal?(D.log("init初始化失败2",e),void this._emit(E.default.CLASS_INIT_FAILED,E.default.ERROR_PARAM)):(D.log("init",e),w.default.confId=e.meetingNumber,w.default.portal=e.portal,w.default.userRole=e.userRole||"normal",w.default.userId=e.userId||"0",void(L&&L.sassGetJoinParams(w.default.getConfInfo())))}},{key:"_joinClass",value:function(e,t,n){return q=t,V=n,null==e||N.default.isEmptyObject(e)?(this._emit(E.default.CLASS_JOIN_FAILED,E.default.ERROR_PARAM),void D.log("不能进入会议,传递的参数不对.",e)):null==e.userName?(D.log("不能进入会议,传递的参数不对.名字不能为空"),void this._emit(E.default.CLASS_JOIN_FAILED,E.default.ERROR_PARAM)):(w.default.userName=e.userName,w.default.password=e.password||"",void(L&&L.sassChecking(w.default.getConfInfo())))}},{key:"leaveClass",value:function(){k&&k.leaveMCU()}},{key:"_sassInitSuccessHandler",value:function(e){e&&(w.default.md5=e.md5||"",w.default.msType=e.msType||1,w.default.passwordRequired=e.passwordRequired||!1,w.default.siteId=e.siteId),D.log("向SASS平台获取入会验证信息成功."),this._emit(E.default.CLASS_INIT_SUCCESS,e),x&&x(e)}},{key:"_sassInitFailedHandler",value:function(){D.log("向SASS平台获取入会验证信息失败."),j&&j()}},{key:"_setDebugData",value:function(e){D.log("setDebugData "+e),w.default.setDebugData(e)}},{key:"_sassVerifySuccessHandler",value:function(e){D.log("加入底层MCU会议."),k&&k.joinMCU(w.default.getConfInfo())}},{key:"_h5SassGetMeetingParaSuccessHandler",value:function(e){D.log("获取getMeetingParam完成."),w.default.meetingParam=e,D.log(e)}},{key:"_joinClassSuccessHandler",value:function(){D.log("MCU 会议成功."),L&&(L.getClassDetail(),L.getMeetingParam()),q&&q()}},{key:"_joinClassFailureHandler",value:function(e){D.log("_joinClassFailureHandler",e),V&&V(e)}},{key:"conferenceHandler",value:function(e){var t={type:e,data:null};this._emit(t.type,t)}},{key:"_sendChatMsg",value:function(e){return null===e||N.default.isEmptyObject(e)?void D.log("sendChatMsg 传递的参数不对",e):void(B&&B.sendChatMsg(e))}},{key:"annoUpdateHandler",value:function(e){var t=M.activeDocId,n=H.docList[t];n&&e.id==n.wbid&&this._emit(E.default.DOC_ANNO,e)}},{key:"docShowHandler",value:function(e){D.log("Doc Show ->"+e.id+"|"+e.curPageNo);var t=F.annoInfos[e.wbid];t?this._emit(E.default.DOC_ANNO,t):this._emit(E.default.DOC_ANNO)}},{key:"docSwitchHandler",value:function(){var e=M.activeDocId;D.log("Switch Doc Active -> "+e);var t=H.docList[e];t&&this._emit(E.default.DOC_SHOW,t)}},{key:"docUpdateHandler",value:function(e){D.log("Doc UpdateId ->"+e.id+"| activeDocId ->"+M.activeDocId),e.id==M.activeDocId&&this._emit(E.default.DOC_SHOW,e)}},{key:"docDeleteHandler",value:function(e){e.id==M.activeDocId&&this._emit(E.default.DOC_DEL,e)}}]),t}(f.default),J=Y;t.default=J;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(D,"loger","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(U,"_sdkInfo","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(L,"_sass","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(k,"_mcu","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(M,"_confer_ape","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(B,"_chat_ape","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(G,"_video_ape","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(H,"_doc_ape","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(F,"_wb_ape","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(x,"_initSuccessCallBackFun","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(j,"_initFailureCallBackFun","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(q,"_joinClassSuccessCallBackFun","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(V,"_joinClassFailureCallBackFun","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(Y,"MessageEntrance","D:/work/McuClient/src/EngineEntrance.js"),__REACT_HOT_LOADER__.register(J,"default","D:/work/McuClient/src/EngineEntrance.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){return f}Object.defineProperty(t,"__esModule",{value:!0}),t.MessageTypes=void 0,t.createMcuClient=i;var s=n(22),o=r(s),a=n(2),u=r(a),f=new o.default;t.MessageTypes=u.default;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(f,"MCU_CLIENT","D:/work/McuClient/src/McuClientEngine.js"),__REACT_HOT_LOADER__.register(i,"createMcuClient","D:/work/McuClient/src/McuClientEngine.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),f=r(u),l=n(1),h=r(l),d=n(2),c=r(d),_=n(11),E=r(_),p=n(35),g=r(p),R=h.default.getLoger("Sass"),y={},C={},T=function(e){function t(){return i(this,t),s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return o(t,e),a(t,[{key:"sassGetJoinParams",value:function(e){var n=this;R.log("Sass获取课堂校验信息",e);var r="http://"+e.portal+"/3m/api/meeting/joinParams.do?meetingNumber="+e.confId+"&userID="+e.userId;R.log("Sass获取课堂校验信息.",r),fetch(r,{timeout:5e3}).then(function(e){if(e.ok)return e.json();throw R.error("Sass获取课堂校验信息-网络异常.状态码:"+e.status),n._emit(t.CLASS_INIT_FAILED),""}).then(function(e){0===e.code?(R.log("Sass获取课堂校验信息完成"),n._emit(t.CLASS_INIT_SUCCESS,e)):(R.warn("Sass获取课堂校验信息失败."),n._emit(t.CLASS_INIT_FAILED))}).catch(function(e){R.error("Sass获取课堂校验信息异常.状态码:"+e),n._emit(t.CLASS_INIT_FAILED,e)})}},{key:"sassChecking",value:function(e){return R.log("发起Sass校验",e),y=e,"true"===y.passwordRequired||y.passwordRequired===!0?void this.sendPWDChecking():void this.sendMD5Checking()}},{key:"sendPWDChecking",value:function(){var e=this,t="http://"+y.portal+"/3m/getCheckMeetinig.do?siteId="+y.siteId+"&classId="+y.confId+"&password="+y.password;R.log("会议密码校验",t),fetch(t,{timeout:5e3}).then(function(t){if(200===t.status)return t.text();throw R.error("会议密码校验-网络异常.状态码:"+t.status),e._emit(c.default.NET_ERROR),""}).then(function(t){return"false"===t?(R.error("会议密码校验-失败."),void e._emit(c.default.CLASS_JOIN_FAILED,c.default.ERROR_CLASS_PASSWORD_WRONG)):"true"===t?(R.log("会议密码校验-成功."),void e.sendMD5Checking()):(R.error("会议密码校验-协议异常."),void e._emit(c.default.CLASS_JOIN_FAILED,c.default.ERROR_CLASS_PROTOCOL_WRONG))}).catch(function(t){R.error("会议密码校验-异常.状态码:"+t),e._emit(c.default.NET_ERROR)})}},{key:"sendMD5Checking",value:function(){var e=this,n="http://"+y.portal+"/3m/meeting/md5CheckMeeting.do?siteId="+y.siteId+"&meetingNumber="+y.confId+"&userId="+y.userId+"&userName="+y.userName+"&userType="+y.userType+"&nopassword="+y.passwordRequired+"&md5="+y.md5;R.log("H5SassMD5校验",n),fetch(n,{timeout:5e3}).then(function(t){if(200===t.status)return t.json();throw R.error("H5SassMD5校验-网络异常.状态码:"+t.status),e._emit(c.default.NET_ERROR),""}).then(function(n){if("true"==n.flag){if(n.h5_mcu_list){var r=n.h5_mcu_list.split(";")[0];y.MCUServerIP=r.split(":")[0],y.MCUServerPort=r.split(":")[1],E.default.MCUServerIP=y.MCUServerIP,E.default.MCUServerPort=y.MCUServerPort}y.maxVideoChannels=n.maxVideoChannels,y.maxAudioChannels=n.maxAudioChannels,y.maxMediaChannels=y.maxVideoChannels+y.maxAudioChannels,E.default.maxVideoChannels=y.maxVideoChannels,E.default.maxAudioChannels=y.maxAudioChannels,E.default.maxMediaChannels=y.maxMediaChannels,R.log("H5Sass校验完成"),console.log(n),e._emit(t.SUCCESS,n)}else R.log("H5SassMD5校验-失败."),e._emit(c.default.CLASS_JOIN_FAILED,c.default.ERROR_CLASS_MD5_WRONG)}).catch(function(t){R.error("H5SassMD5校验-异常.状态码:"+t),e._emit(c.default.NET_ERROR)})}},{key:"getClassDetail",value:function(){var e=this,t="http://"+y.portal+"/3m/meeting/getClassH5.do?classNumber="+y.confId;R.log("H5Sass获取Class详情.",t),fetch(t,{timeout:5e3}).then(function(t){if(t.ok)return t.json();throw R.error("H5Sass获取Class详情-网络异常.状态码:"+t.status),e._emit(c.default.NET_ERROR),""}).then(function(t){0===t.errorCode?(R.log("H5Sass获取Class详情完成"),e._emit(c.default.CLASS_SHOW_DETAIL,t)):(R.warn("H5Sass获取Class详情失败."),e._emit(c.default.NET_ERROR))}).catch(function(t){R.error("H5Sass获取Class详情异常.状态码:"+t),e._emit(c.default.NET_ERROR)})}},{key:"getMeetingParam",value:function(){var e=this,n=(new Date).getTime(),r=(0,g.default)(y.confId+""+n),i="http://"+y.portal+"/3m/api/meeting/detail.do?meetingNumber="+y.confId+"×tamp="+n+"&authId="+r;R.log("H5Sass获取getMeetingParam ",i),fetch(i,{timeout:5e3}).then(function(t){if(t.ok)return t.json();throw R.error("H5Sass获取getMeetingParam-网络异常.状态码:"+t.status),e._emit(c.default.NET_ERROR),""}).then(function(n){0===n.code?(R.log("H5Sass获取getMeetingParam完成"),e._emit(t.CLASS_GET_MEETING_PARAM,n)):(R.warn("H5Sass获取getMeetingParam失败."),e._emit(c.default.NET_ERROR))}).catch(function(t){R.error("H5Sass获取getMeetingParam异常.状态码:"+t),e._emit(c.default.NET_ERROR)})}}]),t}(f.default);T.prototype.SUCCESS=T.SUCCESS="h5sass.success",T.prototype.CLASS_INIT_SUCCESS=T.CLASS_INIT_SUCCESS="sass.class.init.success",T.prototype.CLASS_INIT_FAILED=T.CLASS_INIT_FAILED="sass.class.init.failed",T.prototype.CLASS_GET_MEETING_PARAM=T.CLASS_GET_MEETING_PARAM="class_getMeetingParam.message";var S=new T;t.default=S;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"loger","D:/work/McuClient/src/Sass.js"),__REACT_HOT_LOADER__.register(y,"confInfo","D:/work/McuClient/src/Sass.js"),__REACT_HOT_LOADER__.register(C,"initInfo","D:/work/McuClient/src/Sass.js"),__REACT_HOT_LOADER__.register(T,"Sass","D:/work/McuClient/src/Sass.js"),__REACT_HOT_LOADER__.register(S,"default","D:/work/McuClient/src/Sass.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),f=r(u),l=n(3),h=r(l),d=n(4),c=r(d),_=n(1),E=r(_),p=n(2),g=r(p),R=n(10),y=r(R),C=E.default.getLoger("ChatApe"),T=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.default.CHAT_SESSION_ID,h.default.CHAT_SESSION_NAME,h.default.CHAT_SESSION_TAG));return e.registerKey(e._session_id,e._session_name,e._session_tag,new ArrayBuffer),e.registerObj(c.default.RCPDU_REG_REGISTER_TABLE,h.default.CHAT_OBJ_TABLE_ID,h.default.CHAT_OBJ_TABLE_NAME,h.default.CHAT_OBJ_TABLE_TAG,0,new ArrayBuffer),e.on(c.default.RCPDU_CHAT_SEND_DATA_REQUEST,e.chatMsgIncomingHandler.bind(e)),e}return o(t,e),a(t,[{key:"sendChatMsg",value:function(e){if(null===this._confInfo||y.default.isEmptyObject(this._confInfo))return void C.log("不能发送聊天消息.McuClient还未初始化数据!");C.log("发送聊天消息.",e.to,e.message);var t=new c.default.RCChatSendDataRequestPdu;t.type=c.default.RCPDU_CHAT_SEND_DATA_REQUEST,t.initiator=this._confInfo.nodeId,t.peer=parseInt(e.to),t.isPublic=!0,t.userData=this._rCArrayBufferUtil.strToUint8Array("h5"+e.message),t.fromName=this._rCArrayBufferUtil.strToUint8Array("h5"+this._confInfo.userName),t.fromRole=this._confInfo.classRole,t.isPublic||0===t.peer?this.sendUniform(t):this.send(t)}},{key:"chatMsgIncomingHandler",value:function(e){var t=c.default.RCChatSendDataRequestPdu.decode(e),n={};n.fromNodeID=t.initiator,n.toNodeID=t.peer,n.message=this._rCArrayBufferUtil.uint8ArrayToStr(t.userData,2),n.fromName=this._rCArrayBufferUtil.uint8ArrayToStr(t.fromName,2),n.fromRole=t.fromRole,C.log("接收聊天消息.",n),this._emit(g.default.CHAT_RECEIVE,n)}}]),t}(f.default),S=T;t.default=S;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(C,"loger","D:/work/McuClient/src/apes/ChatApe.js"),__REACT_HOT_LOADER__.register(T,"ChatApe","D:/work/McuClient/src/apes/ChatApe.js"),__REACT_HOT_LOADER__.register(S,"default","D:/work/McuClient/src/apes/ChatApe.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),f=r(u),l=n(3),h=r(l),d=n(4),c=r(d),_=n(1),E=r(_),p=n(2),g=r(p),R=E.default.getLoger("DocApe"),y=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.default.DOCSHARING_SESSION_ID,h.default.DOCSHARING_SESSION_NAME,h.default.DOCSHARING_SESSION_TAG));return e.docList={},e.registerKey(e._session_id,e._session_name,e._session_tag,new ArrayBuffer),e.registerObj(c.default.RCPDU_REG_REGISTER_TABLE,h.default.DOCSHARING_OBJ_TABLE_ID_H5,h.default.DOCSHARING_OBJ_TABLE_NAME_H5,h.default.DOCSHARING_OBJ_TABLE_TAG_H5,0,new ArrayBuffer),e._apeDelayed=!0,e}return o(t,e),a(t,[{key:"tableInsertHandler",value:function(e,t,n){this.tableUpdateHandler(e,t,n)}},{key:"tableDeleteHandler",value:function(e,t){var n={};n.type=h.default.DOCUMENT_DEL,this._emit(g.default.DOC_DEL,n)}},{key:"tableUpdateHandler",value:function(e,t,n){try{var r=c.default.RCDocSendDataRequestPdu.decode(n);r.type=h.default.DOCUMENT_LOAD,r.ext=r.name.substr(r.name.indexOf(".")+1),r.wbid=(r.id<<10)+r.curPageNo,r.isPicture=~["bmp","png","gif","jpg","jpeg"].indexOf(r.ext),r.isPicture?(r.namePath=r.uri.substring(0,r.uri.lastIndexOf(".")),r.loadURL=r.namePath+"."+r.ext):(r.namePath=r.uri.substring(0,r.uri.lastIndexOf("/")),r.loadURL=r.namePath+"/"+r.curPageNo+".jpg"),this.docList[t]=r,this._emit(g.default.DOC_UPDATE,r),R.log("Doc update ->"+t)}catch(e){R.warn("Doc Table Update Decode包异常")}}}]),t}(f.default),C=y;t.default=C;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"loger","D:/work/McuClient/src/apes/DocApe.js"),__REACT_HOT_LOADER__.register(y,"DocApe","D:/work/McuClient/src/apes/DocApe.js"),__REACT_HOT_LOADER__.register(C,"default","D:/work/McuClient/src/apes/DocApe.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),f=r(u),l=n(3),h=r(l),d=n(4),c=r(d),_=n(1),E=r(_),p=n(2),g=r(p),R=E.default.getLoger("VideoChat"),y=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.default.VIDEO_SESSION_ID,h.default.VIDEO_SESSION_NAME,h.default.VIDEO_SESSION_TAG));return e.videoChannels={},e.activeChannelId=0,e.activeURL="",e.registerKey(e._session_id,e._session_name,e._session_tag,new ArrayBuffer),e.registerObj(c.default.RCPDU_REG_REGISTER_TABLE,h.default.VIDEO_OBJ_TABLE_ID,h.default.VIDEO_OBJ_TABLE_NAME,h.default.VIDEO_OBJ_TABLE_TAG,0,new ArrayBuffer),
-e.on(c.default.RCPDU_VIDEO_SEND_DATA_REQUEST,e.videoIncomingHandler.bind(e)),e}return o(t,e),a(t,[{key:"videoIncomingHandler",value:function(e){var t=c.default.VideoSendDataRequestPdu.decode(e),n={};n._initiator=t.initiator,n._is_key_frame=t.keyFrame,n._sequence_id=t.sequenceId,n._slice_id=t.sliceId,n._data=t.userData,R.log("接受视频消息.",n),this._emit(g.default.VIDEO_SHOW,n)}},{key:"tableUpdateHandler",value:function(e,t,n){var r=c.default.RCVideoChannelInfoRecordPdu.decode(n);switch(r.owner=e,r.channelId=t,r.status=0===e?h.default.CGS_RELEASED:r.status,this.videoChannels[t]=r,r.status){case h.default.CGS_RELEASED:case h.default.CGS_PENDING:case h.default.CGS_GRABBING:this.activeChannelId===r.channelId&&(this.activeChannelId=0,this.activeURL="",this.emitVideoChange());break;case h.default.CGS_OPENNED:this.activeChannelId=r.channelId,"1"===this._confInfo.msType?this.activeURL="http://dazhi.3mang.com/live/"+this._confInfo.confId+"/"+this._confInfo.confId+"_"+r.channelId+"_flash_cam_mic_aac/playlist.m3u8":this.activeURL="http://hls.3mang.com/live/"+this._confInfo.confId+"_"+r.channelId+"_flash_cam_mic_aac/playlist.m3u8",this.emitVideoChange()}}},{key:"emitVideoChange",value:function(){this._emit(g.default.VIDEO_SHOW,{activeChannelId:this.activeChannelId,HLSURL:this.activeURL})}}]),t}(f.default),C=y;t.default=C;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(R,"loger","D:/work/McuClient/src/apes/VideoApe.js"),__REACT_HOT_LOADER__.register(y,"VideoChat","D:/work/McuClient/src/apes/VideoApe.js"),__REACT_HOT_LOADER__.register(C,"default","D:/work/McuClient/src/apes/VideoApe.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),f=r(u),l=n(3),h=r(l),d=n(4),c=r(d),_=n(1),E=r(_),p=n(2),g=r(p),R=n(20),y=n(19),C=r(y),T=E.default.getLoger("WhiteBoardApe"),S=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.default.WHITEBOARD_SESSION_ID,h.default.WHITEBOARD_SESSION_NAME,h.default.WHITEBOARD_SESSION_TAG));return e.annoInfos={},e.registerKey(e._session_id,e._session_name,e._session_tag,new ArrayBuffer),e.registerObj(c.default.RCPDU_REG_REGISTER_TABLE,h.default.WHITEBOARD_OBJ_TABLE_ID,h.default.WHITEBOARD_OBJ_TABLE_NAME,h.default.WHITEBOARD_OBJ_TABLE_TAG,0,new ArrayBuffer),e.on(c.default.RCPDU_CONFERENCE_SEND_DATA_REQUEST,e.whiteboardMsgComingHandler.bind(e)),e._apeDelayed=!0,e}return o(t,e),a(t,[{key:"whiteboardMsgComingHandler",value:function(e){T.warn("whiteboardMsgComingHandler needs to be handled.")}},{key:"tableInsertHandler",value:function(e,t){this.emitDocChange(h.default.DOCUMENT_DEL)}},{key:"tableUpdateHandler",value:function(e,t,n){var r=c.default.RCWhiteboardDataRequestPdu.decode(n);if(r.type==h.default.WBA_DOC_ANNOTATION){var i=new R.Zlib.Inflate(r.action.compact().view).decompress(),s={id:t,svg:C.default.getStringFromBytes(i)};this.annoInfos[t]=s,this._emit(g.default.ANNO_UPDATE,s)}else T.log("白板动作忽略,类型:",(0,h.default)(r.type))}}]),t}(f.default),I=S;t.default=I;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(T,"loger","D:/work/McuClient/src/apes/WhiteBoardApe.js"),__REACT_HOT_LOADER__.register(S,"WhiteBoardApe","D:/work/McuClient/src/apes/WhiteBoardApe.js"),__REACT_HOT_LOADER__.register(I,"default","D:/work/McuClient/src/apes/WhiteBoardApe.js"))})()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),f=r(u),l=n(1),h=r(l),d=h.default.getLoger("EverSocket"),c=function(e){function t(){i(this,t);var e=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._connected=!1,e._lastActiveTime=0,e._enableEverSocket=!1,e}return o(t,e),a(t,[{key:"begin",value:function(e,t){d.log("开始WebSocket应用."),this._enableEverSocket=!0,this.wsURL="ws://"+e+":"+t,this._newConnection()}},{key:"end",value:function(){d.log("停止WebSocket应用."),this._clear()}},{key:"send",value:function(e){this._connected?(d.log("SEND MESSAGE---->"),this.websocket.send(e)):d.warn("WebSocket未建立连接.消息忽略")}},{key:"_setConnected",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._connected=e,this._connected?this._emit(t.OPEN):this._emit(t.CLOSED)}},{key:"_newConnection",value:function(){this.websocket=new WebSocket(this.wsURL),this.websocket.binaryType="arraybuffer",this.websocket.onopen=this._onOpen.bind(this),this.websocket.onclose=this._onClose.bind(this),this.websocket.onerror=this._onError.bind(this),this.websocket.onmessage=this._onMessage.bind(this)}},{key:"_reConnection",value:function(){var e=this;this._clear(),this.reConnectionTimeout=window.setTimeout(function(){d.log("WebSocket重新建立."),window.clearTimeout(e.reConnectionTimeout),e._newConnection()},t.RECONN_INTERVAL)}},{key:"_clear",value:function(){d.log("WebSocket,Timers销毁"),window.clearInterval(this.pingTimer),window.clearInterval(this.pongTimer),this.websocket.onopen=void 0,this.websocket.onclose=void 0,this.websocket.onerror=void 0,this.websocket.onmessage=void 0;try{this.websocket.close()}catch(e){d.log("ignore errors")}this.websocket=void 0,this._enableEverSocket=!1,this._setConnected(!1)}},{key:"_onOpen",value:function(){d.log("WebSocket建立成功",this.wsURL),this._setConnected()}},{key:"_onClose",value:function(e){d.log("WebSocket连接断开 CODE:"+e.code+" REASON:"+e.reason+" CLEAN: "+e.wasClean,this.wsURL),this._reConnection()}},{key:"_onError",value:function(){d.log("WebSocket错误出现"),this._connected=!1,this._reConnection()}},{key:"_onMessage",value:function(e){d.log("<----RECEIVE MESSAGE"),this._lastActiveTime=Date.now();var n=e.data;n.byteLength>0&&this._emit(t.MESSAGE,n)}},{key:"_sendPingHandler",value:function(){this._connected?this.websocket.send(new ArrayBuffer):this._reConnection()}},{key:"_checkPongHandler",value:function(){var e=Date.now();this._lastActiveTime&&this._lastActiveTime>=e-t.PONG_INTERVAL&&this._lastActiveTime<=e||(d.warn("---服务器PINGPONG超时-----"),this._reConnection())}},{key:"connected",get:function(){return this._connected}}]),t}(f.default);c.prototype.PONG_INTERVAL=c.PONG_INTERVAL=5e3,c.prototype.PING_INTERVAL=c.PING_INTERVAL=3e3,c.prototype.RECONN_INTERVAL=c.RECONN_INTERVAL=2e3,c.prototype.CONNECTING=c.CONNECTING=0,c.prototype.OPEN=c.OPEN=1,c.prototype.CLOSING=c.CLOSING=2,c.prototype.CLOSED=c.CLOSED=3,c.prototype.MESSAGE=c.MESSAGE=4;var _=new c;t.default=_;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(d,"loger","D:/work/McuClient/src/everSocket.js"),__REACT_HOT_LOADER__.register(c,"EverSocket","D:/work/McuClient/src/everSocket.js"),__REACT_HOT_LOADER__.register(_,"default","D:/work/McuClient/src/everSocket.js"))})()},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n='\n//start\n// pdu_def.proto\n\n// syntax = "proto3";\n\noption optimize_for = LITE_RUNTIME;\nenum RCPduPriority_E {\n DP_TOP = 0;\n DP_HIGH = 1;\n DP_MEDIUM = 2;\n DP_LOW = 3;\n}\n\nenum RCPduSegment_E {\n SEG_BEGIN = 0;\n SEG_END = 1;\n SEG_ONCE = 2;\n}\n\nenum RCPduTokenStatus_E {\n TS_NOT_IN_USE = 0;\n TS_SELF_GRABBED = 1;\n TS_OTHER_GRABBED = 2;\n TS_SELF_INHIBITED = 3;\n TS_OTHER_INHIBITED = 4;\n TS_SELF_RECIPIENT = 5;\n TS_SELF_GIVING = 6;\n TS_OTHER_GIVING = 7;\n}\n\nenum RCPduType_E {\n// GCC PDU\n RCPDU_CONNECT_PROVIDER_REQUEST = 0;\n RCPDU_CONNECT_PROVIDER_RESPONSE = 1;\n RCPDU_CONFERENCE_JOIN_REQUEST = 2;\n RCPDU_CONFERENCE_JOIN_RESPONSE = 3;\n RCPDU_CONFERENCE_INVITE_REQUEST = 10;\n RCPDU_CONFERENCE_INVITE_RESPONSE = 11;\n RCPDU_CONFERENCE_LOCK_REQUEST = 20;\n RCPDU_CONFERENCE_LOCK_RESPONSE = 21;\n RCPDU_CONFERENCE_LOCK_INDICATION = 22;\n RCPDU_CONFERENCE_UNLOCK_REQUEST = 30;\n RCPDU_CONFERENCE_UNLOCK_RESPONSE = 31;\n RCPDU_CONFERENCE_UNLOCK_INDICATION = 32;\n RCPDU_CONFERENCE_LEAVE_REQUEST = 39;\n RCPDU_CONFERENCE_TERMINATE_REQUEST = 40;\n RCPDU_CONFERENCE_TERMINATE_RESPONSE = 41;\n RCPDU_CONFERENCE_TERMINATE_INDICATION = 42;\n RCPDU_CONFERENCE_EJECT_USER_REQUEST = 50;\n RCPDU_CONFERENCE_EJECT_USER_RESPONSE = 51;\n RCPDU_CONFERENCE_EJECT_USER_INDICATION = 52;\n RCPDU_ROSTER_UPDATE_INDICATION = 60;\n RCPDU_REGISTRY_UPDATE_REQUEST = 70; // INCLUDE ALL OBJS OPERATION\n RCPDU_REGISTRY_UPDATE_RESPONSE = 71;\n RCPDU_REGISTRY_UPDATE_INDICATION = 72;\n RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE = 80;\n\n // MCS PDU\n RCPDU_SESSION_JOIN_REQUEST = 90;\n RCPDU_SESSION_JOIN_RESPONSE = 91;\n RCPDU_CHANNEL_GRAB_REQUEST = 100;\n RCPDU_CHANNEL_GRAB_RESPONSE = 101;\n RCPDU_CHANNEL_GRAB_INDICATION = 102;\n RCPDU_CHANNEL_JOIN_REQUEST = 103;\n RCPDU_CHANNEL_JOIN_RESPONSE = 104;\n RCPDU_CHANNEL_LEAVE_REQUEST = 105;\n RCPDU_CHANNEL_RELEASE_REQUEST = 106;\n RCPDU_CHANNEL_RELEASE_INDICATION = 107;\n RCPDU_SEND_DATA_REQUEST = 120;\n RCPDU_SEND_DATA_INDICATION = 121;\n RCPDU_UNIFORM_SEND_DATA_REQUEST = 125;\n RCPDU_UNIFORM_SEND_DATA_INDICATION = 126;\n RCPDU_TOKEN_GRAB_REQUEST = 130;\n RCPDU_TOKEN_GRAB_CONFIRM = 131;\n RCPDU_TOKEN_INHIBIT_REQUEST = 132;\n RCPDU_TOKEN_INHIBIT_CONFIRM = 133;\n RCPDU_TOKEN_GIVE_REQUEST = 134;\n RCPDU_TOKEN_GIVE_INDICATION = 135;\n RCPDU_TOKEN_GIVE_RESPONSE = 136;\n RCPDU_TOKEN_GIVE_CONFIRM = 137;\n RCPDU_TOKEN_PLEASE_REQUEST = 138;\n RCPDU_TOKEN_PLEASE_INDICATION = 139;\n RCPDU_TOKEN_RELEASE_REQUEST = 140;\n RCPDU_TOKEN_RELEASE_CONFIRM = 141;\n RCPDU_TOKEN_TEST_REQUEST = 142;\n RCPDU_TOKEN_TEST_CONFIRM = 143;\n\n // Registry PDU\n RCPDU_REG_REGISTER_KEY = 200;\n RCPDU_REG_UNREGISTER_KEY = 201;\n RCPDU_REG_REGISTER_ROSTER = 202;\n RCPDU_REG_REGISTER_TOKEN = 203;\n RCPDU_REG_REGISTER_PARAMETER = 204;\n RCPDU_REG_REGISTER_COUNTER = 205;\n RCPDU_REG_REGISTER_TABLE = 206;\n RCPDU_REG_REGISTER_CACHE = 207;\n RCPDU_REG_REGISTER_OBJ = 208;\n RCPDU_REG_UNREGISTER_OBJ = 209;\n RCPDU_REG_UPDATE_OBJ = 210;\n RCPDU_REG_ADAPTER = 211;\n RCPDU_REG_CLEANUP_NODE = 212;\n RCPDU_REG_REGISTER_QUEUE = 213;\n\n // Registry Obj update PDU\n RCPDU_REG_TABLE_INSERT_PDU = 230;\n RCPDU_REG_TABLE_DELETE_PDU = 231;\n RCPDU_REG_TABLE_UPDATE_PDU = 232;\n RCPDU_REG_ROSTER_INSERT_PDU = 240;\n RCPDU_REG_ROSTER_DELETE_PDU = 241;\n RCPDU_REG_ROSTER_UPDATE_PDU = 242;\n RCPDU_REG_PARAMETER_UPDATE_PDU = 250;\n RCPDU_REG_QUEUE_INSERT_PDU = 255;\n RCPDU_REG_QUEUE_DELETE_PDU = 256;\n RCPDU_REG_QUEUE_UPDATE_PDU = 257;\n\n // data\n RCPDU_CONFERENCE_SEND_DATA_REQUEST = 259;\n RCPDU_VIDEO_SEND_DATA_REQUEST = 260;\n RCPDU_AUDIO_SEND_DATA_REQUEST = 261;\n RCPDU_GIFT_SEND_DATA_REQUEST = 262;\n RCPDU_CHAT_SEND_DATA_REQUEST = 263;\n RCPDU_VOTING_POLL_RECORD = 265;\n\n // Registry resource request or response PDU\n RCPDU_REG_REQUEST_OBJ = 290;\n RCPDU_REG_RESPONSE_OBJ = 291;\n RCPDU_REG_COUNTER_REQUEST_PDU = 292;\n RCPDU_REG_COUNTER_RESPONSE_PDU = 293;\n\n // Index exchange\n RCPDU_INDEX_ADAPTER = 300;\n RCPDU_INDEX_SERVER_USERS = 301;\n RCPDU_INDEX_CONFERENCE_USER_JOINED = 302;\n RCPDU_INDEX_CONFERENCE_USER_EXITED = 303;\n RCPDU_INDEX_CONFERENCE_USERS = 304;\n}\n\nenum RCPduNodeType_E {\n NT_TERMINAL = 0;\n NT_MULTIPORT_TERMINAL = 1;\n NT_MCU = 2;\n}\n\nenum RCPduReason_E {\n RSN_USERINITIATED = 0;\n RSN_DISCONNECTED = 1;\n RSN_SUPER_LEFT = 2;\n}\n\nenum RCPduResult_E {\n RET_SUCCESS = 0;\n RET_USER_REJECTED = 1;\n RET_INVALID_CONFERENCE = 2;\n RET_INVALID_PASSWORD = 3;\n RET_INVALID_CONVENER_PASSWORD = 4;\n RET_CHALLENGE_RESPONSE_REQUIRED = 5;\n RET_INVALID_CHALLENGE_RESPONSE = 6;\n RET_NO_CONNECTION = 7;\n RET_FULL_CAPACITY = 8;\n}\n\nenum RCPduNodeCategory_E {\n NC_CONVENTIONAL = 0;\n NC_COUNTED = 1;\n NC_ANONYMOUS = 2;\n}\n\nmessage RCConferenceDescriptorPdu {\n required uint32 id = 1;\n required bytes name = 2;\n optional bytes description = 3;\n //optional string net_address = 4;\n optional uint32 mode = 4;\n optional string password = 5;\n optional uint32 capacity = 6;\n optional bytes user_data = 7;\n}\n\nmessage RCNodeRecordPdu {\n required uint32 id = 1;\n optional uint32 superior_node = 2;\n required RCPduNodeType_E type = 3;\n required string name = 4;\n required uint32 capability = 5;\n optional string net_address = 6;\n optional RCPduNodeCategory_E category = 7;\n}\n\nmessage RCApplicationRecordPdu {\n required uint32 id = 1; // session id\n required string name = 2;\n required string tag = 3;\n repeated uint32 channel_ids = 4 [packed = true];\n optional uint32 capability = 5;\n}\n\n//reg.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCRegistryRegisterKeyPdu {\n required RCPduType_E type = 1 [default = RCPDU_REG_REGISTER_KEY];\n required uint32 id = 2;\n required string name = 3;\n required string tag = 4;\n optional bytes user_data = 5;\n}\n\nmessage RCRegistryUnregisterKeyPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_KEY];\n required uint32 key_id = 2;\n}\n\nmessage RCRegistryRegisterObjPdu {\n optional RCPduType_E type = 1;\n required uint32 obj_id = 2;\n required string name = 3;\n required string tag = 4;\n optional uint32 owner = 5;\n optional bytes user_data = 6;\n}\n\nmessage RCRegistryUnregisterObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_OBJ];\n required uint32 obj_id = 2;\n}\n\nmessage RCRegistryUpdateObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UPDATE_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCAdapterItemPdu {\n required RCPduType_E type = 1;\n required bytes item_data = 2;\n}\n\n// adapter pdu that used to package a list of pdu.\nmessage RCAdapterPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ADAPTER];\n repeated RCAdapterItemPdu item = 2;\n}\n\n// table operation pdu\nmessage RCRegistryTableItemPdu {\n required uint32 item_idx = 1;\n required uint32 owner = 2;\n required bytes item_data = 3;\n}\n\nmessage RCRegistryTableInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_INSERT_PDU];\n repeated RCRegistryTableItemPdu items = 2;\n}\n\nmessage RCRegistryTableDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_DELETE_PDU];\n repeated uint32 item_idx = 2;\n}\n\nmessage RCRegistryTableUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU];\n repeated RCRegistryTableItemPdu items = 2;\n}\n\n// roster operation pdu\nmessage RCRegistryRosterItemPdu {\n required uint32 node_id = 1;\n required bytes node_data = 2;\n}\n\nmessage RCRegistryRosterInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_INSERT_PDU];\n repeated RCRegistryRosterItemPdu items = 2;\n}\n\nmessage RCRegistryRosterDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_DELETE_PDU];\n required uint32 node_id = 2;\n}\n\nmessage RCRegistryRosterUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_UPDATE_PDU];\n repeated RCRegistryRosterItemPdu items = 2;\n}\n\n//message RCCleanupNodePdu\n//{\n// optional RCPduType_E type = 1 [default = RCPDU_REG_CLEANUP_NODE];\n// required uint32 node_id = 2;\n//}\n\n// parameter operation pdu\nmessage RCRegistryParameterUpdatePdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_PARAMETER_UPDATE_PDU];\n required uint32 value = 2 [default = 0];\n optional uint32 begin_bit = 3 [default = 31];\n optional uint32 end_bit = 4;\n}\n\n// queue operation pdu\nmessage RCRegistryQueueItemPdu {\n required uint32 owner = 1;\n required uint32 item_id = 2;\n optional bytes item_data = 3;\n optional uint32 item_idx = 4;\n}\n\nmessage RCRegstryQueueInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_INSERT_PDU];\n repeated RCRegistryQueueItemPdu items = 2;\n}\n\nmessage RCRegistryQueueDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_DELETE_PDU];\n required uint32 item_id = 2;\n}\n\nmessage RCRegistryQueueUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_UPDATE_PDU];\n repeated RCRegistryQueueItemPdu items = 2;\n}\n\nmessage RCRegistryRequestObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_REQUEST_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryResponseObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_RESPONSE_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryCounterRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_REQUEST_PDU];\n required uint32 count = 2;\n}\n\nmessage RCRegistryCounterResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_RESPONSE_PDU];\n required uint32 start = 2;\n required uint32 end = 3;\n}\n\n// mcs\noption optimize_for = LITE_RUNTIME;\n\n// Session management\nmessage RCSessionJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_REQUEST];\n required uint32 id = 2;\n required string name = 3;\n required string tag = 4;\n optional bytes session_data = 5; //聚合在一起的registry信息\n}\n\nmessage RCSessionJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_RESPONSE];\n required uint32 id = 2;\n optional bytes response_data = 3;\n}\n\n// Channel management\nmessage RCChannelGrabRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelGrabResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_RESPONSE];\n required uint32 initiator = 2;\n required uint32 requested_channel_id = 3;\n required RCPduResult_E result = 4;\n optional uint32 channel_id = 5;\n}\n\nmessage RCChannelGrabIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_INDICATION];\n required uint32 initiator = 2;\n optional uint32 channel_id = 3;\n}\n\nmessage RCChannelJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_RESPONSE];\n required uint32 initiator = 2;\n required uint32 requested_channel_id = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCChannelLeaveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_LEAVE_REQUEST];\n required uint32 initiator = 2;\n repeated uint32 channel_ids = 3 [packed = true];\n}\n\nmessage RCChannelReleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_RELEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelReleaseIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CHANNEL_RELEASE_INDICATION];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\n// Data transfer\nmessage RCSendDataPdu {\n required RCPduType_E type = 1 [default = RCPDU_SEND_DATA_REQUEST];\n required RCPduType_E sub_type = 2;\n required uint32 initiator = 3;\n required uint32 conf_id = 4;\n required uint32 session_id = 5;\n required uint32 channel_id = 6;\n required bool upward = 7;\n required bool reliability = 8;\n required RCPduPriority_E priority = 9;\n required bytes data = 10;\n optional uint32 peer = 11;\n optional RCPduSegment_E seg = 12;\n optional uint32 total_size = 13;\n optional uint32 site_id = 14;\n optional string user_id = 15;\n optional string user_name = 16;\n optional string user_role = 17;\n optional string device_type = 18;\n optional string site = 19;\n}\n\n// Token management\nmessage RCTokenGrabRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenGrabConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenInhibitRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenInhibitConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenGiveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required uint64 recipient = 4;\n}\n\nmessage RCTokenGiveIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_INDICATION];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required uint64 recipient = 4;\n}\n\nmessage RCTokenGiveResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_RESPONSE];\n required uint32 token_id = 2;\n required uint64 recipient = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCTokenGiveConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_CONFIRM];\n required uint32 token_id = 2;\n required uint64 recipient = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenPleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenPleaseIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_INDICATION];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenReleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_RELEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenReleaseConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenTestRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenTestConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduTokenStatus_E status = 4;\n}\n\n//gcc.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCConferenceJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_REQUEST];\n required uint32 initiator = 2;\n required RCPduNodeType_E node_type = 3;\n required RCConferenceDescriptorPdu conf_desc = 4;\n}\n\nmessage RCConferenceJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_RESPONSE];\n required uint32 conf_id = 2;\n required RCPduResult_E result = 3;\n optional RCConferenceDescriptorPdu conf_desc = 4;\n}\n\nmessage RCConferenceInviteRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_INVITE_REQUEST];\n required uint32 initiator = 2;\n required RCConferenceDescriptorPdu conf_desc = 3;\n}\n\nmessage RCConferenceInviteResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_INVITE_RESPONSE];\n required RCPduResult_E result = 2;\n optional bytes user_data = 3;\n}\n\nmessage RCConferenceLockRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_REQUEST];\n}\n\nmessage RCConferenceLockResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceLockIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_LOCK_INDICATION];\n}\n\nmessage RCConferenceUnlockRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_UNLOCK_REQUEST];\n}\n\nmessage RCConferenceUnlockResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_UNLOCK_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceUnlockIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_UNLOCK_INDICATION];\n}\n\nmessage RCConferenceLeaveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LEAVE_REQUEST];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceTerminateRequestPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_REQUEST];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceTerminateResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceTerminateIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_INDICATION];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceEjectUserRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_REQUEST];\n required uint32 ejected_node_id = 2;\n required RCPduReason_E reason = 3;\n}\n\nmessage RCConferenceEjectUserResponsePdu { // MCS_Send_Data on Node ID Channel of requester\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_RESPONSE];\n required uint32 ejected_node_id = 2;\n required RCPduResult_E result = 3;\n}\n\nmessage RCConferenceEjectUserIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_INDICATION];\n required uint32 ejected_node_id = 2;\n required RCPduReason_E reason = 3;\n}\n\nmessage RCRosterUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel or\n// MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1 [default = RCPDU_ROSTER_UPDATE_INDICATION];\n required bool full_refresh = 2; // Conference Roster and all\n repeated RCNodeRecordPdu node_record = 3;\n repeated RCApplicationRecordPdu app_record = 4;\n}\n\nmessage RCRegistryUpdateRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_REQUEST];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_RESPONSE];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryUpdateResponsePdu { // MCS_Send_Data on Node ID Channel of requester\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_INDICATION];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCFunctionNotSupportedResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE];\n required uint32 request_pdu_id = 2;\n}\n\n//ape.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCConferenceSendDataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required bytes user_data = 4;\n}\n\nmessage RCChatSendDataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required bytes user_data = 4;\n required uint32 from_role = 5;\n required bytes from_name = 6;\n}\n\nmessage RCChatSendH5DataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required string user_data = 4;\n required string from_role = 5;\n required string from_name = 6;\n}\n\nmessage RCDocSendDataRequestPdu {\n required int32 id = 1;\n required string doc_type = 2;\n required string uri = 3;\n optional int32 owner = 4;\n optional int32 from = 5;\n optional string name = 6;\n optional int32 cur_page_no = 7;\n optional int32 cur_H = 8;\n optional int32 cur_V = 9;\n optional int32 scale = 10;\n optional int32 page_num = 11;\n}\n\nmessage RCGiftSendDataRequestPdu {\n optional uint32 initiator = 1;\n required uint32 peer = 2;\n required uint32 index = 3;\n required uint32 num = 4;\n optional bytes user_data = 5;\n}\n\nmessage RCAudioSendDataRequestPdu {\n optional uint32 initiator = 1;\n required bytes user_data = 2;\n}\n\nmessage RCVideoSendDataRequestPdu {\n optional uint32 initiator = 1;\n required bool key_frame = 2;\n required uint32 sequence_id = 3;\n required uint32 slice_id = 4;\n required bytes user_data = 5;\n}\n\nmessage RCAudioChannelInfoRecordPdu {\n required uint32 status = 1;\n required uint32 device_id = 2;\n required uint32 framerate = 3;\n required uint32 bitrate = 4;\n required uint32 codec = 5;\n}\n\nmessage RCVideoChannelInfoRecordPdu {\n optional uint32 status = 1;\n optional uint32 device_id = 2;\n optional uint32 width = 3;\n optional uint32 height = 4;\n optional uint32 framerate = 5;\n optional uint32 bitrate = 6;\n optional uint32 codec = 7;\n optional string peer_id = 8;\n optional string url = 9;\n optional uint32 type = 10;\n optional string shamlive = 11;\n optional uint32 livetype = 12;\n optional uint32 releaseGrab = 13;\n optional string curTime = 14;\n}\n\nmessage RCAudioDeviceInfoRecordPdu {\n required uint32 device_id = 1;\n required string device_name = 2;\n}\n\nmessage RCVideoDeviceInfoRecordPdu {\n required uint32 device_id = 1;\n required string device_name = 2;\n}\n\nmessage RCNodeInfoRecordPdu {\n required uint32 node_id = 1;\n required string name = 2;\n required uint32 role = 3;\n required uint32 level = 4;\n repeated RCAudioDeviceInfoRecordPdu audio_records = 5;\n repeated RCVideoDeviceInfoRecordPdu video_records = 6;\n optional uint32 status = 7;\n optional bytes user_data = 8;\n optional string user_id = 9;\n optional uint32 handUpTime = 10;\n optional uint32 deviceType = 11;\n optional uint32 mobileDirection = 12;\n}\n\nmessage RCVotingPollSettingsPdu {\n required bool timer = 1;\n optional uint32 time_limit = 2;\n optional uint32 total_score = 3;\n}\n\nmessage RCVotingPollResultPdu {\n required string title = 1;\n required string content = 2;\n optional uint32 score = 3;\n}\n\nmessage RCVotingPollQuestionPdu {\n required uint32 index = 1;\n required uint32 type = 2;\n required string title = 3;\n repeated string options = 4;\n optional uint32 score = 5;\n optional uint32 time_limit = 6;\n optional string restrict_input = 7;\n optional uint32 char_limit = 8;\n optional string answer = 9;\n repeated uint32 selections = 10;\n repeated string responses = 11;\n}\n\nmessage RCVotingPollRecordPdu {\n required RCVotingPollSettingsPdu settings = 1;\n required string title = 2;\n repeated RCVotingPollResultPdu results = 3;\n repeated RCVotingPollQuestionPdu questions = 4;\n}\n\nmessage RCNodeInfoUserDataPdu {\n optional string qq = 1;\n optional string skype = 2;\n optional string mobile = 3;\n}\n\nmessage RCWhiteboardDataRequestPdu {\n required uint32 id = 1;\n required uint32 type = 2;\n required uint32 initiator = 3;\n optional bytes action = 4;\n optional uint32 uncomprLen = 5;\n}\n\nmessage RCTabUpdateDataRequestPdu {\n optional uint32 id = 1;\n optional bytes action = 2;\n optional uint32 uncomprLen =3;\n}\n\n\n\n//end\n';
-t.default=n;(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&__REACT_HOT_LOADER__.register(n,"default","D:/work/McuClient/src/pdu/pro.js")})()},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(h===clearTimeout)return clearTimeout(e);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function o(){E&&c&&(E=!1,c.length?_=c.concat(_):p=-1,_.length&&a())}function a(){if(!E){var e=i(o);E=!0;for(var t=_.length;t;){for(c=_,_=[];++p<t;)c&&c[p].run();p=-1,t=_.length}c=null,E=!1,s(e)}}function u(e,t){this.fun=e,this.array=t}function f(){}var l,h,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(e){h=r}}();var c,_=[],E=!1,p=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];_.push(new u(e,t)),1!==_.length||E||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=f,d.addListener=f,d.once=f,d.off=f,d.removeListener=f,d.removeAllListeners=f,d.emit=f,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function r(e){return 3*e.length/4-n(e)}function i(e){var t,r,i,s,o,a,u=e.length;o=n(e),a=new l(3*u/4-o),i=o>0?u-4:u;var h=0;for(t=0,r=0;t<i;t+=4,r+=3)s=f[e.charCodeAt(t)]<<18|f[e.charCodeAt(t+1)]<<12|f[e.charCodeAt(t+2)]<<6|f[e.charCodeAt(t+3)],a[h++]=s>>16&255,a[h++]=s>>8&255,a[h++]=255&s;return 2===o?(s=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[h++]=255&s):1===o&&(s=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[h++]=s>>8&255,a[h++]=255&s),a}function s(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function o(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(s(r));return i.join("")}function a(e){for(var t,n=e.length,r=n%3,i="",s=[],a=16383,f=0,l=n-r;f<l;f+=a)s.push(o(e,f,f+a>l?l:f+a));return 1===r?(t=e[n-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),s.push(i),s.join("")}t.byteLength=r,t.toByteArray=i,t.fromByteArray=a;for(var u=[],f=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,c=h.length;d<c;++d)u[d]=h[d],f[h.charCodeAt(d)]=d;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(e,t){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],s=0;s<4;s++)8*r+6*s<=8*e.length?n.push(t.charAt(i>>>6*(3-s)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}};e.exports=n}()},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){!function(){var t=n(33),r=n(17).utf8,i=n(34),s=n(17).bin,o=function(e,n){e.constructor==String?e=n&&"binary"===n.encoding?s.stringToBytes(e):r.stringToBytes(e):i(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||(e=e.toString());for(var a=t.bytesToWords(e),u=8*e.length,f=1732584193,l=-271733879,h=-1732584194,d=271733878,c=0;c<a.length;c++)a[c]=16711935&(a[c]<<8|a[c]>>>24)|4278255360&(a[c]<<24|a[c]>>>8);a[u>>>5]|=128<<u%32,a[(u+64>>>9<<4)+14]=u;for(var _=o._ff,E=o._gg,p=o._hh,g=o._ii,c=0;c<a.length;c+=16){var R=f,y=l,C=h,T=d;f=_(f,l,h,d,a[c+0],7,-680876936),d=_(d,f,l,h,a[c+1],12,-389564586),h=_(h,d,f,l,a[c+2],17,606105819),l=_(l,h,d,f,a[c+3],22,-1044525330),f=_(f,l,h,d,a[c+4],7,-176418897),d=_(d,f,l,h,a[c+5],12,1200080426),h=_(h,d,f,l,a[c+6],17,-1473231341),l=_(l,h,d,f,a[c+7],22,-45705983),f=_(f,l,h,d,a[c+8],7,1770035416),d=_(d,f,l,h,a[c+9],12,-1958414417),h=_(h,d,f,l,a[c+10],17,-42063),l=_(l,h,d,f,a[c+11],22,-1990404162),f=_(f,l,h,d,a[c+12],7,1804603682),d=_(d,f,l,h,a[c+13],12,-40341101),h=_(h,d,f,l,a[c+14],17,-1502002290),l=_(l,h,d,f,a[c+15],22,1236535329),f=E(f,l,h,d,a[c+1],5,-165796510),d=E(d,f,l,h,a[c+6],9,-1069501632),h=E(h,d,f,l,a[c+11],14,643717713),l=E(l,h,d,f,a[c+0],20,-373897302),f=E(f,l,h,d,a[c+5],5,-701558691),d=E(d,f,l,h,a[c+10],9,38016083),h=E(h,d,f,l,a[c+15],14,-660478335),l=E(l,h,d,f,a[c+4],20,-405537848),f=E(f,l,h,d,a[c+9],5,568446438),d=E(d,f,l,h,a[c+14],9,-1019803690),h=E(h,d,f,l,a[c+3],14,-187363961),l=E(l,h,d,f,a[c+8],20,1163531501),f=E(f,l,h,d,a[c+13],5,-1444681467),d=E(d,f,l,h,a[c+2],9,-51403784),h=E(h,d,f,l,a[c+7],14,1735328473),l=E(l,h,d,f,a[c+12],20,-1926607734),f=p(f,l,h,d,a[c+5],4,-378558),d=p(d,f,l,h,a[c+8],11,-2022574463),h=p(h,d,f,l,a[c+11],16,1839030562),l=p(l,h,d,f,a[c+14],23,-35309556),f=p(f,l,h,d,a[c+1],4,-1530992060),d=p(d,f,l,h,a[c+4],11,1272893353),h=p(h,d,f,l,a[c+7],16,-155497632),l=p(l,h,d,f,a[c+10],23,-1094730640),f=p(f,l,h,d,a[c+13],4,681279174),d=p(d,f,l,h,a[c+0],11,-358537222),h=p(h,d,f,l,a[c+3],16,-722521979),l=p(l,h,d,f,a[c+6],23,76029189),f=p(f,l,h,d,a[c+9],4,-640364487),d=p(d,f,l,h,a[c+12],11,-421815835),h=p(h,d,f,l,a[c+15],16,530742520),l=p(l,h,d,f,a[c+2],23,-995338651),f=g(f,l,h,d,a[c+0],6,-198630844),d=g(d,f,l,h,a[c+7],10,1126891415),h=g(h,d,f,l,a[c+14],15,-1416354905),l=g(l,h,d,f,a[c+5],21,-57434055),f=g(f,l,h,d,a[c+12],6,1700485571),d=g(d,f,l,h,a[c+3],10,-1894986606),h=g(h,d,f,l,a[c+10],15,-1051523),l=g(l,h,d,f,a[c+1],21,-2054922799),f=g(f,l,h,d,a[c+8],6,1873313359),d=g(d,f,l,h,a[c+15],10,-30611744),h=g(h,d,f,l,a[c+6],15,-1560198380),l=g(l,h,d,f,a[c+13],21,1309151649),f=g(f,l,h,d,a[c+4],6,-145523070),d=g(d,f,l,h,a[c+11],10,-1120210379),h=g(h,d,f,l,a[c+2],15,718787259),l=g(l,h,d,f,a[c+9],21,-343485551),f=f+R>>>0,l=l+y>>>0,h=h+C>>>0,d=d+T>>>0}return t.endian([f,l,h,d])};o._ff=function(e,t,n,r,i,s,o){var a=e+(t&n|~t&r)+(i>>>0)+o;return(a<<s|a>>>32-s)+t},o._gg=function(e,t,n,r,i,s,o){var a=e+(t&r|n&~r)+(i>>>0)+o;return(a<<s|a>>>32-s)+t},o._hh=function(e,t,n,r,i,s,o){var a=e+(t^n^r)+(i>>>0)+o;return(a<<s|a>>>32-s)+t},o._ii=function(e,t,n,r,i,s,o){var a=e+(n^(t|~r))+(i>>>0)+o;return(a<<s|a>>>32-s)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,n){if(void 0===e||null===e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(o(e,n));return n&&n.asBytes?r:n&&n.asString?s.bytesToString(r):t.bytesToHex(r)}}()},function(e,t,n){var r,i,s;(function(e,o){!function(e,a){n(9).amd?(i=[n(16)],r=a,s="function"==typeof r?r.apply(t,i):r,!(void 0!==s&&(o.exports=s))):"object"==typeof o&&o&&o.exports?o.exports=a(n(16),!0):(e.dcodeIO=e.dcodeIO||{}).ProtoBuf=a(e.dcodeIO.ByteBuffer)}(this,function(t,r){"use strict";var i={};return i.ByteBuffer=t,i.Long=t.Long||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var t={};return t.IS_NODE=!("object"!=typeof e||e+""!="[object process]"||e.browser),t.XHR=function(){for(var e=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],t=null,n=0;n<e.length;n++){try{t=e[n]()}catch(e){continue}break}if(!t)throw Error("XMLHttpRequest is not supported");return t},t.fetch=function(e,r){if(r&&"function"!=typeof r&&(r=null),t.IS_NODE){var i=n(39);if(r)i.readFile(e,function(e,t){r(e?null:""+t)});else try{return i.readFileSync(e)}catch(e){return null}}else{var s=t.XHR();if(s.open("GET",e,!!r),s.setRequestHeader("Accept","text/plain"),"function"==typeof s.overrideMimeType&&s.overrideMimeType("text/plain"),!r)return s.send(null),200==s.status||0==s.status&&"string"==typeof s.responseText?s.responseText:null;if(s.onreadystatechange=function(){4==s.readyState&&r(200==s.status||0==s.status&&"string"==typeof s.responseText?s.responseText:null)},4==s.readyState)return;s.send(null)}},t.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,function(e,t){return t.toUpperCase()})},t}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=i*r|0,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return n*(1/0);if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){"undefined"==typeof e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var s={},o=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},a=o.prototype;a._readString=function(){var e='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;e.lastIndex=this.index-1;var n=e.exec(this.source);if(!n)throw Error("unterminated string");return this.index=e.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,n[1]},a.next=function(){if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var e,n,r;do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var i=this.index;t.DELIM.lastIndex=0;var s=t.DELIM.test(this.source.charAt(i++));if(!s)for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;var o=this.source.substring(this.index,this.index=i);return'"'!==o&&"'"!==o||(this._stringOpen=o),o},a.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},a.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},a.omit=function(e){return this.peek()===e&&(this.next(),!0)},a.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},s.Tokenizer=o;var u=function(e){this.tn=new o(e),this.proto3=!1},f=u.prototype;return f.parse=function(){var e,n,r={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==r.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),r.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");e=this.tn.peek(),("public"===e||(n="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n||r.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(r.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(r,null),i=!1;break;case"enum":this._parseEnum(r),i=!1;break;case"option":this._parseOption(r);break;case"service":this._parseService(r);break;case"extend":this._parseExtend(r);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete r.name,r},u.parse=function(e){return new u(e).parse()},f._readString=function(){var e,t,n="";do{if(t=this.tn.next(),"'"!==t&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},f._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},f._parseOption=function(e,n){var r=this.tn.next(),i=!1;if("("===r&&(i=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);var s=r;i&&(this.tn.skip(")"),s="("+s+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(s+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,s),n||this.tn.skip(";")},f._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},f._parseService=function(e){var n=this.tn.next();if(!t.NAME.test(n))throw Error("illegal service name at line "+this.tn.line+": "+n);var r=n,i={name:r,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(n=this.tn.next());)if("option"===n)this._parseOption(i);else{if("rpc"!==n)throw Error("illegal service token: "+n);this._parseServiceRPC(i)}this.tn.omit(";"),e.services.push(i)},f._parseServiceRPC=function(e){var n="rpc",r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal rpc service method name: "+r);var i=r,s={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),r=this.tn.next(),"stream"===r.toLowerCase()&&(s.request_stream=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal rpc service request type: "+r);if(s.request=r,this.tn.skip(")"),r=this.tn.next(),"returns"!==r.toLowerCase())throw Error("illegal rpc service request type delimiter: "+r);if(this.tn.skip("("),r=this.tn.next(),"stream"===r.toLowerCase()&&(s.response_stream=!0,r=this.tn.next()),s.response=r,this.tn.skip(")"),r=this.tn.peek(),"{"===r){for(this.tn.next();"}"!==(r=this.tn.next());){if("option"!==r)throw Error("illegal rpc service token: "+r);this._parseOption(s)}this.tn.omit(";")}else this.tn.skip(";");"undefined"==typeof e[n]&&(e[n]={}),e[n][i]=s},f._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(o.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),o.isGroup=!0),s=this.tn.peek(),"["===s&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(o,s);else if("oneof"===s)this._parseMessageOneOf(o);else if("enum"===s)this._parseEnum(o);else if("message"===s)this._parseMessage(o);else if("option"===s)this._parseOption(o);else if("service"===s)this._parseService(o);else if("extensions"===s)o.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(o);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(o,"optional",s)}return this.tn.omit(";"),e.messages.push(o),o},f._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},f._parseMessageField=function(e,r,i){if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);var s,o={rule:r,type:"",name:"",options:{},id:0};if("map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),s=this.tn.peek(),"["===s&&this._parseFieldOptions(o),this.tn.skip(";")}else if(i="undefined"!=typeof i?i:this.tn.next(),"group"===i){var a=this._parseMessage(e,o);if(!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),s=this.tn.peek(),"["===s&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},f._parseMessageOneOf=function(e){var n=this.tn.next();if(!t.NAME.test(n))throw Error("illegal oneof name: "+n);var r,i=n,s=[];for(this.tn.skip("{");"}"!==(n=this.tn.next());)r=this._parseMessageField(e,"optional",n),r.oneof=i,s.push(r.id);this.tn.omit(";"),e.oneofs[i]=s},f._parseFieldOptions=function(e){this.tn.skip("[");for(var t,n=!0;"]"!==(t=this.tn.peek());)n||this.tn.skip(","),this._parseOption(e,!0),n=!1;this.tn.next()},f._parseEnum=function(e){var r={name:"",values:[],options:{}},i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal name: "+i);for(r.name=i,this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(r);else{if(!t.NAME.test(i))throw Error("illegal name: "+i);this.tn.skip("=");var s={name:i,id:n(this.tn.next(),!0)};i=this.tn.peek(),"["===i&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(s)}this.tn.omit(";"),e.enums.push(r)},f._parseExtensionRanges=function(){var t,n,i,s=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}s.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),s},f._parseExtend=function(e){var n=this.tn.next();if(!t.TYPEREF.test(n))throw Error("illegal extend reference: "+n);var r={ref:n,fields:[]};for(this.tn.skip("{");"}"!==(n=this.tn.next());)if(t.RULE.test(n))this._parseMessageField(r,n);else{if(!t.TYPEREF.test(n))throw Error("illegal extend token: "+n);if(!this.proto3)throw Error("illegal field rule: "+n);this._parseMessageField(r,"optional",n)}return this.tn.omit(";"),e.messages.push(r),r},f.toString=function(){return"Parser at line "+this.tn.line},s.Parser=u,s}(i,i.Lang),i.Reflect=function(e){function n(n){if("string"==typeof n&&(n=e.TYPES[n]),"undefined"==typeof n.defaultValue)throw Error("default value for type "+n.name+" is not supported");return n==e.TYPES.bytes?new t(0):n.defaultValue}function r(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low===t.low&&t.high===t.high)return new e.Long(t.low,t.high,"undefined"==typeof n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function i(t,n){var r=n.readVarint32(),s=7&r,o=r>>>3;switch(s){case e.WIRE_TYPES.VARINT:do r=n.readUint8();while(128===(128&r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:i(o,n);break;case e.WIRE_TYPES.ENDGROUP:if(o===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+s)}return!0}var s={},o=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},a=o.prototype;a.fqn=function(){for(var e=this.name,t=this;;){if(t=t.parent,null==t)break;e=t.name+"."+e}return e},a.toString=function(e){return(e?this.className+" ":"")+this.fqn()},a.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},s.T=o;var u=function(e,t,n,r,i){o.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},f=u.prototype=Object.create(o.prototype);f.getChildren=function(e){if(e=e||null,null==e)return this.children.slice();for(var t=[],n=0,r=this.children.length;n<r;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},f.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof d.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof d.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},f.getChild=function(e){for(var t="number"==typeof e?"id":"name",n=0,r=this.children.length;n<r;++n)if(this.children[n][t]===e)return this.children[n];return null},f.resolve=function(e,t){var n="string"==typeof e?e.split("."):e,r=this,i=0;if(""===n[i]){for(;null!==r.parent;)r=r.parent;i++}var o;do{do{if(!(r instanceof s.Namespace)){r=null;break}if(o=r.getChild(n[i]),!o||!(o instanceof s.T)||t&&!(o instanceof s.Namespace)){r=null;break}r=o,i++}while(i<n.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},f.qn=function(e){var t=[],n=e;do t.unshift(n.name),n=n.parent;while(null!==n);for(var r=1;r<=t.length;r++){var i=t.slice(t.length-r);if(e===this.resolve(i,e instanceof s.Namespace))return i.join(".")}return e.fqn()},f.build=function(){for(var e,t={},n=this.children,r=0,i=n.length;r<i;++r)e=n[r],e instanceof u&&(t[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(t,"$options",{value:this.buildOpt()}),t},f.buildOpt=function(){for(var e={},t=Object.keys(this.options),n=0,r=t.length;n<r;++n){var i=t[n],s=this.options[t[n]];e[i]=s}return e},f.getOption=function(e){return"undefined"==typeof e?this.options:"undefined"!=typeof this.options[e]?this.options[e]:null},s.Namespace=u;var l=function(t,n,r,i){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},h=l.prototype;l.defaultFieldValue=n,h.verifyValue=function(n){function i(e,t){throw Error("Illegal value for "+s.toString(!0)+" of type "+s.type.name+": "+e+" ("+t+")")}var s=this;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof n||n===n&&n%1!==0)&&i(typeof n,"not an integer"),n>4294967295?0|n:n;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof n||n===n&&n%1!==0)&&i(typeof n,"not an integer"),n<0?n>>>0:n;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return r(n,!1)}catch(e){i(typeof n,e.message)}else i(typeof n,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return r(n,!0)}catch(e){i(typeof n,e.message)}else i(typeof n,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof n&&i(typeof n,"not a boolean"),n;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof n&&i(typeof n,"not a number"),n;case e.TYPES.string:return"string"==typeof n||n&&n instanceof String||i(typeof n,"not a string"),""+n;case e.TYPES.bytes:return t.isByteBuffer(n)?n:t.wrap(n,"base64");case e.TYPES.enum:var o=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(u=0;u<o.length;u++){if(o[u].name==n)return o[u].id;if(o[u].id==n)return o[u].id}if("proto3"===this.syntax)return("number"!=typeof n||n===n&&n%1!==0)&&i(typeof n,"not an integer"),(n>4294967295||n<0)&&i(typeof n,"not in range for uint32"),n;i(n,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(n&&"object"==typeof n||i(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof e.Builder.Message){var a={};for(var u in n)n.hasOwnProperty(u)&&(a[u]=n[u]);n=a}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},h.calculateLength=function(n,r){if(null===r)return 0;var i;switch(this.type){case e.TYPES.int32:return r<0?t.calculateVarint64(r):t.calculateVarint32(r);case e.TYPES.uint32:return t.calculateVarint32(r);case e.TYPES.sint32:return t.calculateVarint32(t.zigZagEncode32(r));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return t.calculateVarint64(r);case e.TYPES.sint64:return t.calculateVarint64(t.zigZagEncode64(r));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return t.calculateVarint32(r);case e.TYPES.double:return 8;case e.TYPES.string:return i=t.calculateUTF8Bytes(r),t.calculateVarint32(i)+i;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return t.calculateVarint32(r.remaining())+r.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(r),t.calculateVarint32(i)+i;case e.TYPES.group:return i=this.resolvedType.calculate(r),i+t.calculateVarint32(n<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},h.encodeValue=function(n,r,i){if(null===r)return i;switch(this.type){case e.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case e.TYPES.uint32:i.writeVarint32(r);break;case e.TYPES.sint32:i.writeVarint32ZigZag(r);break;case e.TYPES.fixed32:i.writeUint32(r);break;case e.TYPES.sfixed32:i.writeInt32(r);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(r);break;case e.TYPES.sint64:i.writeVarint64ZigZag(r);break;case e.TYPES.fixed64:i.writeUint64(r);break;case e.TYPES.sfixed64:i.writeInt64(r);break;case e.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case e.TYPES.enum:i.writeVarint32(r);break;case e.TYPES.float:i.writeFloat32(r);break;case e.TYPES.double:i.writeFloat64(r);break;case e.TYPES.string:i.writeVString(r);break;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");var s=r.offset;i.writeVarint32(r.remaining()),i.append(r),r.offset=s;break;case e.TYPES.message:var o=(new t).LE();this.resolvedType.encode(r,o),i.writeVarint32(o.offset),i.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(n<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},h.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,s;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(s=t.readVarint32(),t.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+t.remaining());return i=t.clone(),i.limit=i.offset+s,t.offset+=s,i;case e.TYPES.message:return s=t.readVarint32(),this.resolvedType.decode(t,s);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},h.valueFromString=function(n){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");
-switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(n));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(n);case e.TYPES.bool:return"true"===n;case e.TYPES.string:return this.verifyValue(n);case e.TYPES.bytes:return t.fromBinary(n)}},h.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},s.Element=l;var d=function(e,t,n,r,i,s){u.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},c=d.prototype=Object.create(u.prototype);c.build=function(n){if(this.clazz&&!n)return this.clazz;var r=function(e,n){function r(n,i,s,o){if(null===n||"object"!=typeof n){if(o&&o instanceof e.Reflect.Enum){var a=e.Reflect.Enum.getName(o.object,n);if(null!==a)return a}return n}if(t.isByteBuffer(n))return i?n.toBase64():n.toBuffer();if(e.Long.isLong(n))return s?n.toString():e.Long.fromValue(n);var u;if(Array.isArray(n))return u=[],n.forEach(function(e,t){u[t]=r(e,i,s,o)}),u;if(u={},n instanceof e.Map){for(var f=n.entries(),l=f.next();!l.done;l=f.next())u[n.keyElem.valueToString(l.value[0])]=r(l.value[1],i,s,n.valueElem.resolvedType);return u}var h=n.$type,d=void 0;for(var c in n)n.hasOwnProperty(c)&&(h&&(d=h.getChild(c))?u[c]=r(n[c],i,s,d.resolvedType):u[c]=r(n[c],i,s));return u}var i=n.getChildren(e.Reflect.Message.Field),s=n.getChildren(e.Reflect.Message.OneOf),o=function(r,a){e.Builder.Message.call(this);for(var u=0,f=s.length;u<f;++u)this[s[u].name]=null;for(u=0,f=i.length;u<f;++u){var l=i[u];this[l.name]=l.repeated?[]:l.map?new e.Map(l):null,!l.required&&"proto3"!==n.syntax||null===l.defaultValue||(this[l.name]=l.defaultValue)}if(arguments.length>0){var h;if(1!==arguments.length||null===r||"object"!=typeof r||!("function"!=typeof r.encode||r instanceof o)||Array.isArray(r)||r instanceof e.Map||t.isByteBuffer(r)||r instanceof ArrayBuffer||e.Long&&r instanceof e.Long)for(u=0,f=arguments.length;u<f;++u)"undefined"!=typeof(h=arguments[u])&&this.$set(i[u].name,h);else this.$set(r)}},a=o.prototype=Object.create(e.Builder.Message.prototype);a.add=function(t,r,i){var s=n._fieldsByName[t];if(!i){if(!s)throw Error(this+"#"+t+" is undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+t+" is not a repeated field");r=s.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},a.$add=a.add,a.set=function(t,r,i){if(t&&"object"==typeof t){i=r;for(var s in t)t.hasOwnProperty(s)&&"undefined"!=typeof(r=t[s])&&this.$set(s,r,i);return this}var o=n._fieldsByName[t];if(i)this[t]=r;else{if(!o)throw Error(this+"#"+t+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));this[o.name]=r=o.verifyValue(r)}if(o&&o.oneof){var a=this[o.oneof.name];null!==r?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===t&&(this[o.oneof.name]=null)}return this},a.$set=a.set,a.get=function(t,r){if(r)return this[t];var i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));return this[i.name]},a.$get=a.get;for(var u=0;u<i.length;u++){var f=i[u];f instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t=e.originalName.replace(/(_[a-zA-Z])/g,function(e){return e.toUpperCase().replace("_","")});t=t.substring(0,1).toUpperCase()+t.substring(1);var r=e.originalName.replace(/([A-Z])/g,function(e){return"_"+e}),i=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},s=function(){return this[e.name]};null===n.getChild("set"+t)&&(a["set"+t]=i),null===n.getChild("set_"+r)&&(a["set_"+r]=i),null===n.getChild("get"+t)&&(a["get"+t]=s),null===n.getChild("get_"+r)&&(a["get_"+r]=s)}(f)}a.encode=function(e,r){"boolean"==typeof e&&(r=e,e=void 0);var i=!1;e||(e=new t,i=!0);var s=e.littleEndian;try{return n.encode(this,e.LE(),r),(i?e.flip():e).LE(s)}catch(t){throw e.LE(s),t}},o.encode=function(e,t,n){return new o(e).encode(t,n)},a.calculate=function(){return n.calculate(this)},a.encodeDelimited=function(e,r){var i=!1;e||(e=new t,i=!0);var s=(new t).LE();return n.encode(this,s,r).flip(),e.writeVarint32(s.remaining()),e.append(s),i?e.flip():e},a.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},a.toArrayBuffer=a.encodeAB,a.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},a.toBuffer=a.encodeNB,a.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},a.toBase64=a.encode64,a.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},a.toHex=a.encodeHex,a.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},a.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},o.decode=function(e,r,i){"string"==typeof r&&(i=r,r=-1),"string"==typeof e&&(e=t.wrap(e,i?i:"base64")),e=t.isByteBuffer(e)?e:t.wrap(e);var s=e.littleEndian;try{var o=n.decode(e.LE());return e.LE(s),o}catch(t){throw e.LE(s),t}},o.decodeDelimited=function(e,r){if("string"==typeof e&&(e=t.wrap(e,r?r:"base64")),e=t.isByteBuffer(e)?e:t.wrap(e),e.remaining()<1)return null;var i=e.offset,s=e.readVarint32();if(e.remaining()<s)return e.offset=i,null;try{var o=n.decode(e.slice(e.offset,e.offset+s).LE());return e.offset+=s,o}catch(t){throw e.offset+=s,t}},o.decode64=function(e){return o.decode(e,"base64")},o.decodeHex=function(e){return o.decode(e,"hex")},o.decodeJSON=function(e){return new o(JSON.parse(e))},a.toString=function(){return n.toString()};return Object.defineProperty&&(Object.defineProperty(o,"$options",{value:n.buildOpt()}),Object.defineProperty(a,"$options",{value:o.$options}),Object.defineProperty(o,"$type",{value:n}),Object.defineProperty(a,"$type",{value:n})),o}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={};for(var i,s=0,o=this.children.length;s<o;s++)if(i=this.children[s],i instanceof R||i instanceof d||i instanceof S){if(r.hasOwnProperty(i.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+i.toString(!0)+" cannot override static property '"+i.name+"'");r[i.name]=i.build()}else if(i instanceof d.Field)i.build(),this._fields.push(i),this._fieldsById[i.id]=i,this._fieldsByName[i.name]=i;else if(!(i instanceof d.OneOf||i instanceof T))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},c.encode=function(e,t,n){for(var r,i,s=null,o=0,a=this._fields.length;o<a;++o)r=this._fields[o],i=e[r.name],r.required&&null===i?null===s&&(s=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==s){var u=Error("Missing at least one required field for "+this.toString(!0)+": "+s);throw u.encoded=t,u}return t},c.calculate=function(e){for(var t,n,r=0,i=0,s=this._fields.length;i<s;++i){if(t=this._fields[i],n=e[t.name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},c.decode=function(t,n,r){n="number"==typeof n?n:-1;for(var s,o,a,u,f=t.offset,l=new this.clazz;t.offset<f+n||n===-1&&t.remaining()>0;){if(s=t.readVarint32(),o=7&s,a=s>>>3,o===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a]){if(u.repeated&&!u.options.packed)l[u.name].push(u.decode(o,t));else if(u.map){var h=u.decode(o,t);l[u.name].set(h[0],h[1])}else if(l[u.name]=u.decode(o,t),u.oneof){var d=l[u.oneof.name];null!==d&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name}}else switch(o){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:var c=t.readVarint32();t.offset+=c;break;case e.WIRE_TYPES.STARTGROUP:for(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(var _=0,E=this._fields.length;_<E;++_)if(u=this._fields[_],null===l[u.name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required){var p=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name);throw p.decoded=l,p}e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},s.Message=d;var _=function(t,n,r,i,s,a,u,f,l,h){o.call(this,t,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=s,this.resolvedType=null,this.id=u,this.options=f||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof d.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},E=_.prototype=Object.create(o.prototype);E.build=function(){this.element=new l(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new l(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?"undefined"!=typeof this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=l.defaultFieldValue(this.type)},E.verifyValue=function(t,n){function r(e,t){throw Error("Illegal value for "+i.toString(!0)+" of type "+i.type.name+": "+e+" ("+t+")")}n=n||!1;var i=this;if(null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;var s;if(this.repeated&&!n){Array.isArray(t)||(t=[t]);var o=[];for(s=0;s<t.length;s++)o.push(this.element.verifyValue(t[s]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},E.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},E.encode=function(n,r,i){if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===n||this.repeated&&0==n.length)return r;try{if(this.repeated){var s;if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var o=r.offset;for(s=0;s<n.length;s++)this.element.encodeValue(this.id,n[s],r);var a=r.offset-o,u=t.calculateVarint32(a);if(u>1){var f=r.slice(o,r.offset);o+=u-1,r.offset=o,r.append(f)}r.writeVarint32(a,o-u)}else for(s=0;s<n.length;s++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,n[s],r)}else this.map?n.forEach(function(n,i,s){var o=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,n);r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,n,r)},this):this.hasWirePresence(n,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,n,r))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+n+" ("+e+")")}return r},E.calculate=function(n,r){if(n=this.verifyValue(n),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===n||this.repeated&&0==n.length)return 0;var i=0;try{if(this.repeated){var s,o;if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=t.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,s=0;s<n.length;s++)o+=this.element.calculateLength(this.id,n[s]);i+=t.calculateVarint32(o),i+=o}else for(s=0;s<n.length;s++)i+=t.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,n[s])}else this.map?n.forEach(function(n,r,s){var o=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,n);i+=t.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=t.calculateVarint32(o),i+=o},this):this.hasWirePresence(n,r)&&(i+=t.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+n+" ("+e+")")}return i},E.decode=function(t,n,r){var i,s,o=!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM;if(!o)throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){s=n.readVarint32(),s=n.offset+s;for(var a=[];n.offset<s;)a.push(this.decode(this.type.wireType,n,!0));return a}if(this.map){var u=l.defaultFieldValue(this.keyType);if(i=l.defaultFieldValue(this.type),s=n.readVarint32(),n.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());var f=n.clone();for(f.limit=f.offset+s,n.offset+=s;f.remaining()>0;){var h=f.readVarint32();t=7&h;var d=h>>>3;if(1===d)u=this.keyElement.decode(f,t,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(f,t,d)}}return[u,i]}return this.element.decode(n,t,this.id)},s.Message.Field=_;var p=function(e,t,n,r,i,s,o){_.call(this,e,t,n,null,r,i,s,o),this.extension};p.prototype=Object.create(_.prototype),s.Message.ExtensionField=p;var g=function(e,t,n){o.call(this,e,t,n),this.fields=[]};s.Message.OneOf=g;var R=function(e,t,n,r,i){u.call(this,e,t,n,r,i),this.className="Enum",this.object=null};R.getName=function(e,t){for(var n,r=Object.keys(e),i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null};var y=R.prototype=Object.create(u.prototype);y.build=function(t){if(this.object&&!t)return this.object;for(var n=new e.Builder.Enum,r=this.getChildren(R.Value),i=0,s=r.length;i<s;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},s.Enum=R;var C=function(e,t,n,r){o.call(this,e,t,n),this.className="Enum.Value",this.id=r};C.prototype=Object.create(o.prototype),s.Enum.Value=C;var T=function(e,t,n,r){o.call(this,e,t,n),this.field=r};T.prototype=Object.create(o.prototype),s.Extension=T;var S=function(e,t,n,r){u.call(this,e,t,n,r),this.className="Service",this.clazz=null},I=S.prototype=Object.create(u.prototype);I.build=function(n){return this.clazz&&!n?this.clazz:this.clazz=function(e,n){for(var r=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},i=r.prototype=Object.create(e.Builder.Service.prototype),s=n.getChildren(e.Reflect.Service.RPCMethod),o=0;o<s.length;o++)!function(e){i[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(t.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,function(t,r){if(t)return void i(t);null===r&&(r="");try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+n.name+"#"+e.name))})}catch(e){setTimeout(i.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(i[e.name],"$options",{value:r[e.name].$options}))}(s[o]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:n.buildOpt()}),Object.defineProperty(i,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:n}),Object.defineProperty(i,"$type",{value:n})),r}(e,this)},s.Service=S;var m=function(e,t,n,r){o.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},v=m.prototype=Object.create(o.prototype);v.buildOpt=f.buildOpt,s.Service.Method=m;var b=function(e,t,n,r,i,s,o,a){m.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null};return b.prototype=Object.create(m.prototype),s.Service.RPCMethod=b,s}(i),i.Builder=function(e,t,r){function i(e){e.messages&&e.messages.forEach(function(t){t.syntax=e.syntax,i(t)}),e.enums&&e.enums.forEach(function(t){t.syntax=e.syntax})}var s=function(e){this.ns=new r.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=s.prototype;return s.isMessage=function(e){return"string"==typeof e.name&&("undefined"==typeof e.values&&"undefined"==typeof e.rpc)},s.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&"undefined"!=typeof e.id},s.isEnum=function(e){return"string"==typeof e.name&&!("undefined"==typeof e.values||!Array.isArray(e.values)||0===e.values.length)},s.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},s.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach(function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new r.Namespace(this,this.ptr,e)),this.ptr=t},this),this},o.create=function(t){if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(var n=[t];n.length>0;){if(t=n.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var i=t.shift();if(s.isMessage(i)){var o=new r.Message(this,this.ptr,i.name,i.options,i.isGroup,i.syntax),a={};i.oneofs&&Object.keys(i.oneofs).forEach(function(e){o.addChild(a[e]=new r.Message.OneOf(this,o,e))},this),i.fields&&i.fields.forEach(function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new r.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,i.syntax),t&&t.fields.push(e),o.addChild(e)},this);var u=[];if(i.enums&&i.enums.forEach(function(e){u.push(e)}),i.messages&&i.messages.forEach(function(e){u.push(e)}),i.services&&i.services.forEach(function(e){u.push(e)}),i.extensions&&("number"==typeof i.extensions[0]?o.extensions=[i.extensions]:o.extensions=i.extensions),this.ptr.addChild(o),u.length>0){n.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(s.isEnum(i))o=new r.Enum(this,this.ptr,i.name,i.options,i.syntax),i.values.forEach(function(e){o.addChild(new r.Enum.Value(this,o,e.name,e.id))},this),this.ptr.addChild(o);else if(s.isService(i))o=new r.Service(this,this.ptr,i.name,i.options),Object.keys(i.rpc).forEach(function(e){var t=i.rpc[e];o.addChild(new r.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))},this),this.ptr.addChild(o);else{if(!s.isExtend(i))throw Error("not a valid definition: "+JSON.stringify(i));if(o=this.ptr.resolve(i.ref,!0))i.fields.forEach(function(t){if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions){var n=!1;if(o.extensions.forEach(function(e){t.id>=e[0]&&t.id<=e[1]&&(n=!0)}),!n)throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)")}var i=t.name;this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i));var s=new r.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new r.Extension(this,this.ptr,t.name,s);s.extension=a,this.ptr.addChild(a),o.addChild(s)},this);else if(!/\.?google\.protobuf\./.test(i.ref))throw Error("extended message "+i.ref+" is not defined")}i=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,r){var s="/";if("string"==typeof r){if(e.Util.IS_NODE&&(r=n(21).resolve(r)),this.files[r]===!0)return this.reset();this.files[r]=!0}else if("object"==typeof r){var o=r.root;e.Util.IS_NODE&&(o=n(21).resolve(o)),(o.indexOf("\\")>=0||r.file.indexOf("\\")>=0)&&(s="\\");var a=o+s+r.file;if(this.files[a]===!0)return this.reset();this.files[a]=!0}if(t.imports&&t.imports.length>0){var u,f=!1;"object"==typeof r?(this.importRoot=r.root,f=!0,u=this.importRoot,r=r.file,(u.indexOf("\\")>=0||r.indexOf("\\")>=0)&&(s="\\")):"string"==typeof r?this.importRoot?u=this.importRoot:r.indexOf("/")>=0?(u=r.replace(/\/[^\/]*$/,""),""===u&&(u="/")):r.indexOf("\\")>=0?(u=r.replace(/\\[^\\]*$/,""),s="\\"):u=".":u=null;for(var l=0;l<t.imports.length;l++)if("string"==typeof t.imports[l]){if(!u)throw Error("cannot determine import root");var h=t.imports[l];if("google/protobuf/descriptor.proto"===h)continue;if(h=u+s+h,this.files[h]===!0)continue;/\.proto$/i.test(h)&&!e.DotProto&&(h=h.replace(/\.proto$/,".json"));var d=e.Util.fetch(h);if(null===d)throw Error("failed to import '"+h+"' in '"+r+"': file not found");/\.json$/i.test(h)?this.import(JSON.parse(d+""),h):this.import(e.DotProto.Parser.parse(d),h)}else r?/\.(\w+)$/.test(r)?this.import(t.imports[l],r.replace(/^(.+)\.(\w+)$/,function(e,t,n){return t+"_import"+l+"."+n})):this.import(t.imports[l],r+"_import"+l):this.import(t.imports[l]);f&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&i(t);var c=this.ptr;return t.options&&Object.keys(t.options).forEach(function(e){c.options[e]=t.options[e]}),t.messages&&(this.create(t.messages),this.ptr=c),t.enums&&(this.create(t.enums),this.ptr=c),t.services&&(this.create(t.services),this.ptr=c),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var n;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof r.Namespace)this.ptr.children.forEach(function(e){this.ptr=e,this.resolveAll()},this);else if(this.ptr instanceof r.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(n=(this.ptr instanceof r.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0),!n)throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=n,n instanceof r.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==n.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(n instanceof r.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=n.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(n=this.ptr.parent.resolve(this.ptr.requestName,!0),!(n&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=n,n=this.ptr.parent.resolve(this.ptr.responseName,!0),!(n&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=n}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(var t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},s.Message=function(){},s.Enum=function(){},s.Service=function(){},s}(i,i.Lang,i.Reflect),i.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(var r=Object.keys(n),i=0;i<r.length;i++){var s=this.keyElem.valueFromString(r[i]),o=this.valueElem.verifyValue(n[r[i]]);this.map[this.keyElem.valueToString(s)]={key:s,value:o}}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){for(var e,t=[],r=Object.keys(this.map),i=0;i<r.length;i++)t.push([(e=this.map[r[i]]).key,e.value]);return n(t)},i.keys=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].key);return n(e)},i.values=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].value);return n(e)},i.forEach=function(e,t){for(var n,r=Object.keys(this.map),i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},i.has=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map},r}(i,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,function(r){if(null===r)return void t(Error("Failed to fetch file"));try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}});var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return e=e||{},"undefined"==typeof e.convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),"undefined"==typeof e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,function(r){if(null===r)return void t(Error("Failed to fetch file"));try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}});var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},i})}).call(t,n(31),n(7)(e))},function(e,t){String.fromCodePoint||!function(){var e=function(){try{var e={},t=Object.defineProperty,n=t(e,e,e)&&t}catch(e){}return n}(),t=String.fromCharCode,n=Math.floor,r=function(e){var r,i,s=16384,o=[],a=-1,u=arguments.length;if(!u)return"";for(var f="";++a<u;){var l=Number(arguments[a]);if(!isFinite(l)||l<0||l>1114111||n(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?o.push(l):(l-=65536,r=(l>>10)+55296,i=l%1024+56320,o.push(r,i)),(a+1==u||o.length>s)&&(f+=t.apply(null,o),o.length=0)}return f};e?e(String,"fromCodePoint",{value:r,configurable:!0,writable:!0}):String.fromCodePoint=r}()},function(e,t){String.prototype.codePointAt||!function(){"use strict";var e=function(){try{var e={},t=Object.defineProperty,n=t(e,e,e)&&t}catch(e){}return n}(),t=function(e){if(null==this)throw TypeError();var t=String(this),n=t.length,r=e?Number(e):0;if(r!=r&&(r=0),!(r<0||r>=n)){var i,s=t.charCodeAt(r);return s>=55296&&s<=56319&&n>r+1&&(i=t.charCodeAt(r+1),i>=56320&&i<=57343)?1024*(s-55296)+i-56320+65536:s}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t}()},21]))});
\ No newline at end of file
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+ else if(typeof exports === 'object')
+ exports["MCUClientEngine"] = factory();
+ else
+ root["MCUClientEngine"] = factory();
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ var parentHotUpdateCallback = this["webpackHotUpdateMCUClientEngine"];
+/******/ this["webpackHotUpdateMCUClientEngine"] = function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
+/******/ hotAddUpdateChunk(chunkId, moreModules);
+/******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
+/******/ }
+
+/******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
+/******/ var head = document.getElementsByTagName("head")[0];
+/******/ var script = document.createElement("script");
+/******/ script.type = "text/javascript";
+/******/ script.charset = "utf-8";
+/******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js";
+/******/ head.appendChild(script);
+/******/ }
+
+/******/ function hotDownloadManifest(callback) { // eslint-disable-line no-unused-vars
+/******/ if(typeof XMLHttpRequest === "undefined")
+/******/ return callback(new Error("No browser support"));
+/******/ try {
+/******/ var request = new XMLHttpRequest();
+/******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json";
+/******/ request.open("GET", requestPath, true);
+/******/ request.timeout = 10000;
+/******/ request.send(null);
+/******/ } catch(err) {
+/******/ return callback(err);
+/******/ }
+/******/ request.onreadystatechange = function() {
+/******/ if(request.readyState !== 4) return;
+/******/ if(request.status === 0) {
+/******/ // timeout
+/******/ callback(new Error("Manifest request to " + requestPath + " timed out."));
+/******/ } else if(request.status === 404) {
+/******/ // no update available
+/******/ callback();
+/******/ } else if(request.status !== 200 && request.status !== 304) {
+/******/ // other failure
+/******/ callback(new Error("Manifest request to " + requestPath + " failed."));
+/******/ } else {
+/******/ // success
+/******/ try {
+/******/ var update = JSON.parse(request.responseText);
+/******/ } catch(e) {
+/******/ callback(e);
+/******/ return;
+/******/ }
+/******/ callback(null, update);
+/******/ }
+/******/ };
+/******/ }
+
+
+/******/ // Copied from https://github.com/facebook/react/blob/bef45b0/src/shared/utils/canDefineProperty.js
+/******/ var canDefineProperty = false;
+/******/ try {
+/******/ Object.defineProperty({}, "x", {
+/******/ get: function() {}
+/******/ });
+/******/ canDefineProperty = true;
+/******/ } catch(x) {
+/******/ // IE will fail on defineProperty
+/******/ }
+
+/******/ var hotApplyOnUpdate = true;
+/******/ var hotCurrentHash = "8e2a58a9d7380241ebf0"; // eslint-disable-line no-unused-vars
+/******/ var hotCurrentModuleData = {};
+/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars
+
+/******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars
+/******/ var me = installedModules[moduleId];
+/******/ if(!me) return __webpack_require__;
+/******/ var fn = function(request) {
+/******/ if(me.hot.active) {
+/******/ if(installedModules[request]) {
+/******/ if(installedModules[request].parents.indexOf(moduleId) < 0)
+/******/ installedModules[request].parents.push(moduleId);
+/******/ if(me.children.indexOf(request) < 0)
+/******/ me.children.push(request);
+/******/ } else hotCurrentParents = [moduleId];
+/******/ } else {
+/******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
+/******/ hotCurrentParents = [];
+/******/ }
+/******/ return __webpack_require__(request);
+/******/ };
+/******/ for(var name in __webpack_require__) {
+/******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name)) {
+/******/ if(canDefineProperty) {
+/******/ Object.defineProperty(fn, name, (function(name) {
+/******/ return {
+/******/ configurable: true,
+/******/ enumerable: true,
+/******/ get: function() {
+/******/ return __webpack_require__[name];
+/******/ },
+/******/ set: function(value) {
+/******/ __webpack_require__[name] = value;
+/******/ }
+/******/ };
+/******/ }(name)));
+/******/ } else {
+/******/ fn[name] = __webpack_require__[name];
+/******/ }
+/******/ }
+/******/ }
+
+/******/ function ensure(chunkId, callback) {
+/******/ if(hotStatus === "ready")
+/******/ hotSetStatus("prepare");
+/******/ hotChunksLoading++;
+/******/ __webpack_require__.e(chunkId, function() {
+/******/ try {
+/******/ callback.call(null, fn);
+/******/ } finally {
+/******/ finishChunkLoading();
+/******/ }
+
+/******/ function finishChunkLoading() {
+/******/ hotChunksLoading--;
+/******/ if(hotStatus === "prepare") {
+/******/ if(!hotWaitingFilesMap[chunkId]) {
+/******/ hotEnsureUpdateChunk(chunkId);
+/******/ }
+/******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
+/******/ hotUpdateDownloaded();
+/******/ }
+/******/ }
+/******/ }
+/******/ });
+/******/ }
+/******/ if(canDefineProperty) {
+/******/ Object.defineProperty(fn, "e", {
+/******/ enumerable: true,
+/******/ value: ensure
+/******/ });
+/******/ } else {
+/******/ fn.e = ensure;
+/******/ }
+/******/ return fn;
+/******/ }
+
+/******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars
+/******/ var hot = {
+/******/ // private stuff
+/******/ _acceptedDependencies: {},
+/******/ _declinedDependencies: {},
+/******/ _selfAccepted: false,
+/******/ _selfDeclined: false,
+/******/ _disposeHandlers: [],
+
+/******/ // Module API
+/******/ active: true,
+/******/ accept: function(dep, callback) {
+/******/ if(typeof dep === "undefined")
+/******/ hot._selfAccepted = true;
+/******/ else if(typeof dep === "function")
+/******/ hot._selfAccepted = dep;
+/******/ else if(typeof dep === "object")
+/******/ for(var i = 0; i < dep.length; i++)
+/******/ hot._acceptedDependencies[dep[i]] = callback;
+/******/ else
+/******/ hot._acceptedDependencies[dep] = callback;
+/******/ },
+/******/ decline: function(dep) {
+/******/ if(typeof dep === "undefined")
+/******/ hot._selfDeclined = true;
+/******/ else if(typeof dep === "number")
+/******/ hot._declinedDependencies[dep] = true;
+/******/ else
+/******/ for(var i = 0; i < dep.length; i++)
+/******/ hot._declinedDependencies[dep[i]] = true;
+/******/ },
+/******/ dispose: function(callback) {
+/******/ hot._disposeHandlers.push(callback);
+/******/ },
+/******/ addDisposeHandler: function(callback) {
+/******/ hot._disposeHandlers.push(callback);
+/******/ },
+/******/ removeDisposeHandler: function(callback) {
+/******/ var idx = hot._disposeHandlers.indexOf(callback);
+/******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1);
+/******/ },
+
+/******/ // Management API
+/******/ check: hotCheck,
+/******/ apply: hotApply,
+/******/ status: function(l) {
+/******/ if(!l) return hotStatus;
+/******/ hotStatusHandlers.push(l);
+/******/ },
+/******/ addStatusHandler: function(l) {
+/******/ hotStatusHandlers.push(l);
+/******/ },
+/******/ removeStatusHandler: function(l) {
+/******/ var idx = hotStatusHandlers.indexOf(l);
+/******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1);
+/******/ },
+
+/******/ //inherit from previous dispose call
+/******/ data: hotCurrentModuleData[moduleId]
+/******/ };
+/******/ return hot;
+/******/ }
+
+/******/ var hotStatusHandlers = [];
+/******/ var hotStatus = "idle";
+
+/******/ function hotSetStatus(newStatus) {
+/******/ hotStatus = newStatus;
+/******/ for(var i = 0; i < hotStatusHandlers.length; i++)
+/******/ hotStatusHandlers[i].call(null, newStatus);
+/******/ }
+
+/******/ // while downloading
+/******/ var hotWaitingFiles = 0;
+/******/ var hotChunksLoading = 0;
+/******/ var hotWaitingFilesMap = {};
+/******/ var hotRequestedFilesMap = {};
+/******/ var hotAvailibleFilesMap = {};
+/******/ var hotCallback;
+
+/******/ // The update info
+/******/ var hotUpdate, hotUpdateNewHash;
+
+/******/ function toModuleId(id) {
+/******/ var isNumber = (+id) + "" === id;
+/******/ return isNumber ? +id : id;
+/******/ }
+
+/******/ function hotCheck(apply, callback) {
+/******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status");
+/******/ if(typeof apply === "function") {
+/******/ hotApplyOnUpdate = false;
+/******/ callback = apply;
+/******/ } else {
+/******/ hotApplyOnUpdate = apply;
+/******/ callback = callback || function(err) {
+/******/ if(err) throw err;
+/******/ };
+/******/ }
+/******/ hotSetStatus("check");
+/******/ hotDownloadManifest(function(err, update) {
+/******/ if(err) return callback(err);
+/******/ if(!update) {
+/******/ hotSetStatus("idle");
+/******/ callback(null, null);
+/******/ return;
+/******/ }
+
+/******/ hotRequestedFilesMap = {};
+/******/ hotAvailibleFilesMap = {};
+/******/ hotWaitingFilesMap = {};
+/******/ for(var i = 0; i < update.c.length; i++)
+/******/ hotAvailibleFilesMap[update.c[i]] = true;
+/******/ hotUpdateNewHash = update.h;
+
+/******/ hotSetStatus("prepare");
+/******/ hotCallback = callback;
+/******/ hotUpdate = {};
+/******/ var chunkId = 0;
+/******/ { // eslint-disable-line no-lone-blocks
+/******/ /*globals chunkId */
+/******/ hotEnsureUpdateChunk(chunkId);
+/******/ }
+/******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) {
+/******/ hotUpdateDownloaded();
+/******/ }
+/******/ });
+/******/ }
+
+/******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars
+/******/ if(!hotAvailibleFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
+/******/ return;
+/******/ hotRequestedFilesMap[chunkId] = false;
+/******/ for(var moduleId in moreModules) {
+/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
+/******/ hotUpdate[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) {
+/******/ hotUpdateDownloaded();
+/******/ }
+/******/ }
+
+/******/ function hotEnsureUpdateChunk(chunkId) {
+/******/ if(!hotAvailibleFilesMap[chunkId]) {
+/******/ hotWaitingFilesMap[chunkId] = true;
+/******/ } else {
+/******/ hotRequestedFilesMap[chunkId] = true;
+/******/ hotWaitingFiles++;
+/******/ hotDownloadUpdateChunk(chunkId);
+/******/ }
+/******/ }
+
+/******/ function hotUpdateDownloaded() {
+/******/ hotSetStatus("ready");
+/******/ var callback = hotCallback;
+/******/ hotCallback = null;
+/******/ if(!callback) return;
+/******/ if(hotApplyOnUpdate) {
+/******/ hotApply(hotApplyOnUpdate, callback);
+/******/ } else {
+/******/ var outdatedModules = [];
+/******/ for(var id in hotUpdate) {
+/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
+/******/ outdatedModules.push(toModuleId(id));
+/******/ }
+/******/ }
+/******/ callback(null, outdatedModules);
+/******/ }
+/******/ }
+
+/******/ function hotApply(options, callback) {
+/******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status");
+/******/ if(typeof options === "function") {
+/******/ callback = options;
+/******/ options = {};
+/******/ } else if(options && typeof options === "object") {
+/******/ callback = callback || function(err) {
+/******/ if(err) throw err;
+/******/ };
+/******/ } else {
+/******/ options = {};
+/******/ callback = callback || function(err) {
+/******/ if(err) throw err;
+/******/ };
+/******/ }
+
+/******/ function getAffectedStuff(module) {
+/******/ var outdatedModules = [module];
+/******/ var outdatedDependencies = {};
+
+/******/ var queue = outdatedModules.slice();
+/******/ while(queue.length > 0) {
+/******/ var moduleId = queue.pop();
+/******/ var module = installedModules[moduleId];
+/******/ if(!module || module.hot._selfAccepted)
+/******/ continue;
+/******/ if(module.hot._selfDeclined) {
+/******/ return new Error("Aborted because of self decline: " + moduleId);
+/******/ }
+/******/ if(moduleId === 0) {
+/******/ return;
+/******/ }
+/******/ for(var i = 0; i < module.parents.length; i++) {
+/******/ var parentId = module.parents[i];
+/******/ var parent = installedModules[parentId];
+/******/ if(parent.hot._declinedDependencies[moduleId]) {
+/******/ return new Error("Aborted because of declined dependency: " + moduleId + " in " + parentId);
+/******/ }
+/******/ if(outdatedModules.indexOf(parentId) >= 0) continue;
+/******/ if(parent.hot._acceptedDependencies[moduleId]) {
+/******/ if(!outdatedDependencies[parentId])
+/******/ outdatedDependencies[parentId] = [];
+/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]);
+/******/ continue;
+/******/ }
+/******/ delete outdatedDependencies[parentId];
+/******/ outdatedModules.push(parentId);
+/******/ queue.push(parentId);
+/******/ }
+/******/ }
+
+/******/ return [outdatedModules, outdatedDependencies];
+/******/ }
+
+/******/ function addAllToSet(a, b) {
+/******/ for(var i = 0; i < b.length; i++) {
+/******/ var item = b[i];
+/******/ if(a.indexOf(item) < 0)
+/******/ a.push(item);
+/******/ }
+/******/ }
+
+/******/ // at begin all updates modules are outdated
+/******/ // the "outdated" status can propagate to parents if they don't accept the children
+/******/ var outdatedDependencies = {};
+/******/ var outdatedModules = [];
+/******/ var appliedUpdate = {};
+/******/ for(var id in hotUpdate) {
+/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
+/******/ var moduleId = toModuleId(id);
+/******/ var result = getAffectedStuff(moduleId);
+/******/ if(!result) {
+/******/ if(options.ignoreUnaccepted)
+/******/ continue;
+/******/ hotSetStatus("abort");
+/******/ return callback(new Error("Aborted because " + moduleId + " is not accepted"));
+/******/ }
+/******/ if(result instanceof Error) {
+/******/ hotSetStatus("abort");
+/******/ return callback(result);
+/******/ }
+/******/ appliedUpdate[moduleId] = hotUpdate[moduleId];
+/******/ addAllToSet(outdatedModules, result[0]);
+/******/ for(var moduleId in result[1]) {
+/******/ if(Object.prototype.hasOwnProperty.call(result[1], moduleId)) {
+/******/ if(!outdatedDependencies[moduleId])
+/******/ outdatedDependencies[moduleId] = [];
+/******/ addAllToSet(outdatedDependencies[moduleId], result[1][moduleId]);
+/******/ }
+/******/ }
+/******/ }
+/******/ }
+
+/******/ // Store self accepted outdated modules to require them later by the module system
+/******/ var outdatedSelfAcceptedModules = [];
+/******/ for(var i = 0; i < outdatedModules.length; i++) {
+/******/ var moduleId = outdatedModules[i];
+/******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted)
+/******/ outdatedSelfAcceptedModules.push({
+/******/ module: moduleId,
+/******/ errorHandler: installedModules[moduleId].hot._selfAccepted
+/******/ });
+/******/ }
+
+/******/ // Now in "dispose" phase
+/******/ hotSetStatus("dispose");
+/******/ var queue = outdatedModules.slice();
+/******/ while(queue.length > 0) {
+/******/ var moduleId = queue.pop();
+/******/ var module = installedModules[moduleId];
+/******/ if(!module) continue;
+
+/******/ var data = {};
+
+/******/ // Call dispose handlers
+/******/ var disposeHandlers = module.hot._disposeHandlers;
+/******/ for(var j = 0; j < disposeHandlers.length; j++) {
+/******/ var cb = disposeHandlers[j];
+/******/ cb(data);
+/******/ }
+/******/ hotCurrentModuleData[moduleId] = data;
+
+/******/ // disable module (this disables requires from this module)
+/******/ module.hot.active = false;
+
+/******/ // remove module from cache
+/******/ delete installedModules[moduleId];
+
+/******/ // remove "parents" references from all children
+/******/ for(var j = 0; j < module.children.length; j++) {
+/******/ var child = installedModules[module.children[j]];
+/******/ if(!child) continue;
+/******/ var idx = child.parents.indexOf(moduleId);
+/******/ if(idx >= 0) {
+/******/ child.parents.splice(idx, 1);
+/******/ }
+/******/ }
+/******/ }
+
+/******/ // remove outdated dependency from module children
+/******/ for(var moduleId in outdatedDependencies) {
+/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
+/******/ var module = installedModules[moduleId];
+/******/ var moduleOutdatedDependencies = outdatedDependencies[moduleId];
+/******/ for(var j = 0; j < moduleOutdatedDependencies.length; j++) {
+/******/ var dependency = moduleOutdatedDependencies[j];
+/******/ var idx = module.children.indexOf(dependency);
+/******/ if(idx >= 0) module.children.splice(idx, 1);
+/******/ }
+/******/ }
+/******/ }
+
+/******/ // Not in "apply" phase
+/******/ hotSetStatus("apply");
+
+/******/ hotCurrentHash = hotUpdateNewHash;
+
+/******/ // insert new code
+/******/ for(var moduleId in appliedUpdate) {
+/******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
+/******/ modules[moduleId] = appliedUpdate[moduleId];
+/******/ }
+/******/ }
+
+/******/ // call accept handlers
+/******/ var error = null;
+/******/ for(var moduleId in outdatedDependencies) {
+/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
+/******/ var module = installedModules[moduleId];
+/******/ var moduleOutdatedDependencies = outdatedDependencies[moduleId];
+/******/ var callbacks = [];
+/******/ for(var i = 0; i < moduleOutdatedDependencies.length; i++) {
+/******/ var dependency = moduleOutdatedDependencies[i];
+/******/ var cb = module.hot._acceptedDependencies[dependency];
+/******/ if(callbacks.indexOf(cb) >= 0) continue;
+/******/ callbacks.push(cb);
+/******/ }
+/******/ for(var i = 0; i < callbacks.length; i++) {
+/******/ var cb = callbacks[i];
+/******/ try {
+/******/ cb(outdatedDependencies);
+/******/ } catch(err) {
+/******/ if(!error)
+/******/ error = err;
+/******/ }
+/******/ }
+/******/ }
+/******/ }
+
+/******/ // Load self accepted modules
+/******/ for(var i = 0; i < outdatedSelfAcceptedModules.length; i++) {
+/******/ var item = outdatedSelfAcceptedModules[i];
+/******/ var moduleId = item.module;
+/******/ hotCurrentParents = [moduleId];
+/******/ try {
+/******/ __webpack_require__(moduleId);
+/******/ } catch(err) {
+/******/ if(typeof item.errorHandler === "function") {
+/******/ try {
+/******/ item.errorHandler(err);
+/******/ } catch(err) {
+/******/ if(!error)
+/******/ error = err;
+/******/ }
+/******/ } else if(!error)
+/******/ error = err;
+/******/ }
+/******/ }
+
+/******/ // handle errors in accept handlers and self accepted module load
+/******/ if(error) {
+/******/ hotSetStatus("fail");
+/******/ return callback(error);
+/******/ }
+
+/******/ hotSetStatus("idle");
+/******/ callback(null, outdatedModules);
+/******/ }
+
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false,
+/******/ hot: hotCreateModule(moduleId),
+/******/ parents: hotCurrentParents,
+/******/ children: []
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // __webpack_hash__
+/******/ __webpack_require__.h = function() { return hotCurrentHash; };
+
+/******/ // Load entry module and return exports
+/******/ return hotCreateRequire(0)(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(1);
+ module.exports = __webpack_require__(15);
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(__resourceQuery, module) {/*eslint-env browser*/
+ /*global __resourceQuery __webpack_public_path__*/
+
+ var options = {
+ path: "/__webpack_hmr",
+ timeout: 20 * 1000,
+ overlay: true,
+ reload: false,
+ log: true,
+ warn: true
+ };
+ if (true) {
+ var querystring = __webpack_require__(3);
+ var overrides = querystring.parse(__resourceQuery.slice(1));
+ if (overrides.path) options.path = overrides.path;
+ if (overrides.timeout) options.timeout = overrides.timeout;
+ if (overrides.overlay) options.overlay = overrides.overlay !== 'false';
+ if (overrides.reload) options.reload = overrides.reload !== 'false';
+ if (overrides.noInfo && overrides.noInfo !== 'false') {
+ options.log = false;
+ }
+ if (overrides.quiet && overrides.quiet !== 'false') {
+ options.log = false;
+ options.warn = false;
+ }
+ if (overrides.dynamicPublicPath) {
+ options.path = __webpack_require__.p + options.path;
+ }
+ }
+
+ if (typeof window === 'undefined') {
+ // do nothing
+ } else if (typeof window.EventSource === 'undefined') {
+ console.warn(
+ "webpack-hot-middleware's client requires EventSource to work. " +
+ "You should include a polyfill if you want to support this browser: " +
+ "https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools"
+ );
+ } else {
+ connect(window.EventSource);
+ }
+
+ function connect(EventSource) {
+ var source = new EventSource(options.path);
+ var lastActivity = new Date();
+
+ source.onopen = handleOnline;
+ source.onmessage = handleMessage;
+ source.onerror = handleDisconnect;
+
+ var timer = setInterval(function() {
+ if ((new Date() - lastActivity) > options.timeout) {
+ handleDisconnect();
+ }
+ }, options.timeout / 2);
+
+ function handleOnline() {
+ if (options.log) console.log("[HMR] connected");
+ lastActivity = new Date();
+ }
+
+ function handleMessage(event) {
+ lastActivity = new Date();
+ if (event.data == "\uD83D\uDC93") {
+ return;
+ }
+ try {
+ processMessage(JSON.parse(event.data));
+ } catch (ex) {
+ if (options.warn) {
+ console.warn("Invalid HMR message: " + event.data + "\n" + ex);
+ }
+ }
+ }
+
+ function handleDisconnect() {
+ clearInterval(timer);
+ source.close();
+ setTimeout(function() { connect(EventSource); }, options.timeout);
+ }
+
+ }
+
+ var reporter;
+ // the reporter needs to be a singleton on the page
+ // in case the client is being used by mutliple bundles
+ // we only want to report once.
+ // all the errors will go to all clients
+ var singletonKey = '__webpack_hot_middleware_reporter__';
+ if (typeof window !== 'undefined' && !window[singletonKey]) {
+ reporter = window[singletonKey] = createReporter();
+ }
+
+ function createReporter() {
+ var strip = __webpack_require__(6);
+
+ var overlay;
+ if (typeof document !== 'undefined' && options.overlay) {
+ overlay = __webpack_require__(8);
+ }
+
+ return {
+ problems: function(type, obj) {
+ if (options.warn) {
+ console.warn("[HMR] bundle has " + type + ":");
+ obj[type].forEach(function(msg) {
+ console.warn("[HMR] " + strip(msg));
+ });
+ }
+ if (overlay && type !== 'warnings') overlay.showProblems(type, obj[type]);
+ },
+ success: function() {
+ if (overlay) overlay.clear();
+ },
+ useCustomOverlay: function(customOverlay) {
+ overlay = customOverlay;
+ }
+ };
+ }
+
+ var processUpdate = __webpack_require__(14);
+
+ var customHandler;
+ var subscribeAllHandler;
+ function processMessage(obj) {
+ switch(obj.action) {
+ case "building":
+ if (options.log) console.log("[HMR] bundle rebuilding");
+ break;
+ case "built":
+ if (options.log) {
+ console.log(
+ "[HMR] bundle " + (obj.name ? obj.name + " " : "") +
+ "rebuilt in " + obj.time + "ms"
+ );
+ }
+ // fall through
+ case "sync":
+ if (obj.errors.length > 0) {
+ if (reporter) reporter.problems('errors', obj);
+ } else {
+ if (reporter) {
+ if (obj.warnings.length > 0) reporter.problems('warnings', obj);
+ reporter.success();
+ }
+ processUpdate(obj.hash, obj.modules, options);
+ }
+ break;
+ default:
+ if (customHandler) {
+ customHandler(obj);
+ }
+ }
+
+ if (subscribeAllHandler) {
+ subscribeAllHandler(obj);
+ }
+ }
+
+ if (module) {
+ module.exports = {
+ subscribeAll: function subscribeAll(handler) {
+ subscribeAllHandler = handler;
+ },
+ subscribe: function subscribe(handler) {
+ customHandler = handler;
+ },
+ useCustomOverlay: function useCustomOverlay(customOverlay) {
+ if (reporter) reporter.useCustomOverlay(customOverlay);
+ }
+ };
+ }
+
+ /* WEBPACK VAR INJECTION */}.call(exports, "?reload=true", __webpack_require__(2)(module)))
+
+/***/ },
+/* 2 */
+/***/ function(module, exports) {
+
+ module.exports = function(module) {
+ if(!module.webpackPolyfill) {
+ module.deprecate = function() {};
+ module.paths = [];
+ // module.parent = undefined by default
+ module.children = [];
+ module.webpackPolyfill = 1;
+ }
+ return module;
+ }
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.decode = exports.parse = __webpack_require__(4);
+ exports.encode = exports.stringify = __webpack_require__(5);
+
+
+/***/ },
+/* 4 */
+/***/ function(module, exports) {
+
+ // Copyright Joyent, Inc. and other Node contributors.
+ //
+ // Permission is hereby granted, free of charge, to any person obtaining a
+ // copy of this software and associated documentation files (the
+ // "Software"), to deal in the Software without restriction, including
+ // without limitation the rights to use, copy, modify, merge, publish,
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
+ // persons to whom the Software is furnished to do so, subject to the
+ // following conditions:
+ //
+ // The above copyright notice and this permission notice shall be included
+ // in all copies or substantial portions of the Software.
+ //
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ 'use strict';
+
+ // If obj.hasOwnProperty has been overridden, then calling
+ // obj.hasOwnProperty(prop) will break.
+ // See: https://github.com/joyent/node/issues/1707
+ function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ module.exports = function(qs, sep, eq, options) {
+ sep = sep || '&';
+ eq = eq || '=';
+ var obj = {};
+
+ if (typeof qs !== 'string' || qs.length === 0) {
+ return obj;
+ }
+
+ var regexp = /\+/g;
+ qs = qs.split(sep);
+
+ var maxKeys = 1000;
+ if (options && typeof options.maxKeys === 'number') {
+ maxKeys = options.maxKeys;
+ }
+
+ var len = qs.length;
+ // maxKeys <= 0 means that we should not limit keys count
+ if (maxKeys > 0 && len > maxKeys) {
+ len = maxKeys;
+ }
+
+ for (var i = 0; i < len; ++i) {
+ var x = qs[i].replace(regexp, '%20'),
+ idx = x.indexOf(eq),
+ kstr, vstr, k, v;
+
+ if (idx >= 0) {
+ kstr = x.substr(0, idx);
+ vstr = x.substr(idx + 1);
+ } else {
+ kstr = x;
+ vstr = '';
+ }
+
+ k = decodeURIComponent(kstr);
+ v = decodeURIComponent(vstr);
+
+ if (!hasOwnProperty(obj, k)) {
+ obj[k] = v;
+ } else if (Array.isArray(obj[k])) {
+ obj[k].push(v);
+ } else {
+ obj[k] = [obj[k], v];
+ }
+ }
+
+ return obj;
+ };
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports) {
+
+ // Copyright Joyent, Inc. and other Node contributors.
+ //
+ // Permission is hereby granted, free of charge, to any person obtaining a
+ // copy of this software and associated documentation files (the
+ // "Software"), to deal in the Software without restriction, including
+ // without limitation the rights to use, copy, modify, merge, publish,
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
+ // persons to whom the Software is furnished to do so, subject to the
+ // following conditions:
+ //
+ // The above copyright notice and this permission notice shall be included
+ // in all copies or substantial portions of the Software.
+ //
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ 'use strict';
+
+ var stringifyPrimitive = function(v) {
+ switch (typeof v) {
+ case 'string':
+ return v;
+
+ case 'boolean':
+ return v ? 'true' : 'false';
+
+ case 'number':
+ return isFinite(v) ? v : '';
+
+ default:
+ return '';
+ }
+ };
+
+ module.exports = function(obj, sep, eq, name) {
+ sep = sep || '&';
+ eq = eq || '=';
+ if (obj === null) {
+ obj = undefined;
+ }
+
+ if (typeof obj === 'object') {
+ return Object.keys(obj).map(function(k) {
+ var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
+ if (Array.isArray(obj[k])) {
+ return obj[k].map(function(v) {
+ return ks + encodeURIComponent(stringifyPrimitive(v));
+ }).join(sep);
+ } else {
+ return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
+ }
+ }).join(sep);
+
+ }
+
+ if (!name) return '';
+ return encodeURIComponent(stringifyPrimitive(name)) + eq +
+ encodeURIComponent(stringifyPrimitive(obj));
+ };
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ var ansiRegex = __webpack_require__(7)();
+
+ module.exports = function (str) {
+ return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
+ };
+
+
+/***/ },
+/* 7 */
+/***/ function(module, exports) {
+
+ 'use strict';
+ module.exports = function () {
+ return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
+ };
+
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /*eslint-env browser*/
+
+ var clientOverlay = document.createElement('div');
+ var styles = {
+ background: 'rgba(0,0,0,0.85)',
+ color: '#E8E8E8',
+ lineHeight: '1.2',
+ whiteSpace: 'pre',
+ fontFamily: 'Menlo, Consolas, monospace',
+ fontSize: '13px',
+ position: 'fixed',
+ zIndex: 9999,
+ padding: '10px',
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0,
+ overflow: 'auto',
+ dir: 'ltr'
+ };
+ for (var key in styles) {
+ clientOverlay.style[key] = styles[key];
+ }
+
+ var ansiHTML = __webpack_require__(9);
+ var colors = {
+ reset: ['transparent', 'transparent'],
+ black: '181818',
+ red: 'E36049',
+ green: 'B3CB74',
+ yellow: 'FFD080',
+ blue: '7CAFC2',
+ magenta: '7FACCA',
+ cyan: 'C3C2EF',
+ lightgrey: 'EBE7E3',
+ darkgrey: '6D7891'
+ };
+ ansiHTML.setColors(colors);
+
+ var Entities = __webpack_require__(10).AllHtmlEntities;
+ var entities = new Entities();
+
+ exports.showProblems =
+ function showProblems(type, lines) {
+ clientOverlay.innerHTML = '';
+ lines.forEach(function(msg) {
+ msg = ansiHTML(entities.encode(msg));
+ var div = document.createElement('div');
+ div.style.marginBottom = '26px';
+ div.innerHTML = problemType(type) + ' in ' + msg;
+ clientOverlay.appendChild(div);
+ });
+ if (document.body) {
+ document.body.appendChild(clientOverlay);
+ }
+ };
+
+ exports.clear =
+ function clear() {
+ if (document.body && clientOverlay.parentNode) {
+ document.body.removeChild(clientOverlay);
+ }
+ };
+
+ var problemColors = {
+ errors: colors.red,
+ warnings: colors.yellow
+ };
+
+ function problemType (type) {
+ var color = problemColors[type] || colors.red;
+ return (
+ '<span style="background-color:#' + color + '; color:#fff; padding:2px 4px; border-radius: 2px">' +
+ type.slice(0, -1).toUpperCase() +
+ '</span>'
+ );
+ }
+
+
+/***/ },
+/* 9 */
+/***/ function(module, exports) {
+
+ 'use strict'
+
+ module.exports = ansiHTML
+
+ // Reference to https://github.com/sindresorhus/ansi-regex
+ var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/
+
+ var _defColors = {
+ reset: ['fff', '000'], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
+ black: '000',
+ red: 'ff0000',
+ green: '209805',
+ yellow: 'e8bf03',
+ blue: '0000ff',
+ magenta: 'ff00ff',
+ cyan: '00ffee',
+ lightgrey: 'f0f0f0',
+ darkgrey: '888'
+ }
+ var _styles = {
+ 30: 'black',
+ 31: 'red',
+ 32: 'green',
+ 33: 'yellow',
+ 34: 'blue',
+ 35: 'magenta',
+ 36: 'cyan',
+ 37: 'lightgrey'
+ }
+ var _openTags = {
+ '1': 'font-weight:bold', // bold
+ '2': 'opacity:0.8', // dim
+ '3': '<i>', // italic
+ '4': '<u>', // underscore
+ '8': 'display:none', // hidden
+ '9': '<del>' // delete
+ }
+ var _closeTags = {
+ '23': '</i>', // reset italic
+ '24': '</u>', // reset underscore
+ '29': '</del>' // reset delete
+ }
+
+ ;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {
+ _closeTags[n] = '</span>'
+ })
+
+ /**
+ * Converts text with ANSI color codes to HTML markup.
+ * @param {String} text
+ * @returns {*}
+ */
+ function ansiHTML (text) {
+ // Returns the text if the string has no ANSI escape code.
+ if (!_regANSI.test(text)) {
+ return text
+ }
+
+ // Cache opened sequence.
+ var ansiCodes = []
+ // Replace with markup.
+ var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) {
+ var ot = _openTags[seq]
+ if (ot) {
+ // If current sequence has been opened, close it.
+ if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast
+ ansiCodes.pop()
+ return '</span>'
+ }
+ // Open tag.
+ ansiCodes.push(seq)
+ return ot[0] === '<' ? ot : '<span style="' + ot + ';">'
+ }
+
+ var ct = _closeTags[seq]
+ if (ct) {
+ // Pop sequence
+ ansiCodes.pop()
+ return ct
+ }
+ return ''
+ })
+
+ // Make sure tags are closed.
+ var l = ansiCodes.length
+ ;(l > 0) && (ret += Array(l + 1).join('</span>'))
+
+ return ret
+ }
+
+ /**
+ * Customize colors.
+ * @param {Object} colors reference to _defColors
+ */
+ ansiHTML.setColors = function (colors) {
+ if (typeof colors !== 'object') {
+ throw new Error('`colors` parameter must be an Object.')
+ }
+
+ var _finalColors = {}
+ for (var key in _defColors) {
+ var hex = colors.hasOwnProperty(key) ? colors[key] : null
+ if (!hex) {
+ _finalColors[key] = _defColors[key]
+ continue
+ }
+ if ('reset' === key) {
+ if (typeof hex === 'string') {
+ hex = [hex]
+ }
+ if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) {
+ return typeof h !== 'string'
+ })) {
+ throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000')
+ }
+ var defHexColor = _defColors[key]
+ if (!hex[0]) {
+ hex[0] = defHexColor[0]
+ }
+ if (hex.length === 1 || !hex[1]) {
+ hex = [hex[0]]
+ hex.push(defHexColor[1])
+ }
+
+ hex = hex.slice(0, 2)
+ } else if (typeof hex !== 'string') {
+ throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000')
+ }
+ _finalColors[key] = hex
+ }
+ _setTags(_finalColors)
+ }
+
+ /**
+ * Reset colors.
+ */
+ ansiHTML.reset = function () {
+ _setTags(_defColors)
+ }
+
+ /**
+ * Expose tags, including open and close.
+ * @type {Object}
+ */
+ ansiHTML.tags = {}
+
+ if (Object.defineProperty) {
+ Object.defineProperty(ansiHTML.tags, 'open', {
+ get: function () { return _openTags }
+ })
+ Object.defineProperty(ansiHTML.tags, 'close', {
+ get: function () { return _closeTags }
+ })
+ } else {
+ ansiHTML.tags.open = _openTags
+ ansiHTML.tags.close = _closeTags
+ }
+
+ function _setTags (colors) {
+ // reset all
+ _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1]
+ // inverse
+ _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0]
+ // dark grey
+ _openTags['90'] = 'color:#' + colors.darkgrey
+
+ for (var code in _styles) {
+ var color = _styles[code]
+ var oriColor = colors[color] || '000'
+ _openTags[code] = 'color:#' + oriColor
+ code = parseInt(code)
+ _openTags[(code + 10).toString()] = 'background:#' + oriColor
+ }
+ }
+
+ ansiHTML.reset()
+
+
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = {
+ XmlEntities: __webpack_require__(11),
+ Html4Entities: __webpack_require__(12),
+ Html5Entities: __webpack_require__(13),
+ AllHtmlEntities: __webpack_require__(13)
+ };
+
+
+/***/ },
+/* 11 */
+/***/ function(module, exports) {
+
+ var ALPHA_INDEX = {
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '&apos': '\'',
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ ''': '\'',
+ '&': '&'
+ };
+
+ var CHAR_INDEX = {
+ 60: 'lt',
+ 62: 'gt',
+ 34: 'quot',
+ 39: 'apos',
+ 38: 'amp'
+ };
+
+ var CHAR_S_INDEX = {
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '&': '&'
+ };
+
+ /**
+ * @constructor
+ */
+ function XmlEntities() {}
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.prototype.encode = function(str) {
+ if (str.length === 0) {
+ return '';
+ }
+ return str.replace(/<|>|"|'|&/g, function(s) {
+ return CHAR_S_INDEX[s];
+ });
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.encode = function(str) {
+ return new XmlEntities().encode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.prototype.decode = function(str) {
+ if (str.length === 0) {
+ return '';
+ }
+ return str.replace(/&#?[0-9a-zA-Z]+;?/g, function(s) {
+ if (s.charAt(1) === '#') {
+ var code = s.charAt(2).toLowerCase() === 'x' ?
+ parseInt(s.substr(3), 16) :
+ parseInt(s.substr(2));
+
+ if (isNaN(code) || code < -32768 || code > 65535) {
+ return '';
+ }
+ return String.fromCharCode(code);
+ }
+ return ALPHA_INDEX[s] || s;
+ });
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.decode = function(str) {
+ return new XmlEntities().decode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.prototype.encodeNonUTF = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var c = str.charCodeAt(i);
+ var alpha = CHAR_INDEX[c];
+ if (alpha) {
+ result += "&" + alpha + ";";
+ i++;
+ continue;
+ }
+ if (c < 32 || c > 126) {
+ result += '&#' + c + ';';
+ } else {
+ result += str.charAt(i);
+ }
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.encodeNonUTF = function(str) {
+ return new XmlEntities().encodeNonUTF(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.prototype.encodeNonASCII = function(str) {
+ var strLenght = str.length;
+ if (strLenght === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLenght) {
+ var c = str.charCodeAt(i);
+ if (c <= 255) {
+ result += str[i++];
+ continue;
+ }
+ result += '&#' + c + ';';
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ XmlEntities.encodeNonASCII = function(str) {
+ return new XmlEntities().encodeNonASCII(str);
+ };
+
+ module.exports = XmlEntities;
+
+
+/***/ },
+/* 12 */
+/***/ function(module, exports) {
+
+ var HTML_ALPHA = ['apos', 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'Aelig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'Oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'oelig', 'oelig', 'scaron', 'scaron', 'yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'there4', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams'];
+ var HTML_CODES = [39, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 34, 38, 60, 62, 338, 339, 352, 353, 376, 710, 732, 8194, 8195, 8201, 8204, 8205, 8206, 8207, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8240, 8249, 8250, 8364, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8472, 8465, 8476, 8482, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8968, 8969, 8970, 8971, 9001, 9002, 9674, 9824, 9827, 9829, 9830];
+
+ var alphaIndex = {};
+ var numIndex = {};
+
+ var i = 0;
+ var length = HTML_ALPHA.length;
+ while (i < length) {
+ var a = HTML_ALPHA[i];
+ var c = HTML_CODES[i];
+ alphaIndex[a] = String.fromCharCode(c);
+ numIndex[c] = a;
+ i++;
+ }
+
+ /**
+ * @constructor
+ */
+ function Html4Entities() {}
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.prototype.decode = function(str) {
+ if (str.length === 0) {
+ return '';
+ }
+ return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) {
+ var chr;
+ if (entity.charAt(0) === "#") {
+ var code = entity.charAt(1).toLowerCase() === 'x' ?
+ parseInt(entity.substr(2), 16) :
+ parseInt(entity.substr(1));
+
+ if (!(isNaN(code) || code < -32768 || code > 65535)) {
+ chr = String.fromCharCode(code);
+ }
+ } else {
+ chr = alphaIndex[entity];
+ }
+ return chr || s;
+ });
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.decode = function(str) {
+ return new Html4Entities().decode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.prototype.encode = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var alpha = numIndex[str.charCodeAt(i)];
+ result += alpha ? "&" + alpha + ";" : str.charAt(i);
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.encode = function(str) {
+ return new Html4Entities().encode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.prototype.encodeNonUTF = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var cc = str.charCodeAt(i);
+ var alpha = numIndex[cc];
+ if (alpha) {
+ result += "&" + alpha + ";";
+ } else if (cc < 32 || cc > 126) {
+ result += "&#" + cc + ";";
+ } else {
+ result += str.charAt(i);
+ }
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.encodeNonUTF = function(str) {
+ return new Html4Entities().encodeNonUTF(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.prototype.encodeNonASCII = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var c = str.charCodeAt(i);
+ if (c <= 255) {
+ result += str[i++];
+ continue;
+ }
+ result += '&#' + c + ';';
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html4Entities.encodeNonASCII = function(str) {
+ return new Html4Entities().encodeNonASCII(str);
+ };
+
+ module.exports = Html4Entities;
+
+
+/***/ },
+/* 13 */
+/***/ function(module, exports) {
+
+ var ENTITIES = [['Aacute', [193]], ['aacute', [225]], ['Abreve', [258]], ['abreve', [259]], ['ac', [8766]], ['acd', [8767]], ['acE', [8766, 819]], ['Acirc', [194]], ['acirc', [226]], ['acute', [180]], ['Acy', [1040]], ['acy', [1072]], ['AElig', [198]], ['aelig', [230]], ['af', [8289]], ['Afr', [120068]], ['afr', [120094]], ['Agrave', [192]], ['agrave', [224]], ['alefsym', [8501]], ['aleph', [8501]], ['Alpha', [913]], ['alpha', [945]], ['Amacr', [256]], ['amacr', [257]], ['amalg', [10815]], ['amp', [38]], ['AMP', [38]], ['andand', [10837]], ['And', [10835]], ['and', [8743]], ['andd', [10844]], ['andslope', [10840]], ['andv', [10842]], ['ang', [8736]], ['ange', [10660]], ['angle', [8736]], ['angmsdaa', [10664]], ['angmsdab', [10665]], ['angmsdac', [10666]], ['angmsdad', [10667]], ['angmsdae', [10668]], ['angmsdaf', [10669]], ['angmsdag', [10670]], ['angmsdah', [10671]], ['angmsd', [8737]], ['angrt', [8735]], ['angrtvb', [8894]], ['angrtvbd', [10653]], ['angsph', [8738]], ['angst', [197]], ['angzarr', [9084]], ['Aogon', [260]], ['aogon', [261]], ['Aopf', [120120]], ['aopf', [120146]], ['apacir', [10863]], ['ap', [8776]], ['apE', [10864]], ['ape', [8778]], ['apid', [8779]], ['apos', [39]], ['ApplyFunction', [8289]], ['approx', [8776]], ['approxeq', [8778]], ['Aring', [197]], ['aring', [229]], ['Ascr', [119964]], ['ascr', [119990]], ['Assign', [8788]], ['ast', [42]], ['asymp', [8776]], ['asympeq', [8781]], ['Atilde', [195]], ['atilde', [227]], ['Auml', [196]], ['auml', [228]], ['awconint', [8755]], ['awint', [10769]], ['backcong', [8780]], ['backepsilon', [1014]], ['backprime', [8245]], ['backsim', [8765]], ['backsimeq', [8909]], ['Backslash', [8726]], ['Barv', [10983]], ['barvee', [8893]], ['barwed', [8965]], ['Barwed', [8966]], ['barwedge', [8965]], ['bbrk', [9141]], ['bbrktbrk', [9142]], ['bcong', [8780]], ['Bcy', [1041]], ['bcy', [1073]], ['bdquo', [8222]], ['becaus', [8757]], ['because', [8757]], ['Because', [8757]], ['bemptyv', [10672]], ['bepsi', [1014]], ['bernou', [8492]], ['Bernoullis', [8492]], ['Beta', [914]], ['beta', [946]], ['beth', [8502]], ['between', [8812]], ['Bfr', [120069]], ['bfr', [120095]], ['bigcap', [8898]], ['bigcirc', [9711]], ['bigcup', [8899]], ['bigodot', [10752]], ['bigoplus', [10753]], ['bigotimes', [10754]], ['bigsqcup', [10758]], ['bigstar', [9733]], ['bigtriangledown', [9661]], ['bigtriangleup', [9651]], ['biguplus', [10756]], ['bigvee', [8897]], ['bigwedge', [8896]], ['bkarow', [10509]], ['blacklozenge', [10731]], ['blacksquare', [9642]], ['blacktriangle', [9652]], ['blacktriangledown', [9662]], ['blacktriangleleft', [9666]], ['blacktriangleright', [9656]], ['blank', [9251]], ['blk12', [9618]], ['blk14', [9617]], ['blk34', [9619]], ['block', [9608]], ['bne', [61, 8421]], ['bnequiv', [8801, 8421]], ['bNot', [10989]], ['bnot', [8976]], ['Bopf', [120121]], ['bopf', [120147]], ['bot', [8869]], ['bottom', [8869]], ['bowtie', [8904]], ['boxbox', [10697]], ['boxdl', [9488]], ['boxdL', [9557]], ['boxDl', [9558]], ['boxDL', [9559]], ['boxdr', [9484]], ['boxdR', [9554]], ['boxDr', [9555]], ['boxDR', [9556]], ['boxh', [9472]], ['boxH', [9552]], ['boxhd', [9516]], ['boxHd', [9572]], ['boxhD', [9573]], ['boxHD', [9574]], ['boxhu', [9524]], ['boxHu', [9575]], ['boxhU', [9576]], ['boxHU', [9577]], ['boxminus', [8863]], ['boxplus', [8862]], ['boxtimes', [8864]], ['boxul', [9496]], ['boxuL', [9563]], ['boxUl', [9564]], ['boxUL', [9565]], ['boxur', [9492]], ['boxuR', [9560]], ['boxUr', [9561]], ['boxUR', [9562]], ['boxv', [9474]], ['boxV', [9553]], ['boxvh', [9532]], ['boxvH', [9578]], ['boxVh', [9579]], ['boxVH', [9580]], ['boxvl', [9508]], ['boxvL', [9569]], ['boxVl', [9570]], ['boxVL', [9571]], ['boxvr', [9500]], ['boxvR', [9566]], ['boxVr', [9567]], ['boxVR', [9568]], ['bprime', [8245]], ['breve', [728]], ['Breve', [728]], ['brvbar', [166]], ['bscr', [119991]], ['Bscr', [8492]], ['bsemi', [8271]], ['bsim', [8765]], ['bsime', [8909]], ['bsolb', [10693]], ['bsol', [92]], ['bsolhsub', [10184]], ['bull', [8226]], ['bullet', [8226]], ['bump', [8782]], ['bumpE', [10926]], ['bumpe', [8783]], ['Bumpeq', [8782]], ['bumpeq', [8783]], ['Cacute', [262]], ['cacute', [263]], ['capand', [10820]], ['capbrcup', [10825]], ['capcap', [10827]], ['cap', [8745]], ['Cap', [8914]], ['capcup', [10823]], ['capdot', [10816]], ['CapitalDifferentialD', [8517]], ['caps', [8745, 65024]], ['caret', [8257]], ['caron', [711]], ['Cayleys', [8493]], ['ccaps', [10829]], ['Ccaron', [268]], ['ccaron', [269]], ['Ccedil', [199]], ['ccedil', [231]], ['Ccirc', [264]], ['ccirc', [265]], ['Cconint', [8752]], ['ccups', [10828]], ['ccupssm', [10832]], ['Cdot', [266]], ['cdot', [267]], ['cedil', [184]], ['Cedilla', [184]], ['cemptyv', [10674]], ['cent', [162]], ['centerdot', [183]], ['CenterDot', [183]], ['cfr', [120096]], ['Cfr', [8493]], ['CHcy', [1063]], ['chcy', [1095]], ['check', [10003]], ['checkmark', [10003]], ['Chi', [935]], ['chi', [967]], ['circ', [710]], ['circeq', [8791]], ['circlearrowleft', [8634]], ['circlearrowright', [8635]], ['circledast', [8859]], ['circledcirc', [8858]], ['circleddash', [8861]], ['CircleDot', [8857]], ['circledR', [174]], ['circledS', [9416]], ['CircleMinus', [8854]], ['CirclePlus', [8853]], ['CircleTimes', [8855]], ['cir', [9675]], ['cirE', [10691]], ['cire', [8791]], ['cirfnint', [10768]], ['cirmid', [10991]], ['cirscir', [10690]], ['ClockwiseContourIntegral', [8754]], ['CloseCurlyDoubleQuote', [8221]], ['CloseCurlyQuote', [8217]], ['clubs', [9827]], ['clubsuit', [9827]], ['colon', [58]], ['Colon', [8759]], ['Colone', [10868]], ['colone', [8788]], ['coloneq', [8788]], ['comma', [44]], ['commat', [64]], ['comp', [8705]], ['compfn', [8728]], ['complement', [8705]], ['complexes', [8450]], ['cong', [8773]], ['congdot', [10861]], ['Congruent', [8801]], ['conint', [8750]], ['Conint', [8751]], ['ContourIntegral', [8750]], ['copf', [120148]], ['Copf', [8450]], ['coprod', [8720]], ['Coproduct', [8720]], ['copy', [169]], ['COPY', [169]], ['copysr', [8471]], ['CounterClockwiseContourIntegral', [8755]], ['crarr', [8629]], ['cross', [10007]], ['Cross', [10799]], ['Cscr', [119966]], ['cscr', [119992]], ['csub', [10959]], ['csube', [10961]], ['csup', [10960]], ['csupe', [10962]], ['ctdot', [8943]], ['cudarrl', [10552]], ['cudarrr', [10549]], ['cuepr', [8926]], ['cuesc', [8927]], ['cularr', [8630]], ['cularrp', [10557]], ['cupbrcap', [10824]], ['cupcap', [10822]], ['CupCap', [8781]], ['cup', [8746]], ['Cup', [8915]], ['cupcup', [10826]], ['cupdot', [8845]], ['cupor', [10821]], ['cups', [8746, 65024]], ['curarr', [8631]], ['curarrm', [10556]], ['curlyeqprec', [8926]], ['curlyeqsucc', [8927]], ['curlyvee', [8910]], ['curlywedge', [8911]], ['curren', [164]], ['curvearrowleft', [8630]], ['curvearrowright', [8631]], ['cuvee', [8910]], ['cuwed', [8911]], ['cwconint', [8754]], ['cwint', [8753]], ['cylcty', [9005]], ['dagger', [8224]], ['Dagger', [8225]], ['daleth', [8504]], ['darr', [8595]], ['Darr', [8609]], ['dArr', [8659]], ['dash', [8208]], ['Dashv', [10980]], ['dashv', [8867]], ['dbkarow', [10511]], ['dblac', [733]], ['Dcaron', [270]], ['dcaron', [271]], ['Dcy', [1044]], ['dcy', [1076]], ['ddagger', [8225]], ['ddarr', [8650]], ['DD', [8517]], ['dd', [8518]], ['DDotrahd', [10513]], ['ddotseq', [10871]], ['deg', [176]], ['Del', [8711]], ['Delta', [916]], ['delta', [948]], ['demptyv', [10673]], ['dfisht', [10623]], ['Dfr', [120071]], ['dfr', [120097]], ['dHar', [10597]], ['dharl', [8643]], ['dharr', [8642]], ['DiacriticalAcute', [180]], ['DiacriticalDot', [729]], ['DiacriticalDoubleAcute', [733]], ['DiacriticalGrave', [96]], ['DiacriticalTilde', [732]], ['diam', [8900]], ['diamond', [8900]], ['Diamond', [8900]], ['diamondsuit', [9830]], ['diams', [9830]], ['die', [168]], ['DifferentialD', [8518]], ['digamma', [989]], ['disin', [8946]], ['div', [247]], ['divide', [247]], ['divideontimes', [8903]], ['divonx', [8903]], ['DJcy', [1026]], ['djcy', [1106]], ['dlcorn', [8990]], ['dlcrop', [8973]], ['dollar', [36]], ['Dopf', [120123]], ['dopf', [120149]], ['Dot', [168]], ['dot', [729]], ['DotDot', [8412]], ['doteq', [8784]], ['doteqdot', [8785]], ['DotEqual', [8784]], ['dotminus', [8760]], ['dotplus', [8724]], ['dotsquare', [8865]], ['doublebarwedge', [8966]], ['DoubleContourIntegral', [8751]], ['DoubleDot', [168]], ['DoubleDownArrow', [8659]], ['DoubleLeftArrow', [8656]], ['DoubleLeftRightArrow', [8660]], ['DoubleLeftTee', [10980]], ['DoubleLongLeftArrow', [10232]], ['DoubleLongLeftRightArrow', [10234]], ['DoubleLongRightArrow', [10233]], ['DoubleRightArrow', [8658]], ['DoubleRightTee', [8872]], ['DoubleUpArrow', [8657]], ['DoubleUpDownArrow', [8661]], ['DoubleVerticalBar', [8741]], ['DownArrowBar', [10515]], ['downarrow', [8595]], ['DownArrow', [8595]], ['Downarrow', [8659]], ['DownArrowUpArrow', [8693]], ['DownBreve', [785]], ['downdownarrows', [8650]], ['downharpoonleft', [8643]], ['downharpoonright', [8642]], ['DownLeftRightVector', [10576]], ['DownLeftTeeVector', [10590]], ['DownLeftVectorBar', [10582]], ['DownLeftVector', [8637]], ['DownRightTeeVector', [10591]], ['DownRightVectorBar', [10583]], ['DownRightVector', [8641]], ['DownTeeArrow', [8615]], ['DownTee', [8868]], ['drbkarow', [10512]], ['drcorn', [8991]], ['drcrop', [8972]], ['Dscr', [119967]], ['dscr', [119993]], ['DScy', [1029]], ['dscy', [1109]], ['dsol', [10742]], ['Dstrok', [272]], ['dstrok', [273]], ['dtdot', [8945]], ['dtri', [9663]], ['dtrif', [9662]], ['duarr', [8693]], ['duhar', [10607]], ['dwangle', [10662]], ['DZcy', [1039]], ['dzcy', [1119]], ['dzigrarr', [10239]], ['Eacute', [201]], ['eacute', [233]], ['easter', [10862]], ['Ecaron', [282]], ['ecaron', [283]], ['Ecirc', [202]], ['ecirc', [234]], ['ecir', [8790]], ['ecolon', [8789]], ['Ecy', [1069]], ['ecy', [1101]], ['eDDot', [10871]], ['Edot', [278]], ['edot', [279]], ['eDot', [8785]], ['ee', [8519]], ['efDot', [8786]], ['Efr', [120072]], ['efr', [120098]], ['eg', [10906]], ['Egrave', [200]], ['egrave', [232]], ['egs', [10902]], ['egsdot', [10904]], ['el', [10905]], ['Element', [8712]], ['elinters', [9191]], ['ell', [8467]], ['els', [10901]], ['elsdot', [10903]], ['Emacr', [274]], ['emacr', [275]], ['empty', [8709]], ['emptyset', [8709]], ['EmptySmallSquare', [9723]], ['emptyv', [8709]], ['EmptyVerySmallSquare', [9643]], ['emsp13', [8196]], ['emsp14', [8197]], ['emsp', [8195]], ['ENG', [330]], ['eng', [331]], ['ensp', [8194]], ['Eogon', [280]], ['eogon', [281]], ['Eopf', [120124]], ['eopf', [120150]], ['epar', [8917]], ['eparsl', [10723]], ['eplus', [10865]], ['epsi', [949]], ['Epsilon', [917]], ['epsilon', [949]], ['epsiv', [1013]], ['eqcirc', [8790]], ['eqcolon', [8789]], ['eqsim', [8770]], ['eqslantgtr', [10902]], ['eqslantless', [10901]], ['Equal', [10869]], ['equals', [61]], ['EqualTilde', [8770]], ['equest', [8799]], ['Equilibrium', [8652]], ['equiv', [8801]], ['equivDD', [10872]], ['eqvparsl', [10725]], ['erarr', [10609]], ['erDot', [8787]], ['escr', [8495]], ['Escr', [8496]], ['esdot', [8784]], ['Esim', [10867]], ['esim', [8770]], ['Eta', [919]], ['eta', [951]], ['ETH', [208]], ['eth', [240]], ['Euml', [203]], ['euml', [235]], ['euro', [8364]], ['excl', [33]], ['exist', [8707]], ['Exists', [8707]], ['expectation', [8496]], ['exponentiale', [8519]], ['ExponentialE', [8519]], ['fallingdotseq', [8786]], ['Fcy', [1060]], ['fcy', [1092]], ['female', [9792]], ['ffilig', [64259]], ['fflig', [64256]], ['ffllig', [64260]], ['Ffr', [120073]], ['ffr', [120099]], ['filig', [64257]], ['FilledSmallSquare', [9724]], ['FilledVerySmallSquare', [9642]], ['fjlig', [102, 106]], ['flat', [9837]], ['fllig', [64258]], ['fltns', [9649]], ['fnof', [402]], ['Fopf', [120125]], ['fopf', [120151]], ['forall', [8704]], ['ForAll', [8704]], ['fork', [8916]], ['forkv', [10969]], ['Fouriertrf', [8497]], ['fpartint', [10765]], ['frac12', [189]], ['frac13', [8531]], ['frac14', [188]], ['frac15', [8533]], ['frac16', [8537]], ['frac18', [8539]], ['frac23', [8532]], ['frac25', [8534]], ['frac34', [190]], ['frac35', [8535]], ['frac38', [8540]], ['frac45', [8536]], ['frac56', [8538]], ['frac58', [8541]], ['frac78', [8542]], ['frasl', [8260]], ['frown', [8994]], ['fscr', [119995]], ['Fscr', [8497]], ['gacute', [501]], ['Gamma', [915]], ['gamma', [947]], ['Gammad', [988]], ['gammad', [989]], ['gap', [10886]], ['Gbreve', [286]], ['gbreve', [287]], ['Gcedil', [290]], ['Gcirc', [284]], ['gcirc', [285]], ['Gcy', [1043]], ['gcy', [1075]], ['Gdot', [288]], ['gdot', [289]], ['ge', [8805]], ['gE', [8807]], ['gEl', [10892]], ['gel', [8923]], ['geq', [8805]], ['geqq', [8807]], ['geqslant', [10878]], ['gescc', [10921]], ['ges', [10878]], ['gesdot', [10880]], ['gesdoto', [10882]], ['gesdotol', [10884]], ['gesl', [8923, 65024]], ['gesles', [10900]], ['Gfr', [120074]], ['gfr', [120100]], ['gg', [8811]], ['Gg', [8921]], ['ggg', [8921]], ['gimel', [8503]], ['GJcy', [1027]], ['gjcy', [1107]], ['gla', [10917]], ['gl', [8823]], ['glE', [10898]], ['glj', [10916]], ['gnap', [10890]], ['gnapprox', [10890]], ['gne', [10888]], ['gnE', [8809]], ['gneq', [10888]], ['gneqq', [8809]], ['gnsim', [8935]], ['Gopf', [120126]], ['gopf', [120152]], ['grave', [96]], ['GreaterEqual', [8805]], ['GreaterEqualLess', [8923]], ['GreaterFullEqual', [8807]], ['GreaterGreater', [10914]], ['GreaterLess', [8823]], ['GreaterSlantEqual', [10878]], ['GreaterTilde', [8819]], ['Gscr', [119970]], ['gscr', [8458]], ['gsim', [8819]], ['gsime', [10894]], ['gsiml', [10896]], ['gtcc', [10919]], ['gtcir', [10874]], ['gt', [62]], ['GT', [62]], ['Gt', [8811]], ['gtdot', [8919]], ['gtlPar', [10645]], ['gtquest', [10876]], ['gtrapprox', [10886]], ['gtrarr', [10616]], ['gtrdot', [8919]], ['gtreqless', [8923]], ['gtreqqless', [10892]], ['gtrless', [8823]], ['gtrsim', [8819]], ['gvertneqq', [8809, 65024]], ['gvnE', [8809, 65024]], ['Hacek', [711]], ['hairsp', [8202]], ['half', [189]], ['hamilt', [8459]], ['HARDcy', [1066]], ['hardcy', [1098]], ['harrcir', [10568]], ['harr', [8596]], ['hArr', [8660]], ['harrw', [8621]], ['Hat', [94]], ['hbar', [8463]], ['Hcirc', [292]], ['hcirc', [293]], ['hearts', [9829]], ['heartsuit', [9829]], ['hellip', [8230]], ['hercon', [8889]], ['hfr', [120101]], ['Hfr', [8460]], ['HilbertSpace', [8459]], ['hksearow', [10533]], ['hkswarow', [10534]], ['hoarr', [8703]], ['homtht', [8763]], ['hookleftarrow', [8617]], ['hookrightarrow', [8618]], ['hopf', [120153]], ['Hopf', [8461]], ['horbar', [8213]], ['HorizontalLine', [9472]], ['hscr', [119997]], ['Hscr', [8459]], ['hslash', [8463]], ['Hstrok', [294]], ['hstrok', [295]], ['HumpDownHump', [8782]], ['HumpEqual', [8783]], ['hybull', [8259]], ['hyphen', [8208]], ['Iacute', [205]], ['iacute', [237]], ['ic', [8291]], ['Icirc', [206]], ['icirc', [238]], ['Icy', [1048]], ['icy', [1080]], ['Idot', [304]], ['IEcy', [1045]], ['iecy', [1077]], ['iexcl', [161]], ['iff', [8660]], ['ifr', [120102]], ['Ifr', [8465]], ['Igrave', [204]], ['igrave', [236]], ['ii', [8520]], ['iiiint', [10764]], ['iiint', [8749]], ['iinfin', [10716]], ['iiota', [8489]], ['IJlig', [306]], ['ijlig', [307]], ['Imacr', [298]], ['imacr', [299]], ['image', [8465]], ['ImaginaryI', [8520]], ['imagline', [8464]], ['imagpart', [8465]], ['imath', [305]], ['Im', [8465]], ['imof', [8887]], ['imped', [437]], ['Implies', [8658]], ['incare', [8453]], ['in', [8712]], ['infin', [8734]], ['infintie', [10717]], ['inodot', [305]], ['intcal', [8890]], ['int', [8747]], ['Int', [8748]], ['integers', [8484]], ['Integral', [8747]], ['intercal', [8890]], ['Intersection', [8898]], ['intlarhk', [10775]], ['intprod', [10812]], ['InvisibleComma', [8291]], ['InvisibleTimes', [8290]], ['IOcy', [1025]], ['iocy', [1105]], ['Iogon', [302]], ['iogon', [303]], ['Iopf', [120128]], ['iopf', [120154]], ['Iota', [921]], ['iota', [953]], ['iprod', [10812]], ['iquest', [191]], ['iscr', [119998]], ['Iscr', [8464]], ['isin', [8712]], ['isindot', [8949]], ['isinE', [8953]], ['isins', [8948]], ['isinsv', [8947]], ['isinv', [8712]], ['it', [8290]], ['Itilde', [296]], ['itilde', [297]], ['Iukcy', [1030]], ['iukcy', [1110]], ['Iuml', [207]], ['iuml', [239]], ['Jcirc', [308]], ['jcirc', [309]], ['Jcy', [1049]], ['jcy', [1081]], ['Jfr', [120077]], ['jfr', [120103]], ['jmath', [567]], ['Jopf', [120129]], ['jopf', [120155]], ['Jscr', [119973]], ['jscr', [119999]], ['Jsercy', [1032]], ['jsercy', [1112]], ['Jukcy', [1028]], ['jukcy', [1108]], ['Kappa', [922]], ['kappa', [954]], ['kappav', [1008]], ['Kcedil', [310]], ['kcedil', [311]], ['Kcy', [1050]], ['kcy', [1082]], ['Kfr', [120078]], ['kfr', [120104]], ['kgreen', [312]], ['KHcy', [1061]], ['khcy', [1093]], ['KJcy', [1036]], ['kjcy', [1116]], ['Kopf', [120130]], ['kopf', [120156]], ['Kscr', [119974]], ['kscr', [120000]], ['lAarr', [8666]], ['Lacute', [313]], ['lacute', [314]], ['laemptyv', [10676]], ['lagran', [8466]], ['Lambda', [923]], ['lambda', [955]], ['lang', [10216]], ['Lang', [10218]], ['langd', [10641]], ['langle', [10216]], ['lap', [10885]], ['Laplacetrf', [8466]], ['laquo', [171]], ['larrb', [8676]], ['larrbfs', [10527]], ['larr', [8592]], ['Larr', [8606]], ['lArr', [8656]], ['larrfs', [10525]], ['larrhk', [8617]], ['larrlp', [8619]], ['larrpl', [10553]], ['larrsim', [10611]], ['larrtl', [8610]], ['latail', [10521]], ['lAtail', [10523]], ['lat', [10923]], ['late', [10925]], ['lates', [10925, 65024]], ['lbarr', [10508]], ['lBarr', [10510]], ['lbbrk', [10098]], ['lbrace', [123]], ['lbrack', [91]], ['lbrke', [10635]], ['lbrksld', [10639]], ['lbrkslu', [10637]], ['Lcaron', [317]], ['lcaron', [318]], ['Lcedil', [315]], ['lcedil', [316]], ['lceil', [8968]], ['lcub', [123]], ['Lcy', [1051]], ['lcy', [1083]], ['ldca', [10550]], ['ldquo', [8220]], ['ldquor', [8222]], ['ldrdhar', [10599]], ['ldrushar', [10571]], ['ldsh', [8626]], ['le', [8804]], ['lE', [8806]], ['LeftAngleBracket', [10216]], ['LeftArrowBar', [8676]], ['leftarrow', [8592]], ['LeftArrow', [8592]], ['Leftarrow', [8656]], ['LeftArrowRightArrow', [8646]], ['leftarrowtail', [8610]], ['LeftCeiling', [8968]], ['LeftDoubleBracket', [10214]], ['LeftDownTeeVector', [10593]], ['LeftDownVectorBar', [10585]], ['LeftDownVector', [8643]], ['LeftFloor', [8970]], ['leftharpoondown', [8637]], ['leftharpoonup', [8636]], ['leftleftarrows', [8647]], ['leftrightarrow', [8596]], ['LeftRightArrow', [8596]], ['Leftrightarrow', [8660]], ['leftrightarrows', [8646]], ['leftrightharpoons', [8651]], ['leftrightsquigarrow', [8621]], ['LeftRightVector', [10574]], ['LeftTeeArrow', [8612]], ['LeftTee', [8867]], ['LeftTeeVector', [10586]], ['leftthreetimes', [8907]], ['LeftTriangleBar', [10703]], ['LeftTriangle', [8882]], ['LeftTriangleEqual', [8884]], ['LeftUpDownVector', [10577]], ['LeftUpTeeVector', [10592]], ['LeftUpVectorBar', [10584]], ['LeftUpVector', [8639]], ['LeftVectorBar', [10578]], ['LeftVector', [8636]], ['lEg', [10891]], ['leg', [8922]], ['leq', [8804]], ['leqq', [8806]], ['leqslant', [10877]], ['lescc', [10920]], ['les', [10877]], ['lesdot', [10879]], ['lesdoto', [10881]], ['lesdotor', [10883]], ['lesg', [8922, 65024]], ['lesges', [10899]], ['lessapprox', [10885]], ['lessdot', [8918]], ['lesseqgtr', [8922]], ['lesseqqgtr', [10891]], ['LessEqualGreater', [8922]], ['LessFullEqual', [8806]], ['LessGreater', [8822]], ['lessgtr', [8822]], ['LessLess', [10913]], ['lesssim', [8818]], ['LessSlantEqual', [10877]], ['LessTilde', [8818]], ['lfisht', [10620]], ['lfloor', [8970]], ['Lfr', [120079]], ['lfr', [120105]], ['lg', [8822]], ['lgE', [10897]], ['lHar', [10594]], ['lhard', [8637]], ['lharu', [8636]], ['lharul', [10602]], ['lhblk', [9604]], ['LJcy', [1033]], ['ljcy', [1113]], ['llarr', [8647]], ['ll', [8810]], ['Ll', [8920]], ['llcorner', [8990]], ['Lleftarrow', [8666]], ['llhard', [10603]], ['lltri', [9722]], ['Lmidot', [319]], ['lmidot', [320]], ['lmoustache', [9136]], ['lmoust', [9136]], ['lnap', [10889]], ['lnapprox', [10889]], ['lne', [10887]], ['lnE', [8808]], ['lneq', [10887]], ['lneqq', [8808]], ['lnsim', [8934]], ['loang', [10220]], ['loarr', [8701]], ['lobrk', [10214]], ['longleftarrow', [10229]], ['LongLeftArrow', [10229]], ['Longleftarrow', [10232]], ['longleftrightarrow', [10231]], ['LongLeftRightArrow', [10231]], ['Longleftrightarrow', [10234]], ['longmapsto', [10236]], ['longrightarrow', [10230]], ['LongRightArrow', [10230]], ['Longrightarrow', [10233]], ['looparrowleft', [8619]], ['looparrowright', [8620]], ['lopar', [10629]], ['Lopf', [120131]], ['lopf', [120157]], ['loplus', [10797]], ['lotimes', [10804]], ['lowast', [8727]], ['lowbar', [95]], ['LowerLeftArrow', [8601]], ['LowerRightArrow', [8600]], ['loz', [9674]], ['lozenge', [9674]], ['lozf', [10731]], ['lpar', [40]], ['lparlt', [10643]], ['lrarr', [8646]], ['lrcorner', [8991]], ['lrhar', [8651]], ['lrhard', [10605]], ['lrm', [8206]], ['lrtri', [8895]], ['lsaquo', [8249]], ['lscr', [120001]], ['Lscr', [8466]], ['lsh', [8624]], ['Lsh', [8624]], ['lsim', [8818]], ['lsime', [10893]], ['lsimg', [10895]], ['lsqb', [91]], ['lsquo', [8216]], ['lsquor', [8218]], ['Lstrok', [321]], ['lstrok', [322]], ['ltcc', [10918]], ['ltcir', [10873]], ['lt', [60]], ['LT', [60]], ['Lt', [8810]], ['ltdot', [8918]], ['lthree', [8907]], ['ltimes', [8905]], ['ltlarr', [10614]], ['ltquest', [10875]], ['ltri', [9667]], ['ltrie', [8884]], ['ltrif', [9666]], ['ltrPar', [10646]], ['lurdshar', [10570]], ['luruhar', [10598]], ['lvertneqq', [8808, 65024]], ['lvnE', [8808, 65024]], ['macr', [175]], ['male', [9794]], ['malt', [10016]], ['maltese', [10016]], ['Map', [10501]], ['map', [8614]], ['mapsto', [8614]], ['mapstodown', [8615]], ['mapstoleft', [8612]], ['mapstoup', [8613]], ['marker', [9646]], ['mcomma', [10793]], ['Mcy', [1052]], ['mcy', [1084]], ['mdash', [8212]], ['mDDot', [8762]], ['measuredangle', [8737]], ['MediumSpace', [8287]], ['Mellintrf', [8499]], ['Mfr', [120080]], ['mfr', [120106]], ['mho', [8487]], ['micro', [181]], ['midast', [42]], ['midcir', [10992]], ['mid', [8739]], ['middot', [183]], ['minusb', [8863]], ['minus', [8722]], ['minusd', [8760]], ['minusdu', [10794]], ['MinusPlus', [8723]], ['mlcp', [10971]], ['mldr', [8230]], ['mnplus', [8723]], ['models', [8871]], ['Mopf', [120132]], ['mopf', [120158]], ['mp', [8723]], ['mscr', [120002]], ['Mscr', [8499]], ['mstpos', [8766]], ['Mu', [924]], ['mu', [956]], ['multimap', [8888]], ['mumap', [8888]], ['nabla', [8711]], ['Nacute', [323]], ['nacute', [324]], ['nang', [8736, 8402]], ['nap', [8777]], ['napE', [10864, 824]], ['napid', [8779, 824]], ['napos', [329]], ['napprox', [8777]], ['natural', [9838]], ['naturals', [8469]], ['natur', [9838]], ['nbsp', [160]], ['nbump', [8782, 824]], ['nbumpe', [8783, 824]], ['ncap', [10819]], ['Ncaron', [327]], ['ncaron', [328]], ['Ncedil', [325]], ['ncedil', [326]], ['ncong', [8775]], ['ncongdot', [10861, 824]], ['ncup', [10818]], ['Ncy', [1053]], ['ncy', [1085]], ['ndash', [8211]], ['nearhk', [10532]], ['nearr', [8599]], ['neArr', [8663]], ['nearrow', [8599]], ['ne', [8800]], ['nedot', [8784, 824]], ['NegativeMediumSpace', [8203]], ['NegativeThickSpace', [8203]], ['NegativeThinSpace', [8203]], ['NegativeVeryThinSpace', [8203]], ['nequiv', [8802]], ['nesear', [10536]], ['nesim', [8770, 824]], ['NestedGreaterGreater', [8811]], ['NestedLessLess', [8810]], ['nexist', [8708]], ['nexists', [8708]], ['Nfr', [120081]], ['nfr', [120107]], ['ngE', [8807, 824]], ['nge', [8817]], ['ngeq', [8817]], ['ngeqq', [8807, 824]], ['ngeqslant', [10878, 824]], ['nges', [10878, 824]], ['nGg', [8921, 824]], ['ngsim', [8821]], ['nGt', [8811, 8402]], ['ngt', [8815]], ['ngtr', [8815]], ['nGtv', [8811, 824]], ['nharr', [8622]], ['nhArr', [8654]], ['nhpar', [10994]], ['ni', [8715]], ['nis', [8956]], ['nisd', [8954]], ['niv', [8715]], ['NJcy', [1034]], ['njcy', [1114]], ['nlarr', [8602]], ['nlArr', [8653]], ['nldr', [8229]], ['nlE', [8806, 824]], ['nle', [8816]], ['nleftarrow', [8602]], ['nLeftarrow', [8653]], ['nleftrightarrow', [8622]], ['nLeftrightarrow', [8654]], ['nleq', [8816]], ['nleqq', [8806, 824]], ['nleqslant', [10877, 824]], ['nles', [10877, 824]], ['nless', [8814]], ['nLl', [8920, 824]], ['nlsim', [8820]], ['nLt', [8810, 8402]], ['nlt', [8814]], ['nltri', [8938]], ['nltrie', [8940]], ['nLtv', [8810, 824]], ['nmid', [8740]], ['NoBreak', [8288]], ['NonBreakingSpace', [160]], ['nopf', [120159]], ['Nopf', [8469]], ['Not', [10988]], ['not', [172]], ['NotCongruent', [8802]], ['NotCupCap', [8813]], ['NotDoubleVerticalBar', [8742]], ['NotElement', [8713]], ['NotEqual', [8800]], ['NotEqualTilde', [8770, 824]], ['NotExists', [8708]], ['NotGreater', [8815]], ['NotGreaterEqual', [8817]], ['NotGreaterFullEqual', [8807, 824]], ['NotGreaterGreater', [8811, 824]], ['NotGreaterLess', [8825]], ['NotGreaterSlantEqual', [10878, 824]], ['NotGreaterTilde', [8821]], ['NotHumpDownHump', [8782, 824]], ['NotHumpEqual', [8783, 824]], ['notin', [8713]], ['notindot', [8949, 824]], ['notinE', [8953, 824]], ['notinva', [8713]], ['notinvb', [8951]], ['notinvc', [8950]], ['NotLeftTriangleBar', [10703, 824]], ['NotLeftTriangle', [8938]], ['NotLeftTriangleEqual', [8940]], ['NotLess', [8814]], ['NotLessEqual', [8816]], ['NotLessGreater', [8824]], ['NotLessLess', [8810, 824]], ['NotLessSlantEqual', [10877, 824]], ['NotLessTilde', [8820]], ['NotNestedGreaterGreater', [10914, 824]], ['NotNestedLessLess', [10913, 824]], ['notni', [8716]], ['notniva', [8716]], ['notnivb', [8958]], ['notnivc', [8957]], ['NotPrecedes', [8832]], ['NotPrecedesEqual', [10927, 824]], ['NotPrecedesSlantEqual', [8928]], ['NotReverseElement', [8716]], ['NotRightTriangleBar', [10704, 824]], ['NotRightTriangle', [8939]], ['NotRightTriangleEqual', [8941]], ['NotSquareSubset', [8847, 824]], ['NotSquareSubsetEqual', [8930]], ['NotSquareSuperset', [8848, 824]], ['NotSquareSupersetEqual', [8931]], ['NotSubset', [8834, 8402]], ['NotSubsetEqual', [8840]], ['NotSucceeds', [8833]], ['NotSucceedsEqual', [10928, 824]], ['NotSucceedsSlantEqual', [8929]], ['NotSucceedsTilde', [8831, 824]], ['NotSuperset', [8835, 8402]], ['NotSupersetEqual', [8841]], ['NotTilde', [8769]], ['NotTildeEqual', [8772]], ['NotTildeFullEqual', [8775]], ['NotTildeTilde', [8777]], ['NotVerticalBar', [8740]], ['nparallel', [8742]], ['npar', [8742]], ['nparsl', [11005, 8421]], ['npart', [8706, 824]], ['npolint', [10772]], ['npr', [8832]], ['nprcue', [8928]], ['nprec', [8832]], ['npreceq', [10927, 824]], ['npre', [10927, 824]], ['nrarrc', [10547, 824]], ['nrarr', [8603]], ['nrArr', [8655]], ['nrarrw', [8605, 824]], ['nrightarrow', [8603]], ['nRightarrow', [8655]], ['nrtri', [8939]], ['nrtrie', [8941]], ['nsc', [8833]], ['nsccue', [8929]], ['nsce', [10928, 824]], ['Nscr', [119977]], ['nscr', [120003]], ['nshortmid', [8740]], ['nshortparallel', [8742]], ['nsim', [8769]], ['nsime', [8772]], ['nsimeq', [8772]], ['nsmid', [8740]], ['nspar', [8742]], ['nsqsube', [8930]], ['nsqsupe', [8931]], ['nsub', [8836]], ['nsubE', [10949, 824]], ['nsube', [8840]], ['nsubset', [8834, 8402]], ['nsubseteq', [8840]], ['nsubseteqq', [10949, 824]], ['nsucc', [8833]], ['nsucceq', [10928, 824]], ['nsup', [8837]], ['nsupE', [10950, 824]], ['nsupe', [8841]], ['nsupset', [8835, 8402]], ['nsupseteq', [8841]], ['nsupseteqq', [10950, 824]], ['ntgl', [8825]], ['Ntilde', [209]], ['ntilde', [241]], ['ntlg', [8824]], ['ntriangleleft', [8938]], ['ntrianglelefteq', [8940]], ['ntriangleright', [8939]], ['ntrianglerighteq', [8941]], ['Nu', [925]], ['nu', [957]], ['num', [35]], ['numero', [8470]], ['numsp', [8199]], ['nvap', [8781, 8402]], ['nvdash', [8876]], ['nvDash', [8877]], ['nVdash', [8878]], ['nVDash', [8879]], ['nvge', [8805, 8402]], ['nvgt', [62, 8402]], ['nvHarr', [10500]], ['nvinfin', [10718]], ['nvlArr', [10498]], ['nvle', [8804, 8402]], ['nvlt', [60, 8402]], ['nvltrie', [8884, 8402]], ['nvrArr', [10499]], ['nvrtrie', [8885, 8402]], ['nvsim', [8764, 8402]], ['nwarhk', [10531]], ['nwarr', [8598]], ['nwArr', [8662]], ['nwarrow', [8598]], ['nwnear', [10535]], ['Oacute', [211]], ['oacute', [243]], ['oast', [8859]], ['Ocirc', [212]], ['ocirc', [244]], ['ocir', [8858]], ['Ocy', [1054]], ['ocy', [1086]], ['odash', [8861]], ['Odblac', [336]], ['odblac', [337]], ['odiv', [10808]], ['odot', [8857]], ['odsold', [10684]], ['OElig', [338]], ['oelig', [339]], ['ofcir', [10687]], ['Ofr', [120082]], ['ofr', [120108]], ['ogon', [731]], ['Ograve', [210]], ['ograve', [242]], ['ogt', [10689]], ['ohbar', [10677]], ['ohm', [937]], ['oint', [8750]], ['olarr', [8634]], ['olcir', [10686]], ['olcross', [10683]], ['oline', [8254]], ['olt', [10688]], ['Omacr', [332]], ['omacr', [333]], ['Omega', [937]], ['omega', [969]], ['Omicron', [927]], ['omicron', [959]], ['omid', [10678]], ['ominus', [8854]], ['Oopf', [120134]], ['oopf', [120160]], ['opar', [10679]], ['OpenCurlyDoubleQuote', [8220]], ['OpenCurlyQuote', [8216]], ['operp', [10681]], ['oplus', [8853]], ['orarr', [8635]], ['Or', [10836]], ['or', [8744]], ['ord', [10845]], ['order', [8500]], ['orderof', [8500]], ['ordf', [170]], ['ordm', [186]], ['origof', [8886]], ['oror', [10838]], ['orslope', [10839]], ['orv', [10843]], ['oS', [9416]], ['Oscr', [119978]], ['oscr', [8500]], ['Oslash', [216]], ['oslash', [248]], ['osol', [8856]], ['Otilde', [213]], ['otilde', [245]], ['otimesas', [10806]], ['Otimes', [10807]], ['otimes', [8855]], ['Ouml', [214]], ['ouml', [246]], ['ovbar', [9021]], ['OverBar', [8254]], ['OverBrace', [9182]], ['OverBracket', [9140]], ['OverParenthesis', [9180]], ['para', [182]], ['parallel', [8741]], ['par', [8741]], ['parsim', [10995]], ['parsl', [11005]], ['part', [8706]], ['PartialD', [8706]], ['Pcy', [1055]], ['pcy', [1087]], ['percnt', [37]], ['period', [46]], ['permil', [8240]], ['perp', [8869]], ['pertenk', [8241]], ['Pfr', [120083]], ['pfr', [120109]], ['Phi', [934]], ['phi', [966]], ['phiv', [981]], ['phmmat', [8499]], ['phone', [9742]], ['Pi', [928]], ['pi', [960]], ['pitchfork', [8916]], ['piv', [982]], ['planck', [8463]], ['planckh', [8462]], ['plankv', [8463]], ['plusacir', [10787]], ['plusb', [8862]], ['pluscir', [10786]], ['plus', [43]], ['plusdo', [8724]], ['plusdu', [10789]], ['pluse', [10866]], ['PlusMinus', [177]], ['plusmn', [177]], ['plussim', [10790]], ['plustwo', [10791]], ['pm', [177]], ['Poincareplane', [8460]], ['pointint', [10773]], ['popf', [120161]], ['Popf', [8473]], ['pound', [163]], ['prap', [10935]], ['Pr', [10939]], ['pr', [8826]], ['prcue', [8828]], ['precapprox', [10935]], ['prec', [8826]], ['preccurlyeq', [8828]], ['Precedes', [8826]], ['PrecedesEqual', [10927]], ['PrecedesSlantEqual', [8828]], ['PrecedesTilde', [8830]], ['preceq', [10927]], ['precnapprox', [10937]], ['precneqq', [10933]], ['precnsim', [8936]], ['pre', [10927]], ['prE', [10931]], ['precsim', [8830]], ['prime', [8242]], ['Prime', [8243]], ['primes', [8473]], ['prnap', [10937]], ['prnE', [10933]], ['prnsim', [8936]], ['prod', [8719]], ['Product', [8719]], ['profalar', [9006]], ['profline', [8978]], ['profsurf', [8979]], ['prop', [8733]], ['Proportional', [8733]], ['Proportion', [8759]], ['propto', [8733]], ['prsim', [8830]], ['prurel', [8880]], ['Pscr', [119979]], ['pscr', [120005]], ['Psi', [936]], ['psi', [968]], ['puncsp', [8200]], ['Qfr', [120084]], ['qfr', [120110]], ['qint', [10764]], ['qopf', [120162]], ['Qopf', [8474]], ['qprime', [8279]], ['Qscr', [119980]], ['qscr', [120006]], ['quaternions', [8461]], ['quatint', [10774]], ['quest', [63]], ['questeq', [8799]], ['quot', [34]], ['QUOT', [34]], ['rAarr', [8667]], ['race', [8765, 817]], ['Racute', [340]], ['racute', [341]], ['radic', [8730]], ['raemptyv', [10675]], ['rang', [10217]], ['Rang', [10219]], ['rangd', [10642]], ['range', [10661]], ['rangle', [10217]], ['raquo', [187]], ['rarrap', [10613]], ['rarrb', [8677]], ['rarrbfs', [10528]], ['rarrc', [10547]], ['rarr', [8594]], ['Rarr', [8608]], ['rArr', [8658]], ['rarrfs', [10526]], ['rarrhk', [8618]], ['rarrlp', [8620]], ['rarrpl', [10565]], ['rarrsim', [10612]], ['Rarrtl', [10518]], ['rarrtl', [8611]], ['rarrw', [8605]], ['ratail', [10522]], ['rAtail', [10524]], ['ratio', [8758]], ['rationals', [8474]], ['rbarr', [10509]], ['rBarr', [10511]], ['RBarr', [10512]], ['rbbrk', [10099]], ['rbrace', [125]], ['rbrack', [93]], ['rbrke', [10636]], ['rbrksld', [10638]], ['rbrkslu', [10640]], ['Rcaron', [344]], ['rcaron', [345]], ['Rcedil', [342]], ['rcedil', [343]], ['rceil', [8969]], ['rcub', [125]], ['Rcy', [1056]], ['rcy', [1088]], ['rdca', [10551]], ['rdldhar', [10601]], ['rdquo', [8221]], ['rdquor', [8221]], ['rdsh', [8627]], ['real', [8476]], ['realine', [8475]], ['realpart', [8476]], ['reals', [8477]], ['Re', [8476]], ['rect', [9645]], ['reg', [174]], ['REG', [174]], ['ReverseElement', [8715]], ['ReverseEquilibrium', [8651]], ['ReverseUpEquilibrium', [10607]], ['rfisht', [10621]], ['rfloor', [8971]], ['rfr', [120111]], ['Rfr', [8476]], ['rHar', [10596]], ['rhard', [8641]], ['rharu', [8640]], ['rharul', [10604]], ['Rho', [929]], ['rho', [961]], ['rhov', [1009]], ['RightAngleBracket', [10217]], ['RightArrowBar', [8677]], ['rightarrow', [8594]], ['RightArrow', [8594]], ['Rightarrow', [8658]], ['RightArrowLeftArrow', [8644]], ['rightarrowtail', [8611]], ['RightCeiling', [8969]], ['RightDoubleBracket', [10215]], ['RightDownTeeVector', [10589]], ['RightDownVectorBar', [10581]], ['RightDownVector', [8642]], ['RightFloor', [8971]], ['rightharpoondown', [8641]], ['rightharpoonup', [8640]], ['rightleftarrows', [8644]], ['rightleftharpoons', [8652]], ['rightrightarrows', [8649]], ['rightsquigarrow', [8605]], ['RightTeeArrow', [8614]], ['RightTee', [8866]], ['RightTeeVector', [10587]], ['rightthreetimes', [8908]], ['RightTriangleBar', [10704]], ['RightTriangle', [8883]], ['RightTriangleEqual', [8885]], ['RightUpDownVector', [10575]], ['RightUpTeeVector', [10588]], ['RightUpVectorBar', [10580]], ['RightUpVector', [8638]], ['RightVectorBar', [10579]], ['RightVector', [8640]], ['ring', [730]], ['risingdotseq', [8787]], ['rlarr', [8644]], ['rlhar', [8652]], ['rlm', [8207]], ['rmoustache', [9137]], ['rmoust', [9137]], ['rnmid', [10990]], ['roang', [10221]], ['roarr', [8702]], ['robrk', [10215]], ['ropar', [10630]], ['ropf', [120163]], ['Ropf', [8477]], ['roplus', [10798]], ['rotimes', [10805]], ['RoundImplies', [10608]], ['rpar', [41]], ['rpargt', [10644]], ['rppolint', [10770]], ['rrarr', [8649]], ['Rrightarrow', [8667]], ['rsaquo', [8250]], ['rscr', [120007]], ['Rscr', [8475]], ['rsh', [8625]], ['Rsh', [8625]], ['rsqb', [93]], ['rsquo', [8217]], ['rsquor', [8217]], ['rthree', [8908]], ['rtimes', [8906]], ['rtri', [9657]], ['rtrie', [8885]], ['rtrif', [9656]], ['rtriltri', [10702]], ['RuleDelayed', [10740]], ['ruluhar', [10600]], ['rx', [8478]], ['Sacute', [346]], ['sacute', [347]], ['sbquo', [8218]], ['scap', [10936]], ['Scaron', [352]], ['scaron', [353]], ['Sc', [10940]], ['sc', [8827]], ['sccue', [8829]], ['sce', [10928]], ['scE', [10932]], ['Scedil', [350]], ['scedil', [351]], ['Scirc', [348]], ['scirc', [349]], ['scnap', [10938]], ['scnE', [10934]], ['scnsim', [8937]], ['scpolint', [10771]], ['scsim', [8831]], ['Scy', [1057]], ['scy', [1089]], ['sdotb', [8865]], ['sdot', [8901]], ['sdote', [10854]], ['searhk', [10533]], ['searr', [8600]], ['seArr', [8664]], ['searrow', [8600]], ['sect', [167]], ['semi', [59]], ['seswar', [10537]], ['setminus', [8726]], ['setmn', [8726]], ['sext', [10038]], ['Sfr', [120086]], ['sfr', [120112]], ['sfrown', [8994]], ['sharp', [9839]], ['SHCHcy', [1065]], ['shchcy', [1097]], ['SHcy', [1064]], ['shcy', [1096]], ['ShortDownArrow', [8595]], ['ShortLeftArrow', [8592]], ['shortmid', [8739]], ['shortparallel', [8741]], ['ShortRightArrow', [8594]], ['ShortUpArrow', [8593]], ['shy', [173]], ['Sigma', [931]], ['sigma', [963]], ['sigmaf', [962]], ['sigmav', [962]], ['sim', [8764]], ['simdot', [10858]], ['sime', [8771]], ['simeq', [8771]], ['simg', [10910]], ['simgE', [10912]], ['siml', [10909]], ['simlE', [10911]], ['simne', [8774]], ['simplus', [10788]], ['simrarr', [10610]], ['slarr', [8592]], ['SmallCircle', [8728]], ['smallsetminus', [8726]], ['smashp', [10803]], ['smeparsl', [10724]], ['smid', [8739]], ['smile', [8995]], ['smt', [10922]], ['smte', [10924]], ['smtes', [10924, 65024]], ['SOFTcy', [1068]], ['softcy', [1100]], ['solbar', [9023]], ['solb', [10692]], ['sol', [47]], ['Sopf', [120138]], ['sopf', [120164]], ['spades', [9824]], ['spadesuit', [9824]], ['spar', [8741]], ['sqcap', [8851]], ['sqcaps', [8851, 65024]], ['sqcup', [8852]], ['sqcups', [8852, 65024]], ['Sqrt', [8730]], ['sqsub', [8847]], ['sqsube', [8849]], ['sqsubset', [8847]], ['sqsubseteq', [8849]], ['sqsup', [8848]], ['sqsupe', [8850]], ['sqsupset', [8848]], ['sqsupseteq', [8850]], ['square', [9633]], ['Square', [9633]], ['SquareIntersection', [8851]], ['SquareSubset', [8847]], ['SquareSubsetEqual', [8849]], ['SquareSuperset', [8848]], ['SquareSupersetEqual', [8850]], ['SquareUnion', [8852]], ['squarf', [9642]], ['squ', [9633]], ['squf', [9642]], ['srarr', [8594]], ['Sscr', [119982]], ['sscr', [120008]], ['ssetmn', [8726]], ['ssmile', [8995]], ['sstarf', [8902]], ['Star', [8902]], ['star', [9734]], ['starf', [9733]], ['straightepsilon', [1013]], ['straightphi', [981]], ['strns', [175]], ['sub', [8834]], ['Sub', [8912]], ['subdot', [10941]], ['subE', [10949]], ['sube', [8838]], ['subedot', [10947]], ['submult', [10945]], ['subnE', [10955]], ['subne', [8842]], ['subplus', [10943]], ['subrarr', [10617]], ['subset', [8834]], ['Subset', [8912]], ['subseteq', [8838]], ['subseteqq', [10949]], ['SubsetEqual', [8838]], ['subsetneq', [8842]], ['subsetneqq', [10955]], ['subsim', [10951]], ['subsub', [10965]], ['subsup', [10963]], ['succapprox', [10936]], ['succ', [8827]], ['succcurlyeq', [8829]], ['Succeeds', [8827]], ['SucceedsEqual', [10928]], ['SucceedsSlantEqual', [8829]], ['SucceedsTilde', [8831]], ['succeq', [10928]], ['succnapprox', [10938]], ['succneqq', [10934]], ['succnsim', [8937]], ['succsim', [8831]], ['SuchThat', [8715]], ['sum', [8721]], ['Sum', [8721]], ['sung', [9834]], ['sup1', [185]], ['sup2', [178]], ['sup3', [179]], ['sup', [8835]], ['Sup', [8913]], ['supdot', [10942]], ['supdsub', [10968]], ['supE', [10950]], ['supe', [8839]], ['supedot', [10948]], ['Superset', [8835]], ['SupersetEqual', [8839]], ['suphsol', [10185]], ['suphsub', [10967]], ['suplarr', [10619]], ['supmult', [10946]], ['supnE', [10956]], ['supne', [8843]], ['supplus', [10944]], ['supset', [8835]], ['Supset', [8913]], ['supseteq', [8839]], ['supseteqq', [10950]], ['supsetneq', [8843]], ['supsetneqq', [10956]], ['supsim', [10952]], ['supsub', [10964]], ['supsup', [10966]], ['swarhk', [10534]], ['swarr', [8601]], ['swArr', [8665]], ['swarrow', [8601]], ['swnwar', [10538]], ['szlig', [223]], ['Tab', [9]], ['target', [8982]], ['Tau', [932]], ['tau', [964]], ['tbrk', [9140]], ['Tcaron', [356]], ['tcaron', [357]], ['Tcedil', [354]], ['tcedil', [355]], ['Tcy', [1058]], ['tcy', [1090]], ['tdot', [8411]], ['telrec', [8981]], ['Tfr', [120087]], ['tfr', [120113]], ['there4', [8756]], ['therefore', [8756]], ['Therefore', [8756]], ['Theta', [920]], ['theta', [952]], ['thetasym', [977]], ['thetav', [977]], ['thickapprox', [8776]], ['thicksim', [8764]], ['ThickSpace', [8287, 8202]], ['ThinSpace', [8201]], ['thinsp', [8201]], ['thkap', [8776]], ['thksim', [8764]], ['THORN', [222]], ['thorn', [254]], ['tilde', [732]], ['Tilde', [8764]], ['TildeEqual', [8771]], ['TildeFullEqual', [8773]], ['TildeTilde', [8776]], ['timesbar', [10801]], ['timesb', [8864]], ['times', [215]], ['timesd', [10800]], ['tint', [8749]], ['toea', [10536]], ['topbot', [9014]], ['topcir', [10993]], ['top', [8868]], ['Topf', [120139]], ['topf', [120165]], ['topfork', [10970]], ['tosa', [10537]], ['tprime', [8244]], ['trade', [8482]], ['TRADE', [8482]], ['triangle', [9653]], ['triangledown', [9663]], ['triangleleft', [9667]], ['trianglelefteq', [8884]], ['triangleq', [8796]], ['triangleright', [9657]], ['trianglerighteq', [8885]], ['tridot', [9708]], ['trie', [8796]], ['triminus', [10810]], ['TripleDot', [8411]], ['triplus', [10809]], ['trisb', [10701]], ['tritime', [10811]], ['trpezium', [9186]], ['Tscr', [119983]], ['tscr', [120009]], ['TScy', [1062]], ['tscy', [1094]], ['TSHcy', [1035]], ['tshcy', [1115]], ['Tstrok', [358]], ['tstrok', [359]], ['twixt', [8812]], ['twoheadleftarrow', [8606]], ['twoheadrightarrow', [8608]], ['Uacute', [218]], ['uacute', [250]], ['uarr', [8593]], ['Uarr', [8607]], ['uArr', [8657]], ['Uarrocir', [10569]], ['Ubrcy', [1038]], ['ubrcy', [1118]], ['Ubreve', [364]], ['ubreve', [365]], ['Ucirc', [219]], ['ucirc', [251]], ['Ucy', [1059]], ['ucy', [1091]], ['udarr', [8645]], ['Udblac', [368]], ['udblac', [369]], ['udhar', [10606]], ['ufisht', [10622]], ['Ufr', [120088]], ['ufr', [120114]], ['Ugrave', [217]], ['ugrave', [249]], ['uHar', [10595]], ['uharl', [8639]], ['uharr', [8638]], ['uhblk', [9600]], ['ulcorn', [8988]], ['ulcorner', [8988]], ['ulcrop', [8975]], ['ultri', [9720]], ['Umacr', [362]], ['umacr', [363]], ['uml', [168]], ['UnderBar', [95]], ['UnderBrace', [9183]], ['UnderBracket', [9141]], ['UnderParenthesis', [9181]], ['Union', [8899]], ['UnionPlus', [8846]], ['Uogon', [370]], ['uogon', [371]], ['Uopf', [120140]], ['uopf', [120166]], ['UpArrowBar', [10514]], ['uparrow', [8593]], ['UpArrow', [8593]], ['Uparrow', [8657]], ['UpArrowDownArrow', [8645]], ['updownarrow', [8597]], ['UpDownArrow', [8597]], ['Updownarrow', [8661]], ['UpEquilibrium', [10606]], ['upharpoonleft', [8639]], ['upharpoonright', [8638]], ['uplus', [8846]], ['UpperLeftArrow', [8598]], ['UpperRightArrow', [8599]], ['upsi', [965]], ['Upsi', [978]], ['upsih', [978]], ['Upsilon', [933]], ['upsilon', [965]], ['UpTeeArrow', [8613]], ['UpTee', [8869]], ['upuparrows', [8648]], ['urcorn', [8989]], ['urcorner', [8989]], ['urcrop', [8974]], ['Uring', [366]], ['uring', [367]], ['urtri', [9721]], ['Uscr', [119984]], ['uscr', [120010]], ['utdot', [8944]], ['Utilde', [360]], ['utilde', [361]], ['utri', [9653]], ['utrif', [9652]], ['uuarr', [8648]], ['Uuml', [220]], ['uuml', [252]], ['uwangle', [10663]], ['vangrt', [10652]], ['varepsilon', [1013]], ['varkappa', [1008]], ['varnothing', [8709]], ['varphi', [981]], ['varpi', [982]], ['varpropto', [8733]], ['varr', [8597]], ['vArr', [8661]], ['varrho', [1009]], ['varsigma', [962]], ['varsubsetneq', [8842, 65024]], ['varsubsetneqq', [10955, 65024]], ['varsupsetneq', [8843, 65024]], ['varsupsetneqq', [10956, 65024]], ['vartheta', [977]], ['vartriangleleft', [8882]], ['vartriangleright', [8883]], ['vBar', [10984]], ['Vbar', [10987]], ['vBarv', [10985]], ['Vcy', [1042]], ['vcy', [1074]], ['vdash', [8866]], ['vDash', [8872]], ['Vdash', [8873]], ['VDash', [8875]], ['Vdashl', [10982]], ['veebar', [8891]], ['vee', [8744]], ['Vee', [8897]], ['veeeq', [8794]], ['vellip', [8942]], ['verbar', [124]], ['Verbar', [8214]], ['vert', [124]], ['Vert', [8214]], ['VerticalBar', [8739]], ['VerticalLine', [124]], ['VerticalSeparator', [10072]], ['VerticalTilde', [8768]], ['VeryThinSpace', [8202]], ['Vfr', [120089]], ['vfr', [120115]], ['vltri', [8882]], ['vnsub', [8834, 8402]], ['vnsup', [8835, 8402]], ['Vopf', [120141]], ['vopf', [120167]], ['vprop', [8733]], ['vrtri', [8883]], ['Vscr', [119985]], ['vscr', [120011]], ['vsubnE', [10955, 65024]], ['vsubne', [8842, 65024]], ['vsupnE', [10956, 65024]], ['vsupne', [8843, 65024]], ['Vvdash', [8874]], ['vzigzag', [10650]], ['Wcirc', [372]], ['wcirc', [373]], ['wedbar', [10847]], ['wedge', [8743]], ['Wedge', [8896]], ['wedgeq', [8793]], ['weierp', [8472]], ['Wfr', [120090]], ['wfr', [120116]], ['Wopf', [120142]], ['wopf', [120168]], ['wp', [8472]], ['wr', [8768]], ['wreath', [8768]], ['Wscr', [119986]], ['wscr', [120012]], ['xcap', [8898]], ['xcirc', [9711]], ['xcup', [8899]], ['xdtri', [9661]], ['Xfr', [120091]], ['xfr', [120117]], ['xharr', [10231]], ['xhArr', [10234]], ['Xi', [926]], ['xi', [958]], ['xlarr', [10229]], ['xlArr', [10232]], ['xmap', [10236]], ['xnis', [8955]], ['xodot', [10752]], ['Xopf', [120143]], ['xopf', [120169]], ['xoplus', [10753]], ['xotime', [10754]], ['xrarr', [10230]], ['xrArr', [10233]], ['Xscr', [119987]], ['xscr', [120013]], ['xsqcup', [10758]], ['xuplus', [10756]], ['xutri', [9651]], ['xvee', [8897]], ['xwedge', [8896]], ['Yacute', [221]], ['yacute', [253]], ['YAcy', [1071]], ['yacy', [1103]], ['Ycirc', [374]], ['ycirc', [375]], ['Ycy', [1067]], ['ycy', [1099]], ['yen', [165]], ['Yfr', [120092]], ['yfr', [120118]], ['YIcy', [1031]], ['yicy', [1111]], ['Yopf', [120144]], ['yopf', [120170]], ['Yscr', [119988]], ['yscr', [120014]], ['YUcy', [1070]], ['yucy', [1102]], ['yuml', [255]], ['Yuml', [376]], ['Zacute', [377]], ['zacute', [378]], ['Zcaron', [381]], ['zcaron', [382]], ['Zcy', [1047]], ['zcy', [1079]], ['Zdot', [379]], ['zdot', [380]], ['zeetrf', [8488]], ['ZeroWidthSpace', [8203]], ['Zeta', [918]], ['zeta', [950]], ['zfr', [120119]], ['Zfr', [8488]], ['ZHcy', [1046]], ['zhcy', [1078]], ['zigrarr', [8669]], ['zopf', [120171]], ['Zopf', [8484]], ['Zscr', [119989]], ['zscr', [120015]], ['zwj', [8205]], ['zwnj', [8204]]];
+
+ var alphaIndex = {};
+ var charIndex = {};
+
+ createIndexes(alphaIndex, charIndex);
+
+ /**
+ * @constructor
+ */
+ function Html5Entities() {}
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.prototype.decode = function(str) {
+ if (str.length === 0) {
+ return '';
+ }
+ return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) {
+ var chr;
+ if (entity.charAt(0) === "#") {
+ var code = entity.charAt(1) === 'x' ?
+ parseInt(entity.substr(2).toLowerCase(), 16) :
+ parseInt(entity.substr(1));
+
+ if (!(isNaN(code) || code < -32768 || code > 65535)) {
+ chr = String.fromCharCode(code);
+ }
+ } else {
+ chr = alphaIndex[entity];
+ }
+ return chr || s;
+ });
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.decode = function(str) {
+ return new Html5Entities().decode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.prototype.encode = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var charInfo = charIndex[str.charCodeAt(i)];
+ if (charInfo) {
+ var alpha = charInfo[str.charCodeAt(i + 1)];
+ if (alpha) {
+ i++;
+ } else {
+ alpha = charInfo[''];
+ }
+ if (alpha) {
+ result += "&" + alpha + ";";
+ i++;
+ continue;
+ }
+ }
+ result += str.charAt(i);
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.encode = function(str) {
+ return new Html5Entities().encode(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.prototype.encodeNonUTF = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var c = str.charCodeAt(i);
+ var charInfo = charIndex[c];
+ if (charInfo) {
+ var alpha = charInfo[str.charCodeAt(i + 1)];
+ if (alpha) {
+ i++;
+ } else {
+ alpha = charInfo[''];
+ }
+ if (alpha) {
+ result += "&" + alpha + ";";
+ i++;
+ continue;
+ }
+ }
+ if (c < 32 || c > 126) {
+ result += '&#' + c + ';';
+ } else {
+ result += str.charAt(i);
+ }
+ i++;
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.encodeNonUTF = function(str) {
+ return new Html5Entities().encodeNonUTF(str);
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.prototype.encodeNonASCII = function(str) {
+ var strLength = str.length;
+ if (strLength === 0) {
+ return '';
+ }
+ var result = '';
+ var i = 0;
+ while (i < strLength) {
+ var c = str.charCodeAt(i);
+ if (c <= 255) {
+ result += str[i++];
+ continue;
+ }
+ result += '&#' + c + ';';
+ i++
+ }
+ return result;
+ };
+
+ /**
+ * @param {String} str
+ * @returns {String}
+ */
+ Html5Entities.encodeNonASCII = function(str) {
+ return new Html5Entities().encodeNonASCII(str);
+ };
+
+ /**
+ * @param {Object} alphaIndex Passed by reference.
+ * @param {Object} charIndex Passed by reference.
+ */
+ function createIndexes(alphaIndex, charIndex) {
+ var i = ENTITIES.length;
+ var _results = [];
+ while (i--) {
+ var e = ENTITIES[i];
+ var alpha = e[0];
+ var chars = e[1];
+ var chr = chars[0];
+ var addChar = (chr < 32 || chr > 126) || chr === 62 || chr === 60 || chr === 38 || chr === 34 || chr === 39;
+ var charInfo;
+ if (addChar) {
+ charInfo = charIndex[chr] = charIndex[chr] || {};
+ }
+ if (chars[1]) {
+ var chr2 = chars[1];
+ alphaIndex[alpha] = String.fromCharCode(chr) + String.fromCharCode(chr2);
+ _results.push(addChar && (charInfo[chr2] = alpha));
+ } else {
+ alphaIndex[alpha] = String.fromCharCode(chr);
+ _results.push(addChar && (charInfo[''] = alpha));
+ }
+ }
+ }
+
+ module.exports = Html5Entities;
+
+
+/***/ },
+/* 14 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /**
+ * Based heavily on https://github.com/webpack/webpack/blob/
+ * c0afdf9c6abc1dd70707c594e473802a566f7b6e/hot/only-dev-server.js
+ * Original copyright Tobias Koppers @sokra (MIT license)
+ */
+
+ /* global window __webpack_hash__ */
+
+ if (false) {
+ throw new Error("[HMR] Hot Module Replacement is disabled.");
+ }
+
+ var hmrDocsUrl = "http://webpack.github.io/docs/hot-module-replacement-with-webpack.html"; // eslint-disable-line max-len
+
+ var lastHash;
+ var failureStatuses = { abort: 1, fail: 1 };
+ var applyOptions = { ignoreUnaccepted: true };
+
+ function upToDate(hash) {
+ if (hash) lastHash = hash;
+ return lastHash == __webpack_require__.h();
+ }
+
+ module.exports = function(hash, moduleMap, options) {
+ var reload = options.reload;
+ if (!upToDate(hash) && module.hot.status() == "idle") {
+ if (options.log) console.log("[HMR] Checking for updates on the server...");
+ check();
+ }
+
+ function check() {
+ var cb = function(err, updatedModules) {
+ if (err) return handleError(err);
+
+ if(!updatedModules) {
+ if (options.warn) {
+ console.warn("[HMR] Cannot find update (Full reload needed)");
+ console.warn("[HMR] (Probably because of restarting the server)");
+ }
+ performReload();
+ return null;
+ }
+
+ var applyCallback = function(applyErr, renewedModules) {
+ if (applyErr) return handleError(applyErr);
+
+ if (!upToDate()) check();
+
+ logUpdates(updatedModules, renewedModules);
+ };
+
+ var applyResult = module.hot.apply(applyOptions, applyCallback);
+ // webpack 2 promise
+ if (applyResult && applyResult.then) {
+ // HotModuleReplacement.runtime.js refers to the result as `outdatedModules`
+ applyResult.then(function(outdatedModules) {
+ applyCallback(null, outdatedModules);
+ });
+ applyResult.catch(applyCallback);
+ }
+
+ };
+
+ var result = module.hot.check(false, cb);
+ // webpack 2 promise
+ if (result && result.then) {
+ result.then(function(updatedModules) {
+ cb(null, updatedModules);
+ });
+ result.catch(cb);
+ }
+ }
+
+ function logUpdates(updatedModules, renewedModules) {
+ var unacceptedModules = updatedModules.filter(function(moduleId) {
+ return renewedModules && renewedModules.indexOf(moduleId) < 0;
+ });
+
+ if(unacceptedModules.length > 0) {
+ if (options.warn) {
+ console.warn(
+ "[HMR] The following modules couldn't be hot updated: " +
+ "(Full reload needed)\n" +
+ "This is usually because the modules which have changed " +
+ "(and their parents) do not know how to hot reload themselves. " +
+ "See " + hmrDocsUrl + " for more details."
+ );
+ unacceptedModules.forEach(function(moduleId) {
+ console.warn("[HMR] - " + moduleMap[moduleId]);
+ });
+ }
+ performReload();
+ return;
+ }
+
+ if (options.log) {
+ if(!renewedModules || renewedModules.length === 0) {
+ console.log("[HMR] Nothing hot updated.");
+ } else {
+ console.log("[HMR] Updated modules:");
+ renewedModules.forEach(function(moduleId) {
+ console.log("[HMR] - " + moduleMap[moduleId]);
+ });
+ }
+
+ if (upToDate()) {
+ console.log("[HMR] App is up to date.");
+ }
+ }
+ }
+
+ function handleError(err) {
+ if (module.hot.status() in failureStatuses) {
+ if (options.warn) {
+ console.warn("[HMR] Cannot check for update (Full reload needed)");
+ console.warn("[HMR] " + err.stack || err.message);
+ }
+ performReload();
+ return;
+ }
+ if (options.warn) {
+ console.warn("[HMR] Update check failed: " + err.stack || err.message);
+ }
+ }
+
+ function performReload() {
+ if (reload) {
+ if (options.warn) console.warn("[HMR] Reloading page");
+ window.location.reload();
+ }
+ }
+ };
+
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.MessageTypes = undefined;
+ exports.createMcuClient = createMcuClient;
+
+ var _EngineEntrance = __webpack_require__(16);
+
+ var _EngineEntrance2 = _interopRequireDefault(_EngineEntrance);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ var MCU_CLIENT = new _EngineEntrance2.default();
+ function createMcuClient() {
+ return MCU_CLIENT;
+ }
+
+ exports.MessageTypes = _MessageTypes2.default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(MCU_CLIENT, 'MCU_CLIENT', 'D:/work/McuClient/src/McuClientEngine.js');
+
+ __REACT_HOT_LOADER__.register(createMcuClient, 'createMcuClient', 'D:/work/McuClient/src/McuClientEngine.js');
+ }();
+
+ ;
+
+/***/ },
+/* 16 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Emiter2 = __webpack_require__(17);
+
+ var _Emiter3 = _interopRequireDefault(_Emiter2);
+
+ var _Sass = __webpack_require__(18);
+
+ var _Sass2 = _interopRequireDefault(_Sass);
+
+ var _mcu2 = __webpack_require__(26);
+
+ var _mcu3 = _interopRequireDefault(_mcu2);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _ConferApe = __webpack_require__(40);
+
+ var _ConferApe2 = _interopRequireDefault(_ConferApe);
+
+ var _ChatApe = __webpack_require__(48);
+
+ var _ChatApe2 = _interopRequireDefault(_ChatApe);
+
+ var _VideoApe = __webpack_require__(50);
+
+ var _VideoApe2 = _interopRequireDefault(_VideoApe);
+
+ var _DocApe = __webpack_require__(51);
+
+ var _DocApe2 = _interopRequireDefault(_DocApe);
+
+ var _WhiteBoardApe = __webpack_require__(52);
+
+ var _WhiteBoardApe2 = _interopRequireDefault(_WhiteBoardApe);
+
+ var _EngineUtils = __webpack_require__(49);
+
+ var _EngineUtils2 = _interopRequireDefault(_EngineUtils);
+
+ var _GlobalConfig = __webpack_require__(21);
+
+ var _GlobalConfig2 = _interopRequireDefault(_GlobalConfig);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+ var loger = _Loger2.default.getLoger('MessageEntrance');
+ var _sdkInfo = { "version": "v1.0.0", "author": "www.3mang.com" };
+
+ var _sass = void 0;
+ var _mcu = void 0;
+ var _confer_ape = void 0;
+ var _chat_ape = void 0;
+ var _video_ape = void 0;
+ var _doc_ape = void 0;
+ var _wb_ape = void 0;
+
+ var _initSuccessCallBackFun = void 0;
+ var _initFailureCallBackFun = void 0;
+
+ var _joinClassSuccessCallBackFun = void 0;
+ var _joinClassFailureCallBackFun = void 0;
+
+ var MessageEntrance = function (_Emiter) {
+ _inherits(MessageEntrance, _Emiter);
+
+ function MessageEntrance() {
+ _classCallCheck(this, MessageEntrance);
+
+ //sdk 信息
+ var _this = _possibleConstructorReturn(this, (MessageEntrance.__proto__ || Object.getPrototypeOf(MessageEntrance)).call(this));
+
+ _this.sdkInfo = _sdkInfo;
+ loger.log(_this.sdkInfo);
+
+ _this.on(_MessageTypes2.default.CLASS_INIT_FAILED, _this._sassInitFailedHandler.bind(_this));
+ _this.on(_MessageTypes2.default.CLASS_JOIN_FAILED, _this._joinClassFailureHandler.bind(_this));
+ _this.on(_MessageTypes2.default.DOC_SHOW, _this.docShowHandler.bind(_this));
+
+ // Sass平台层
+ _sass = _Sass2.default;
+ _sass.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+ _sass.on(_sass.SUCCESS, _this._sassVerifySuccessHandler.bind(_this));
+ _sass.on(_sass.CLASS_INIT_SUCCESS, _this._sassInitSuccessHandler.bind(_this));
+ _sass.on(_sass.CLASS_INIT_FAILED, _this._sassInitFailedHandler.bind(_this));
+ _sass.on(_sass.CLASS_GET_MEETING_PARAM, _this._h5SassGetMeetingParaSuccessHandler);
+
+ // 底层MCU消息层
+ _mcu = _mcu3.default;
+ _mcu.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+ _mcu.on(_MessageTypes2.default.CLASS_JOIN_SUCCESS, _this._joinClassSuccessHandler.bind(_this));
+
+ // 注册所有应用Ape
+ _confer_ape = new _ConferApe2.default();
+ _confer_ape.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+ _confer_ape.on(_MessageTypes2.default.DOC_SWITCH, _this.docSwitchHandler.bind(_this));
+
+ _chat_ape = new _ChatApe2.default();
+ _chat_ape.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+
+ _video_ape = new _VideoApe2.default();
+ _video_ape.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+
+ _doc_ape = new _DocApe2.default();
+ _doc_ape.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+ _doc_ape.on(_MessageTypes2.default.DOC_UPDATE, _this.docUpdateHandler.bind(_this));
+
+ _doc_ape.on(_MessageTypes2.default.DOC_DEL, _this.docDeleteHandler.bind(_this));
+
+ _wb_ape = new _WhiteBoardApe2.default();
+ _wb_ape.on('*', function (type, data) {
+ return _this._emit(type, data);
+ });
+ _wb_ape.on(_MessageTypes2.default.ANNO_UPDATE, _this.annoUpdateHandler.bind(_this));
+
+ //公开外部调用的方法
+ _this.init = _this._init;
+ _this.joinClass = _this._joinClass;
+ _this.sendChatMsg = _this._sendChatMsg;
+ _this.setDebugData = _this._setDebugData;
+ return _this;
+ }
+
+ _createClass(MessageEntrance, [{
+ key: '_init',
+ value: function _init(_param, _onSuccess, _onFailure) {
+ _initSuccessCallBackFun = _onSuccess;
+ _initFailureCallBackFun = _onFailure;
+
+ //{"meetingNumber":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0}
+ //判断传入的参数是否存在
+ if (_param == null || _EngineUtils2.default.isEmptyObject(_param)) {
+ loger.log('init初始化失败', _MessageTypes2.default.ERROR_PARAM);
+ this._emit(_MessageTypes2.default.CLASS_INIT_FAILED, _MessageTypes2.default.ERROR_PARAM);
+ return;
+ }
+ //判断必要的参数字段值
+ if (_param.meetingNumber == null || isNaN(_param.meetingNumber) || _param.portal == null) {
+ loger.log('init初始化失败', _param);
+ this._emit(_MessageTypes2.default.CLASS_INIT_FAILED, _MessageTypes2.default.ERROR_PARAM);
+ return;
+ }
+ loger.log('init', _param);
+ //保存参数
+ _GlobalConfig2.default.confId = _param.meetingNumber;
+ _GlobalConfig2.default.portal = _param.portal;
+ _GlobalConfig2.default.userRole = _param.userRole || "normal";
+ _GlobalConfig2.default.userId = _param.userId || "0";
+
+ //获取课堂校验信息
+ if (_sass) {
+ _sass.getJoinParams(_GlobalConfig2.default.getConfInfo());
+ }
+ }
+ }, {
+ key: '_joinClass',
+ value: function _joinClass(_param, _onSuccess, _onFailure) {
+ _joinClassSuccessCallBackFun = _onSuccess;
+ _joinClassFailureCallBackFun = _onFailure;
+ //{"userName":"名字","password":""}
+ if (_param == null || _EngineUtils2.default.isEmptyObject(_param)) {
+ this._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_PARAM);
+ loger.log('不能进入会议,传递的参数不对.', _param);
+ return;
+ }
+ //判断userName
+ if (_param.userName == null) {
+ loger.log('不能进入会议,传递的参数不对.名字不能为空');
+ this._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_PARAM);
+ return;
+ }
+
+ _GlobalConfig2.default.userName = _param.userName;
+ _GlobalConfig2.default.password = _param.password || "";
+
+ //开始校验
+ if (_sass) {
+ _sass.passwordAndMd5Checking(_GlobalConfig2.default.getConfInfo());
+ }
+ }
+ // 离开会议
+
+ }, {
+ key: 'leaveClass',
+ value: function leaveClass() {
+ if (_mcu) {
+ _mcu.leaveMCU();
+ }
+ }
+ // 用meetingNumber向SASS平台获取入会验证信息成功
+
+ }, {
+ key: '_sassInitSuccessHandler',
+ value: function _sassInitSuccessHandler(_data) {
+ //{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
+ if (_data) {
+ _GlobalConfig2.default.md5 = _data.md5 || ""; //这个暂时用假数据,后台接口写完就有数据了
+ _GlobalConfig2.default.msType = _data.msType || 1;
+ _GlobalConfig2.default.passwordRequired = _data.passwordRequired || false;
+ _GlobalConfig2.default.siteId = _data.siteId;
+ }
+ loger.log('向SASS平台获取入会验证信息成功.');
+ this._emit(_MessageTypes2.default.CLASS_INIT_SUCCESS, _data);
+
+ if (_initSuccessCallBackFun) {
+ _initSuccessCallBackFun(_data);
+ }
+ }
+
+ // 用meetingNumber向SASS平台获取入会验证信息失败
+
+ }, {
+ key: '_sassInitFailedHandler',
+ value: function _sassInitFailedHandler() {
+ loger.log('向SASS平台获取入会验证信息失败.');
+ //this._emit(MessageTypes.CLASS_INIT_FAILED);
+ if (_initFailureCallBackFun) {
+ _initFailureCallBackFun();
+ }
+ }
+
+ //使用固定的假数据
+
+ }, {
+ key: '_setDebugData',
+ value: function _setDebugData(_data) {
+ loger.log("setDebugData " + _data);
+ _GlobalConfig2.default.setDebugData(_data);
+ }
+
+ // 通过SASS平台验证
+
+ }, {
+ key: '_sassVerifySuccessHandler',
+ value: function _sassVerifySuccessHandler(_data) {
+ loger.log('加入底层MCU会议.');
+ if (_mcu) {
+ _mcu.joinMCU(_GlobalConfig2.default.getConfInfo());
+ }
+ }
+ //获取会议所有参数
+
+ }, {
+ key: '_h5SassGetMeetingParaSuccessHandler',
+ value: function _h5SassGetMeetingParaSuccessHandler(_data) {
+ loger.log('获取getMeetingParam完成.');
+ _GlobalConfig2.default.meetingParam = _data;
+ loger.log(_data);
+ }
+
+ // MCU 会议成功
+
+ }, {
+ key: '_joinClassSuccessHandler',
+ value: function _joinClassSuccessHandler() {
+ loger.log('MCU 会议成功.');
+ if (_sass) {
+ _sass.getClassDetail(); //会议信息
+ _sass.getMeetingParam(); //会议参数大全
+ }
+ if (_joinClassSuccessCallBackFun) {
+ _joinClassSuccessCallBackFun();
+ }
+ }
+ // MCU 会议失败
+
+ }, {
+ key: '_joinClassFailureHandler',
+ value: function _joinClassFailureHandler(_data) {
+ loger.log("_joinClassFailureHandler", _data);
+ if (_joinClassFailureCallBackFun) {
+ _joinClassFailureCallBackFun(_data);
+ }
+ }
+
+ // 参会处理
+
+ }, {
+ key: 'conferenceHandler',
+ value: function conferenceHandler(msg_type) {
+ var msg = {
+ type: msg_type,
+ data: null
+ };
+ this._emit(msg.type, msg);
+ }
+
+ // 发送聊天消息
+
+ }, {
+ key: '_sendChatMsg',
+ value: function _sendChatMsg(_messageInfo) {
+ if (_messageInfo === null || _EngineUtils2.default.isEmptyObject(_messageInfo)) {
+ loger.log('sendChatMsg 传递的参数不对', _messageInfo);
+ return;
+ }
+ if (_chat_ape) {
+ _chat_ape.sendChatMsg(_messageInfo);
+ }
+ }
+
+ // 白板笔记更新
+
+ }, {
+ key: 'annoUpdateHandler',
+ value: function annoUpdateHandler(annoInfo) {
+ var activeDocId = _confer_ape.activeDocId;
+ var docItem = _doc_ape.docList[activeDocId];
+ if (docItem && annoInfo.id == docItem.wbid) {
+ this._emit(_MessageTypes2.default.DOC_ANNO, annoInfo);
+ }
+ }
+
+ // 文档变更-笔记处理
+
+ }, {
+ key: 'docShowHandler',
+ value: function docShowHandler(docItem) {
+ loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo);
+ var annoInfo = _wb_ape.annoInfos[docItem.wbid];
+ if (annoInfo) {
+ this._emit(_MessageTypes2.default.DOC_ANNO, annoInfo);
+ } else {
+ this._emit(_MessageTypes2.default.DOC_ANNO);
+ }
+ }
+
+ // 文档切换
+
+ }, {
+ key: 'docSwitchHandler',
+ value: function docSwitchHandler() {
+ var activeDocId = _confer_ape.activeDocId;
+ loger.log('Switch Doc Active -> ' + activeDocId);
+ var docItem = _doc_ape.docList[activeDocId];
+ if (docItem) {
+ this._emit(_MessageTypes2.default.DOC_SHOW, docItem);
+ }
+ }
+
+ // 文档变更
+
+ }, {
+ key: 'docUpdateHandler',
+ value: function docUpdateHandler(docItem) {
+ loger.log('Doc UpdateId ->' + docItem.id + '| activeDocId ->' + _confer_ape.activeDocId);
+ if (docItem.id == _confer_ape.activeDocId) {
+ this._emit(_MessageTypes2.default.DOC_SHOW, docItem);
+ }
+ }
+
+ //文档删除
+
+ }, {
+ key: 'docDeleteHandler',
+ value: function docDeleteHandler(docItem) {
+ if (docItem.id == _confer_ape.activeDocId) {
+ this._emit(_MessageTypes2.default.DOC_DEL, docItem);
+ }
+ }
+ }]);
+
+ return MessageEntrance;
+ }(_Emiter3.default);
+
+ var _default = MessageEntrance;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_sdkInfo, '_sdkInfo', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_sass, '_sass', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_mcu, '_mcu', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_confer_ape, '_confer_ape', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_chat_ape, '_chat_ape', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_video_ape, '_video_ape', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_doc_ape, '_doc_ape', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_wb_ape, '_wb_ape', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_initSuccessCallBackFun, '_initSuccessCallBackFun', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_initFailureCallBackFun, '_initFailureCallBackFun', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_joinClassSuccessCallBackFun, '_joinClassSuccessCallBackFun', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_joinClassFailureCallBackFun, '_joinClassFailureCallBackFun', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(MessageEntrance, 'MessageEntrance', 'D:/work/McuClient/src/EngineEntrance.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/EngineEntrance.js');
+ }();
+
+ ;
+
+/***/ },
+/* 17 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ var Emiter = function () {
+ function Emiter() {
+ _classCallCheck(this, Emiter);
+
+ this.MAPS = {};
+ }
+
+ _createClass(Emiter, [{
+ key: 'on',
+ value: function on(eid, elistener) {
+ if (eid && elistener) {
+ var stub = this.MAPS[eid];
+ if (!stub) {
+ return this.MAPS[eid] = [elistener];
+ }
+ stub.push(elistener);
+ }
+ }
+ }, {
+ key: 'off',
+ value: function off(eid, elistener) {
+ if (eid) {
+ var stub = this.MAPS[eid];
+ if (stub) {
+ if (elistener) {
+ return stub.splice(stub.indexOf(elistener), 1);
+ }
+ stub.length = 0;
+ }
+ }
+ }
+ }, {
+ key: '_emit',
+ value: function _emit(eid, data) {
+ if (eid) {
+ //eid=* broadcast
+ var asteriskStub = this.MAPS['*'];
+ if (asteriskStub && asteriskStub.length) {
+ asteriskStub.forEach(function (elistener) {
+ elistener(eid, data);
+ });
+ }
+
+ // eid= normal
+ var stub = this.MAPS[eid];
+ if (stub && stub.length) {
+ stub.forEach(function (elistener) {
+ elistener(data);
+ });
+ }
+ }
+ }
+ }]);
+
+ return Emiter;
+ }();
+
+ var _default = Emiter;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(Emiter, 'Emiter', 'D:/work/McuClient/src/Emiter.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/Emiter.js');
+ }();
+
+ ;
+
+/***/ },
+/* 18 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Emiter2 = __webpack_require__(17);
+
+ var _Emiter3 = _interopRequireDefault(_Emiter2);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _GlobalConfig = __webpack_require__(21);
+
+ var _GlobalConfig2 = _interopRequireDefault(_GlobalConfig);
+
+ var _md = __webpack_require__(22);
+
+ var _md2 = _interopRequireDefault(_md);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+ // 日志对象
+ var loger = _Loger2.default.getLoger('Sass');
+
+ var confInfo = {};
+
+ var Sass = function (_Emiter) {
+ _inherits(Sass, _Emiter);
+
+ function Sass() {
+ _classCallCheck(this, Sass);
+
+ return _possibleConstructorReturn(this, (Sass.__proto__ || Object.getPrototypeOf(Sass)).call(this));
+ }
+
+ //Sass 接口
+ //----1.校验之前的接口-----
+ //getJoinParams 获取课堂校验信息 let url = `http://${_initInfo.portal}/3m/api/meeting/joinParams.do?meetingNumber=${_initInfo.confId}&userID=${_initInfo.userId}`;
+
+ //-----2.开始校验,如果有密码先校验密码,否则直接开始MD5验证-----
+ //sendPWDChecking入会密码校验 let url = `http://${confInfo.portal}/3m/getCheckMeetinig.do?siteId=${confInfo.siteId}&classId=${confInfo.confId}&password=${confInfo.password}`;
+ //sendMD5Checking MD5校验(发起入会) let url = `http://${confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${confInfo.siteId}&meetingNumber=${confInfo.confId}&userId=${confInfo.userId}&userName=${confInfo.userName}&userType=${confInfo.userType}&passwordRequired=${confInfo.passwordRequired}&md5=${confInfo.md5}`;
+
+ //----3.验证完成后获取------
+ //getClassDetail 获取会议详情 let url = `http://${confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${confInfo.confId}`;
+ //getMeetingParam 获取会议最全参数集合 let url = `http://${confInfo.portal}/3m/api/meeting/detail.do?meetingNumber=${confInfo.confId}×tamp=${timestamp}&authId=${authId}`;
+
+
+ //Sass获取课堂校验信息
+
+
+ _createClass(Sass, [{
+ key: 'getJoinParams',
+ value: function getJoinParams(_initInfo) {
+ var _this2 = this;
+
+ loger.log('Sass获取课堂校验信息', _initInfo);
+ /* 获取用于加入课堂的参数
+ /3m/api/meeting/joinParams.do
+ 参数 (application/x-www-form-urlencoded):
+ 名称 类型 可选 默认值 说明
+ meetingNumber String 否 null 课堂号
+ userID String 是 0 用户id
+ 返回 (application/json):
+ 名称 类型 说明
+ code int 0 正常
+ 1 课堂号必填
+ 2 无效的课堂号
+ 3 没有对应的站点
+ 4 站点已过期
+ siteId String 站点号
+ passwordRequired Boolean 是否需要输入密码
+ md5 String 用于后续加入课堂验证
+ msType int 媒体服务器类型
+ */
+ var url = 'http://' + _initInfo.portal + '/3m/api/meeting/joinParams.do?meetingNumber=' + _initInfo.confId + '&userID=' + _initInfo.userId;
+ loger.log('Sass获取课堂校验信息.', url);
+ fetch(url, {
+ timeout: 5000
+ }).then(function (ret) {
+ if (ret.ok) {
+ return ret.json();
+ } else {
+ loger.error('Sass\u83B7\u53D6\u8BFE\u5802\u6821\u9A8C\u4FE1\u606F-\u7F51\u7EDC\u5F02\u5E38.\u72B6\u6001\u7801:' + ret.status);
+ _this2._emit(Sass.CLASS_INIT_FAILED);
+ throw '';
+ }
+ }).then(function (ret) {
+ if (ret.code === 0) {
+ loger.log('Sass获取课堂校验信息完成');
+ _this2._emit(Sass.CLASS_INIT_SUCCESS, ret);
+ } else {
+ loger.warn('Sass获取课堂校验信息失败.');
+ _this2._emit(Sass.CLASS_INIT_FAILED);
+ }
+ }).catch(function (err) {
+ loger.error('Sass\u83B7\u53D6\u8BFE\u5802\u6821\u9A8C\u4FE1\u606F\u5F02\u5E38.\u72B6\u6001\u7801:' + err);
+ _this2._emit(Sass.CLASS_INIT_FAILED, err);
+ });
+ }
+
+ // Sass校验开始
+
+ }, {
+ key: 'passwordAndMd5Checking',
+ value: function passwordAndMd5Checking(_param) {
+ loger.log('发起Sass校验', _param);
+ confInfo = _param;
+ // 密码校验
+ if (confInfo.passwordRequired === 'true' || confInfo.passwordRequired === true) {
+ this.sendPWDChecking();
+ return;
+ }
+ // MD5校验
+ this.sendMD5Checking();
+ }
+
+ // 入会密码校验
+
+ }, {
+ key: 'sendPWDChecking',
+ value: function sendPWDChecking() {
+ var _this3 = this;
+
+ var url = 'http://' + confInfo.portal + '/3m/getCheckMeetinig.do?siteId=' + confInfo.siteId + '&classId=' + confInfo.confId + '&password=' + confInfo.password;
+
+ loger.log('会议密码校验', url);
+ fetch(url, {
+ timeout: 5000
+ }).then(function (ret) {
+ if (ret.status === 200) {
+ return ret.text();
+ } else {
+ loger.error('\u4F1A\u8BAE\u5BC6\u7801\u6821\u9A8C-\u7F51\u7EDC\u5F02\u5E38.\u72B6\u6001\u7801:' + ret.status);
+ _this3._emit(_MessageTypes2.default.NET_ERROR);
+ throw '';
+ }
+ }).then(function (ret) {
+ if (ret === 'false') {
+ loger.error('\u4F1A\u8BAE\u5BC6\u7801\u6821\u9A8C-\u5931\u8D25.');
+ _this3._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_CLASS_PASSWORD_WRONG);
+ return;
+ }
+ if (ret === 'true') {
+ loger.log('\u4F1A\u8BAE\u5BC6\u7801\u6821\u9A8C-\u6210\u529F.');
+ _this3.sendMD5Checking();
+ return;
+ }
+ loger.error('\u4F1A\u8BAE\u5BC6\u7801\u6821\u9A8C-\u534F\u8BAE\u5F02\u5E38.');
+ _this3._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_CLASS_PROTOCOL_WRONG);
+ }).catch(function (err) {
+ loger.error('\u4F1A\u8BAE\u5BC6\u7801\u6821\u9A8C-\u5F02\u5E38.\u72B6\u6001\u7801:' + err);
+ _this3._emit(_MessageTypes2.default.NET_ERROR);
+ });
+ }
+
+ // 发起入会
+
+ }, {
+ key: 'sendMD5Checking',
+ value: function sendMD5Checking() {
+ var _this4 = this;
+
+ var url = 'http://' + confInfo.portal + '/3m/meeting/md5CheckMeeting.do?siteId=' + confInfo.siteId + '&meetingNumber=' + confInfo.confId + '&userId=' + confInfo.userId + '&userName=' + confInfo.userName + '&userType=' + confInfo.userType + '&nopassword=' + confInfo.passwordRequired + '&md5=' + confInfo.md5;
+ loger.log('H5SassMD5校验', url);
+ fetch(url, {
+ timeout: 5000
+ }).then(function (ret) {
+ if (ret.status === 200) {
+ return ret.json();
+ } else {
+ loger.error('H5SassMD5\u6821\u9A8C-\u7F51\u7EDC\u5F02\u5E38.\u72B6\u6001\u7801:' + ret.status);
+ _this4._emit(_MessageTypes2.default.NET_ERROR);
+ throw '';
+ }
+ }).then(function (ret) {
+ if (ret.flag == "true") {
+ if (ret.h5_mcu_list) {
+ var server = ret.h5_mcu_list.split(";")[0];
+ confInfo.MCUServerIP = server.split(":")[0];
+ confInfo.MCUServerPort = server.split(":")[1];
+
+ _GlobalConfig2.default.MCUServerIP = confInfo.MCUServerIP;
+ _GlobalConfig2.default.MCUServerPort = confInfo.MCUServerPort;
+ }
+ confInfo.maxVideoChannels = ret.maxVideoChannels;
+ confInfo.maxAudioChannels = ret.maxAudioChannels;
+ confInfo.maxMediaChannels = confInfo.maxVideoChannels + confInfo.maxAudioChannels;
+
+ _GlobalConfig2.default.maxVideoChannels = confInfo.maxVideoChannels;
+ _GlobalConfig2.default.maxAudioChannels = confInfo.maxAudioChannels;
+ _GlobalConfig2.default.maxMediaChannels = confInfo.maxMediaChannels;
+ loger.log('H5Sass校验完成');
+ console.log(ret);
+ _this4._emit(Sass.SUCCESS, ret);
+ } else {
+ loger.log('H5SassMD5校验-失败.');
+ _this4._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_CLASS_MD5_WRONG);
+ }
+ }).catch(function (err) {
+ loger.error('H5SassMD5\u6821\u9A8C-\u5F02\u5E38.\u72B6\u6001\u7801:' + err);
+ _this4._emit(_MessageTypes2.default.NET_ERROR);
+ });
+ }
+
+ // 获取会议详情
+
+ }, {
+ key: 'getClassDetail',
+ value: function getClassDetail() {
+ var _this5 = this;
+
+ var url = 'http://' + confInfo.portal + '/3m/meeting/getClassH5.do?classNumber=' + confInfo.confId;
+ loger.log('H5Sass获取Class详情.', url);
+ fetch(url, {
+ timeout: 5000
+ }).then(function (ret) {
+ if (ret.ok) {
+ return ret.json();
+ } else {
+ loger.error('H5Sass\u83B7\u53D6Class\u8BE6\u60C5-\u7F51\u7EDC\u5F02\u5E38.\u72B6\u6001\u7801:' + ret.status);
+ _this5._emit(_MessageTypes2.default.NET_ERROR);
+ throw '';
+ }
+ }).then(function (ret) {
+ if (ret.errorCode === 0) {
+ loger.log('H5Sass获取Class详情完成');
+ _this5._emit(_MessageTypes2.default.CLASS_SHOW_DETAIL, ret);
+ } else {
+ loger.warn('H5Sass获取Class详情失败.');
+ _this5._emit(_MessageTypes2.default.NET_ERROR);
+ }
+ }).catch(function (err) {
+ loger.error('H5Sass\u83B7\u53D6Class\u8BE6\u60C5\u5F02\u5E38.\u72B6\u6001\u7801:' + err);
+ _this5._emit(_MessageTypes2.default.NET_ERROR);
+ });
+ }
+ }, {
+ key: 'getMeetingParam',
+ value: function getMeetingParam() {
+ var _this6 = this;
+
+ /*
+ 参数 (application/x-www-form-urlencoded):
+ 名称 类型 可选 默认值 说明
+ meetingNumber String 否 null 课堂号
+ timestamp String 否 null 时间戳
+ authId String 否 null 验证信息 md5(meetingNumber + timestamp)
+ 返回 (application/json):
+ 名称 类型 说明
+ code int 0 正常
+ 1 课堂号必填
+ 2 无效的课堂号
+ 3 没有对应的站点
+ 4 站点已过期
+ siteId String 站点号
+ meetingNumber String 课堂号
+ */
+ var timestamp = new Date().getTime();
+ var authId = (0, _md2.default)(confInfo.confId + "" + timestamp); //课堂号+时间戳 的字符串,转成MD5
+ var url = 'http://' + confInfo.portal + '/3m/api/meeting/detail.do?meetingNumber=' + confInfo.confId + '×tamp=' + timestamp + '&authId=' + authId;
+ loger.log('H5Sass获取getMeetingParam ', url);
+ fetch(url, {
+ timeout: 5000
+ }).then(function (ret) {
+ if (ret.ok) {
+ return ret.json();
+ } else {
+ loger.error('H5Sass\u83B7\u53D6getMeetingParam-\u7F51\u7EDC\u5F02\u5E38.\u72B6\u6001\u7801:' + ret.status);
+ _this6._emit(_MessageTypes2.default.NET_ERROR);
+ throw '';
+ }
+ }).then(function (ret) {
+ if (ret.code === 0) {
+ loger.log('H5Sass获取getMeetingParam完成');
+ _this6._emit(Sass.CLASS_GET_MEETING_PARAM, ret);
+ } else {
+ loger.warn('H5Sass获取getMeetingParam失败.');
+ _this6._emit(_MessageTypes2.default.NET_ERROR);
+ }
+ }).catch(function (err) {
+ loger.error('H5Sass\u83B7\u53D6getMeetingParam\u5F02\u5E38.\u72B6\u6001\u7801:' + err);
+ _this6._emit(_MessageTypes2.default.NET_ERROR);
+ });
+ }
+ }]);
+
+ return Sass;
+ }(_Emiter3.default);
+
+ Sass.prototype.SUCCESS = Sass.SUCCESS = 'h5sass.success';
+ Sass.prototype.CLASS_INIT_SUCCESS = Sass.CLASS_INIT_SUCCESS = 'sass.class.init.success';
+ Sass.prototype.CLASS_INIT_FAILED = Sass.CLASS_INIT_FAILED = 'sass.class.init.failed';
+ Sass.prototype.CLASS_GET_MEETING_PARAM = Sass.CLASS_GET_MEETING_PARAM = 'class_getMeetingParam.message';
+
+ var _default = new Sass();
+
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/Sass.js');
+
+ __REACT_HOT_LOADER__.register(confInfo, 'confInfo', 'D:/work/McuClient/src/Sass.js');
+
+ __REACT_HOT_LOADER__.register(Sass, 'Sass', 'D:/work/McuClient/src/Sass.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/Sass.js');
+ }();
+
+ ;
+
+/***/ },
+/* 19 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-27 22:58:47
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-08-27 23:05:53
+ // Description: LiveClass-Loger
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var Loger = function () {
+ function Loger(info) {
+ _classCallCheck(this, Loger);
+
+ this.sdkInfo = info || '';
+ this.id = this.initId();
+ }
+
+ _createClass(Loger, [{
+ key: 'initId',
+ value: function initId() {
+ var infoType = this.sdkInfo.constructor.name.toLowerCase();
+ if (infoType === 'string') {
+ return this.sdkInfo;
+ }
+ if (infoType === 'object') {
+ return this.sdkInfo.mid || '';
+ }
+ return '';
+ }
+ }, {
+ key: 'log',
+ value: function log() {
+ for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
+ msg[_key] = arguments[_key];
+ }
+
+ this._log(Loger.LOG, msg);
+ }
+ }, {
+ key: 'warn',
+ value: function warn() {
+ for (var _len2 = arguments.length, msg = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ msg[_key2] = arguments[_key2];
+ }
+
+ this._log(Loger.WARN, msg);
+ }
+ }, {
+ key: 'error',
+ value: function error() {
+ for (var _len3 = arguments.length, msg = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ msg[_key3] = arguments[_key3];
+ }
+
+ this._log(Loger.ERROR, msg);
+ }
+ }, {
+ key: '_log',
+ value: function _log(type, msg) {
+ msg = JSON.stringify(msg);
+
+ var logMsg = this.id + ' -> ' + msg;
+ if (type >= Loger.logLevel) {
+ switch (type) {
+ case Loger.LOG:
+ console.log(logMsg);
+ break;
+ case Loger.WARN:
+ console.warn(logMsg);
+ break;
+ case Loger.ERROR:
+ console.error(logMsg);
+ break;
+ }
+ }
+ }
+ }]);
+
+ return Loger;
+ }();
+
+ Loger.LOG = 0;
+ Loger.WARN = 1;
+ Loger.ERROR = 2;
+ Loger.NO = Infinity;
+ Loger.logLevel = Loger.LOG;
+
+ var _default = {
+ getLoger: function getLoger(info) {
+ return new Loger(info);
+ },
+ setLogLevel: function setLogLevel(logLevel) {
+ Loger.logLevel = logLevel;
+ },
+ LOG: Loger.LOG,
+ WARN: Loger.WARN,
+ ERROR: Loger.ERROR,
+ NO: Loger.NO
+ };
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(Loger, 'Loger', 'D:/work/McuClient/src/Loger.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/Loger.js');
+ }();
+
+ ;
+
+/***/ },
+/* 20 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-27 23:04:56
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-07 15:58:29
+ // Description: LiveClass-MessageTypes
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ function MessageTypes() {}
+
+ //--------------------事件相关的定义--------------------------------------
+ //初始化相关事件定义
+ MessageTypes.CLASS_INIT_SUCCESS = 'class.init.success'; //初始化成功
+ MessageTypes.CLASS_INIT_FAILED = 'class.init.failed'; //初始化失败
+
+ //加入会议相关事件定义
+ MessageTypes.CLASS_JOIN_FAILED = 'join.class.failed';
+ MessageTypes.CLASS_JOIN_SUCCESS = 'join.class.success';
+
+ //会议信息和操作事件定义
+ MessageTypes.CLASS_SHOW_DETAIL = 'class_detail.message';
+ MessageTypes.CLASS_SHOW_ROSTER_NUM = 'roster_num.message';
+ MessageTypes.CLASS_EXIT = 'class.exit';
+
+ //聊天模块事件定义
+ MessageTypes.CHAT_RECEIVE = 'chat.message';
+
+ //视频模块事件定义
+ MessageTypes.VIDEO_SHOW = 'video.message';
+
+ //文档模块事件定义
+ MessageTypes.DOC_SHOW = 'document.message';
+ MessageTypes.DOC_SWITCH = 'document.switch';
+ MessageTypes.DOC_UPDATE = 'document.update';
+ MessageTypes.DOC_DEL = 'document.delete';
+ MessageTypes.DOC_ANNO = 'document.anno'; //笔记
+
+ //笔记事件定义
+ MessageTypes.ANNO_UPDATE = 'anno_update';
+ MessageTypes.AUDIO_SHOW = 'audio.message';
+
+ //错误事件定义
+ MessageTypes.NET_ERROR = 'net_error';
+ MessageTypes.PRO_ERROR = 'pro_error'; //协议异常
+
+
+ //---------------错误消息定义-------------------------------------------------
+ MessageTypes.ERROR_NET = '网络异常';
+ MessageTypes.ERROR_PARAM = '参数不正确';
+
+ MessageTypes.ERROR_CLASS_JOIN_FULL = 'class.join,full'; //人数已满
+ MessageTypes.ERROR_CLASS_JOIN_CONFILICT = 'class.join.conflict'; //已经在其它地方登陆
+ MessageTypes.ERROR_CLASS_PASSWORD_WRONG = 'class.password.wrong'; //密码错误
+ MessageTypes.ERROR_CLASS_MD5_WRONG = 'class.md5.wrong'; //MD5验证失败
+ MessageTypes.ERROR_CLASS_PROTOCOL_WRONG = 'class.protocol.wrong'; //协议异常
+
+ var _default = MessageTypes;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(MessageTypes, 'MessageTypes', 'D:/work/McuClient/src/MessageTypes.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/MessageTypes.js');
+ }();
+
+ ;
+
+/***/ },
+/* 21 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
+ * 全局数据管理
+ * */
+
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ var loger = _Loger2.default.getLoger('GlobalConfig');
+
+ var GlobalConfig = function () {
+ function GlobalConfig() {
+ _classCallCheck(this, GlobalConfig);
+ }
+
+ _createClass(GlobalConfig, null, [{
+ key: 'setDebugData',
+ value: function setDebugData(_deBugData) {
+ this.isDebug = true;
+ this.deBugData = _deBugData;
+ }
+ }, {
+ key: 'getConfInfo',
+ value: function getConfInfo() {
+ if (this.isDebug) {
+
+ //这几个属性是sass验证完成之后返回的,启动MCU的时候需要
+ this.deBugData.MCUServerIP = this.MCUServerIP;
+ this.deBugData.MCUServerPort = this.MCUServerPort;
+ this.deBugData.maxVideoChannels = this.maxVideoChannels;
+ this.deBugData.maxAudioChannels = this.maxAudioChannels;
+ this.deBugData.maxMediaChannels = this.maxMediaChannels;
+
+ return this.deBugData;
+ } else {
+ return {
+ "siteId": this.siteId,
+ "confId": this.confId,
+ "h5Module": this.h5Module,
+ "nodeId": this.nodeId,
+ "topNodeID": this.topNodeID,
+ "userRole": this.userRole,
+ "role": this.role,
+ "isHost": this.isHost,
+ "classRole": this.classRole,
+ "userId": this.userId,
+ "userName": this.userName,
+ "password": this.password,
+ "userType": this.userType,
+ "passwordRequired": this.passwordRequired,
+ "md5": this.md5,
+ "msType": this.msType,
+ "portal": this.portal,
+ "mcuDelay": this.mcuDelay,
+ "MCUServerIP": this.MCUServerIP,
+ "MCUServerPort": this.MCUServerPort,
+ "maxVideoChannels": this.maxVideoChannels,
+ "maxAudioChannels": this.maxAudioChannels,
+ "maxMediaChannels": this.maxMediaChannels
+ };
+ }
+ }
+ }]);
+
+ return GlobalConfig;
+ }();
+
+ GlobalConfig.siteId = "gust";
+ GlobalConfig.confId = 1653304953; //课堂号=classId=meetingNumber 之后统一修改为classId
+ GlobalConfig.nodeId = 1483947664; //随机生成
+ GlobalConfig.topNodeID = 101; //现在固定值,还不知道是做什么用
+ GlobalConfig.userRole = "normal";
+ GlobalConfig.role = 1;
+ GlobalConfig.isHost = false;
+ GlobalConfig.classRole = 0;
+ GlobalConfig.userId = 0;
+ GlobalConfig.userName = "";
+ GlobalConfig.password = "";
+ GlobalConfig.userType = 8;
+ GlobalConfig.h5Module = 0;
+ GlobalConfig.passwordRequired = false;
+ GlobalConfig.md5 = "";
+ GlobalConfig.msType = 1;
+ GlobalConfig.mcuDelay = 3000;
+ GlobalConfig.portal = "112.126.80.182:80";
+ GlobalConfig.ip = "112.126.80.182";
+ GlobalConfig.port = "80";
+ GlobalConfig.MCUServerIP = "114.215.195.70";
+ GlobalConfig.MCUServerPort = 9003;
+ GlobalConfig.maxVideoChannels = 1;
+ GlobalConfig.maxAudioChannels = 1;
+ GlobalConfig.maxMediaChannels = 2;
+ GlobalConfig.isDebug = false;
+ GlobalConfig.deBugData = {};
+
+ GlobalConfig.meetingParam = {};
+ var _default = GlobalConfig;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/GlobalConfig.js');
+
+ __REACT_HOT_LOADER__.register(GlobalConfig, 'GlobalConfig', 'D:/work/McuClient/src/GlobalConfig.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/GlobalConfig.js');
+ }();
+
+ ;
+
+/***/ },
+/* 22 */
+/***/ function(module, exports, __webpack_require__) {
+
+ (function(){
+ var crypt = __webpack_require__(23),
+ utf8 = __webpack_require__(24).utf8,
+ isBuffer = __webpack_require__(25),
+ bin = __webpack_require__(24).bin,
+
+ // The core
+ md5 = function (message, options) {
+ // Convert to byte array
+ if (message.constructor == String)
+ if (options && options.encoding === 'binary')
+ message = bin.stringToBytes(message);
+ else
+ message = utf8.stringToBytes(message);
+ else if (isBuffer(message))
+ message = Array.prototype.slice.call(message, 0);
+ else if (!Array.isArray(message))
+ message = message.toString();
+ // else, assume byte array already
+
+ var m = crypt.bytesToWords(message),
+ l = message.length * 8,
+ a = 1732584193,
+ b = -271733879,
+ c = -1732584194,
+ d = 271733878;
+
+ // Swap endian
+ for (var i = 0; i < m.length; i++) {
+ m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
+ ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
+ }
+
+ // Padding
+ m[l >>> 5] |= 0x80 << (l % 32);
+ m[(((l + 64) >>> 9) << 4) + 14] = l;
+
+ // Method shortcuts
+ var FF = md5._ff,
+ GG = md5._gg,
+ HH = md5._hh,
+ II = md5._ii;
+
+ for (var i = 0; i < m.length; i += 16) {
+
+ var aa = a,
+ bb = b,
+ cc = c,
+ dd = d;
+
+ a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
+ d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
+ c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
+ b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
+ a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
+ d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
+ c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
+ b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
+ a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
+ d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
+ c = FF(c, d, a, b, m[i+10], 17, -42063);
+ b = FF(b, c, d, a, m[i+11], 22, -1990404162);
+ a = FF(a, b, c, d, m[i+12], 7, 1804603682);
+ d = FF(d, a, b, c, m[i+13], 12, -40341101);
+ c = FF(c, d, a, b, m[i+14], 17, -1502002290);
+ b = FF(b, c, d, a, m[i+15], 22, 1236535329);
+
+ a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
+ d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
+ c = GG(c, d, a, b, m[i+11], 14, 643717713);
+ b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
+ a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
+ d = GG(d, a, b, c, m[i+10], 9, 38016083);
+ c = GG(c, d, a, b, m[i+15], 14, -660478335);
+ b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
+ a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
+ d = GG(d, a, b, c, m[i+14], 9, -1019803690);
+ c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
+ b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
+ a = GG(a, b, c, d, m[i+13], 5, -1444681467);
+ d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
+ c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
+ b = GG(b, c, d, a, m[i+12], 20, -1926607734);
+
+ a = HH(a, b, c, d, m[i+ 5], 4, -378558);
+ d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
+ c = HH(c, d, a, b, m[i+11], 16, 1839030562);
+ b = HH(b, c, d, a, m[i+14], 23, -35309556);
+ a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
+ d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
+ c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
+ b = HH(b, c, d, a, m[i+10], 23, -1094730640);
+ a = HH(a, b, c, d, m[i+13], 4, 681279174);
+ d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
+ c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
+ b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
+ a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
+ d = HH(d, a, b, c, m[i+12], 11, -421815835);
+ c = HH(c, d, a, b, m[i+15], 16, 530742520);
+ b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
+
+ a = II(a, b, c, d, m[i+ 0], 6, -198630844);
+ d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
+ c = II(c, d, a, b, m[i+14], 15, -1416354905);
+ b = II(b, c, d, a, m[i+ 5], 21, -57434055);
+ a = II(a, b, c, d, m[i+12], 6, 1700485571);
+ d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
+ c = II(c, d, a, b, m[i+10], 15, -1051523);
+ b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
+ a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
+ d = II(d, a, b, c, m[i+15], 10, -30611744);
+ c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
+ b = II(b, c, d, a, m[i+13], 21, 1309151649);
+ a = II(a, b, c, d, m[i+ 4], 6, -145523070);
+ d = II(d, a, b, c, m[i+11], 10, -1120210379);
+ c = II(c, d, a, b, m[i+ 2], 15, 718787259);
+ b = II(b, c, d, a, m[i+ 9], 21, -343485551);
+
+ a = (a + aa) >>> 0;
+ b = (b + bb) >>> 0;
+ c = (c + cc) >>> 0;
+ d = (d + dd) >>> 0;
+ }
+
+ return crypt.endian([a, b, c, d]);
+ };
+
+ // Auxiliary functions
+ md5._ff = function (a, b, c, d, x, s, t) {
+ var n = a + (b & c | ~b & d) + (x >>> 0) + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ };
+ md5._gg = function (a, b, c, d, x, s, t) {
+ var n = a + (b & d | c & ~d) + (x >>> 0) + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ };
+ md5._hh = function (a, b, c, d, x, s, t) {
+ var n = a + (b ^ c ^ d) + (x >>> 0) + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ };
+ md5._ii = function (a, b, c, d, x, s, t) {
+ var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ };
+
+ // Package private blocksize
+ md5._blocksize = 16;
+ md5._digestsize = 16;
+
+ module.exports = function (message, options) {
+ if (message === undefined || message === null)
+ throw new Error('Illegal argument ' + message);
+
+ var digestbytes = crypt.wordsToBytes(md5(message, options));
+ return options && options.asBytes ? digestbytes :
+ options && options.asString ? bin.bytesToString(digestbytes) :
+ crypt.bytesToHex(digestbytes);
+ };
+
+ })();
+
+
+/***/ },
+/* 23 */
+/***/ function(module, exports) {
+
+ (function() {
+ var base64map
+ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
+
+ crypt = {
+ // Bit-wise rotation left
+ rotl: function(n, b) {
+ return (n << b) | (n >>> (32 - b));
+ },
+
+ // Bit-wise rotation right
+ rotr: function(n, b) {
+ return (n << (32 - b)) | (n >>> b);
+ },
+
+ // Swap big-endian to little-endian and vice versa
+ endian: function(n) {
+ // If number given, swap endian
+ if (n.constructor == Number) {
+ return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
+ }
+
+ // Else, assume array and swap all items
+ for (var i = 0; i < n.length; i++)
+ n[i] = crypt.endian(n[i]);
+ return n;
+ },
+
+ // Generate an array of any length of random bytes
+ randomBytes: function(n) {
+ for (var bytes = []; n > 0; n--)
+ bytes.push(Math.floor(Math.random() * 256));
+ return bytes;
+ },
+
+ // Convert a byte array to big-endian 32-bit words
+ bytesToWords: function(bytes) {
+ for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
+ words[b >>> 5] |= bytes[i] << (24 - b % 32);
+ return words;
+ },
+
+ // Convert big-endian 32-bit words to a byte array
+ wordsToBytes: function(words) {
+ for (var bytes = [], b = 0; b < words.length * 32; b += 8)
+ bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
+ return bytes;
+ },
+
+ // Convert a byte array to a hex string
+ bytesToHex: function(bytes) {
+ for (var hex = [], i = 0; i < bytes.length; i++) {
+ hex.push((bytes[i] >>> 4).toString(16));
+ hex.push((bytes[i] & 0xF).toString(16));
+ }
+ return hex.join('');
+ },
+
+ // Convert a hex string to a byte array
+ hexToBytes: function(hex) {
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
+ bytes.push(parseInt(hex.substr(c, 2), 16));
+ return bytes;
+ },
+
+ // Convert a byte array to a base-64 string
+ bytesToBase64: function(bytes) {
+ for (var base64 = [], i = 0; i < bytes.length; i += 3) {
+ var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
+ for (var j = 0; j < 4; j++)
+ if (i * 8 + j * 6 <= bytes.length * 8)
+ base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
+ else
+ base64.push('=');
+ }
+ return base64.join('');
+ },
+
+ // Convert a base-64 string to a byte array
+ base64ToBytes: function(base64) {
+ // Remove non-base-64 characters
+ base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
+
+ for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
+ imod4 = ++i % 4) {
+ if (imod4 == 0) continue;
+ bytes.push(((base64map.indexOf(base64.charAt(i - 1))
+ & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
+ | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
+ }
+ return bytes;
+ }
+ };
+
+ module.exports = crypt;
+ })();
+
+
+/***/ },
+/* 24 */
+/***/ function(module, exports) {
+
+ var charenc = {
+ // UTF-8 encoding
+ utf8: {
+ // Convert a string to a byte array
+ stringToBytes: function(str) {
+ return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
+ },
+
+ // Convert a byte array to a string
+ bytesToString: function(bytes) {
+ return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
+ }
+ },
+
+ // Binary encoding
+ bin: {
+ // Convert a string to a byte array
+ stringToBytes: function(str) {
+ for (var bytes = [], i = 0; i < str.length; i++)
+ bytes.push(str.charCodeAt(i) & 0xFF);
+ return bytes;
+ },
+
+ // Convert a byte array to a string
+ bytesToString: function(bytes) {
+ for (var str = [], i = 0; i < bytes.length; i++)
+ str.push(String.fromCharCode(bytes[i]));
+ return str.join('');
+ }
+ }
+ };
+
+ module.exports = charenc;
+
+
+/***/ },
+/* 25 */
+/***/ function(module, exports) {
+
+ /*!
+ * Determine if an object is a Buffer
+ *
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
+ * @license MIT
+ */
+
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
+ // Object.prototype.constructor. Remove this eventually
+ module.exports = function (obj) {
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
+ }
+
+ function isBuffer (obj) {
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
+ }
+
+ // For Node v0.10 support. Remove this eventually.
+ function isSlowBuffer (obj) {
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
+ }
+
+
+/***/ },
+/* 26 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Emiter2 = __webpack_require__(17);
+
+ var _Emiter3 = _interopRequireDefault(_Emiter2);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _everSocket = __webpack_require__(27);
+
+ var _everSocket2 = _interopRequireDefault(_everSocket);
+
+ var _index = __webpack_require__(28);
+
+ var _index2 = _interopRequireDefault(_index);
+
+ var _PduType = __webpack_require__(37);
+
+ var _PduType2 = _interopRequireDefault(_PduType);
+
+ var _PduConsts = __webpack_require__(38);
+
+ var _PduConsts2 = _interopRequireDefault(_PduConsts);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _ConferApe = __webpack_require__(40);
+
+ var _ConferApe2 = _interopRequireDefault(_ConferApe);
+
+ var _ArrayBufferUtil = __webpack_require__(42);
+
+ var _ArrayBufferUtil2 = _interopRequireDefault(_ArrayBufferUtil);
+
+ var _base64Js = __webpack_require__(47);
+
+ var _base64Js2 = _interopRequireDefault(_base64Js);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*eslint-disable*/
+
+ //import GlobalConfig from 'GlobalConfig';
+
+ var loger = _Loger2.default.getLoger('MCU');
+
+ var MCU = function (_Emiter) {
+ _inherits(MCU, _Emiter);
+
+ function MCU() {
+ _classCallCheck(this, MCU);
+
+ var _this = _possibleConstructorReturn(this, (MCU.__proto__ || Object.getPrototypeOf(MCU)).call(this));
+
+ _this._apes = {};
+ _this._everSocket = _everSocket2.default;
+ _this._everSocket.on(_everSocket2.default.OPEN, _this._everSocketOpenHandler.bind(_this));
+ _this._everSocket.on(_everSocket2.default.MESSAGE, _this._everSocketMsgReceivedHandler.bind(_this));
+ return _this;
+ }
+
+ // 注册Ape
+
+
+ _createClass(MCU, [{
+ key: 'registerApe',
+ value: function registerApe(ape) {
+ this._apes[ape._session_id] = ape;
+ }
+
+ // EverSocket建立通道完毕
+
+ }, {
+ key: '_everSocketOpenHandler',
+ value: function _everSocketOpenHandler() {
+ this._sendJoinClassRequest();
+ }
+
+ //MCU-发送加入会议请求
+
+ }, {
+ key: '_sendJoinClassRequest',
+ value: function _sendJoinClassRequest() {
+ loger.log('MCU-发送加入会议请求.');
+ var confInfo = this.confInfo;
+
+ // 创建刷新nodeId
+ confInfo.nodeId = parseInt(Date.now() / 1000);
+
+ var joinRequestPdu = new _index2.default['RCConferenceJoinRequestPdu']();
+ joinRequestPdu.type = 2;
+ joinRequestPdu.initiator = confInfo.nodeId;
+ joinRequestPdu.nodeType = _PduConsts2.default.NT_TERMINAL; //normal
+
+ var descriptorPdu = new _index2.default['RCConferenceDescriptorPdu']();
+ descriptorPdu.id = confInfo.confId;
+ descriptorPdu.name = new ArrayBuffer();
+ descriptorPdu.mode = 0;
+ descriptorPdu.capacity = 1;
+ joinRequestPdu.confDesc = descriptorPdu;
+
+ var pduMsg = _index2.default.create_connect_provider_request_pdu(joinRequestPdu.type, confInfo.nodeId, confInfo.confId, 0, _ApeConsts2.default.BROADCAST_CHANNEL_ID, true, _PduConsts2.default.DP_TOP, confInfo.topNodeID, _PduConsts2.default.SEG_ONCE);
+
+ pduMsg.set("site", confInfo.siteId);
+ pduMsg.set("userId", confInfo.userId);
+ pduMsg.set("userName", _base64Js2.default.fromByteArray(_ArrayBufferUtil2.default.strToUint8Array(confInfo.userName)));
+ pduMsg.set("userRole", confInfo.userRole);
+ pduMsg.set("deviceType", "");
+ pduMsg.set("data", joinRequestPdu.toArrayBuffer());
+
+ this._everSocket.send(pduMsg.toArrayBuffer());
+ }
+
+ // EverSocket底层消息处理
+
+ }, {
+ key: '_everSocketMsgReceivedHandler',
+ value: function _everSocketMsgReceivedHandler(data) {
+ var pduMsg = _index2.default.decode_pdu(data);
+ var pduType = pduMsg.get("type");
+ var pduData = pduMsg.get("data");
+ loger.log('MCU-FirstLayer封装消息', 'type', _index2.default.id2type(pduMsg.type), pduMsg.type, 'sessionId', (0, _ApeConsts2.default)(pduMsg.sessionId), pduMsg.sessionId);
+ switch (pduType) {
+ case _PduType2.default.RCPDU_CONNECT_PROVIDER_RESPONSE:
+ //加入会议请求返回数据处理
+ var joinConfPdu = _index2.default['RCConferenceJoinResponsePdu'].decode(pduData);
+ var pduResultCode = joinConfPdu.get("result");
+ switch (pduResultCode) {
+ case _PduConsts2.default.RET_SUCCESS:
+ //加入成功
+ this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc"));
+ this._emit(_MessageTypes2.default.CLASS_JOIN_SUCCESS, this.confInfo);
+ break;
+ case _PduConsts2.default.RET_FULL_CAPACITY:
+ this._emit(_MessageTypes2.default.CLASS_JOIN_FAILED, _MessageTypes2.default.ERROR_CLASS_JOIN_FULL);
+ //this._emit(MessageTypes.CLASS_JOIN_FULL);
+ break;
+ default:
+ loger.arn('JoinConfPdu-未知类型-等待处理.', pduResultCode);
+ break;
+ }
+ break;
+ case _PduType2.default.RCPDU_SEND_DATA_REQUEST:
+ var ape = this._apes[pduMsg.sessionId];
+ var sessionLabel = (0, _ApeConsts2.default)(pduMsg.sessionId);
+ if (ape) {
+ var subTypeLabel = _index2.default.id2type(pduMsg.subType);
+ loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType);
+ loger.log("ape._emit(" + pduMsg.subType + ", " + pduMsg.data + ")---------------------------");
+ ape._emit(pduMsg.subType, pduMsg.data);
+ } else {
+ loger.warn(sessionLabel + '尚未注册');
+ }
+ break;
+ default:
+ loger.warn('PDU-未知类型-等待处理.', pduType);
+ }
+ }
+ }, {
+ key: '_updateMCUConfInfoDesc',
+ value: function _updateMCUConfInfoDesc(mcuConfDesc) {
+ var info = this.mcuConfInfo.info;
+ info._conference_name = _ArrayBufferUtil2.default.uint8ArrayToStr(mcuConfDesc.name, 0);
+ info._capacity = mcuConfDesc.capacity;
+ info._mode = mcuConfDesc.mode;
+ }
+
+ // MU服务是否连接
+
+ }, {
+ key: 'send',
+
+
+ // 会议发送消息 -- 消息同意序列号
+ value: function send(msg) {
+ if (this.connected) {
+ loger.log('MCU-发送会议数据....', msg);
+ this._everSocket.send(msg.toArrayBuffer());
+ } else {
+ loger.log('MCU-发送会议数据失败,MCU底层通道不可用');
+ }
+ }
+
+ // 主动断开MCU连接
+
+ }, {
+ key: 'leaveMCU',
+ value: function leaveMCU() {
+ // for (let ape in this._apes) {
+ // this._apes[ape].stop();
+ // }
+ this._everSocket.end();
+ }
+
+ // 主动建立MCU连接
+
+ }, {
+ key: 'joinMCU',
+ value: function joinMCU(_confInfo) {
+ loger.log('开始建立EverSocket通道.', _confInfo);
+ _confInfo.confId = parseInt(_confInfo.confId); // confId 必须整形
+ this.confInfo = _confInfo;
+
+ var nodeInfoRecordPdu = new _index2.default['RCNodeInfoRecordPdu']();
+ nodeInfoRecordPdu.name = this.confInfo.userName;
+ nodeInfoRecordPdu.nodeId = this.confInfo.nodeId;
+ nodeInfoRecordPdu.userId = this.confInfo.userId;
+ nodeInfoRecordPdu.role = 1; //NR_NORMAL
+ nodeInfoRecordPdu.level = 0;
+
+ var conferenceRecord = {}; //RCConferenceRecord_T
+ conferenceRecord._conference_id = this.confInfo.confId;
+ conferenceRecord._top_node_id = this.confInfo.topNodeID;
+
+ this.mcuConfInfo = {}; //RCMeetingInfo_T
+ this.mcuConfInfo.self = nodeInfoRecordPdu;
+ this.mcuConfInfo.info = conferenceRecord;
+
+ // 内部mcuConfInfo
+ this.confInfo.mcuConfInfo = this.mcuConfInfo;
+
+ //开启EverSocket
+ this._everSocket.begin(this.confInfo.MCUServerIP, this.confInfo.MCUServerPort);
+ }
+ }, {
+ key: 'connected',
+ get: function get() {
+ if (this._everSocket && this._everSocket.connected) return true;
+ return false;
+ }
+ }]);
+
+ return MCU;
+ }(_Emiter3.default);
+
+ var _default = new MCU();
+
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/mcu.js');
+
+ __REACT_HOT_LOADER__.register(MCU, 'MCU', 'D:/work/McuClient/src/mcu.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/mcu.js');
+ }();
+
+ ;
+
+/***/ },
+/* 27 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Emiter2 = __webpack_require__(17);
+
+ var _Emiter3 = _interopRequireDefault(_Emiter2);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present
+ // All Rights Reserved.
+ //
+ // Author: AlexWang
+ // Date: 2016-08-27 21:40:49
+ // Last Modified by: AlexWang
+ // Last Modified time: 2016-12-05 12:02:48
+ // QQ Email: 1669499355@qq.com
+ // Description: 底层Socket管理器,保持一直在线及异常重连.
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('EverSocket');
+
+ var EverSocket = function (_Emiter) {
+ _inherits(EverSocket, _Emiter);
+
+ function EverSocket() {
+ _classCallCheck(this, EverSocket);
+
+ var _this = _possibleConstructorReturn(this, (EverSocket.__proto__ || Object.getPrototypeOf(EverSocket)).call(this));
+
+ _this._connected = false;
+ _this._lastActiveTime = 0;
+ _this._enableEverSocket = false;
+ return _this;
+ }
+
+ _createClass(EverSocket, [{
+ key: 'begin',
+ value: function begin(ip, port) {
+ loger.log('开始WebSocket应用.');
+ this._enableEverSocket = true;
+ this.wsURL = 'ws://' + ip + ':' + port;
+ this._newConnection();
+ }
+ }, {
+ key: 'end',
+ value: function end() {
+ loger.log('停止WebSocket应用.');
+ this._clear();
+ }
+ }, {
+ key: 'send',
+ value: function send(data) {
+ if (this._connected) {
+ loger.log('SEND MESSAGE---->');
+ this.websocket.send(data);
+ } else {
+ loger.warn('WebSocket未建立连接.消息忽略');
+ }
+ }
+ }, {
+ key: '_setConnected',
+ value: function _setConnected() {
+ var isConn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+
+ this._connected = isConn;
+ if (this._connected) {
+ this._emit(EverSocket.OPEN);
+ } else {
+ this._emit(EverSocket.CLOSED);
+ }
+ }
+ }, {
+ key: '_newConnection',
+ value: function _newConnection() {
+ this.websocket = new WebSocket(this.wsURL);
+ this.websocket.binaryType = 'arraybuffer';
+ this.websocket.onopen = this._onOpen.bind(this);
+ this.websocket.onclose = this._onClose.bind(this);
+ this.websocket.onerror = this._onError.bind(this);
+ this.websocket.onmessage = this._onMessage.bind(this);
+ }
+ }, {
+ key: '_reConnection',
+ value: function _reConnection() {
+ var _this2 = this;
+
+ this._clear();
+ this.reConnectionTimeout = window.setTimeout(function () {
+ loger.log('WebSocket重新建立.');
+ window.clearTimeout(_this2.reConnectionTimeout);
+ _this2._newConnection();
+ }, EverSocket.RECONN_INTERVAL);
+ }
+ }, {
+ key: '_clear',
+ value: function _clear() {
+ loger.log('WebSocket,Timers销毁');
+ window.clearInterval(this.pingTimer);
+ window.clearInterval(this.pongTimer);
+ this.websocket.onopen = undefined;
+ this.websocket.onclose = undefined;
+ this.websocket.onerror = undefined;
+ this.websocket.onmessage = undefined;
+ try {
+ this.websocket.close();
+ } catch (e) {
+ loger.log('ignore errors');
+ }
+ this.websocket = undefined;
+ this._enableEverSocket = false;
+ this._setConnected(false);
+ }
+ }, {
+ key: '_onOpen',
+ value: function _onOpen() {
+ loger.log('WebSocket建立成功', this.wsURL);
+
+ //启动心跳,检查socket链接状态
+ //this.pingTimer = window.setInterval(this._sendPingHandler.bind(this), EverSocket.PING_INTERVAL);
+ //this.pongTimer = window.setInterval(this._checkPongHandler.bind(this), EverSocket.PONG_INTERVAL);
+
+ this._setConnected();
+ }
+ }, {
+ key: '_onClose',
+ value: function _onClose(closeEvent) {
+ loger.log('WebSocket\u8FDE\u63A5\u65AD\u5F00 CODE:' + closeEvent.code + ' REASON:' + closeEvent.reason + ' CLEAN: ' + closeEvent.wasClean, this.wsURL);
+ this._reConnection();
+ }
+ }, {
+ key: '_onError',
+ value: function _onError() {
+ loger.log('WebSocket错误出现');
+ this._connected = false;
+ this._reConnection();
+ }
+ }, {
+ key: '_onMessage',
+ value: function _onMessage(messageEvent) {
+ loger.log('<----RECEIVE MESSAGE');
+ this._lastActiveTime = Date.now();
+ var bufferData = messageEvent.data;
+ if (bufferData.byteLength > 0) {
+ this._emit(EverSocket.MESSAGE, bufferData);
+ }
+ }
+ }, {
+ key: '_sendPingHandler',
+ value: function _sendPingHandler() {
+ if (this._connected) {
+ this.websocket.send(new ArrayBuffer());
+ } else {
+ this._reConnection();
+ }
+ }
+ }, {
+ key: '_checkPongHandler',
+ value: function _checkPongHandler() {
+ var pongTime = Date.now();
+ if (this._lastActiveTime && this._lastActiveTime >= pongTime - EverSocket.PONG_INTERVAL && this._lastActiveTime <= pongTime) {} else {
+ loger.warn('---服务器PINGPONG超时-----');
+ this._reConnection();
+ }
+ }
+ }, {
+ key: 'connected',
+ get: function get() {
+ return this._connected;
+ }
+ }]);
+
+ return EverSocket;
+ }(_Emiter3.default);
+
+ EverSocket.prototype.PONG_INTERVAL = EverSocket.PONG_INTERVAL = 5000;
+ EverSocket.prototype.PING_INTERVAL = EverSocket.PING_INTERVAL = 3000;
+ EverSocket.prototype.RECONN_INTERVAL = EverSocket.RECONN_INTERVAL = 2000;
+ EverSocket.prototype.CONNECTING = EverSocket.CONNECTING = 0;
+ EverSocket.prototype.OPEN = EverSocket.OPEN = 1;
+ EverSocket.prototype.CLOSING = EverSocket.CLOSING = 2;
+ EverSocket.prototype.CLOSED = EverSocket.CLOSED = 3;
+ EverSocket.prototype.MESSAGE = EverSocket.MESSAGE = 4;
+
+ var _default = new EverSocket();
+
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/everSocket.js');
+
+ __REACT_HOT_LOADER__.register(EverSocket, 'EverSocket', 'D:/work/McuClient/src/everSocket.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/everSocket.js');
+ }();
+
+ ;
+
+/***/ },
+/* 28 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
+ var _protobufjs = __webpack_require__(29);
+
+ var _protobufjs2 = _interopRequireDefault(_protobufjs);
+
+ var _pro = __webpack_require__(36);
+
+ var _pro2 = _interopRequireDefault(_pro);
+
+ var _PduType = __webpack_require__(37);
+
+ var _PduType2 = _interopRequireDefault(_PduType);
+
+ var _PduConsts = __webpack_require__(38);
+
+ var _PduConsts2 = _interopRequireDefault(_PduConsts);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ var builder = _protobufjs2.default.newBuilder({ convertFieldsToCamelCase: true });
+ _protobufjs2.default.loadProto(_pro2.default, builder);
+
+ var pdu = builder.build();
+
+ // 底层通信层[Firstlayer] - RCSendDataPdu封包
+ function create_pdu(type, sub_type, initiator, conference_id, session_id, channel_id, upward, reliability, priority, peer, seg) {
+ var pduMsg = new pdu['RCSendDataPdu']();
+ pduMsg.set("type", type);
+ pduMsg.set("subType", sub_type);
+ pduMsg.set("initiator", initiator);
+ pduMsg.set("confId", conference_id);
+ pduMsg.set("sessionId", session_id);
+ pduMsg.set("channelId", channel_id);
+ pduMsg.set("upward", upward);
+ pduMsg.set("reliability", reliability);
+ pduMsg.set("priority", priority);
+ pduMsg.set("peer", peer);
+ pduMsg.set("seg", seg);
+ return pduMsg;
+ }
+ // 底层通信层[Firstlayer] - RCSendDataPdu解包
+ pdu.decode_pdu = function (buffer) {
+ return pdu['RCSendDataPdu'].decode(buffer);
+ };
+
+ pdu.create_connect_provider_request_pdu = function (sub_type, initiator, conference_id, session_id, channel_id, reliability, priority, peer, seg) {
+ return create_pdu(_PduType2.default.RCPDU_CONNECT_PROVIDER_REQUEST, sub_type, initiator, conference_id, session_id, channel_id, true, reliability, priority, peer, seg);
+ };
+
+ //upward 是否向顶层抛 create_uniform_pdu默认为true
+ pdu.create_uniform_pdu = function (sub_type, initiator, conference_id, session_id, channel_id, reliability, priority, peer, seg) {
+ return create_pdu(_PduType2.default.RCPDU_UNIFORM_SEND_DATA_REQUEST, sub_type, initiator, conference_id, session_id, channel_id, true, reliability, priority, peer, seg);
+ };
+
+ //upward 是否向顶层抛 create_normal_pdu 中由外部定义
+ pdu.create_normal_pdu = function (sub_type, initiator, conference_id, session_id, channel_id, upward, reliability, priority, peer, seg) {
+ return create_pdu(_PduType2.default.RCPDU_SEND_DATA_REQUEST, sub_type, initiator, conference_id, session_id, channel_id, upward, reliability, priority, peer, seg);
+ };
+
+ pdu.id2type = function (id) {
+ for (var type_const in _PduType2.default) {
+ if (_PduType2.default[type_const] === id) {
+ return type_const;
+ }
+ }
+ };
+
+ // 合并统一对外
+ pdu = _extends({}, pdu, _PduType2.default, _PduConsts2.default);
+
+ var _default = pdu;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(builder, 'builder', 'D:/work/McuClient/src/pdu/index.js');
+
+ __REACT_HOT_LOADER__.register(pdu, 'pdu', 'D:/work/McuClient/src/pdu/index.js');
+
+ __REACT_HOT_LOADER__.register(create_pdu, 'create_pdu', 'D:/work/McuClient/src/pdu/index.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/pdu/index.js');
+ }();
+
+ ;
+
+/***/ },
+/* 29 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(process, module) {/*
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+ /**
+ * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/protobuf.js for details
+ */
+ (function (global, factory) {
+
+ /* AMD */
+ if ("function" === 'function' && __webpack_require__(31)["amd"])
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(32)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ /* CommonJS */
+ else if ("function" === "function" && typeof module === "object" && module && module["exports"])
+ module["exports"] = factory(__webpack_require__(32), true);
+ /* Global */
+ else
+ (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
+
+ })(this, function (ByteBuffer, isCommonJS) {
+ "use strict";
+
+ /**
+ * The ProtoBuf namespace.
+ * @exports ProtoBuf
+ * @namespace
+ * @expose
+ */
+ var ProtoBuf = {};
+
+ /**
+ * @type {!function(new: ByteBuffer, ...[*])}
+ * @expose
+ */
+ ProtoBuf.ByteBuffer = ByteBuffer;
+
+ /**
+ * @type {?function(new: Long, ...[*])}
+ * @expose
+ */
+ ProtoBuf.Long = ByteBuffer.Long || null;
+
+ /**
+ * ProtoBuf.js version.
+ * @type {string}
+ * @const
+ * @expose
+ */
+ ProtoBuf.VERSION = "5.0.1";
+
+ /**
+ * Wire types.
+ * @type {Object.<string,number>}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES = {};
+
+ /**
+ * Varint wire type.
+ * @type {number}
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.VARINT = 0;
+
+ /**
+ * Fixed 64 bits wire type.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.BITS64 = 1;
+
+ /**
+ * Length delimited wire type.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.LDELIM = 2;
+
+ /**
+ * Start group wire type.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
+
+ /**
+ * End group wire type.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
+
+ /**
+ * Fixed 32 bits wire type.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.WIRE_TYPES.BITS32 = 5;
+
+ /**
+ * Packable wire types.
+ * @type {!Array.<number>}
+ * @const
+ * @expose
+ */
+ ProtoBuf.PACKABLE_WIRE_TYPES = [
+ ProtoBuf.WIRE_TYPES.VARINT,
+ ProtoBuf.WIRE_TYPES.BITS64,
+ ProtoBuf.WIRE_TYPES.BITS32
+ ];
+
+ /**
+ * Types.
+ * @dict
+ * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
+ * @const
+ * @expose
+ */
+ ProtoBuf.TYPES = {
+ // According to the protobuf spec.
+ "int32": {
+ name: "int32",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: 0
+ },
+ "uint32": {
+ name: "uint32",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: 0
+ },
+ "sint32": {
+ name: "sint32",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: 0
+ },
+ "int64": {
+ name: "int64",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+ },
+ "uint64": {
+ name: "uint64",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+ },
+ "sint64": {
+ name: "sint64",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+ },
+ "bool": {
+ name: "bool",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: false
+ },
+ "double": {
+ name: "double",
+ wireType: ProtoBuf.WIRE_TYPES.BITS64,
+ defaultValue: 0
+ },
+ "string": {
+ name: "string",
+ wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+ defaultValue: ""
+ },
+ "bytes": {
+ name: "bytes",
+ wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+ defaultValue: null // overridden in the code, must be a unique instance
+ },
+ "fixed32": {
+ name: "fixed32",
+ wireType: ProtoBuf.WIRE_TYPES.BITS32,
+ defaultValue: 0
+ },
+ "sfixed32": {
+ name: "sfixed32",
+ wireType: ProtoBuf.WIRE_TYPES.BITS32,
+ defaultValue: 0
+ },
+ "fixed64": {
+ name: "fixed64",
+ wireType: ProtoBuf.WIRE_TYPES.BITS64,
+ defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
+ },
+ "sfixed64": {
+ name: "sfixed64",
+ wireType: ProtoBuf.WIRE_TYPES.BITS64,
+ defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
+ },
+ "float": {
+ name: "float",
+ wireType: ProtoBuf.WIRE_TYPES.BITS32,
+ defaultValue: 0
+ },
+ "enum": {
+ name: "enum",
+ wireType: ProtoBuf.WIRE_TYPES.VARINT,
+ defaultValue: 0
+ },
+ "message": {
+ name: "message",
+ wireType: ProtoBuf.WIRE_TYPES.LDELIM,
+ defaultValue: null
+ },
+ "group": {
+ name: "group",
+ wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
+ defaultValue: null
+ }
+ };
+
+ /**
+ * Valid map key types.
+ * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
+ * @const
+ * @expose
+ */
+ ProtoBuf.MAP_KEY_TYPES = [
+ ProtoBuf.TYPES["int32"],
+ ProtoBuf.TYPES["sint32"],
+ ProtoBuf.TYPES["sfixed32"],
+ ProtoBuf.TYPES["uint32"],
+ ProtoBuf.TYPES["fixed32"],
+ ProtoBuf.TYPES["int64"],
+ ProtoBuf.TYPES["sint64"],
+ ProtoBuf.TYPES["sfixed64"],
+ ProtoBuf.TYPES["uint64"],
+ ProtoBuf.TYPES["fixed64"],
+ ProtoBuf.TYPES["bool"],
+ ProtoBuf.TYPES["string"],
+ ProtoBuf.TYPES["bytes"]
+ ];
+
+ /**
+ * Minimum field id.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.ID_MIN = 1;
+
+ /**
+ * Maximum field id.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ProtoBuf.ID_MAX = 0x1FFFFFFF;
+
+ /**
+ * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
+ * Must be set prior to parsing.
+ * @type {boolean}
+ * @expose
+ */
+ ProtoBuf.convertFieldsToCamelCase = false;
+
+ /**
+ * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
+ * setting this to `false` prior to building messages.
+ * @type {boolean}
+ * @expose
+ */
+ ProtoBuf.populateAccessors = true;
+
+ /**
+ * By default, messages are populated with default values if a field is not present on the wire. To disable
+ * this behavior, set this setting to `false`.
+ * @type {boolean}
+ * @expose
+ */
+ ProtoBuf.populateDefaults = true;
+
+ /**
+ * @alias ProtoBuf.Util
+ * @expose
+ */
+ ProtoBuf.Util = (function () {
+ "use strict";
+
+ /**
+ * ProtoBuf utilities.
+ * @exports ProtoBuf.Util
+ * @namespace
+ */
+ var Util = {};
+
+ /**
+ * Flag if running in node or not.
+ * @type {boolean}
+ * @const
+ * @expose
+ */
+ Util.IS_NODE = !!(
+ typeof process === 'object' && process + '' === '[object process]' && !process['browser']
+ );
+
+ /**
+ * Constructs a XMLHttpRequest object.
+ * @return {XMLHttpRequest}
+ * @throws {Error} If XMLHttpRequest is not supported
+ * @expose
+ */
+ Util.XHR = function () {
+ // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
+ var XMLHttpFactories = [
+ function () {
+ return new XMLHttpRequest()
+ },
+ function () {
+ return new ActiveXObject("Msxml2.XMLHTTP")
+ },
+ function () {
+ return new ActiveXObject("Msxml3.XMLHTTP")
+ },
+ function () {
+ return new ActiveXObject("Microsoft.XMLHTTP")
+ }
+ ];
+ /** @type {?XMLHttpRequest} */
+ var xhr = null;
+ for (var i = 0; i < XMLHttpFactories.length; i++) {
+ try { xhr = XMLHttpFactories[i](); } catch (e) {
+ continue;
+ }
+ break;
+ }
+ if (!xhr)
+ throw Error("XMLHttpRequest is not supported");
+ return xhr;
+ };
+
+ /**
+ * Fetches a resource.
+ * @param {string} path Resource path
+ * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
+ * be fetched synchronously. If the request failed, contents will be null.
+ * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
+ * @expose
+ */
+ Util.fetch = function (path, callback) {
+ if (callback && typeof callback != 'function')
+ callback = null;
+ if (Util.IS_NODE) {
+ var fs = __webpack_require__(34);
+ if (callback) {
+ fs.readFile(path, function (err, data) {
+ if (err)
+ callback(null);
+ else
+ callback("" + data);
+ });
+ } else
+ try {
+ return fs.readFileSync(path);
+ } catch (e) {
+ return null;
+ }
+ } else {
+ var xhr = Util.XHR();
+ xhr.open('GET', path, callback ? true : false);
+ // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
+ xhr.setRequestHeader('Accept', 'text/plain');
+ if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
+ if (callback) {
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState != 4) return;
+ if ( /* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+ callback(xhr.responseText);
+ else
+ callback(null);
+ };
+ if (xhr.readyState == 4)
+ return;
+ xhr.send(null);
+ } else {
+ xhr.send(null);
+ if ( /* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
+ return xhr.responseText;
+ return null;
+ }
+ }
+ };
+
+ /**
+ * Converts a string to camel case.
+ * @param {string} str
+ * @returns {string}
+ * @expose
+ */
+ Util.toCamelCase = function (str) {
+ return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
+ return $1.toUpperCase();
+ });
+ };
+
+ return Util;
+ })();
+
+ /**
+ * Language expressions.
+ * @type {!Object.<string,!RegExp>}
+ * @expose
+ */
+ ProtoBuf.Lang = {
+
+ // Characters always ending a statement
+ DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
+
+ // Field rules
+ RULE: /^(?:required|optional|repeated|map)$/,
+
+ // Field types
+ TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
+
+ // Names
+ NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
+
+ // Type definitions
+ TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
+
+ // Type references
+ TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,
+
+ // Fully qualified type references
+ FQTYPEREF: /^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,
+
+ // All numbers
+ NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
+
+ // Decimal numbers
+ NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
+
+ // Hexadecimal numbers
+ NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
+
+ // Octal numbers
+ NUMBER_OCT: /^0[0-7]+$/,
+
+ // Floating point numbers
+ NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
+
+ // Booleans
+ BOOL: /^(?:true|false)$/i,
+
+ // Id numbers
+ ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+ // Negative id numbers (enum values)
+ NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
+
+ // Whitespaces
+ WHITESPACE: /\s/,
+
+ // All strings
+ STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
+
+ // Double quoted strings
+ STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
+
+ // Single quoted strings
+ STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
+ };
+
+ /**
+ * @alias ProtoBuf.DotProto
+ * @expose
+ */
+ ProtoBuf.DotProto = (function (ProtoBuf, Lang) {
+ "use strict";
+
+ /**
+ * Utilities to parse .proto files.
+ * @exports ProtoBuf.DotProto
+ * @namespace
+ */
+ var DotProto = {};
+
+ /**
+ * Constructs a new Tokenizer.
+ * @exports ProtoBuf.DotProto.Tokenizer
+ * @class prototype tokenizer
+ * @param {string} proto Proto to tokenize
+ * @constructor
+ */
+ var Tokenizer = function (proto) {
+
+ /**
+ * Source to parse.
+ * @type {string}
+ * @expose
+ */
+ this.source = proto + "";
+
+ /**
+ * Current index.
+ * @type {number}
+ * @expose
+ */
+ this.index = 0;
+
+ /**
+ * Current line.
+ * @type {number}
+ * @expose
+ */
+ this.line = 1;
+
+ /**
+ * Token stack.
+ * @type {!Array.<string>}
+ * @expose
+ */
+ this.stack = [];
+
+ /**
+ * Opening character of the current string read, if any.
+ * @type {?string}
+ * @private
+ */
+ this._stringOpen = null;
+ };
+
+ /**
+ * @alias ProtoBuf.DotProto.Tokenizer.prototype
+ * @inner
+ */
+ var TokenizerPrototype = Tokenizer.prototype;
+
+ /**
+ * Reads a string beginning at the current index.
+ * @return {string}
+ * @private
+ */
+ TokenizerPrototype._readString = function () {
+ var re = this._stringOpen === '"' ? Lang.STRING_DQ : Lang.STRING_SQ;
+ re.lastIndex = this.index - 1; // Include the open quote
+ var match = re.exec(this.source);
+ if (!match)
+ throw Error("unterminated string");
+ this.index = re.lastIndex;
+ this.stack.push(this._stringOpen);
+ this._stringOpen = null;
+ return match[1];
+ };
+
+ /**
+ * Gets the next token and advances by one.
+ * @return {?string} Token or `null` on EOF
+ * @expose
+ */
+ TokenizerPrototype.next = function () {
+ if (this.stack.length > 0)
+ return this.stack.shift();
+ if (this.index >= this.source.length)
+ return null;
+ if (this._stringOpen !== null)
+ return this._readString();
+
+ var repeat,
+ prev,
+ next;
+ do {
+ repeat = false;
+
+ // Strip white spaces
+ while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) {
+ if (next === '\n')
+ ++this.line;
+ if (++this.index === this.source.length)
+ return null;
+ }
+
+ // Strip comments
+ if (this.source.charAt(this.index) === '/') {
+ ++this.index;
+ if (this.source.charAt(this.index) === '/') { // Line
+ while (this.source.charAt(++this.index) !== '\n')
+ if (this.index == this.source.length)
+ return null;
+ ++this.index;
+ ++this.line;
+ repeat = true;
+ } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */
+ do {
+ if (next === '\n')
+ ++this.line;
+ if (++this.index === this.source.length)
+ return null;
+ prev = next;
+ next = this.source.charAt(this.index);
+ } while (prev !== '*' || next !== '/');
+ ++this.index;
+ repeat = true;
+ } else
+ return '/';
+ }
+ } while (repeat);
+
+ if (this.index === this.source.length)
+ return null;
+
+ // Read the next token
+ var end = this.index;
+ Lang.DELIM.lastIndex = 0;
+ var delim = Lang.DELIM.test(this.source.charAt(end++));
+ if (!delim)
+ while (end < this.source.length && !Lang.DELIM.test(this.source.charAt(end)))
+ ++end;
+ var token = this.source.substring(this.index, this.index = end);
+ if (token === '"' || token === "'")
+ this._stringOpen = token;
+ return token;
+ };
+
+ /**
+ * Peeks for the next token.
+ * @return {?string} Token or `null` on EOF
+ * @expose
+ */
+ TokenizerPrototype.peek = function () {
+ if (this.stack.length === 0) {
+ var token = this.next();
+ if (token === null)
+ return null;
+ this.stack.push(token);
+ }
+ return this.stack[0];
+ };
+
+ /**
+ * Skips a specific token and throws if it differs.
+ * @param {string} expected Expected token
+ * @throws {Error} If the actual token differs
+ */
+ TokenizerPrototype.skip = function (expected) {
+ var actual = this.next();
+ if (actual !== expected)
+ throw Error("illegal '" + actual + "', '" + expected + "' expected");
+ };
+
+ /**
+ * Omits an optional token.
+ * @param {string} expected Expected optional token
+ * @returns {boolean} `true` if the token exists
+ */
+ TokenizerPrototype.omit = function (expected) {
+ if (this.peek() === expected) {
+ this.next();
+ return true;
+ }
+ return false;
+ };
+
+ /**
+ * Returns a string representation of this object.
+ * @return {string} String representation as of "Tokenizer(index/length)"
+ * @expose
+ */
+ TokenizerPrototype.toString = function () {
+ return "Tokenizer (" + this.index + "/" + this.source.length + " at line " + this.line + ")";
+ };
+
+ /**
+ * @alias ProtoBuf.DotProto.Tokenizer
+ * @expose
+ */
+ DotProto.Tokenizer = Tokenizer;
+
+ /**
+ * Constructs a new Parser.
+ * @exports ProtoBuf.DotProto.Parser
+ * @class prototype parser
+ * @param {string} source Source
+ * @constructor
+ */
+ var Parser = function (source) {
+
+ /**
+ * Tokenizer.
+ * @type {!ProtoBuf.DotProto.Tokenizer}
+ * @expose
+ */
+ this.tn = new Tokenizer(source);
+
+ /**
+ * Whether parsing proto3 or not.
+ * @type {boolean}
+ */
+ this.proto3 = false;
+ };
+
+ /**
+ * @alias ProtoBuf.DotProto.Parser.prototype
+ * @inner
+ */
+ var ParserPrototype = Parser.prototype;
+
+ /**
+ * Parses the source.
+ * @returns {!Object}
+ * @throws {Error} If the source cannot be parsed
+ * @expose
+ */
+ ParserPrototype.parse = function () {
+ var topLevel = {
+ "name": "[ROOT]", // temporary
+ "package": null,
+ "messages": [],
+ "enums": [],
+ "imports": [],
+ "options": {},
+ "services": []
+ // "syntax": undefined
+ };
+ var token,
+ head = true,
+ weak;
+ try {
+ while (token = this.tn.next()) {
+ switch (token) {
+ case 'package':
+ if (!head || topLevel["package"] !== null)
+ throw Error("unexpected 'package'");
+ token = this.tn.next();
+ if (!Lang.TYPEREF.test(token))
+ throw Error("illegal package name: " + token);
+ this.tn.skip(";");
+ topLevel["package"] = token;
+ break;
+ case 'import':
+ if (!head)
+ throw Error("unexpected 'import'");
+ token = this.tn.peek();
+ if (token === "public" || (weak = token === "weak")) // token ignored
+ this.tn.next();
+ token = this._readString();
+ this.tn.skip(";");
+ if (!weak) // import ignored
+ topLevel["imports"].push(token);
+ break;
+ case 'syntax':
+ if (!head)
+ throw Error("unexpected 'syntax'");
+ this.tn.skip("=");
+ if ((topLevel["syntax"] = this._readString()) === "proto3")
+ this.proto3 = true;
+ this.tn.skip(";");
+ break;
+ case 'message':
+ this._parseMessage(topLevel, null);
+ head = false;
+ break;
+ case 'enum':
+ this._parseEnum(topLevel);
+ head = false;
+ break;
+ case 'option':
+ this._parseOption(topLevel);
+ break;
+ case 'service':
+ this._parseService(topLevel);
+ break;
+ case 'extend':
+ this._parseExtend(topLevel);
+ break;
+ default:
+ throw Error("unexpected '" + token + "'");
+ }
+ }
+ } catch (e) {
+ e.message = "Parse error at line " + this.tn.line + ": " + e.message;
+ throw e;
+ }
+ delete topLevel["name"];
+ return topLevel;
+ };
+
+ /**
+ * Parses the specified source.
+ * @returns {!Object}
+ * @throws {Error} If the source cannot be parsed
+ * @expose
+ */
+ Parser.parse = function (source) {
+ return new Parser(source).parse();
+ };
+
+ // ----- Conversion ------
+
+ /**
+ * Converts a numerical string to an id.
+ * @param {string} value
+ * @param {boolean=} mayBeNegative
+ * @returns {number}
+ * @inner
+ */
+ function mkId(value, mayBeNegative) {
+ var id = -1,
+ sign = 1;
+ if (value.charAt(0) == '-') {
+ sign = -1;
+ value = value.substring(1);
+ }
+ if (Lang.NUMBER_DEC.test(value))
+ id = parseInt(value);
+ else if (Lang.NUMBER_HEX.test(value))
+ id = parseInt(value.substring(2), 16);
+ else if (Lang.NUMBER_OCT.test(value))
+ id = parseInt(value.substring(1), 8);
+ else
+ throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+ id = (sign * id) | 0; // Force to 32bit
+ if (!mayBeNegative && id < 0)
+ throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);
+ return id;
+ }
+
+ /**
+ * Converts a numerical string to a number.
+ * @param {string} val
+ * @returns {number}
+ * @inner
+ */
+ function mkNumber(val) {
+ var sign = 1;
+ if (val.charAt(0) == '-') {
+ sign = -1;
+ val = val.substring(1);
+ }
+ if (Lang.NUMBER_DEC.test(val))
+ return sign * parseInt(val, 10);
+ else if (Lang.NUMBER_HEX.test(val))
+ return sign * parseInt(val.substring(2), 16);
+ else if (Lang.NUMBER_OCT.test(val))
+ return sign * parseInt(val.substring(1), 8);
+ else if (val === 'inf')
+ return sign * Infinity;
+ else if (val === 'nan')
+ return NaN;
+ else if (Lang.NUMBER_FLT.test(val))
+ return sign * parseFloat(val);
+ throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);
+ }
+
+ // ----- Reading ------
+
+ /**
+ * Reads a string.
+ * @returns {string}
+ * @private
+ */
+ ParserPrototype._readString = function () {
+ var value = "",
+ token,
+ delim;
+ do {
+ delim = this.tn.next();
+ if (delim !== "'" && delim !== '"')
+ throw Error("illegal string delimiter: " + delim);
+ value += this.tn.next();
+ this.tn.skip(delim);
+ token = this.tn.peek();
+ } while (token === '"' || token === '"'); // multi line?
+ return value;
+ };
+
+ /**
+ * Reads a value.
+ * @param {boolean=} mayBeTypeRef
+ * @returns {number|boolean|string}
+ * @private
+ */
+ ParserPrototype._readValue = function (mayBeTypeRef) {
+ var token = this.tn.peek(),
+ value;
+ if (token === '"' || token === "'")
+ return this._readString();
+ this.tn.next();
+ if (Lang.NUMBER.test(token))
+ return mkNumber(token);
+ if (Lang.BOOL.test(token))
+ return (token.toLowerCase() === 'true');
+ if (mayBeTypeRef && Lang.TYPEREF.test(token))
+ return token;
+ throw Error("illegal value: " + token);
+
+ };
+
+ // ----- Parsing constructs -----
+
+ /**
+ * Parses a namespace option.
+ * @param {!Object} parent Parent definition
+ * @param {boolean=} isList
+ * @private
+ */
+ ParserPrototype._parseOption = function (parent, isList) {
+ var token = this.tn.next(),
+ custom = false;
+ if (token === '(') {
+ custom = true;
+ token = this.tn.next();
+ }
+ if (!Lang.TYPEREF.test(token))
+ // we can allow options of the form google.protobuf.* since they will just get ignored anyways
+ // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref?
+ throw Error("illegal option name: " + token);
+ var name = token;
+ if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar
+ this.tn.skip(')');
+ name = '(' + name + ')';
+ token = this.tn.peek();
+ if (Lang.FQTYPEREF.test(token)) {
+ name += token;
+ this.tn.next();
+ }
+ }
+ this.tn.skip('=');
+ this._parseOptionValue(parent, name);
+ if (!isList)
+ this.tn.skip(";");
+ };
+
+ /**
+ * Sets an option on the specified options object.
+ * @param {!Object.<string,*>} options
+ * @param {string} name
+ * @param {string|number|boolean} value
+ * @inner
+ */
+ function setOption(options, name, value) {
+ if (typeof options[name] === 'undefined')
+ options[name] = value;
+ else {
+ if (!Array.isArray(options[name]))
+ options[name] = [options[name]];
+ options[name].push(value);
+ }
+ }
+
+ /**
+ * Parses an option value.
+ * @param {!Object} parent
+ * @param {string} name
+ * @private
+ */
+ ParserPrototype._parseOptionValue = function (parent, name) {
+ var token = this.tn.peek();
+ if (token !== '{') { // Plain value
+ setOption(parent["options"], name, this._readValue(true));
+ } else { // Aggregate options
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== '}') {
+ if (!Lang.NAME.test(token))
+ throw Error("illegal option name: " + name + "." + token);
+ if (this.tn.omit(":"))
+ setOption(parent["options"], name + "." + token, this._readValue(true));
+ else
+ this._parseOptionValue(parent, name + "." + token);
+ }
+ }
+ };
+
+ /**
+ * Parses a service definition.
+ * @param {!Object} parent Parent definition
+ * @private
+ */
+ ParserPrototype._parseService = function (parent) {
+ var token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal service name at line " + this.tn.line + ": " + token);
+ var name = token;
+ var svc = {
+ "name": name,
+ "rpc": {},
+ "options": {}
+ };
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== '}') {
+ if (token === "option")
+ this._parseOption(svc);
+ else if (token === 'rpc')
+ this._parseServiceRPC(svc);
+ else
+ throw Error("illegal service token: " + token);
+ }
+ this.tn.omit(";");
+ parent["services"].push(svc);
+ };
+
+ /**
+ * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)].
+ * @param {!Object} svc Service definition
+ * @private
+ */
+ ParserPrototype._parseServiceRPC = function (svc) {
+ var type = "rpc",
+ token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal rpc service method name: " + token);
+ var name = token;
+ var method = {
+ "request": null,
+ "response": null,
+ "request_stream": false,
+ "response_stream": false,
+ "options": {}
+ };
+ this.tn.skip("(");
+ token = this.tn.next();
+ if (token.toLowerCase() === "stream") {
+ method["request_stream"] = true;
+ token = this.tn.next();
+ }
+ if (!Lang.TYPEREF.test(token))
+ throw Error("illegal rpc service request type: " + token);
+ method["request"] = token;
+ this.tn.skip(")");
+ token = this.tn.next();
+ if (token.toLowerCase() !== "returns")
+ throw Error("illegal rpc service request type delimiter: " + token);
+ this.tn.skip("(");
+ token = this.tn.next();
+ if (token.toLowerCase() === "stream") {
+ method["response_stream"] = true;
+ token = this.tn.next();
+ }
+ method["response"] = token;
+ this.tn.skip(")");
+ token = this.tn.peek();
+ if (token === '{') {
+ this.tn.next();
+ while ((token = this.tn.next()) !== '}') {
+ if (token === 'option')
+ this._parseOption(method);
+ else
+ throw Error("illegal rpc service token: " + token);
+ }
+ this.tn.omit(";");
+ } else
+ this.tn.skip(";");
+ if (typeof svc[type] === 'undefined')
+ svc[type] = {};
+ svc[type][name] = method;
+ };
+
+ /**
+ * Parses a message definition.
+ * @param {!Object} parent Parent definition
+ * @param {!Object=} fld Field definition if this is a group
+ * @returns {!Object}
+ * @private
+ */
+ ParserPrototype._parseMessage = function (parent, fld) {
+ var isGroup = !!fld,
+ token = this.tn.next();
+ var msg = {
+ "name": "",
+ "fields": [],
+ "enums": [],
+ "messages": [],
+ "options": {},
+ "services": [],
+ "oneofs": {}
+ // "extensions": undefined
+ };
+ if (!Lang.NAME.test(token))
+ throw Error("illegal " + (isGroup ? "group" : "message") + " name: " + token);
+ msg["name"] = token;
+ if (isGroup) {
+ this.tn.skip("=");
+ fld["id"] = mkId(this.tn.next());
+ msg["isGroup"] = true;
+ }
+ token = this.tn.peek();
+ if (token === '[' && fld)
+ this._parseFieldOptions(fld);
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== '}') {
+ if (Lang.RULE.test(token))
+ this._parseMessageField(msg, token);
+ else if (token === "oneof")
+ this._parseMessageOneOf(msg);
+ else if (token === "enum")
+ this._parseEnum(msg);
+ else if (token === "message")
+ this._parseMessage(msg);
+ else if (token === "option")
+ this._parseOption(msg);
+ else if (token === "service")
+ this._parseService(msg);
+ else if (token === "extensions")
+ msg["extensions"] = this._parseExtensionRanges();
+ else if (token === "reserved")
+ this._parseIgnored(); // TODO
+ else if (token === "extend")
+ this._parseExtend(msg);
+ else if (Lang.TYPEREF.test(token)) {
+ if (!this.proto3)
+ throw Error("illegal field rule: " + token);
+ this._parseMessageField(msg, "optional", token);
+ } else
+ throw Error("illegal message token: " + token);
+ }
+ this.tn.omit(";");
+ parent["messages"].push(msg);
+ return msg;
+ };
+
+ /**
+ * Parses an ignored statement.
+ * @private
+ */
+ ParserPrototype._parseIgnored = function () {
+ while (this.tn.peek() !== ';')
+ this.tn.next();
+ this.tn.skip(";");
+ };
+
+ /**
+ * Parses a message field.
+ * @param {!Object} msg Message definition
+ * @param {string} rule Field rule
+ * @param {string=} type Field type if already known (never known for maps)
+ * @returns {!Object} Field descriptor
+ * @private
+ */
+ ParserPrototype._parseMessageField = function (msg, rule, type) {
+ if (!Lang.RULE.test(rule))
+ throw Error("illegal message field rule: " + rule);
+ var fld = {
+ "rule": rule,
+ "type": "",
+ "name": "",
+ "options": {},
+ "id": 0
+ };
+ var token;
+ if (rule === "map") {
+
+ if (type)
+ throw Error("illegal type: " + type);
+ this.tn.skip('<');
+ token = this.tn.next();
+ if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+ throw Error("illegal message field type: " + token);
+ fld["keytype"] = token;
+ this.tn.skip(',');
+ token = this.tn.next();
+ if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))
+ throw Error("illegal message field: " + token);
+ fld["type"] = token;
+ this.tn.skip('>');
+ token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal message field name: " + token);
+ fld["name"] = token;
+ this.tn.skip("=");
+ fld["id"] = mkId(this.tn.next());
+ token = this.tn.peek();
+ if (token === '[')
+ this._parseFieldOptions(fld);
+ this.tn.skip(";");
+
+ } else {
+
+ type = typeof type !== 'undefined' ? type : this.tn.next();
+
+ if (type === "group") {
+
+ // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your
+ // code, you can treat this message just as if it had a Result type field called result (the latter name is
+ // converted to lower-case so that it does not conflict with the former)."
+ var grp = this._parseMessage(msg, fld);
+ if (!/^[A-Z]/.test(grp["name"]))
+ throw Error('illegal group name: ' + grp["name"]);
+ fld["type"] = grp["name"];
+ fld["name"] = grp["name"].toLowerCase();
+ this.tn.omit(";");
+
+ } else {
+
+ if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type))
+ throw Error("illegal message field type: " + type);
+ fld["type"] = type;
+ token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal message field name: " + token);
+ fld["name"] = token;
+ this.tn.skip("=");
+ fld["id"] = mkId(this.tn.next());
+ token = this.tn.peek();
+ if (token === "[")
+ this._parseFieldOptions(fld);
+ this.tn.skip(";");
+
+ }
+ }
+ msg["fields"].push(fld);
+ return fld;
+ };
+
+ /**
+ * Parses a message oneof.
+ * @param {!Object} msg Message definition
+ * @private
+ */
+ ParserPrototype._parseMessageOneOf = function (msg) {
+ var token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal oneof name: " + token);
+ var name = token,
+ fld;
+ var fields = [];
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== "}") {
+ fld = this._parseMessageField(msg, "optional", token);
+ fld["oneof"] = name;
+ fields.push(fld["id"]);
+ }
+ this.tn.omit(";");
+ msg["oneofs"][name] = fields;
+ };
+
+ /**
+ * Parses a set of field option definitions.
+ * @param {!Object} fld Field definition
+ * @private
+ */
+ ParserPrototype._parseFieldOptions = function (fld) {
+ this.tn.skip("[");
+ var token,
+ first = true;
+ while ((token = this.tn.peek()) !== ']') {
+ if (!first)
+ this.tn.skip(",");
+ this._parseOption(fld, true);
+ first = false;
+ }
+ this.tn.next();
+ };
+
+ /**
+ * Parses an enum.
+ * @param {!Object} msg Message definition
+ * @private
+ */
+ ParserPrototype._parseEnum = function (msg) {
+ var enm = {
+ "name": "",
+ "values": [],
+ "options": {}
+ };
+ var token = this.tn.next();
+ if (!Lang.NAME.test(token))
+ throw Error("illegal name: " + token);
+ enm["name"] = token;
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== '}') {
+ if (token === "option")
+ this._parseOption(enm);
+ else {
+ if (!Lang.NAME.test(token))
+ throw Error("illegal name: " + token);
+ this.tn.skip("=");
+ var val = {
+ "name": token,
+ "id": mkId(this.tn.next(), true)
+ };
+ token = this.tn.peek();
+ if (token === "[")
+ this._parseFieldOptions({ "options": {} });
+ this.tn.skip(";");
+ enm["values"].push(val);
+ }
+ }
+ this.tn.omit(";");
+ msg["enums"].push(enm);
+ };
+
+ /**
+ * Parses extension / reserved ranges.
+ * @returns {!Array.<!Array.<number>>}
+ * @private
+ */
+ ParserPrototype._parseExtensionRanges = function () {
+ var ranges = [];
+ var token,
+ range,
+ value;
+ do {
+ range = [];
+ while (true) {
+ token = this.tn.next();
+ switch (token) {
+ case "min":
+ value = ProtoBuf.ID_MIN;
+ break;
+ case "max":
+ value = ProtoBuf.ID_MAX;
+ break;
+ default:
+ value = mkNumber(token);
+ break;
+ }
+ range.push(value);
+ if (range.length === 2)
+ break;
+ if (this.tn.peek() !== "to") {
+ range.push(value);
+ break;
+ }
+ this.tn.next();
+ }
+ ranges.push(range);
+ } while (this.tn.omit(","));
+ this.tn.skip(";");
+ return ranges;
+ };
+
+ /**
+ * Parses an extend block.
+ * @param {!Object} parent Parent object
+ * @private
+ */
+ ParserPrototype._parseExtend = function (parent) {
+ var token = this.tn.next();
+ if (!Lang.TYPEREF.test(token))
+ throw Error("illegal extend reference: " + token);
+ var ext = {
+ "ref": token,
+ "fields": []
+ };
+ this.tn.skip("{");
+ while ((token = this.tn.next()) !== '}') {
+ if (Lang.RULE.test(token))
+ this._parseMessageField(ext, token);
+ else if (Lang.TYPEREF.test(token)) {
+ if (!this.proto3)
+ throw Error("illegal field rule: " + token);
+ this._parseMessageField(ext, "optional", token);
+ } else
+ throw Error("illegal extend token: " + token);
+ }
+ this.tn.omit(";");
+ parent["messages"].push(ext);
+ return ext;
+ };
+
+ // ----- General -----
+
+ /**
+ * Returns a string representation of this parser.
+ * @returns {string}
+ */
+ ParserPrototype.toString = function () {
+ return "Parser at line " + this.tn.line;
+ };
+
+ /**
+ * @alias ProtoBuf.DotProto.Parser
+ * @expose
+ */
+ DotProto.Parser = Parser;
+
+ return DotProto;
+
+ })(ProtoBuf, ProtoBuf.Lang);
+
+ /**
+ * @alias ProtoBuf.Reflect
+ * @expose
+ */
+ ProtoBuf.Reflect = (function (ProtoBuf) {
+ "use strict";
+
+ /**
+ * Reflection types.
+ * @exports ProtoBuf.Reflect
+ * @namespace
+ */
+ var Reflect = {};
+
+ /**
+ * Constructs a Reflect base class.
+ * @exports ProtoBuf.Reflect.T
+ * @constructor
+ * @abstract
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {?ProtoBuf.Reflect.T} parent Parent object
+ * @param {string} name Object name
+ */
+ var T = function (builder, parent, name) {
+
+ /**
+ * Builder reference.
+ * @type {!ProtoBuf.Builder}
+ * @expose
+ */
+ this.builder = builder;
+
+ /**
+ * Parent object.
+ * @type {?ProtoBuf.Reflect.T}
+ * @expose
+ */
+ this.parent = parent;
+
+ /**
+ * Object name in namespace.
+ * @type {string}
+ * @expose
+ */
+ this.name = name;
+
+ /**
+ * Fully qualified class name
+ * @type {string}
+ * @expose
+ */
+ this.className;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.T.prototype
+ * @inner
+ */
+ var TPrototype = T.prototype;
+
+ /**
+ * Returns the fully qualified name of this object.
+ * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
+ * @expose
+ */
+ TPrototype.fqn = function () {
+ var name = this.name,
+ ptr = this;
+ do {
+ ptr = ptr.parent;
+ if (ptr == null)
+ break;
+ name = ptr.name + "." + name;
+ } while (true);
+ return name;
+ };
+
+ /**
+ * Returns a string representation of this Reflect object (its fully qualified name).
+ * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
+ * @return String representation
+ * @expose
+ */
+ TPrototype.toString = function (includeClass) {
+ return (includeClass ? this.className + " " : "") + this.fqn();
+ };
+
+ /**
+ * Builds this type.
+ * @throws {Error} If this type cannot be built directly
+ * @expose
+ */
+ TPrototype.build = function () {
+ throw Error(this.toString(true) + " cannot be built directly");
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.T
+ * @expose
+ */
+ Reflect.T = T;
+
+ /**
+ * Constructs a new Namespace.
+ * @exports ProtoBuf.Reflect.Namespace
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
+ * @param {string} name Namespace name
+ * @param {Object.<string,*>=} options Namespace options
+ * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+ * @constructor
+ * @extends ProtoBuf.Reflect.T
+ */
+ var Namespace = function (builder, parent, name, options, syntax) {
+ T.call(this, builder, parent, name);
+
+ /**
+ * @override
+ */
+ this.className = "Namespace";
+
+ /**
+ * Children inside the namespace.
+ * @type {!Array.<ProtoBuf.Reflect.T>}
+ */
+ this.children = [];
+
+ /**
+ * Options.
+ * @type {!Object.<string, *>}
+ */
+ this.options = options || {};
+
+ /**
+ * Syntax level (e.g., proto2 or proto3).
+ * @type {!string}
+ */
+ this.syntax = syntax || "proto2";
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Namespace.prototype
+ * @inner
+ */
+ var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
+
+ /**
+ * Returns an array of the namespace's children.
+ * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
+ * @return {Array.<ProtoBuf.Reflect.T>}
+ * @expose
+ */
+ NamespacePrototype.getChildren = function (type) {
+ type = type || null;
+ if (type == null)
+ return this.children.slice();
+ var children = [];
+ for (var i = 0, k = this.children.length; i < k; ++i)
+ if (this.children[i] instanceof type)
+ children.push(this.children[i]);
+ return children;
+ };
+
+ /**
+ * Adds a child to the namespace.
+ * @param {ProtoBuf.Reflect.T} child Child
+ * @throws {Error} If the child cannot be added (duplicate)
+ * @expose
+ */
+ NamespacePrototype.addChild = function (child) {
+ var other;
+ if (other = this.getChild(child.name)) {
+ // Try to revert camelcase transformation on collision
+ if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
+ other.name = other.originalName; // Revert previous first (effectively keeps both originals)
+ else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
+ child.name = child.originalName;
+ else
+ throw Error("Duplicate name in namespace " + this.toString(true) + ": " + child.name);
+ }
+ this.children.push(child);
+ };
+
+ /**
+ * Gets a child by its name or id.
+ * @param {string|number} nameOrId Child name or id
+ * @return {?ProtoBuf.Reflect.T} The child or null if not found
+ * @expose
+ */
+ NamespacePrototype.getChild = function (nameOrId) {
+ var key = typeof nameOrId === 'number' ? 'id' : 'name';
+ for (var i = 0, k = this.children.length; i < k; ++i)
+ if (this.children[i][key] === nameOrId)
+ return this.children[i];
+ return null;
+ };
+
+ /**
+ * Resolves a reflect object inside of this namespace.
+ * @param {string|!Array.<string>} qn Qualified name to resolve
+ * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
+ * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
+ * @expose
+ */
+ NamespacePrototype.resolve = function (qn, excludeNonNamespace) {
+ var part = typeof qn === 'string' ? qn.split(".") : qn,
+ ptr = this,
+ i = 0;
+ if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
+ while (ptr.parent !== null)
+ ptr = ptr.parent;
+ i++;
+ }
+ var child;
+ do {
+ do {
+ if (!(ptr instanceof Reflect.Namespace)) {
+ ptr = null;
+ break;
+ }
+ child = ptr.getChild(part[i]);
+ if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
+ ptr = null;
+ break;
+ }
+ ptr = child;
+ i++;
+ } while (i < part.length);
+ if (ptr != null)
+ break; // Found
+ // Else search the parent
+ if (this.parent !== null)
+ return this.parent.resolve(qn, excludeNonNamespace);
+ } while (ptr != null);
+ return ptr;
+ };
+
+ /**
+ * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
+ * @param {!ProtoBuf.Reflect.T} t Reflection type
+ * @returns {string} The shortest qualified name or, if there is none, the fqn
+ * @expose
+ */
+ NamespacePrototype.qn = function (t) {
+ var part = [],
+ ptr = t;
+ do {
+ part.unshift(ptr.name);
+ ptr = ptr.parent;
+ } while (ptr !== null);
+ for (var len = 1; len <= part.length; len++) {
+ var qn = part.slice(part.length - len);
+ if (t === this.resolve(qn, t instanceof Reflect.Namespace))
+ return qn.join(".");
+ }
+ return t.fqn();
+ };
+
+ /**
+ * Builds the namespace and returns the runtime counterpart.
+ * @return {Object.<string,Function|Object>} Runtime namespace
+ * @expose
+ */
+ NamespacePrototype.build = function () {
+ /** @dict */
+ var ns = {};
+ var children = this.children;
+ for (var i = 0, k = children.length, child; i < k; ++i) {
+ child = children[i];
+ if (child instanceof Namespace)
+ ns[child.name] = child.build();
+ }
+ if (Object.defineProperty)
+ Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
+ return ns;
+ };
+
+ /**
+ * Builds the namespace's '$options' property.
+ * @return {Object.<string,*>}
+ */
+ NamespacePrototype.buildOpt = function () {
+ var opt = {},
+ keys = Object.keys(this.options);
+ for (var i = 0, k = keys.length; i < k; ++i) {
+ var key = keys[i],
+ val = this.options[keys[i]];
+ // TODO: Options are not resolved, yet.
+ // if (val instanceof Namespace) {
+ // opt[key] = val.build();
+ // } else {
+ opt[key] = val;
+ // }
+ }
+ return opt;
+ };
+
+ /**
+ * Gets the value assigned to the option with the specified name.
+ * @param {string=} name Returns the option value if specified, otherwise all options are returned.
+ * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
+ */
+ NamespacePrototype.getOption = function (name) {
+ if (typeof name === 'undefined')
+ return this.options;
+ return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Namespace
+ * @expose
+ */
+ Reflect.Namespace = Namespace;
+
+ /**
+ * Constructs a new Element implementation that checks and converts values for a
+ * particular field type, as appropriate.
+ *
+ * An Element represents a single value: either the value of a singular field,
+ * or a value contained in one entry of a repeated field or map field. This
+ * class does not implement these higher-level concepts; it only encapsulates
+ * the low-level typechecking and conversion.
+ *
+ * @exports ProtoBuf.Reflect.Element
+ * @param {{name: string, wireType: number}} type Resolved data type
+ * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
+ * (e.g. submessage field).
+ * @param {boolean} isMapKey Is this element a Map key? The value will be
+ * converted to string form if so.
+ * @param {string} syntax Syntax level of defining message type, e.g.,
+ * proto2 or proto3.
+ * @constructor
+ */
+ var Element = function (type, resolvedType, isMapKey, syntax) {
+
+ /**
+ * Element type, as a string (e.g., int32).
+ * @type {{name: string, wireType: number}}
+ */
+ this.type = type;
+
+ /**
+ * Element type reference to submessage or enum definition, if needed.
+ * @type {ProtoBuf.Reflect.T|null}
+ */
+ this.resolvedType = resolvedType;
+
+ /**
+ * Element is a map key.
+ * @type {boolean}
+ */
+ this.isMapKey = isMapKey;
+
+ /**
+ * Syntax level of defining message type, e.g., proto2 or proto3.
+ * @type {string}
+ */
+ this.syntax = syntax;
+
+ if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
+ throw Error("Invalid map key type: " + type.name);
+ };
+
+ var ElementPrototype = Element.prototype;
+
+ /**
+ * Obtains a (new) default value for the specified type.
+ * @param type {string|{name: string, wireType: number}} Field type
+ * @returns {*} Default value
+ * @inner
+ */
+ function mkDefault(type) {
+ if (typeof type === 'string')
+ type = ProtoBuf.TYPES[type];
+ if (typeof type.defaultValue === 'undefined')
+ throw Error("default value for type " + type.name + " is not supported");
+ if (type == ProtoBuf.TYPES["bytes"])
+ return new ByteBuffer(0);
+ return type.defaultValue;
+ }
+
+ /**
+ * Returns the default value for this field in proto3.
+ * @function
+ * @param type {string|{name: string, wireType: number}} the field type
+ * @returns {*} Default value
+ */
+ Element.defaultFieldValue = mkDefault;
+
+ /**
+ * Makes a Long from a value.
+ * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
+ * strings and numbers
+ * @returns {!Long}
+ * @throws {Error} If the value cannot be converted to a Long
+ * @inner
+ */
+ function mkLong(value, unsigned) {
+ if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean' && value.low === value.low && value.high === value.high)
+ return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
+ if (typeof value === 'string')
+ return ProtoBuf.Long.fromString(value, unsigned || false, 10);
+ if (typeof value === 'number')
+ return ProtoBuf.Long.fromNumber(value, unsigned || false);
+ throw Error("not convertible to Long");
+ }
+
+ /**
+ * Checks if the given value can be set for an element of this type (singular
+ * field or one element of a repeated field or map).
+ * @param {*} value Value to check
+ * @return {*} Verified, maybe adjusted, value
+ * @throws {Error} If the value cannot be verified for this element slot
+ * @expose
+ */
+ ElementPrototype.verifyValue = function (value) {
+ var self = this;
+
+ function fail(val, msg) {
+ throw Error("Illegal value for " + self.toString(true) + " of type " + self.type.name + ": " + val + " (" + msg + ")");
+ }
+ switch (this.type) {
+ // Signed 32bit
+ case ProtoBuf.TYPES["int32"]:
+ case ProtoBuf.TYPES["sint32"]:
+ case ProtoBuf.TYPES["sfixed32"]:
+ // Account for !NaN: value === value
+ if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+ fail(typeof value, "not an integer");
+ return value > 4294967295 ? value | 0 : value;
+
+ // Unsigned 32bit
+ case ProtoBuf.TYPES["uint32"]:
+ case ProtoBuf.TYPES["fixed32"]:
+ if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+ fail(typeof value, "not an integer");
+ return value < 0 ? value >>> 0 : value;
+
+ // Signed 64bit
+ case ProtoBuf.TYPES["int64"]:
+ case ProtoBuf.TYPES["sint64"]:
+ case ProtoBuf.TYPES["sfixed64"]:
+ {
+ if (ProtoBuf.Long)
+ try {
+ return mkLong(value, false);
+ } catch (e) {
+ fail(typeof value, e.message);
+ }
+ else
+ fail(typeof value, "requires Long.js");
+ }
+
+ // Unsigned 64bit
+ case ProtoBuf.TYPES["uint64"]:
+ case ProtoBuf.TYPES["fixed64"]:
+ {
+ if (ProtoBuf.Long)
+ try {
+ return mkLong(value, true);
+ } catch (e) {
+ fail(typeof value, e.message);
+ }
+ else
+ fail(typeof value, "requires Long.js");
+ }
+
+ // Bool
+ case ProtoBuf.TYPES["bool"]:
+ if (typeof value !== 'boolean')
+ fail(typeof value, "not a boolean");
+ return value;
+
+ // Float
+ case ProtoBuf.TYPES["float"]:
+ case ProtoBuf.TYPES["double"]:
+ if (typeof value !== 'number')
+ fail(typeof value, "not a number");
+ return value;
+
+ // Length-delimited string
+ case ProtoBuf.TYPES["string"]:
+ if (typeof value !== 'string' && !(value && value instanceof String))
+ fail(typeof value, "not a string");
+ return "" + value; // Convert String object to string
+
+ // Length-delimited bytes
+ case ProtoBuf.TYPES["bytes"]:
+ if (ByteBuffer.isByteBuffer(value))
+ return value;
+ return ByteBuffer.wrap(value, "base64");
+
+ // Constant enum value
+ case ProtoBuf.TYPES["enum"]:
+ {
+ var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
+ for (i = 0; i < values.length; i++)
+ if (values[i].name == value)
+ return values[i].id;
+ else if (values[i].id == value)
+ return values[i].id;
+
+ if (this.syntax === 'proto3') {
+ // proto3: just make sure it's an integer.
+ if (typeof value !== 'number' || (value === value && value % 1 !== 0))
+ fail(typeof value, "not an integer");
+ if (value > 4294967295 || value < 0)
+ fail(typeof value, "not in range for uint32")
+ return value;
+ } else {
+ // proto2 requires enum values to be valid.
+ fail(value, "not a valid enum value");
+ }
+ }
+ // Embedded message
+ case ProtoBuf.TYPES["group"]:
+ case ProtoBuf.TYPES["message"]:
+ {
+ if (!value || typeof value !== 'object')
+ fail(typeof value, "object expected");
+ if (value instanceof this.resolvedType.clazz)
+ return value;
+ if (value instanceof ProtoBuf.Builder.Message) {
+ // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
+ var obj = {};
+ for (var i in value)
+ if (value.hasOwnProperty(i))
+ obj[i] = value[i];
+ value = obj;
+ }
+ // Else let's try to construct one from a key-value object
+ return new(this.resolvedType.clazz)(value); // May throw for a hundred of reasons
+ }
+ }
+
+ // We should never end here
+ throw Error("[INTERNAL] Illegal value for " + this.toString(true) + ": " + value + " (undefined type " + this.type + ")");
+ };
+
+ /**
+ * Calculates the byte length of an element on the wire.
+ * @param {number} id Field number
+ * @param {*} value Field value
+ * @returns {number} Byte length
+ * @throws {Error} If the value cannot be calculated
+ * @expose
+ */
+ ElementPrototype.calculateLength = function (id, value) {
+ if (value === null) return 0; // Nothing to encode
+ // Tag has already been written
+ var n;
+ switch (this.type) {
+ case ProtoBuf.TYPES["int32"]:
+ return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
+ case ProtoBuf.TYPES["uint32"]:
+ return ByteBuffer.calculateVarint32(value);
+ case ProtoBuf.TYPES["sint32"]:
+ return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
+ case ProtoBuf.TYPES["fixed32"]:
+ case ProtoBuf.TYPES["sfixed32"]:
+ case ProtoBuf.TYPES["float"]:
+ return 4;
+ case ProtoBuf.TYPES["int64"]:
+ case ProtoBuf.TYPES["uint64"]:
+ return ByteBuffer.calculateVarint64(value);
+ case ProtoBuf.TYPES["sint64"]:
+ return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
+ case ProtoBuf.TYPES["fixed64"]:
+ case ProtoBuf.TYPES["sfixed64"]:
+ return 8;
+ case ProtoBuf.TYPES["bool"]:
+ return 1;
+ case ProtoBuf.TYPES["enum"]:
+ return ByteBuffer.calculateVarint32(value);
+ case ProtoBuf.TYPES["double"]:
+ return 8;
+ case ProtoBuf.TYPES["string"]:
+ n = ByteBuffer.calculateUTF8Bytes(value);
+ return ByteBuffer.calculateVarint32(n) + n;
+ case ProtoBuf.TYPES["bytes"]:
+ if (value.remaining() < 0)
+ throw Error("Illegal value for " + this.toString(true) + ": " + value.remaining() + " bytes remaining");
+ return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
+ case ProtoBuf.TYPES["message"]:
+ n = this.resolvedType.calculate(value);
+ return ByteBuffer.calculateVarint32(n) + n;
+ case ProtoBuf.TYPES["group"]:
+ n = this.resolvedType.calculate(value);
+ return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+ }
+ // We should never end here
+ throw Error("[INTERNAL] Illegal value to encode in " + this.toString(true) + ": " + value + " (unknown type)");
+ };
+
+ /**
+ * Encodes a value to the specified buffer. Does not encode the key.
+ * @param {number} id Field number
+ * @param {*} value Field value
+ * @param {ByteBuffer} buffer ByteBuffer to encode to
+ * @return {ByteBuffer} The ByteBuffer for chaining
+ * @throws {Error} If the value cannot be encoded
+ * @expose
+ */
+ ElementPrototype.encodeValue = function (id, value, buffer) {
+ if (value === null) return buffer; // Nothing to encode
+ // Tag has already been written
+
+ switch (this.type) {
+ // 32bit signed varint
+ case ProtoBuf.TYPES["int32"]:
+ // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
+ // long – it is, effectively, treated like a very large unsigned integer." (see #122)
+ if (value < 0)
+ buffer.writeVarint64(value);
+ else
+ buffer.writeVarint32(value);
+ break;
+
+ // 32bit unsigned varint
+ case ProtoBuf.TYPES["uint32"]:
+ buffer.writeVarint32(value);
+ break;
+
+ // 32bit varint zig-zag
+ case ProtoBuf.TYPES["sint32"]:
+ buffer.writeVarint32ZigZag(value);
+ break;
+
+ // Fixed unsigned 32bit
+ case ProtoBuf.TYPES["fixed32"]:
+ buffer.writeUint32(value);
+ break;
+
+ // Fixed signed 32bit
+ case ProtoBuf.TYPES["sfixed32"]:
+ buffer.writeInt32(value);
+ break;
+
+ // 64bit varint as-is
+ case ProtoBuf.TYPES["int64"]:
+ case ProtoBuf.TYPES["uint64"]:
+ buffer.writeVarint64(value); // throws
+ break;
+
+ // 64bit varint zig-zag
+ case ProtoBuf.TYPES["sint64"]:
+ buffer.writeVarint64ZigZag(value); // throws
+ break;
+
+ // Fixed unsigned 64bit
+ case ProtoBuf.TYPES["fixed64"]:
+ buffer.writeUint64(value); // throws
+ break;
+
+ // Fixed signed 64bit
+ case ProtoBuf.TYPES["sfixed64"]:
+ buffer.writeInt64(value); // throws
+ break;
+
+ // Bool
+ case ProtoBuf.TYPES["bool"]:
+ if (typeof value === 'string')
+ buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
+ else
+ buffer.writeVarint32(value ? 1 : 0);
+ break;
+
+ // Constant enum value
+ case ProtoBuf.TYPES["enum"]:
+ buffer.writeVarint32(value);
+ break;
+
+ // 32bit float
+ case ProtoBuf.TYPES["float"]:
+ buffer.writeFloat32(value);
+ break;
+
+ // 64bit float
+ case ProtoBuf.TYPES["double"]:
+ buffer.writeFloat64(value);
+ break;
+
+ // Length-delimited string
+ case ProtoBuf.TYPES["string"]:
+ buffer.writeVString(value);
+ break;
+
+ // Length-delimited bytes
+ case ProtoBuf.TYPES["bytes"]:
+ if (value.remaining() < 0)
+ throw Error("Illegal value for " + this.toString(true) + ": " + value.remaining() + " bytes remaining");
+ var prevOffset = value.offset;
+ buffer.writeVarint32(value.remaining());
+ buffer.append(value);
+ value.offset = prevOffset;
+ break;
+
+ // Embedded message
+ case ProtoBuf.TYPES["message"]:
+ var bb = new ByteBuffer().LE();
+ this.resolvedType.encode(value, bb);
+ buffer.writeVarint32(bb.offset);
+ buffer.append(bb.flip());
+ break;
+
+ // Legacy group
+ case ProtoBuf.TYPES["group"]:
+ this.resolvedType.encode(value, buffer);
+ buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
+ break;
+
+ default:
+ // We should never end here
+ throw Error("[INTERNAL] Illegal value to encode in " + this.toString(true) + ": " + value + " (unknown type)");
+ }
+ return buffer;
+ };
+
+ /**
+ * Decode one element value from the specified buffer.
+ * @param {ByteBuffer} buffer ByteBuffer to decode from
+ * @param {number} wireType The field wire type
+ * @param {number} id The field number
+ * @return {*} Decoded value
+ * @throws {Error} If the field cannot be decoded
+ * @expose
+ */
+ ElementPrototype.decode = function (buffer, wireType, id) {
+ if (wireType != this.type.wireType)
+ throw Error("Unexpected wire type for element");
+
+ var value, nBytes;
+ switch (this.type) {
+ // 32bit signed varint
+ case ProtoBuf.TYPES["int32"]:
+ return buffer.readVarint32() | 0;
+
+ // 32bit unsigned varint
+ case ProtoBuf.TYPES["uint32"]:
+ return buffer.readVarint32() >>> 0;
+
+ // 32bit signed varint zig-zag
+ case ProtoBuf.TYPES["sint32"]:
+ return buffer.readVarint32ZigZag() | 0;
+
+ // Fixed 32bit unsigned
+ case ProtoBuf.TYPES["fixed32"]:
+ return buffer.readUint32() >>> 0;
+
+ case ProtoBuf.TYPES["sfixed32"]:
+ return buffer.readInt32() | 0;
+
+ // 64bit signed varint
+ case ProtoBuf.TYPES["int64"]:
+ return buffer.readVarint64();
+
+ // 64bit unsigned varint
+ case ProtoBuf.TYPES["uint64"]:
+ return buffer.readVarint64().toUnsigned();
+
+ // 64bit signed varint zig-zag
+ case ProtoBuf.TYPES["sint64"]:
+ return buffer.readVarint64ZigZag();
+
+ // Fixed 64bit unsigned
+ case ProtoBuf.TYPES["fixed64"]:
+ return buffer.readUint64();
+
+ // Fixed 64bit signed
+ case ProtoBuf.TYPES["sfixed64"]:
+ return buffer.readInt64();
+
+ // Bool varint
+ case ProtoBuf.TYPES["bool"]:
+ return !!buffer.readVarint32();
+
+ // Constant enum value (varint)
+ case ProtoBuf.TYPES["enum"]:
+ // The following Builder.Message#set will already throw
+ return buffer.readVarint32();
+
+ // 32bit float
+ case ProtoBuf.TYPES["float"]:
+ return buffer.readFloat();
+
+ // 64bit float
+ case ProtoBuf.TYPES["double"]:
+ return buffer.readDouble();
+
+ // Length-delimited string
+ case ProtoBuf.TYPES["string"]:
+ return buffer.readVString();
+
+ // Length-delimited bytes
+ case ProtoBuf.TYPES["bytes"]:
+ {
+ nBytes = buffer.readVarint32();
+ if (buffer.remaining() < nBytes)
+ throw Error("Illegal number of bytes for " + this.toString(true) + ": " + nBytes + " required but got only " + buffer.remaining());
+ value = buffer.clone(); // Offset already set
+ value.limit = value.offset + nBytes;
+ buffer.offset += nBytes;
+ return value;
+ }
+
+ // Length-delimited embedded message
+ case ProtoBuf.TYPES["message"]:
+ {
+ nBytes = buffer.readVarint32();
+ return this.resolvedType.decode(buffer, nBytes);
+ }
+
+ // Legacy group
+ case ProtoBuf.TYPES["group"]:
+ return this.resolvedType.decode(buffer, -1, id);
+ }
+
+ // We should never end here
+ throw Error("[INTERNAL] Illegal decode type");
+ };
+
+ /**
+ * Converts a value from a string to the canonical element type.
+ *
+ * Legal only when isMapKey is true.
+ *
+ * @param {string} str The string value
+ * @returns {*} The value
+ */
+ ElementPrototype.valueFromString = function (str) {
+ if (!this.isMapKey) {
+ throw Error("valueFromString() called on non-map-key element");
+ }
+
+ switch (this.type) {
+ case ProtoBuf.TYPES["int32"]:
+ case ProtoBuf.TYPES["sint32"]:
+ case ProtoBuf.TYPES["sfixed32"]:
+ case ProtoBuf.TYPES["uint32"]:
+ case ProtoBuf.TYPES["fixed32"]:
+ return this.verifyValue(parseInt(str));
+
+ case ProtoBuf.TYPES["int64"]:
+ case ProtoBuf.TYPES["sint64"]:
+ case ProtoBuf.TYPES["sfixed64"]:
+ case ProtoBuf.TYPES["uint64"]:
+ case ProtoBuf.TYPES["fixed64"]:
+ // Long-based fields support conversions from string already.
+ return this.verifyValue(str);
+
+ case ProtoBuf.TYPES["bool"]:
+ return str === "true";
+
+ case ProtoBuf.TYPES["string"]:
+ return this.verifyValue(str);
+
+ case ProtoBuf.TYPES["bytes"]:
+ return ByteBuffer.fromBinary(str);
+ }
+ };
+
+ /**
+ * Converts a value from the canonical element type to a string.
+ *
+ * It should be the case that `valueFromString(valueToString(val))` returns
+ * a value equivalent to `verifyValue(val)` for every legal value of `val`
+ * according to this element type.
+ *
+ * This may be used when the element must be stored or used as a string,
+ * e.g., as a map key on an Object.
+ *
+ * Legal only when isMapKey is true.
+ *
+ * @param {*} val The value
+ * @returns {string} The string form of the value.
+ */
+ ElementPrototype.valueToString = function (value) {
+ if (!this.isMapKey) {
+ throw Error("valueToString() called on non-map-key element");
+ }
+
+ if (this.type === ProtoBuf.TYPES["bytes"]) {
+ return value.toString("binary");
+ } else {
+ return value.toString();
+ }
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Element
+ * @expose
+ */
+ Reflect.Element = Element;
+
+ /**
+ * Constructs a new Message.
+ * @exports ProtoBuf.Reflect.Message
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
+ * @param {string} name Message name
+ * @param {Object.<string,*>=} options Message options
+ * @param {boolean=} isGroup `true` if this is a legacy group
+ * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+ * @constructor
+ * @extends ProtoBuf.Reflect.Namespace
+ */
+ var Message = function (builder, parent, name, options, isGroup, syntax) {
+ Namespace.call(this, builder, parent, name, options, syntax);
+
+ /**
+ * @override
+ */
+ this.className = "Message";
+
+ /**
+ * Extensions range.
+ * @type {!Array.<number>|undefined}
+ * @expose
+ */
+ this.extensions = undefined;
+
+ /**
+ * Runtime message class.
+ * @type {?function(new:ProtoBuf.Builder.Message)}
+ * @expose
+ */
+ this.clazz = null;
+
+ /**
+ * Whether this is a legacy group or not.
+ * @type {boolean}
+ * @expose
+ */
+ this.isGroup = !!isGroup;
+
+ // The following cached collections are used to efficiently iterate over or look up fields when decoding.
+
+ /**
+ * Cached fields.
+ * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
+ * @private
+ */
+ this._fields = null;
+
+ /**
+ * Cached fields by id.
+ * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
+ * @private
+ */
+ this._fieldsById = null;
+
+ /**
+ * Cached fields by name.
+ * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
+ * @private
+ */
+ this._fieldsByName = null;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Message.prototype
+ * @inner
+ */
+ var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
+
+ /**
+ * Builds the message and returns the runtime counterpart, which is a fully functional class.
+ * @see ProtoBuf.Builder.Message
+ * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
+ * @return {ProtoBuf.Reflect.Message} Message class
+ * @throws {Error} If the message cannot be built
+ * @expose
+ */
+ MessagePrototype.build = function (rebuild) {
+ if (this.clazz && !rebuild)
+ return this.clazz;
+
+ // Create the runtime Message class in its own scope
+ var clazz = (function (ProtoBuf, T) {
+
+ var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
+ oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
+
+ /**
+ * Constructs a new runtime Message.
+ * @name ProtoBuf.Builder.Message
+ * @class Barebone of all runtime messages.
+ * @param {!Object.<string,*>|string} values Preset values
+ * @param {...string} var_args
+ * @constructor
+ * @throws {Error} If the message cannot be created
+ */
+ var Message = function (values, var_args) {
+ ProtoBuf.Builder.Message.call(this);
+ // Create virtual oneof properties
+ for (var i = 0, k = oneofs.length; i < k; ++i)
+ this[oneofs[i].name] = null;
+ // Create fields and set default values
+ for (i = 0, k = fields.length; i < k; ++i) {
+ var field = fields[i];
+ this[field.name] =
+ field.repeated ? [] :
+ (field.map ? new ProtoBuf.Map(field) : null);
+ if ((field.required || T.syntax === 'proto3') &&
+ field.defaultValue !== null)
+ this[field.name] = field.defaultValue;
+ }
+
+ if (arguments.length > 0) {
+ var value;
+ // Set field values from a values object
+ if (arguments.length === 1 && values !== null && typeof values === 'object' &&
+ /* not _another_ Message */
+ (typeof values.encode !== 'function' || values instanceof Message) &&
+ /* not a repeated field */
+ !Array.isArray(values) &&
+ /* not a Map */
+ !(values instanceof ProtoBuf.Map) &&
+ /* not a ByteBuffer */
+ !ByteBuffer.isByteBuffer(values) &&
+ /* not an ArrayBuffer */
+ !(values instanceof ArrayBuffer) &&
+ /* not a Long */
+ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
+ this.$set(values);
+ } else // Set field values from arguments, in declaration order
+ for (i = 0, k = arguments.length; i < k; ++i)
+ if (typeof (value = arguments[i]) !== 'undefined')
+ this.$set(fields[i].name, value); // May throw
+ }
+ };
+
+ /**
+ * @alias ProtoBuf.Builder.Message.prototype
+ * @inner
+ */
+ var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
+
+ /**
+ * Adds a value to a repeated field.
+ * @name ProtoBuf.Builder.Message#add
+ * @function
+ * @param {string} key Field name
+ * @param {*} value Value to add
+ * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+ * @returns {!ProtoBuf.Builder.Message} this
+ * @throws {Error} If the value cannot be added
+ * @expose
+ */
+ MessagePrototype.add = function (key, value, noAssert) {
+ var field = T._fieldsByName[key];
+ if (!noAssert) {
+ if (!field)
+ throw Error(this + "#" + key + " is undefined");
+ if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+ throw Error(this + "#" + key + " is not a field: " + field.toString(true)); // May throw if it's an enum or embedded message
+ if (!field.repeated)
+ throw Error(this + "#" + key + " is not a repeated field");
+ value = field.verifyValue(value, true);
+ }
+ if (this[key] === null)
+ this[key] = [];
+ this[key].push(value);
+ return this;
+ };
+
+ /**
+ * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
+ * @name ProtoBuf.Builder.Message#$add
+ * @function
+ * @param {string} key Field name
+ * @param {*} value Value to add
+ * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
+ * @returns {!ProtoBuf.Builder.Message} this
+ * @throws {Error} If the value cannot be added
+ * @expose
+ */
+ MessagePrototype.$add = MessagePrototype.add;
+
+ /**
+ * Sets a field's value.
+ * @name ProtoBuf.Builder.Message#set
+ * @function
+ * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+ * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+ * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
+ * @returns {!ProtoBuf.Builder.Message} this
+ * @throws {Error} If the value cannot be set
+ * @expose
+ */
+ MessagePrototype.set = function (keyOrObj, value, noAssert) {
+ if (keyOrObj && typeof keyOrObj === 'object') {
+ noAssert = value;
+ for (var ikey in keyOrObj)
+ if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined')
+ this.$set(ikey, value, noAssert);
+ return this;
+ }
+ var field = T._fieldsByName[keyOrObj];
+ if (!noAssert) {
+ if (!field)
+ throw Error(this + "#" + keyOrObj + " is not a field: undefined");
+ if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+ throw Error(this + "#" + keyOrObj + " is not a field: " + field.toString(true));
+ this[field.name] = (value = field.verifyValue(value)); // May throw
+ } else
+ this[keyOrObj] = value;
+ if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+ var currentField = this[field.oneof.name]; // Virtual field references currently set field
+ if (value !== null) {
+ if (currentField !== null && currentField !== field.name)
+ this[currentField] = null; // Clear currently set field
+ this[field.oneof.name] = field.name; // Point virtual field at this field
+ } else if ( /* value === null && */ currentField === keyOrObj)
+ this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
+ }
+ return this;
+ };
+
+ /**
+ * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
+ * @name ProtoBuf.Builder.Message#$set
+ * @function
+ * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
+ * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
+ * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+ * @throws {Error} If the value cannot be set
+ * @expose
+ */
+ MessagePrototype.$set = MessagePrototype.set;
+
+ /**
+ * Gets a field's value.
+ * @name ProtoBuf.Builder.Message#get
+ * @function
+ * @param {string} key Key
+ * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
+ * @return {*} Value
+ * @throws {Error} If there is no such field
+ * @expose
+ */
+ MessagePrototype.get = function (key, noAssert) {
+ if (noAssert)
+ return this[key];
+ var field = T._fieldsByName[key];
+ if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
+ throw Error(this + "#" + key + " is not a field: undefined");
+ if (!(field instanceof ProtoBuf.Reflect.Message.Field))
+ throw Error(this + "#" + key + " is not a field: " + field.toString(true));
+ return this[field.name];
+ };
+
+ /**
+ * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
+ * @name ProtoBuf.Builder.Message#$get
+ * @function
+ * @param {string} key Key
+ * @return {*} Value
+ * @throws {Error} If there is no such field
+ * @expose
+ */
+ MessagePrototype.$get = MessagePrototype.get;
+
+ // Getters and setters
+
+ for (var i = 0; i < fields.length; i++) {
+ var field = fields[i];
+ // no setters for extension fields as these are named by their fqn
+ if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
+ continue;
+
+ if (T.builder.options['populateAccessors'])
+ (function (field) {
+ // set/get[SomeValue]
+ var Name = field.originalName.replace(/(_[a-zA-Z])/g, function (match) {
+ return match.toUpperCase().replace('_', '');
+ });
+ Name = Name.substring(0, 1).toUpperCase() + Name.substring(1);
+
+ // set/get_[some_value] FIXME: Do we really need these?
+ var name = field.originalName.replace(/([A-Z])/g, function (match) {
+ return "_" + match;
+ });
+
+ /**
+ * The current field's unbound setter function.
+ * @function
+ * @param {*} value
+ * @param {boolean=} noAssert
+ * @returns {!ProtoBuf.Builder.Message}
+ * @inner
+ */
+ var setter = function (value, noAssert) {
+ this[field.name] = noAssert ? value : field.verifyValue(value);
+ return this;
+ };
+
+ /**
+ * The current field's unbound getter function.
+ * @function
+ * @returns {*}
+ * @inner
+ */
+ var getter = function () {
+ return this[field.name];
+ };
+
+ if (T.getChild("set" + Name) === null)
+ /**
+ * Sets a value. This method is present for each field, but only if there is no name conflict with
+ * another field.
+ * @name ProtoBuf.Builder.Message#set[SomeField]
+ * @function
+ * @param {*} value Value to set
+ * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+ * @returns {!ProtoBuf.Builder.Message} this
+ * @abstract
+ * @throws {Error} If the value cannot be set
+ */
+ MessagePrototype["set" + Name] = setter;
+
+ if (T.getChild("set_" + name) === null)
+ /**
+ * Sets a value. This method is present for each field, but only if there is no name conflict with
+ * another field.
+ * @name ProtoBuf.Builder.Message#set_[some_field]
+ * @function
+ * @param {*} value Value to set
+ * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
+ * @returns {!ProtoBuf.Builder.Message} this
+ * @abstract
+ * @throws {Error} If the value cannot be set
+ */
+ MessagePrototype["set_" + name] = setter;
+
+ if (T.getChild("get" + Name) === null)
+ /**
+ * Gets a value. This method is present for each field, but only if there is no name conflict with
+ * another field.
+ * @name ProtoBuf.Builder.Message#get[SomeField]
+ * @function
+ * @abstract
+ * @return {*} The value
+ */
+ MessagePrototype["get" + Name] = getter;
+
+ if (T.getChild("get_" + name) === null)
+ /**
+ * Gets a value. This method is present for each field, but only if there is no name conflict with
+ * another field.
+ * @name ProtoBuf.Builder.Message#get_[some_field]
+ * @function
+ * @return {*} The value
+ * @abstract
+ */
+ MessagePrototype["get_" + name] = getter;
+
+ })(field);
+ }
+
+ // En-/decoding
+
+ /**
+ * Encodes the message.
+ * @name ProtoBuf.Builder.Message#$encode
+ * @function
+ * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+ * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+ * @return {!ByteBuffer} Encoded message as a ByteBuffer
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded ByteBuffer in the `encoded` property on the error.
+ * @expose
+ * @see ProtoBuf.Builder.Message#encode64
+ * @see ProtoBuf.Builder.Message#encodeHex
+ * @see ProtoBuf.Builder.Message#encodeAB
+ */
+ MessagePrototype.encode = function (buffer, noVerify) {
+ if (typeof buffer === 'boolean')
+ noVerify = buffer,
+ buffer = undefined;
+ var isNew = false;
+ if (!buffer)
+ buffer = new ByteBuffer(),
+ isNew = true;
+ var le = buffer.littleEndian;
+ try {
+ T.encode(this, buffer.LE(), noVerify);
+ return (isNew ? buffer.flip() : buffer).LE(le);
+ } catch (e) {
+ buffer.LE(le);
+ throw (e);
+ }
+ };
+
+ /**
+ * Encodes a message using the specified data payload.
+ * @param {!Object.<string,*>} data Data payload
+ * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+ * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+ * @return {!ByteBuffer} Encoded message as a ByteBuffer
+ * @expose
+ */
+ Message.encode = function (data, buffer, noVerify) {
+ return new Message(data).encode(buffer, noVerify);
+ };
+
+ /**
+ * Calculates the byte length of the message.
+ * @name ProtoBuf.Builder.Message#calculate
+ * @function
+ * @returns {number} Byte length
+ * @throws {Error} If the message cannot be calculated or if required fields are missing.
+ * @expose
+ */
+ MessagePrototype.calculate = function () {
+ return T.calculate(this);
+ };
+
+ /**
+ * Encodes the varint32 length-delimited message.
+ * @name ProtoBuf.Builder.Message#encodeDelimited
+ * @function
+ * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
+ * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+ * @return {!ByteBuffer} Encoded message as a ByteBuffer
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded ByteBuffer in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.encodeDelimited = function (buffer, noVerify) {
+ var isNew = false;
+ if (!buffer)
+ buffer = new ByteBuffer(),
+ isNew = true;
+ var enc = new ByteBuffer().LE();
+ T.encode(this, enc, noVerify).flip();
+ buffer.writeVarint32(enc.remaining());
+ buffer.append(enc);
+ return isNew ? buffer.flip() : buffer;
+ };
+
+ /**
+ * Directly encodes the message to an ArrayBuffer.
+ * @name ProtoBuf.Builder.Message#encodeAB
+ * @function
+ * @return {ArrayBuffer} Encoded message as ArrayBuffer
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded ArrayBuffer in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.encodeAB = function () {
+ try {
+ return this.encode().toArrayBuffer();
+ } catch (e) {
+ if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
+ throw (e);
+ }
+ };
+
+ /**
+ * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
+ * @name ProtoBuf.Builder.Message#toArrayBuffer
+ * @function
+ * @return {ArrayBuffer} Encoded message as ArrayBuffer
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded ArrayBuffer in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
+
+ /**
+ * Directly encodes the message to a node Buffer.
+ * @name ProtoBuf.Builder.Message#encodeNB
+ * @function
+ * @return {!Buffer}
+ * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
+ * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.encodeNB = function () {
+ try {
+ return this.encode().toBuffer();
+ } catch (e) {
+ if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
+ throw (e);
+ }
+ };
+
+ /**
+ * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
+ * @name ProtoBuf.Builder.Message#toBuffer
+ * @function
+ * @return {!Buffer}
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded node Buffer in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.toBuffer = MessagePrototype.encodeNB;
+
+ /**
+ * Directly encodes the message to a base64 encoded string.
+ * @name ProtoBuf.Builder.Message#encode64
+ * @function
+ * @return {string} Base64 encoded string
+ * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+ * still returns the encoded base64 string in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.encode64 = function () {
+ try {
+ return this.encode().toBase64();
+ } catch (e) {
+ if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
+ throw (e);
+ }
+ };
+
+ /**
+ * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
+ * @name ProtoBuf.Builder.Message#toBase64
+ * @function
+ * @return {string} Base64 encoded string
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded base64 string in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.toBase64 = MessagePrototype.encode64;
+
+ /**
+ * Directly encodes the message to a hex encoded string.
+ * @name ProtoBuf.Builder.Message#encodeHex
+ * @function
+ * @return {string} Hex encoded string
+ * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
+ * still returns the encoded hex string in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.encodeHex = function () {
+ try {
+ return this.encode().toHex();
+ } catch (e) {
+ if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
+ throw (e);
+ }
+ };
+
+ /**
+ * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
+ * @name ProtoBuf.Builder.Message#toHex
+ * @function
+ * @return {string} Hex encoded string
+ * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
+ * returns the encoded hex string in the `encoded` property on the error.
+ * @expose
+ */
+ MessagePrototype.toHex = MessagePrototype.encodeHex;
+
+ /**
+ * Clones a message object or field value to a raw object.
+ * @param {*} obj Object to clone
+ * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
+ * @param {boolean} longsAsStrings Whether to encode longs as strings
+ * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
+ * @returns {*} Cloned object
+ * @inner
+ */
+ function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
+ if (obj === null || typeof obj !== 'object') {
+ // Convert enum values to their respective names
+ if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
+ var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
+ if (name !== null)
+ return name;
+ }
+ // Pass-through string, number, boolean, null...
+ return obj;
+ }
+ // Convert ByteBuffers to raw buffer or strings
+ if (ByteBuffer.isByteBuffer(obj))
+ return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
+ // Convert Longs to proper objects or strings
+ if (ProtoBuf.Long.isLong(obj))
+ return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
+ var clone;
+ // Clone arrays
+ if (Array.isArray(obj)) {
+ clone = [];
+ obj.forEach(function (v, k) {
+ clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
+ });
+ return clone;
+ }
+ clone = {};
+ // Convert maps to objects
+ if (obj instanceof ProtoBuf.Map) {
+ var it = obj.entries();
+ for (var e = it.next(); !e.done; e = it.next())
+ clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
+ return clone;
+ }
+ // Everything else is a non-null object
+ var type = obj.$type,
+ field = undefined;
+ for (var i in obj)
+ if (obj.hasOwnProperty(i)) {
+ if (type && (field = type.getChild(i)))
+ clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
+ else
+ clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
+ }
+ return clone;
+ }
+
+ /**
+ * Returns the message's raw payload.
+ * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
+ * @param {boolean} longsAsStrings Whether to encode longs as strings
+ * @returns {Object.<string,*>} Raw payload
+ * @expose
+ */
+ MessagePrototype.toRaw = function (binaryAsBase64, longsAsStrings) {
+ return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
+ };
+
+ /**
+ * Encodes a message to JSON.
+ * @returns {string} JSON string
+ * @expose
+ */
+ MessagePrototype.encodeJSON = function () {
+ return JSON.stringify(
+ cloneRaw(this,
+ /* binary-as-base64 */
+ true,
+ /* longs-as-strings */
+ true,
+ this.$type
+ )
+ );
+ };
+
+ /**
+ * Decodes a message from the specified buffer or string.
+ * @name ProtoBuf.Builder.Message.decode
+ * @function
+ * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+ * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
+ * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+ * @return {!ProtoBuf.Builder.Message} Decoded message
+ * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+ * returns the decoded message with missing fields in the `decoded` property on the error.
+ * @expose
+ * @see ProtoBuf.Builder.Message.decode64
+ * @see ProtoBuf.Builder.Message.decodeHex
+ */
+ Message.decode = function (buffer, length, enc) {
+ if (typeof length === 'string')
+ enc = length,
+ length = -1;
+ if (typeof buffer === 'string')
+ buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+ buffer = ByteBuffer.isByteBuffer(buffer) ? buffer : ByteBuffer.wrap(buffer); // May throw
+ var le = buffer.littleEndian;
+ try {
+ var msg = T.decode(buffer.LE());
+ buffer.LE(le);
+ return msg;
+ } catch (e) {
+ buffer.LE(le);
+ throw (e);
+ }
+ };
+
+ /**
+ * Decodes a varint32 length-delimited message from the specified buffer or string.
+ * @name ProtoBuf.Builder.Message.decodeDelimited
+ * @function
+ * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
+ * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
+ * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
+ * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+ * returns the decoded message with missing fields in the `decoded` property on the error.
+ * @expose
+ */
+ Message.decodeDelimited = function (buffer, enc) {
+ if (typeof buffer === 'string')
+ buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
+ buffer = ByteBuffer.isByteBuffer(buffer) ? buffer : ByteBuffer.wrap(buffer); // May throw
+ if (buffer.remaining() < 1)
+ return null;
+ var off = buffer.offset,
+ len = buffer.readVarint32();
+ if (buffer.remaining() < len) {
+ buffer.offset = off;
+ return null;
+ }
+ try {
+ var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
+ buffer.offset += len;
+ return msg;
+ } catch (err) {
+ buffer.offset += len;
+ throw err;
+ }
+ };
+
+ /**
+ * Decodes the message from the specified base64 encoded string.
+ * @name ProtoBuf.Builder.Message.decode64
+ * @function
+ * @param {string} str String to decode from
+ * @return {!ProtoBuf.Builder.Message} Decoded message
+ * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+ * returns the decoded message with missing fields in the `decoded` property on the error.
+ * @expose
+ */
+ Message.decode64 = function (str) {
+ return Message.decode(str, "base64");
+ };
+
+ /**
+ * Decodes the message from the specified hex encoded string.
+ * @name ProtoBuf.Builder.Message.decodeHex
+ * @function
+ * @param {string} str String to decode from
+ * @return {!ProtoBuf.Builder.Message} Decoded message
+ * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
+ * returns the decoded message with missing fields in the `decoded` property on the error.
+ * @expose
+ */
+ Message.decodeHex = function (str) {
+ return Message.decode(str, "hex");
+ };
+
+ /**
+ * Decodes the message from a JSON string.
+ * @name ProtoBuf.Builder.Message.decodeJSON
+ * @function
+ * @param {string} str String to decode from
+ * @return {!ProtoBuf.Builder.Message} Decoded message
+ * @throws {Error} If the message cannot be decoded or if required fields are
+ * missing.
+ * @expose
+ */
+ Message.decodeJSON = function (str) {
+ return new Message(JSON.parse(str));
+ };
+
+ // Utility
+
+ /**
+ * Returns a string representation of this Message.
+ * @name ProtoBuf.Builder.Message#toString
+ * @function
+ * @return {string} String representation as of ".Fully.Qualified.MessageName"
+ * @expose
+ */
+ MessagePrototype.toString = function () {
+ return T.toString();
+ };
+
+ // Properties
+
+ /**
+ * Message options.
+ * @name ProtoBuf.Builder.Message.$options
+ * @type {Object.<string,*>}
+ * @expose
+ */
+ var $optionsS; // cc needs this
+
+ /**
+ * Message options.
+ * @name ProtoBuf.Builder.Message#$options
+ * @type {Object.<string,*>}
+ * @expose
+ */
+ var $options;
+
+ /**
+ * Reflection type.
+ * @name ProtoBuf.Builder.Message.$type
+ * @type {!ProtoBuf.Reflect.Message}
+ * @expose
+ */
+ var $typeS;
+
+ /**
+ * Reflection type.
+ * @name ProtoBuf.Builder.Message#$type
+ * @type {!ProtoBuf.Reflect.Message}
+ * @expose
+ */
+ var $type;
+
+ if (Object.defineProperty)
+ Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
+ Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
+ Object.defineProperty(Message, "$type", { "value": T }),
+ Object.defineProperty(MessagePrototype, "$type", { "value": T });
+
+ return Message;
+
+ })(ProtoBuf, this);
+
+ // Static enums and prototyped sub-messages / cached collections
+ this._fields = [];
+ this._fieldsById = {};
+ this._fieldsByName = {};
+ for (var i = 0, k = this.children.length, child; i < k; i++) {
+ child = this.children[i];
+ if (child instanceof Enum || child instanceof Message || child instanceof Service) {
+ if (clazz.hasOwnProperty(child.name))
+ throw Error("Illegal reflect child of " + this.toString(true) + ": " + child.toString(true) + " cannot override static property '" + child.name + "'");
+ clazz[child.name] = child.build();
+ } else if (child instanceof Message.Field)
+ child.build(),
+ this._fields.push(child),
+ this._fieldsById[child.id] = child,
+ this._fieldsByName[child.name] = child;
+ else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
+ throw Error("Illegal reflect child of " + this.toString(true) + ": " + this.children[i].toString(true));
+ }
+
+ return this.clazz = clazz;
+ };
+
+ /**
+ * Encodes a runtime message's contents to the specified buffer.
+ * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+ * @param {ByteBuffer} buffer ByteBuffer to write to
+ * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
+ * @return {ByteBuffer} The ByteBuffer for chaining
+ * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
+ * @expose
+ */
+ MessagePrototype.encode = function (message, buffer, noVerify) {
+ var fieldMissing = null,
+ field;
+ for (var i = 0, k = this._fields.length, val; i < k; ++i) {
+ field = this._fields[i];
+ val = message[field.name];
+ if (field.required && val === null) {
+ if (fieldMissing === null)
+ fieldMissing = field;
+ } else
+ field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
+ }
+ if (fieldMissing !== null) {
+ var err = Error("Missing at least one required field for " + this.toString(true) + ": " + fieldMissing);
+ err["encoded"] = buffer; // Still expose what we got
+ throw (err);
+ }
+ return buffer;
+ };
+
+ /**
+ * Calculates a runtime message's byte length.
+ * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
+ * @returns {number} Byte length
+ * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
+ * @expose
+ */
+ MessagePrototype.calculate = function (message) {
+ for (var n = 0, i = 0, k = this._fields.length, field, val; i < k; ++i) {
+ field = this._fields[i];
+ val = message[field.name];
+ if (field.required && val === null)
+ throw Error("Missing at least one required field for " + this.toString(true) + ": " + field);
+ else
+ n += field.calculate(val, message);
+ }
+ return n;
+ };
+
+ /**
+ * Skips all data until the end of the specified group has been reached.
+ * @param {number} expectedId Expected GROUPEND id
+ * @param {!ByteBuffer} buf ByteBuffer
+ * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
+ * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
+ * @inner
+ */
+ function skipTillGroupEnd(expectedId, buf) {
+ var tag = buf.readVarint32(), // Throws on OOB
+ wireType = tag & 0x07,
+ id = tag >>> 3;
+ switch (wireType) {
+ case ProtoBuf.WIRE_TYPES.VARINT:
+ do tag = buf.readUint8();
+ while ((tag & 0x80) === 0x80);
+ break;
+ case ProtoBuf.WIRE_TYPES.BITS64:
+ buf.offset += 8;
+ break;
+ case ProtoBuf.WIRE_TYPES.LDELIM:
+ tag = buf.readVarint32(); // reads the varint
+ buf.offset += tag; // skips n bytes
+ break;
+ case ProtoBuf.WIRE_TYPES.STARTGROUP:
+ skipTillGroupEnd(id, buf);
+ break;
+ case ProtoBuf.WIRE_TYPES.ENDGROUP:
+ if (id === expectedId)
+ return false;
+ else
+ throw Error("Illegal GROUPEND after unknown group: " + id + " (" + expectedId + " expected)");
+ case ProtoBuf.WIRE_TYPES.BITS32:
+ buf.offset += 4;
+ break;
+ default:
+ throw Error("Illegal wire type in unknown group " + expectedId + ": " + wireType);
+ }
+ return true;
+ }
+
+ /**
+ * Decodes an encoded message and returns the decoded message.
+ * @param {ByteBuffer} buffer ByteBuffer to decode from
+ * @param {number=} length Message length. Defaults to decode all remaining data.
+ * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
+ * @return {ProtoBuf.Builder.Message} Decoded message
+ * @throws {Error} If the message cannot be decoded
+ * @expose
+ */
+ MessagePrototype.decode = function (buffer, length, expectedGroupEndId) {
+ length = typeof length === 'number' ? length : -1;
+ var start = buffer.offset,
+ msg = new(this.clazz)(),
+ tag, wireType, id, field;
+ while (buffer.offset < start + length || (length === -1 && buffer.remaining() > 0)) {
+ tag = buffer.readVarint32();
+ wireType = tag & 0x07;
+ id = tag >>> 3;
+ if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
+ if (id !== expectedGroupEndId)
+ throw Error("Illegal group end indicator for " + this.toString(true) + ": " + id + " (" + (expectedGroupEndId ? expectedGroupEndId + " expected" : "not a group") + ")");
+ break;
+ }
+ if (!(field = this._fieldsById[id])) {
+ // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
+ switch (wireType) {
+ case ProtoBuf.WIRE_TYPES.VARINT:
+ buffer.readVarint32();
+ break;
+ case ProtoBuf.WIRE_TYPES.BITS32:
+ buffer.offset += 4;
+ break;
+ case ProtoBuf.WIRE_TYPES.BITS64:
+ buffer.offset += 8;
+ break;
+ case ProtoBuf.WIRE_TYPES.LDELIM:
+ var len = buffer.readVarint32();
+ buffer.offset += len;
+ break;
+ case ProtoBuf.WIRE_TYPES.STARTGROUP:
+ while (skipTillGroupEnd(id, buffer)) {}
+ break;
+ default:
+ throw Error("Illegal wire type for unknown field " + id + " in " + this.toString(true) + "#decode: " + wireType);
+ }
+ continue;
+ }
+ if (field.repeated && !field.options["packed"]) {
+ msg[field.name].push(field.decode(wireType, buffer));
+ } else if (field.map) {
+ var keyval = field.decode(wireType, buffer);
+ msg[field.name].set(keyval[0], keyval[1]);
+ } else {
+ msg[field.name] = field.decode(wireType, buffer);
+ if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
+ var currentField = msg[field.oneof.name]; // Virtual field references currently set field
+ if (currentField !== null && currentField !== field.name)
+ msg[currentField] = null; // Clear currently set field
+ msg[field.oneof.name] = field.name; // Point virtual field at this field
+ }
+ }
+ }
+
+ // Check if all required fields are present and set default values for optional fields that are not
+ for (var i = 0, k = this._fields.length; i < k; ++i) {
+ field = this._fields[i];
+ if (msg[field.name] === null) {
+ if (this.syntax === "proto3") { // Proto3 sets default values by specification
+ msg[field.name] = field.defaultValue;
+ } else if (field.required) {
+ var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
+ err["decoded"] = msg; // Still expose what we got
+ throw (err);
+ } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
+ msg[field.name] = field.defaultValue;
+ }
+ }
+ return msg;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Message
+ * @expose
+ */
+ Reflect.Message = Message;
+
+ /**
+ * Constructs a new Message Field.
+ * @exports ProtoBuf.Reflect.Message.Field
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Message} message Message reference
+ * @param {string} rule Rule, one of requried, optional, repeated
+ * @param {string?} keytype Key data type, if any.
+ * @param {string} type Data type, e.g. int32
+ * @param {string} name Field name
+ * @param {number} id Unique field id
+ * @param {Object.<string,*>=} options Options
+ * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
+ * @param {string?} syntax The syntax level of this definition (e.g., proto3)
+ * @constructor
+ * @extends ProtoBuf.Reflect.T
+ */
+ var Field = function (builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
+ T.call(this, builder, message, name);
+
+ /**
+ * @override
+ */
+ this.className = "Message.Field";
+
+ /**
+ * Message field required flag.
+ * @type {boolean}
+ * @expose
+ */
+ this.required = rule === "required";
+
+ /**
+ * Message field repeated flag.
+ * @type {boolean}
+ * @expose
+ */
+ this.repeated = rule === "repeated";
+
+ /**
+ * Message field map flag.
+ * @type {boolean}
+ * @expose
+ */
+ this.map = rule === "map";
+
+ /**
+ * Message field key type. Type reference string if unresolved, protobuf
+ * type if resolved. Valid only if this.map === true, null otherwise.
+ * @type {string|{name: string, wireType: number}|null}
+ * @expose
+ */
+ this.keyType = keytype || null;
+
+ /**
+ * Message field type. Type reference string if unresolved, protobuf type if
+ * resolved. In a map field, this is the value type.
+ * @type {string|{name: string, wireType: number}}
+ * @expose
+ */
+ this.type = type;
+
+ /**
+ * Resolved type reference inside the global namespace.
+ * @type {ProtoBuf.Reflect.T|null}
+ * @expose
+ */
+ this.resolvedType = null;
+
+ /**
+ * Unique message field id.
+ * @type {number}
+ * @expose
+ */
+ this.id = id;
+
+ /**
+ * Message field options.
+ * @type {!Object.<string,*>}
+ * @dict
+ * @expose
+ */
+ this.options = options || {};
+
+ /**
+ * Default value.
+ * @type {*}
+ * @expose
+ */
+ this.defaultValue = null;
+
+ /**
+ * Enclosing OneOf.
+ * @type {?ProtoBuf.Reflect.Message.OneOf}
+ * @expose
+ */
+ this.oneof = oneof || null;
+
+ /**
+ * Syntax level of this definition (e.g., proto3).
+ * @type {string}
+ * @expose
+ */
+ this.syntax = syntax || 'proto2';
+
+ /**
+ * Original field name.
+ * @type {string}
+ * @expose
+ */
+ this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
+
+ /**
+ * Element implementation. Created in build() after types are resolved.
+ * @type {ProtoBuf.Element}
+ * @expose
+ */
+ this.element = null;
+
+ /**
+ * Key element implementation, for map fields. Created in build() after
+ * types are resolved.
+ * @type {ProtoBuf.Element}
+ * @expose
+ */
+ this.keyElement = null;
+
+ // Convert field names to camel case notation if the override is set
+ if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
+ this.name = ProtoBuf.Util.toCamelCase(this.name);
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Message.Field.prototype
+ * @inner
+ */
+ var FieldPrototype = Field.prototype = Object.create(T.prototype);
+
+ /**
+ * Builds the field.
+ * @override
+ * @expose
+ */
+ FieldPrototype.build = function () {
+ this.element = new Element(this.type, this.resolvedType, false, this.syntax);
+ if (this.map)
+ this.keyElement = new Element(this.keyType, undefined, true, this.syntax);
+
+ // In proto3, fields do not have field presence, and every field is set to
+ // its type's default value ("", 0, 0.0, or false).
+ if (this.syntax === 'proto3' && !this.repeated && !this.map)
+ this.defaultValue = Element.defaultFieldValue(this.type);
+
+ // Otherwise, default values are present when explicitly specified
+ else if (typeof this.options['default'] !== 'undefined')
+ this.defaultValue = this.verifyValue(this.options['default']);
+ };
+
+ /**
+ * Checks if the given value can be set for this field.
+ * @param {*} value Value to check
+ * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
+ * @return {*} Verified, maybe adjusted, value
+ * @throws {Error} If the value cannot be set for this field
+ * @expose
+ */
+ FieldPrototype.verifyValue = function (value, skipRepeated) {
+ skipRepeated = skipRepeated || false;
+ var self = this;
+
+ function fail(val, msg) {
+ throw Error("Illegal value for " + self.toString(true) + " of type " + self.type.name + ": " + val + " (" + msg + ")");
+ }
+ if (value === null) { // NULL values for optional fields
+ if (this.required)
+ fail(typeof value, "required");
+ if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
+ fail(typeof value, "proto3 field without field presence cannot be null");
+ return null;
+ }
+ var i;
+ if (this.repeated && !skipRepeated) { // Repeated values as arrays
+ if (!Array.isArray(value))
+ value = [value];
+ var res = [];
+ for (i = 0; i < value.length; i++)
+ res.push(this.element.verifyValue(value[i]));
+ return res;
+ }
+ if (this.map && !skipRepeated) { // Map values as objects
+ if (!(value instanceof ProtoBuf.Map)) {
+ // If not already a Map, attempt to convert.
+ if (!(value instanceof Object)) {
+ fail(typeof value,
+ "expected ProtoBuf.Map or raw object for map field");
+ }
+ return new ProtoBuf.Map(this, value);
+ } else {
+ return value;
+ }
+ }
+ // All non-repeated fields expect no array
+ if (!this.repeated && Array.isArray(value))
+ fail(typeof value, "no array expected");
+
+ return this.element.verifyValue(value);
+ };
+
+ /**
+ * Determines whether the field will have a presence on the wire given its
+ * value.
+ * @param {*} value Verified field value
+ * @param {!ProtoBuf.Builder.Message} message Runtime message
+ * @return {boolean} Whether the field will be present on the wire
+ */
+ FieldPrototype.hasWirePresence = function (value, message) {
+ if (this.syntax !== 'proto3')
+ return (value !== null);
+ if (this.oneof && message[this.oneof.name] === this.name)
+ return true;
+ switch (this.type) {
+ case ProtoBuf.TYPES["int32"]:
+ case ProtoBuf.TYPES["sint32"]:
+ case ProtoBuf.TYPES["sfixed32"]:
+ case ProtoBuf.TYPES["uint32"]:
+ case ProtoBuf.TYPES["fixed32"]:
+ return value !== 0;
+
+ case ProtoBuf.TYPES["int64"]:
+ case ProtoBuf.TYPES["sint64"]:
+ case ProtoBuf.TYPES["sfixed64"]:
+ case ProtoBuf.TYPES["uint64"]:
+ case ProtoBuf.TYPES["fixed64"]:
+ return value.low !== 0 || value.high !== 0;
+
+ case ProtoBuf.TYPES["bool"]:
+ return value;
+
+ case ProtoBuf.TYPES["float"]:
+ case ProtoBuf.TYPES["double"]:
+ return value !== 0.0;
+
+ case ProtoBuf.TYPES["string"]:
+ return value.length > 0;
+
+ case ProtoBuf.TYPES["bytes"]:
+ return value.remaining() > 0;
+
+ case ProtoBuf.TYPES["enum"]:
+ return value !== 0;
+
+ case ProtoBuf.TYPES["message"]:
+ return value !== null;
+ default:
+ return true;
+ }
+ };
+
+ /**
+ * Encodes the specified field value to the specified buffer.
+ * @param {*} value Verified field value
+ * @param {ByteBuffer} buffer ByteBuffer to encode to
+ * @param {!ProtoBuf.Builder.Message} message Runtime message
+ * @return {ByteBuffer} The ByteBuffer for chaining
+ * @throws {Error} If the field cannot be encoded
+ * @expose
+ */
+ FieldPrototype.encode = function (value, buffer, message) {
+ if (this.type === null || typeof this.type !== 'object')
+ throw Error("[INTERNAL] Unresolved type in " + this.toString(true) + ": " + this.type);
+ if (value === null || (this.repeated && value.length == 0))
+ return buffer; // Optional omitted
+ try {
+ if (this.repeated) {
+ var i;
+ // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
+ // types) can be declared 'packed'."
+ if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+ // "All of the elements of the field are packed into a single key-value pair with wire type 2
+ // (length-delimited). Each element is encoded the same way it would be normally, except without a
+ // tag preceding it."
+ buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+ buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
+ var start = buffer.offset; // Remember where the contents begin
+ for (i = 0; i < value.length; i++)
+ this.element.encodeValue(this.id, value[i], buffer);
+ var len = buffer.offset - start,
+ varintLen = ByteBuffer.calculateVarint32(len);
+ if (varintLen > 1) { // We need to move the contents
+ var contents = buffer.slice(start, buffer.offset);
+ start += varintLen - 1;
+ buffer.offset = start;
+ buffer.append(contents);
+ }
+ buffer.writeVarint32(len, start - varintLen);
+ } else {
+ // "If your message definition has repeated elements (without the [packed=true] option), the encoded
+ // message has zero or more key-value pairs with the same tag number"
+ for (i = 0; i < value.length; i++)
+ buffer.writeVarint32((this.id << 3) | this.type.wireType),
+ this.element.encodeValue(this.id, value[i], buffer);
+ }
+ } else if (this.map) {
+ // Write out each map entry as a submessage.
+ value.forEach(function (val, key, m) {
+ // Compute the length of the submessage (key, val) pair.
+ var length =
+ ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+ this.keyElement.calculateLength(1, key) +
+ ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+ this.element.calculateLength(2, val);
+
+ // Submessage with wire type of length-delimited.
+ buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+ buffer.writeVarint32(length);
+
+ // Write out the key and val.
+ buffer.writeVarint32((1 << 3) | this.keyType.wireType);
+ this.keyElement.encodeValue(1, key, buffer);
+ buffer.writeVarint32((2 << 3) | this.type.wireType);
+ this.element.encodeValue(2, val, buffer);
+ }, this);
+ } else {
+ if (this.hasWirePresence(value, message)) {
+ buffer.writeVarint32((this.id << 3) | this.type.wireType);
+ this.element.encodeValue(this.id, value, buffer);
+ }
+ }
+ } catch (e) {
+ throw Error("Illegal value for " + this.toString(true) + ": " + value + " (" + e + ")");
+ }
+ return buffer;
+ };
+
+ /**
+ * Calculates the length of this field's value on the network level.
+ * @param {*} value Field value
+ * @param {!ProtoBuf.Builder.Message} message Runtime message
+ * @returns {number} Byte length
+ * @expose
+ */
+ FieldPrototype.calculate = function (value, message) {
+ value = this.verifyValue(value); // May throw
+ if (this.type === null || typeof this.type !== 'object')
+ throw Error("[INTERNAL] Unresolved type in " + this.toString(true) + ": " + this.type);
+ if (value === null || (this.repeated && value.length == 0))
+ return 0; // Optional omitted
+ var n = 0;
+ try {
+ if (this.repeated) {
+ var i, ni;
+ if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+ n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+ ni = 0;
+ for (i = 0; i < value.length; i++)
+ ni += this.element.calculateLength(this.id, value[i]);
+ n += ByteBuffer.calculateVarint32(ni);
+ n += ni;
+ } else {
+ for (i = 0; i < value.length; i++)
+ n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
+ n += this.element.calculateLength(this.id, value[i]);
+ }
+ } else if (this.map) {
+ // Each map entry becomes a submessage.
+ value.forEach(function (val, key, m) {
+ // Compute the length of the submessage (key, val) pair.
+ var length =
+ ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
+ this.keyElement.calculateLength(1, key) +
+ ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
+ this.element.calculateLength(2, val);
+
+ n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
+ n += ByteBuffer.calculateVarint32(length);
+ n += length;
+ }, this);
+ } else {
+ if (this.hasWirePresence(value, message)) {
+ n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
+ n += this.element.calculateLength(this.id, value);
+ }
+ }
+ } catch (e) {
+ throw Error("Illegal value for " + this.toString(true) + ": " + value + " (" + e + ")");
+ }
+ return n;
+ };
+
+ /**
+ * Decode the field value from the specified buffer.
+ * @param {number} wireType Leading wire type
+ * @param {ByteBuffer} buffer ByteBuffer to decode from
+ * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
+ * @return {*} Decoded value: array for packed repeated fields, [key, value] for
+ * map fields, or an individual value otherwise.
+ * @throws {Error} If the field cannot be decoded
+ * @expose
+ */
+ FieldPrototype.decode = function (wireType, buffer, skipRepeated) {
+ var value, nBytes;
+
+ // We expect wireType to match the underlying type's wireType unless we see
+ // a packed repeated field, or unless this is a map field.
+ var wireTypeOK =
+ (!this.map && wireType == this.type.wireType) ||
+ (!skipRepeated && this.repeated && this.options["packed"] &&
+ wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
+ (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
+ if (!wireTypeOK)
+ throw Error("Illegal wire type for field " + this.toString(true) + ": " + wireType + " (" + this.type.wireType + " expected)");
+
+ // Handle packed repeated fields.
+ if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
+ if (!skipRepeated) {
+ nBytes = buffer.readVarint32();
+ nBytes = buffer.offset + nBytes; // Limit
+ var values = [];
+ while (buffer.offset < nBytes)
+ values.push(this.decode(this.type.wireType, buffer, true));
+ return values;
+ }
+ // Read the next value otherwise...
+ }
+
+ // Handle maps.
+ if (this.map) {
+ // Read one (key, value) submessage, and return [key, value]
+ var key = Element.defaultFieldValue(this.keyType);
+ value = Element.defaultFieldValue(this.type);
+
+ // Read the length
+ nBytes = buffer.readVarint32();
+ if (buffer.remaining() < nBytes)
+ throw Error("Illegal number of bytes for " + this.toString(true) + ": " + nBytes + " required but got only " + buffer.remaining());
+
+ // Get a sub-buffer of this key/value submessage
+ var msgbuf = buffer.clone();
+ msgbuf.limit = msgbuf.offset + nBytes;
+ buffer.offset += nBytes;
+
+ while (msgbuf.remaining() > 0) {
+ var tag = msgbuf.readVarint32();
+ wireType = tag & 0x07;
+ var id = tag >>> 3;
+ if (id === 1) {
+ key = this.keyElement.decode(msgbuf, wireType, id);
+ } else if (id === 2) {
+ value = this.element.decode(msgbuf, wireType, id);
+ } else {
+ throw Error("Unexpected tag in map field key/value submessage");
+ }
+ }
+
+ return [key, value];
+ }
+
+ // Handle singular and non-packed repeated field values.
+ return this.element.decode(buffer, wireType, this.id);
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Message.Field
+ * @expose
+ */
+ Reflect.Message.Field = Field;
+
+ /**
+ * Constructs a new Message ExtensionField.
+ * @exports ProtoBuf.Reflect.Message.ExtensionField
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Message} message Message reference
+ * @param {string} rule Rule, one of requried, optional, repeated
+ * @param {string} type Data type, e.g. int32
+ * @param {string} name Field name
+ * @param {number} id Unique field id
+ * @param {!Object.<string,*>=} options Options
+ * @constructor
+ * @extends ProtoBuf.Reflect.Message.Field
+ */
+ var ExtensionField = function (builder, message, rule, type, name, id, options) {
+ Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
+
+ /**
+ * Extension reference.
+ * @type {!ProtoBuf.Reflect.Extension}
+ * @expose
+ */
+ this.extension;
+ };
+
+ // Extends Field
+ ExtensionField.prototype = Object.create(Field.prototype);
+
+ /**
+ * @alias ProtoBuf.Reflect.Message.ExtensionField
+ * @expose
+ */
+ Reflect.Message.ExtensionField = ExtensionField;
+
+ /**
+ * Constructs a new Message OneOf.
+ * @exports ProtoBuf.Reflect.Message.OneOf
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Message} message Message reference
+ * @param {string} name OneOf name
+ * @constructor
+ * @extends ProtoBuf.Reflect.T
+ */
+ var OneOf = function (builder, message, name) {
+ T.call(this, builder, message, name);
+
+ /**
+ * Enclosed fields.
+ * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
+ * @expose
+ */
+ this.fields = [];
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Message.OneOf
+ * @expose
+ */
+ Reflect.Message.OneOf = OneOf;
+
+ /**
+ * Constructs a new Enum.
+ * @exports ProtoBuf.Reflect.Enum
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
+ * @param {string} name Enum name
+ * @param {Object.<string,*>=} options Enum options
+ * @param {string?} syntax The syntax level (e.g., proto3)
+ * @constructor
+ * @extends ProtoBuf.Reflect.Namespace
+ */
+ var Enum = function (builder, parent, name, options, syntax) {
+ Namespace.call(this, builder, parent, name, options, syntax);
+
+ /**
+ * @override
+ */
+ this.className = "Enum";
+
+ /**
+ * Runtime enum object.
+ * @type {Object.<string,number>|null}
+ * @expose
+ */
+ this.object = null;
+ };
+
+ /**
+ * Gets the string name of an enum value.
+ * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
+ * @param {number} value Enum value
+ * @returns {?string} Name or `null` if not present
+ * @expose
+ */
+ Enum.getName = function (enm, value) {
+ var keys = Object.keys(enm);
+ for (var i = 0, key; i < keys.length; ++i)
+ if (enm[key = keys[i]] === value)
+ return key;
+ return null;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Enum.prototype
+ * @inner
+ */
+ var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
+
+ /**
+ * Builds this enum and returns the runtime counterpart.
+ * @param {boolean} rebuild Whether to rebuild or not, defaults to false
+ * @returns {!Object.<string,number>}
+ * @expose
+ */
+ EnumPrototype.build = function (rebuild) {
+ if (this.object && !rebuild)
+ return this.object;
+ var enm = new ProtoBuf.Builder.Enum(),
+ values = this.getChildren(Enum.Value);
+ for (var i = 0, k = values.length; i < k; ++i)
+ enm[values[i]['name']] = values[i]['id'];
+ if (Object.defineProperty)
+ Object.defineProperty(enm, '$options', {
+ "value": this.buildOpt(),
+ "enumerable": false
+ });
+ return this.object = enm;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Enum
+ * @expose
+ */
+ Reflect.Enum = Enum;
+
+ /**
+ * Constructs a new Enum Value.
+ * @exports ProtoBuf.Reflect.Enum.Value
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
+ * @param {string} name Field name
+ * @param {number} id Unique field id
+ * @constructor
+ * @extends ProtoBuf.Reflect.T
+ */
+ var Value = function (builder, enm, name, id) {
+ T.call(this, builder, enm, name);
+
+ /**
+ * @override
+ */
+ this.className = "Enum.Value";
+
+ /**
+ * Unique enum value id.
+ * @type {number}
+ * @expose
+ */
+ this.id = id;
+ };
+
+ // Extends T
+ Value.prototype = Object.create(T.prototype);
+
+ /**
+ * @alias ProtoBuf.Reflect.Enum.Value
+ * @expose
+ */
+ Reflect.Enum.Value = Value;
+
+ /**
+ * An extension (field).
+ * @exports ProtoBuf.Reflect.Extension
+ * @constructor
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.T} parent Parent object
+ * @param {string} name Object name
+ * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
+ */
+ var Extension = function (builder, parent, name, field) {
+ T.call(this, builder, parent, name);
+
+ /**
+ * Extended message field.
+ * @type {!ProtoBuf.Reflect.Message.Field}
+ * @expose
+ */
+ this.field = field;
+ };
+
+ // Extends T
+ Extension.prototype = Object.create(T.prototype);
+
+ /**
+ * @alias ProtoBuf.Reflect.Extension
+ * @expose
+ */
+ Reflect.Extension = Extension;
+
+ /**
+ * Constructs a new Service.
+ * @exports ProtoBuf.Reflect.Service
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Namespace} root Root
+ * @param {string} name Service name
+ * @param {Object.<string,*>=} options Options
+ * @constructor
+ * @extends ProtoBuf.Reflect.Namespace
+ */
+ var Service = function (builder, root, name, options) {
+ Namespace.call(this, builder, root, name, options);
+
+ /**
+ * @override
+ */
+ this.className = "Service";
+
+ /**
+ * Built runtime service class.
+ * @type {?function(new:ProtoBuf.Builder.Service)}
+ */
+ this.clazz = null;
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Service.prototype
+ * @inner
+ */
+ var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
+
+ /**
+ * Builds the service and returns the runtime counterpart, which is a fully functional class.
+ * @see ProtoBuf.Builder.Service
+ * @param {boolean=} rebuild Whether to rebuild or not
+ * @return {Function} Service class
+ * @throws {Error} If the message cannot be built
+ * @expose
+ */
+ ServicePrototype.build = function (rebuild) {
+ if (this.clazz && !rebuild)
+ return this.clazz;
+
+ // Create the runtime Service class in its own scope
+ return this.clazz = (function (ProtoBuf, T) {
+
+ /**
+ * Constructs a new runtime Service.
+ * @name ProtoBuf.Builder.Service
+ * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
+ * @class Barebone of all runtime services.
+ * @constructor
+ * @throws {Error} If the service cannot be created
+ */
+ var Service = function (rpcImpl) {
+ ProtoBuf.Builder.Service.call(this);
+
+ /**
+ * Service implementation.
+ * @name ProtoBuf.Builder.Service#rpcImpl
+ * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
+ * @expose
+ */
+ this.rpcImpl = rpcImpl || function (name, msg, callback) {
+ // This is what a user has to implement: A function receiving the method name, the actual message to
+ // send (type checked) and the callback that's either provided with the error as its first
+ // argument or null and the actual response message.
+ setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
+ };
+ };
+
+ /**
+ * @alias ProtoBuf.Builder.Service.prototype
+ * @inner
+ */
+ var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
+
+ /**
+ * Asynchronously performs an RPC call using the given RPC implementation.
+ * @name ProtoBuf.Builder.Service.[Method]
+ * @function
+ * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
+ * @param {ProtoBuf.Builder.Message} req Request
+ * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+ * the error if any and the response either as a pre-parsed message or as its raw bytes
+ * @abstract
+ */
+
+ /**
+ * Asynchronously performs an RPC call using the instance's RPC implementation.
+ * @name ProtoBuf.Builder.Service#[Method]
+ * @function
+ * @param {ProtoBuf.Builder.Message} req Request
+ * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
+ * the error if any and the response either as a pre-parsed message or as its raw bytes
+ * @abstract
+ */
+
+ var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
+ for (var i = 0; i < rpc.length; i++) {
+ (function (method) {
+
+ // service#Method(message, callback)
+ ServicePrototype[method.name] = function (req, callback) {
+ try {
+ try {
+ // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
+ req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
+ } catch (err) {
+ if (!(err instanceof TypeError))
+ throw err;
+ }
+ if (req === null || typeof req !== 'object')
+ throw Error("Illegal arguments");
+ if (!(req instanceof method.resolvedRequestType.clazz))
+ req = new method.resolvedRequestType.clazz(req);
+ this.rpcImpl(method.fqn(), req, function (err, res) { // Assumes that this is properly async
+ if (err) {
+ callback(err);
+ return;
+ }
+ // Coalesce to empty string when service response has empty content
+ if (res === null)
+ res = ''
+ try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
+ if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
+ callback(Error("Illegal response type received in service method " + T.name + "#" + method.name));
+ return;
+ }
+ callback(null, res);
+ });
+ } catch (err) {
+ setTimeout(callback.bind(this, err), 0);
+ }
+ };
+
+ // Service.Method(rpcImpl, message, callback)
+ Service[method.name] = function (rpcImpl, req, callback) {
+ new Service(rpcImpl)[method.name](req, callback);
+ };
+
+ if (Object.defineProperty)
+ Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
+ Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
+ })(rpc[i]);
+ }
+
+ // Properties
+
+ /**
+ * Service options.
+ * @name ProtoBuf.Builder.Service.$options
+ * @type {Object.<string,*>}
+ * @expose
+ */
+ var $optionsS; // cc needs this
+
+ /**
+ * Service options.
+ * @name ProtoBuf.Builder.Service#$options
+ * @type {Object.<string,*>}
+ * @expose
+ */
+ var $options;
+
+ /**
+ * Reflection type.
+ * @name ProtoBuf.Builder.Service.$type
+ * @type {!ProtoBuf.Reflect.Service}
+ * @expose
+ */
+ var $typeS;
+
+ /**
+ * Reflection type.
+ * @name ProtoBuf.Builder.Service#$type
+ * @type {!ProtoBuf.Reflect.Service}
+ * @expose
+ */
+ var $type;
+
+ if (Object.defineProperty)
+ Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
+ Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
+ Object.defineProperty(Service, "$type", { "value": T }),
+ Object.defineProperty(ServicePrototype, "$type", { "value": T });
+
+ return Service;
+
+ })(ProtoBuf, this);
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Service
+ * @expose
+ */
+ Reflect.Service = Service;
+
+ /**
+ * Abstract service method.
+ * @exports ProtoBuf.Reflect.Service.Method
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Service} svc Service
+ * @param {string} name Method name
+ * @param {Object.<string,*>=} options Options
+ * @constructor
+ * @extends ProtoBuf.Reflect.T
+ */
+ var Method = function (builder, svc, name, options) {
+ T.call(this, builder, svc, name);
+
+ /**
+ * @override
+ */
+ this.className = "Service.Method";
+
+ /**
+ * Options.
+ * @type {Object.<string, *>}
+ * @expose
+ */
+ this.options = options || {};
+ };
+
+ /**
+ * @alias ProtoBuf.Reflect.Service.Method.prototype
+ * @inner
+ */
+ var MethodPrototype = Method.prototype = Object.create(T.prototype);
+
+ /**
+ * Builds the method's '$options' property.
+ * @name ProtoBuf.Reflect.Service.Method#buildOpt
+ * @function
+ * @return {Object.<string,*>}
+ */
+ MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
+
+ /**
+ * @alias ProtoBuf.Reflect.Service.Method
+ * @expose
+ */
+ Reflect.Service.Method = Method;
+
+ /**
+ * RPC service method.
+ * @exports ProtoBuf.Reflect.Service.RPCMethod
+ * @param {!ProtoBuf.Builder} builder Builder reference
+ * @param {!ProtoBuf.Reflect.Service} svc Service
+ * @param {string} name Method name
+ * @param {string} request Request message name
+ * @param {string} response Response message name
+ * @param {boolean} request_stream Whether requests are streamed
+ * @param {boolean} response_stream Whether responses are streamed
+ * @param {Object.<string,*>=} options Options
+ * @constructor
+ * @extends ProtoBuf.Reflect.Service.Method
+ */
+ var RPCMethod = function (builder, svc, name, request, response, request_stream, response_stream, options) {
+ Method.call(this, builder, svc, name, options);
+
+ /**
+ * @override
+ */
+ this.className = "Service.RPCMethod";
+
+ /**
+ * Request message name.
+ * @type {string}
+ * @expose
+ */
+ this.requestName = request;
+
+ /**
+ * Response message name.
+ * @type {string}
+ * @expose
+ */
+ this.responseName = response;
+
+ /**
+ * Whether requests are streamed
+ * @type {bool}
+ * @expose
+ */
+ this.requestStream = request_stream;
+
+ /**
+ * Whether responses are streamed
+ * @type {bool}
+ * @expose
+ */
+ this.responseStream = response_stream;
+
+ /**
+ * Resolved request message type.
+ * @type {ProtoBuf.Reflect.Message}
+ * @expose
+ */
+ this.resolvedRequestType = null;
+
+ /**
+ * Resolved response message type.
+ * @type {ProtoBuf.Reflect.Message}
+ * @expose
+ */
+ this.resolvedResponseType = null;
+ };
+
+ // Extends Method
+ RPCMethod.prototype = Object.create(Method.prototype);
+
+ /**
+ * @alias ProtoBuf.Reflect.Service.RPCMethod
+ * @expose
+ */
+ Reflect.Service.RPCMethod = RPCMethod;
+
+ return Reflect;
+
+ })(ProtoBuf);
+
+ /**
+ * @alias ProtoBuf.Builder
+ * @expose
+ */
+ ProtoBuf.Builder = (function (ProtoBuf, Lang, Reflect) {
+ "use strict";
+
+ /**
+ * Constructs a new Builder.
+ * @exports ProtoBuf.Builder
+ * @class Provides the functionality to build protocol messages.
+ * @param {Object.<string,*>=} options Options
+ * @constructor
+ */
+ var Builder = function (options) {
+
+ /**
+ * Namespace.
+ * @type {ProtoBuf.Reflect.Namespace}
+ * @expose
+ */
+ this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
+
+ /**
+ * Namespace pointer.
+ * @type {ProtoBuf.Reflect.T}
+ * @expose
+ */
+ this.ptr = this.ns;
+
+ /**
+ * Resolved flag.
+ * @type {boolean}
+ * @expose
+ */
+ this.resolved = false;
+
+ /**
+ * The current building result.
+ * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
+ * @expose
+ */
+ this.result = null;
+
+ /**
+ * Imported files.
+ * @type {Array.<string>}
+ * @expose
+ */
+ this.files = {};
+
+ /**
+ * Import root override.
+ * @type {?string}
+ * @expose
+ */
+ this.importRoot = null;
+
+ /**
+ * Options.
+ * @type {!Object.<string, *>}
+ * @expose
+ */
+ this.options = options || {};
+ };
+
+ /**
+ * @alias ProtoBuf.Builder.prototype
+ * @inner
+ */
+ var BuilderPrototype = Builder.prototype;
+
+ // ----- Definition tests -----
+
+ /**
+ * Tests if a definition most likely describes a message.
+ * @param {!Object} def
+ * @returns {boolean}
+ * @expose
+ */
+ Builder.isMessage = function (def) {
+ // Messages require a string name
+ if (typeof def["name"] !== 'string')
+ return false;
+ // Messages do not contain values (enum) or rpc methods (service)
+ if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
+ return false;
+ return true;
+ };
+
+ /**
+ * Tests if a definition most likely describes a message field.
+ * @param {!Object} def
+ * @returns {boolean}
+ * @expose
+ */
+ Builder.isMessageField = function (def) {
+ // Message fields require a string rule, name and type and an id
+ if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
+ return false;
+ return true;
+ };
+
+ /**
+ * Tests if a definition most likely describes an enum.
+ * @param {!Object} def
+ * @returns {boolean}
+ * @expose
+ */
+ Builder.isEnum = function (def) {
+ // Enums require a string name
+ if (typeof def["name"] !== 'string')
+ return false;
+ // Enums require at least one value
+ if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
+ return false;
+ return true;
+ };
+
+ /**
+ * Tests if a definition most likely describes a service.
+ * @param {!Object} def
+ * @returns {boolean}
+ * @expose
+ */
+ Builder.isService = function (def) {
+ // Services require a string name and an rpc object
+ if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
+ return false;
+ return true;
+ };
+
+ /**
+ * Tests if a definition most likely describes an extended message
+ * @param {!Object} def
+ * @returns {boolean}
+ * @expose
+ */
+ Builder.isExtend = function (def) {
+ // Extends rquire a string ref
+ if (typeof def["ref"] !== 'string')
+ return false;
+ return true;
+ };
+
+ // ----- Building -----
+
+ /**
+ * Resets the pointer to the root namespace.
+ * @returns {!ProtoBuf.Builder} this
+ * @expose
+ */
+ BuilderPrototype.reset = function () {
+ this.ptr = this.ns;
+ return this;
+ };
+
+ /**
+ * Defines a namespace on top of the current pointer position and places the pointer on it.
+ * @param {string} namespace
+ * @return {!ProtoBuf.Builder} this
+ * @expose
+ */
+ BuilderPrototype.define = function (namespace) {
+ if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
+ throw Error("illegal namespace: " + namespace);
+ namespace.split(".").forEach(function (part) {
+ var ns = this.ptr.getChild(part);
+ if (ns === null) // Keep existing
+ this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
+ this.ptr = ns;
+ }, this);
+ return this;
+ };
+
+ /**
+ * Creates the specified definitions at the current pointer position.
+ * @param {!Array.<!Object>} defs Messages, enums or services to create
+ * @returns {!ProtoBuf.Builder} this
+ * @throws {Error} If a message definition is invalid
+ * @expose
+ */
+ BuilderPrototype.create = function (defs) {
+ if (!defs)
+ return this; // Nothing to create
+ if (!Array.isArray(defs))
+ defs = [defs];
+ else {
+ if (defs.length === 0)
+ return this;
+ defs = defs.slice();
+ }
+
+ // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
+ var stack = [defs];
+ while (stack.length > 0) {
+ defs = stack.pop();
+
+ if (!Array.isArray(defs)) // Stack always contains entire namespaces
+ throw Error("not a valid namespace: " + JSON.stringify(defs));
+
+ while (defs.length > 0) {
+ var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
+
+ if (Builder.isMessage(def)) {
+ var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
+
+ // Create OneOfs
+ var oneofs = {};
+ if (def["oneofs"])
+ Object.keys(def["oneofs"]).forEach(function (name) {
+ obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
+ }, this);
+
+ // Create fields
+ if (def["fields"])
+ def["fields"].forEach(function (fld) {
+ if (obj.getChild(fld["id"] | 0) !== null)
+ throw Error("duplicate or invalid field id in " + obj.name + ": " + fld['id']);
+ if (fld["options"] && typeof fld["options"] !== 'object')
+ throw Error("illegal field options in " + obj.name + "#" + fld["name"]);
+ var oneof = null;
+ if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
+ throw Error("illegal oneof in " + obj.name + "#" + fld["name"] + ": " + fld["oneof"]);
+ fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
+ if (oneof)
+ oneof.fields.push(fld);
+ obj.addChild(fld);
+ }, this);
+
+ // Push children to stack
+ var subObj = [];
+ if (def["enums"])
+ def["enums"].forEach(function (enm) {
+ subObj.push(enm);
+ });
+ if (def["messages"])
+ def["messages"].forEach(function (msg) {
+ subObj.push(msg);
+ });
+ if (def["services"])
+ def["services"].forEach(function (svc) {
+ subObj.push(svc);
+ });
+
+ // Set extension ranges
+ if (def["extensions"]) {
+ if (typeof def["extensions"][0] === 'number') // pre 5.0.1
+ obj.extensions = [def["extensions"]];
+ else
+ obj.extensions = def["extensions"];
+ }
+
+ // Create on top of current namespace
+ this.ptr.addChild(obj);
+ if (subObj.length > 0) {
+ stack.push(defs); // Push the current level back
+ defs = subObj; // Continue processing sub level
+ subObj = null;
+ this.ptr = obj; // And move the pointer to this namespace
+ obj = null;
+ continue;
+ }
+ subObj = null;
+
+ } else if (Builder.isEnum(def)) {
+
+ obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
+ def["values"].forEach(function (val) {
+ obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
+ }, this);
+ this.ptr.addChild(obj);
+
+ } else if (Builder.isService(def)) {
+
+ obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
+ Object.keys(def["rpc"]).forEach(function (name) {
+ var mtd = def["rpc"][name];
+ obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
+ }, this);
+ this.ptr.addChild(obj);
+
+ } else if (Builder.isExtend(def)) {
+
+ obj = this.ptr.resolve(def["ref"], true);
+ if (obj) {
+ def["fields"].forEach(function (fld) {
+ if (obj.getChild(fld['id'] | 0) !== null)
+ throw Error("duplicate extended field id in " + obj.name + ": " + fld['id']);
+ // Check if field id is allowed to be extended
+ if (obj.extensions) {
+ var valid = false;
+ obj.extensions.forEach(function (range) {
+ if (fld["id"] >= range[0] && fld["id"] <= range[1])
+ valid = true;
+ });
+ if (!valid)
+ throw Error("illegal extended field id in " + obj.name + ": " + fld['id'] + " (not within valid ranges)");
+ }
+ // Convert extension field names to camel case notation if the override is set
+ var name = fld["name"];
+ if (this.options['convertFieldsToCamelCase'])
+ name = ProtoBuf.Util.toCamelCase(name);
+ // see #161: Extensions use their fully qualified name as their runtime key and...
+ var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn() + '.' + name, fld["id"], fld["options"]);
+ // ...are added on top of the current namespace as an extension which is used for
+ // resolving their type later on (the extension always keeps the original name to
+ // prevent naming collisions)
+ var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
+ field.extension = ext;
+ this.ptr.addChild(ext);
+ obj.addChild(field);
+ }, this);
+
+ } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
+ throw Error("extended message " + def["ref"] + " is not defined");
+
+ } else
+ throw Error("not a valid definition: " + JSON.stringify(def));
+
+ def = null;
+ obj = null;
+ }
+ // Break goes here
+ defs = null;
+ this.ptr = this.ptr.parent; // Namespace done, continue at parent
+ }
+ this.resolved = false; // Require re-resolve
+ this.result = null; // Require re-build
+ return this;
+ };
+
+ /**
+ * Propagates syntax to all children.
+ * @param {!Object} parent
+ * @inner
+ */
+ function propagateSyntax(parent) {
+ if (parent['messages']) {
+ parent['messages'].forEach(function (child) {
+ child["syntax"] = parent["syntax"];
+ propagateSyntax(child);
+ });
+ }
+ if (parent['enums']) {
+ parent['enums'].forEach(function (child) {
+ child["syntax"] = parent["syntax"];
+ });
+ }
+ }
+
+ /**
+ * Imports another definition into this builder.
+ * @param {Object.<string,*>} json Parsed import
+ * @param {(string|{root: string, file: string})=} filename Imported file name
+ * @returns {!ProtoBuf.Builder} this
+ * @throws {Error} If the definition or file cannot be imported
+ * @expose
+ */
+ BuilderPrototype["import"] = function (json, filename) {
+ var delim = '/';
+
+ // Make sure to skip duplicate imports
+
+ if (typeof filename === 'string') {
+
+ if (ProtoBuf.Util.IS_NODE)
+ filename = __webpack_require__(35)['resolve'](filename);
+ if (this.files[filename] === true)
+ return this.reset();
+ this.files[filename] = true;
+
+ } else if (typeof filename === 'object') { // Object with root, file.
+
+ var root = filename.root;
+ if (ProtoBuf.Util.IS_NODE)
+ root = __webpack_require__(35)['resolve'](root);
+ if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
+ delim = '\\';
+ var fname = root + delim + filename.file;
+ if (this.files[fname] === true)
+ return this.reset();
+ this.files[fname] = true;
+ }
+
+ // Import imports
+
+ if (json['imports'] && json['imports'].length > 0) {
+ var importRoot,
+ resetRoot = false;
+
+ if (typeof filename === 'object') { // If an import root is specified, override
+
+ this.importRoot = filename["root"];
+ resetRoot = true; // ... and reset afterwards
+ importRoot = this.importRoot;
+ filename = filename["file"];
+ if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
+ delim = '\\';
+
+ } else if (typeof filename === 'string') {
+
+ if (this.importRoot) // If import root is overridden, use it
+ importRoot = this.importRoot;
+ else { // Otherwise compute from filename
+ if (filename.indexOf("/") >= 0) { // Unix
+ importRoot = filename.replace(/\/[^\/]*$/, "");
+ if ( /* /file.proto */ importRoot === "")
+ importRoot = "/";
+ } else if (filename.indexOf("\\") >= 0) { // Windows
+ importRoot = filename.replace(/\\[^\\]*$/, "");
+ delim = '\\';
+ } else
+ importRoot = ".";
+ }
+
+ } else
+ importRoot = null;
+
+ for (var i = 0; i < json['imports'].length; i++) {
+ if (typeof json['imports'][i] === 'string') { // Import file
+ if (!importRoot)
+ throw Error("cannot determine import root");
+ var importFilename = json['imports'][i];
+ if (importFilename === "google/protobuf/descriptor.proto")
+ continue; // Not needed and therefore not used
+ importFilename = importRoot + delim + importFilename;
+ if (this.files[importFilename] === true)
+ continue; // Already imported
+ if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
+ importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
+ var contents = ProtoBuf.Util.fetch(importFilename);
+ if (contents === null)
+ throw Error("failed to import '" + importFilename + "' in '" + filename + "': file not found");
+ if (/\.json$/i.test(importFilename)) // Always possible
+ this["import"](JSON.parse(contents + ""), importFilename); // May throw
+ else
+ this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
+ } else // Import structure
+ if (!filename)
+ this["import"](json['imports'][i]);
+ else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
+ this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function ($0, $1, $2) {
+ return $1 + "_import" + i + "." + $2;
+ }));
+ else // Without extension: Append _importN to make it unique
+ this["import"](json['imports'][i], filename + "_import" + i);
+ }
+ if (resetRoot) // Reset import root override when all imports are done
+ this.importRoot = null;
+ }
+
+ // Import structures
+
+ if (json['package'])
+ this.define(json['package']);
+ if (json['syntax'])
+ propagateSyntax(json);
+ var base = this.ptr;
+ if (json['options'])
+ Object.keys(json['options']).forEach(function (key) {
+ base.options[key] = json['options'][key];
+ });
+ if (json['messages'])
+ this.create(json['messages']),
+ this.ptr = base;
+ if (json['enums'])
+ this.create(json['enums']),
+ this.ptr = base;
+ if (json['services'])
+ this.create(json['services']),
+ this.ptr = base;
+ if (json['extends'])
+ this.create(json['extends']);
+
+ return this.reset();
+ };
+
+ /**
+ * Resolves all namespace objects.
+ * @throws {Error} If a type cannot be resolved
+ * @returns {!ProtoBuf.Builder} this
+ * @expose
+ */
+ BuilderPrototype.resolveAll = function () {
+ // Resolve all reflected objects
+ var res;
+ if (this.ptr == null || typeof this.ptr.type === 'object')
+ return this; // Done (already resolved)
+
+ if (this.ptr instanceof Reflect.Namespace) { // Resolve children
+
+ this.ptr.children.forEach(function (child) {
+ this.ptr = child;
+ this.resolveAll();
+ }, this);
+
+ } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
+
+ if (!Lang.TYPE.test(this.ptr.type)) {
+ if (!Lang.TYPEREF.test(this.ptr.type))
+ throw Error("illegal type reference in " + this.ptr.toString(true) + ": " + this.ptr.type);
+ res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
+ if (!res)
+ throw Error("unresolvable type reference in " + this.ptr.toString(true) + ": " + this.ptr.type);
+ this.ptr.resolvedType = res;
+ if (res instanceof Reflect.Enum) {
+ this.ptr.type = ProtoBuf.TYPES["enum"];
+ if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
+ throw Error("proto3 message cannot reference proto2 enum");
+ } else if (res instanceof Reflect.Message)
+ this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
+ else
+ throw Error("illegal type reference in " + this.ptr.toString(true) + ": " + this.ptr.type);
+ } else
+ this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
+
+ // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
+ // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
+ if (this.ptr.map) {
+ if (!Lang.TYPE.test(this.ptr.keyType))
+ throw Error("illegal key type for map field in " + this.ptr.toString(true) + ": " + this.ptr.keyType);
+ this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
+ }
+
+ } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
+
+ if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
+ res = this.ptr.parent.resolve(this.ptr.requestName, true);
+ if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+ throw Error("Illegal type reference in " + this.ptr.toString(true) + ": " + this.ptr.requestName);
+ this.ptr.resolvedRequestType = res;
+ res = this.ptr.parent.resolve(this.ptr.responseName, true);
+ if (!res || !(res instanceof ProtoBuf.Reflect.Message))
+ throw Error("Illegal type reference in " + this.ptr.toString(true) + ": " + this.ptr.responseName);
+ this.ptr.resolvedResponseType = res;
+ } else // Should not happen as nothing else is implemented
+ throw Error("illegal service type in " + this.ptr.toString(true));
+
+ } else if (!(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
+ !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
+ !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
+ )
+ throw Error("illegal object in namespace: " + typeof (this.ptr) + ": " + this.ptr);
+
+ return this.reset();
+ };
+
+ /**
+ * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
+ * return the built package.
+ * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
+ * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
+ * @throws {Error} If a type could not be resolved
+ * @expose
+ */
+ BuilderPrototype.build = function (path) {
+ this.reset();
+ if (!this.resolved)
+ this.resolveAll(),
+ this.resolved = true,
+ this.result = null; // Require re-build
+ if (this.result === null) // (Re-)Build
+ this.result = this.ns.build();
+ if (!path)
+ return this.result;
+ var part = typeof path === 'string' ? path.split(".") : path,
+ ptr = this.result; // Build namespace pointer (no hasChild etc.)
+ for (var i = 0; i < part.length; i++)
+ if (ptr[part[i]])
+ ptr = ptr[part[i]];
+ else {
+ ptr = null;
+ break;
+ }
+ return ptr;
+ };
+
+ /**
+ * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
+ * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
+ * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
+ * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
+ */
+ BuilderPrototype.lookup = function (path, excludeNonNamespace) {
+ return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
+ };
+
+ /**
+ * Returns a string representation of this object.
+ * @return {string} String representation as of "Builder"
+ * @expose
+ */
+ BuilderPrototype.toString = function () {
+ return "Builder";
+ };
+
+ // ----- Base classes -----
+ // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
+
+ /**
+ * @alias ProtoBuf.Builder.Message
+ */
+ Builder.Message = function () {};
+
+ /**
+ * @alias ProtoBuf.Builder.Enum
+ */
+ Builder.Enum = function () {};
+
+ /**
+ * @alias ProtoBuf.Builder.Message
+ */
+ Builder.Service = function () {};
+
+ return Builder;
+
+ })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
+
+ /**
+ * @alias ProtoBuf.Map
+ * @expose
+ */
+ ProtoBuf.Map = (function (ProtoBuf, Reflect) {
+ "use strict";
+
+ /**
+ * Constructs a new Map. A Map is a container that is used to implement map
+ * fields on message objects. It closely follows the ES6 Map API; however,
+ * it is distinct because we do not want to depend on external polyfills or
+ * on ES6 itself.
+ *
+ * @exports ProtoBuf.Map
+ * @param {!ProtoBuf.Reflect.Field} field Map field
+ * @param {Object.<string,*>=} contents Initial contents
+ * @constructor
+ */
+ var Map = function (field, contents) {
+ if (!field.map)
+ throw Error("field is not a map");
+
+ /**
+ * The field corresponding to this map.
+ * @type {!ProtoBuf.Reflect.Field}
+ */
+ this.field = field;
+
+ /**
+ * Element instance corresponding to key type.
+ * @type {!ProtoBuf.Reflect.Element}
+ */
+ this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
+
+ /**
+ * Element instance corresponding to value type.
+ * @type {!ProtoBuf.Reflect.Element}
+ */
+ this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
+
+ /**
+ * Internal map: stores mapping of (string form of key) -> (key, value)
+ * pair.
+ *
+ * We provide map semantics for arbitrary key types, but we build on top
+ * of an Object, which has only string keys. In order to avoid the need
+ * to convert a string key back to its native type in many situations,
+ * we store the native key value alongside the value. Thus, we only need
+ * a one-way mapping from a key type to its string form that guarantees
+ * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
+ * === K2).
+ *
+ * @type {!Object<string, {key: *, value: *}>}
+ */
+ this.map = {};
+
+ /**
+ * Returns the number of elements in the map.
+ */
+ Object.defineProperty(this, "size", {
+ get: function () {
+ return Object.keys(this.map).length;
+ }
+ });
+
+ // Fill initial contents from a raw object.
+ if (contents) {
+ var keys = Object.keys(contents);
+ for (var i = 0; i < keys.length; i++) {
+ var key = this.keyElem.valueFromString(keys[i]);
+ var val = this.valueElem.verifyValue(contents[keys[i]]);
+ this.map[this.keyElem.valueToString(key)] = { key: key, value: val };
+ }
+ }
+ };
+
+ var MapPrototype = Map.prototype;
+
+ /**
+ * Helper: return an iterator over an array.
+ * @param {!Array<*>} arr the array
+ * @returns {!Object} an iterator
+ * @inner
+ */
+ function arrayIterator(arr) {
+ var idx = 0;
+ return {
+ next: function () {
+ if (idx < arr.length)
+ return { done: false, value: arr[idx++] };
+ return { done: true };
+ }
+ }
+ }
+
+ /**
+ * Clears the map.
+ */
+ MapPrototype.clear = function () {
+ this.map = {};
+ };
+
+ /**
+ * Deletes a particular key from the map.
+ * @returns {boolean} Whether any entry with this key was deleted.
+ */
+ MapPrototype["delete"] = function (key) {
+ var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+ var hadKey = keyValue in this.map;
+ delete this.map[keyValue];
+ return hadKey;
+ };
+
+ /**
+ * Returns an iterator over [key, value] pairs in the map.
+ * @returns {Object} The iterator
+ */
+ MapPrototype.entries = function () {
+ var entries = [];
+ var strKeys = Object.keys(this.map);
+ for (var i = 0, entry; i < strKeys.length; i++)
+ entries.push([(entry = this.map[strKeys[i]]).key, entry.value]);
+ return arrayIterator(entries);
+ };
+
+ /**
+ * Returns an iterator over keys in the map.
+ * @returns {Object} The iterator
+ */
+ MapPrototype.keys = function () {
+ var keys = [];
+ var strKeys = Object.keys(this.map);
+ for (var i = 0; i < strKeys.length; i++)
+ keys.push(this.map[strKeys[i]].key);
+ return arrayIterator(keys);
+ };
+
+ /**
+ * Returns an iterator over values in the map.
+ * @returns {!Object} The iterator
+ */
+ MapPrototype.values = function () {
+ var values = [];
+ var strKeys = Object.keys(this.map);
+ for (var i = 0; i < strKeys.length; i++)
+ values.push(this.map[strKeys[i]].value);
+ return arrayIterator(values);
+ };
+
+ /**
+ * Iterates over entries in the map, calling a function on each.
+ * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
+ * @param {Object=} thisArg The `this` value for the callback
+ */
+ MapPrototype.forEach = function (cb, thisArg) {
+ var strKeys = Object.keys(this.map);
+ for (var i = 0, entry; i < strKeys.length; i++)
+ cb.call(thisArg, (entry = this.map[strKeys[i]]).value, entry.key, this);
+ };
+
+ /**
+ * Sets a key in the map to the given value.
+ * @param {*} key The key
+ * @param {*} value The value
+ * @returns {!ProtoBuf.Map} The map instance
+ */
+ MapPrototype.set = function (key, value) {
+ var keyValue = this.keyElem.verifyValue(key);
+ var valValue = this.valueElem.verifyValue(value);
+ this.map[this.keyElem.valueToString(keyValue)] = { key: keyValue, value: valValue };
+ return this;
+ };
+
+ /**
+ * Gets the value corresponding to a key in the map.
+ * @param {*} key The key
+ * @returns {*|undefined} The value, or `undefined` if key not present
+ */
+ MapPrototype.get = function (key) {
+ var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+ if (!(keyValue in this.map))
+ return undefined;
+ return this.map[keyValue].value;
+ };
+
+ /**
+ * Determines whether the given key is present in the map.
+ * @param {*} key The key
+ * @returns {boolean} `true` if the key is present
+ */
+ MapPrototype.has = function (key) {
+ var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
+ return (keyValue in this.map);
+ };
+
+ return Map;
+ })(ProtoBuf, ProtoBuf.Reflect);
+
+ /**
+ * Loads a .proto string and returns the Builder.
+ * @param {string} proto .proto file contents
+ * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+ * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+ * @return {ProtoBuf.Builder} Builder to create new messages
+ * @throws {Error} If the definition cannot be parsed or built
+ * @expose
+ */
+ ProtoBuf.loadProto = function (proto, builder, filename) {
+ if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+ filename = builder,
+ builder = undefined;
+ return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename);
+ };
+
+ /**
+ * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}.
+ * @function
+ * @param {string} proto .proto file contents
+ * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted.
+ * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+ * @return {ProtoBuf.Builder} Builder to create new messages
+ * @throws {Error} If the definition cannot be parsed or built
+ * @expose
+ */
+ ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy
+
+ /**
+ * Loads a .proto file and returns the Builder.
+ * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+ * an overridden 'root' path for all imported files.
+ * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+ * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+ * file will be read synchronously and this function will return the Builder.
+ * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+ * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+ * request has failed), else undefined
+ * @expose
+ */
+ ProtoBuf.loadProtoFile = function (filename, callback, builder) {
+ if (callback && typeof callback === 'object')
+ builder = callback,
+ callback = null;
+ else if (!callback || typeof callback !== 'function')
+ callback = null;
+ if (callback)
+ return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"] + "/" + filename["file"], function (contents) {
+ if (contents === null) {
+ callback(Error("Failed to fetch file"));
+ return;
+ }
+ try {
+ callback(null, ProtoBuf.loadProto(contents, builder, filename));
+ } catch (e) {
+ callback(e);
+ }
+ });
+ var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"] + "/" + filename["file"] : filename);
+ return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename);
+ };
+
+ /**
+ * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}.
+ * @function
+ * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with
+ * an overridden 'root' path for all imported files.
+ * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+ * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+ * file will be read synchronously and this function will return the Builder.
+ * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+ * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+ * request has failed), else undefined
+ * @expose
+ */
+ ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy
+
+ /**
+ * Constructs a new empty Builder.
+ * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
+ * @return {!ProtoBuf.Builder} Builder
+ * @expose
+ */
+ ProtoBuf.newBuilder = function (options) {
+ options = options || {};
+ if (typeof options['convertFieldsToCamelCase'] === 'undefined')
+ options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
+ if (typeof options['populateAccessors'] === 'undefined')
+ options['populateAccessors'] = ProtoBuf.populateAccessors;
+ return new ProtoBuf.Builder(options);
+ };
+
+ /**
+ * Loads a .json definition and returns the Builder.
+ * @param {!*|string} json JSON definition
+ * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
+ * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
+ * @return {ProtoBuf.Builder} Builder to create new messages
+ * @throws {Error} If the definition cannot be parsed or built
+ * @expose
+ */
+ ProtoBuf.loadJson = function (json, builder, filename) {
+ if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
+ filename = builder,
+ builder = null;
+ if (!builder || typeof builder !== 'object')
+ builder = ProtoBuf.newBuilder();
+ if (typeof json === 'string')
+ json = JSON.parse(json);
+ builder["import"](json, filename);
+ builder.resolveAll();
+ return builder;
+ };
+
+ /**
+ * Loads a .json file and returns the Builder.
+ * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
+ * an overridden 'root' path for all imported files.
+ * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
+ * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
+ * file will be read synchronously and this function will return the Builder.
+ * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
+ * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
+ * request has failed), else undefined
+ * @expose
+ */
+ ProtoBuf.loadJsonFile = function (filename, callback, builder) {
+ if (callback && typeof callback === 'object')
+ builder = callback,
+ callback = null;
+ else if (!callback || typeof callback !== 'function')
+ callback = null;
+ if (callback)
+ return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"] + "/" + filename["file"], function (contents) {
+ if (contents === null) {
+ callback(Error("Failed to fetch file"));
+ return;
+ }
+ try {
+ callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
+ } catch (e) {
+ callback(e);
+ }
+ });
+ var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"] + "/" + filename["file"] : filename);
+ return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
+ };
+
+ return ProtoBuf;
+ });
+
+
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(30), __webpack_require__(2)(module)))
+
+/***/ },
+/* 30 */
+/***/ function(module, exports) {
+
+ // shim for using process in browser
+ var process = module.exports = {};
+
+ // cached from whatever global is present so that test runners that stub it
+ // don't break things. But we need to wrap it in a try catch in case it is
+ // wrapped in strict mode code which doesn't define any globals. It's inside a
+ // function because try/catches deoptimize in certain engines.
+
+ var cachedSetTimeout;
+ var cachedClearTimeout;
+
+ function defaultSetTimout() {
+ throw new Error('setTimeout has not been defined');
+ }
+ function defaultClearTimeout () {
+ throw new Error('clearTimeout has not been defined');
+ }
+ (function () {
+ try {
+ if (typeof setTimeout === 'function') {
+ cachedSetTimeout = setTimeout;
+ } else {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ } catch (e) {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ try {
+ if (typeof clearTimeout === 'function') {
+ cachedClearTimeout = clearTimeout;
+ } else {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } catch (e) {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } ())
+ function runTimeout(fun) {
+ if (cachedSetTimeout === setTimeout) {
+ //normal enviroments in sane situations
+ return setTimeout(fun, 0);
+ }
+ // if setTimeout wasn't available but was latter defined
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+ cachedSetTimeout = setTimeout;
+ return setTimeout(fun, 0);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedSetTimeout(fun, 0);
+ } catch(e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedSetTimeout.call(null, fun, 0);
+ } catch(e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
+ return cachedSetTimeout.call(this, fun, 0);
+ }
+ }
+
+
+ }
+ function runClearTimeout(marker) {
+ if (cachedClearTimeout === clearTimeout) {
+ //normal enviroments in sane situations
+ return clearTimeout(marker);
+ }
+ // if clearTimeout wasn't available but was latter defined
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+ cachedClearTimeout = clearTimeout;
+ return clearTimeout(marker);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedClearTimeout(marker);
+ } catch (e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedClearTimeout.call(null, marker);
+ } catch (e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
+ return cachedClearTimeout.call(this, marker);
+ }
+ }
+
+
+
+ }
+ var queue = [];
+ var draining = false;
+ var currentQueue;
+ var queueIndex = -1;
+
+ function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+ }
+
+ function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = runTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ runClearTimeout(timeout);
+ }
+
+ process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ runTimeout(drainQueue);
+ }
+ };
+
+ // v8 likes predictible objects
+ function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+ }
+ Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+ };
+ process.title = 'browser';
+ process.browser = true;
+ process.env = {};
+ process.argv = [];
+ process.version = ''; // empty string to avoid regexp issues
+ process.versions = {};
+
+ function noop() {}
+
+ process.on = noop;
+ process.addListener = noop;
+ process.once = noop;
+ process.off = noop;
+ process.removeListener = noop;
+ process.removeAllListeners = noop;
+ process.emit = noop;
+
+ process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+ };
+
+ process.cwd = function () { return '/' };
+ process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+ };
+ process.umask = function() { return 0; };
+
+
+/***/ },
+/* 31 */
+/***/ function(module, exports) {
+
+ module.exports = function() { throw new Error("define cannot be used indirect"); };
+
+
+/***/ },
+/* 32 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {/*
+ Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+ /**
+ * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
+ * Backing buffer: ArrayBuffer, Accessor: Uint8Array
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/bytebuffer.js for details
+ */
+ (function(global, factory) {
+
+ /* AMD */ if ("function" === 'function' && __webpack_require__(31)["amd"])
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(33)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ /* CommonJS */ else if ("function" === 'function' && typeof module === "object" && module && module["exports"])
+ module['exports'] = (function() {
+ var Long; try { Long = __webpack_require__(33); } catch (e) {}
+ return factory(Long);
+ })();
+ /* Global */ else
+ (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
+
+ })(this, function(Long) {
+ "use strict";
+
+ /**
+ * Constructs a new ByteBuffer.
+ * @class The swiss army knife for binary data in JavaScript.
+ * @exports ByteBuffer
+ * @constructor
+ * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @expose
+ */
+ var ByteBuffer = function(capacity, littleEndian, noAssert) {
+ if (typeof capacity === 'undefined')
+ capacity = ByteBuffer.DEFAULT_CAPACITY;
+ if (typeof littleEndian === 'undefined')
+ littleEndian = ByteBuffer.DEFAULT_ENDIAN;
+ if (typeof noAssert === 'undefined')
+ noAssert = ByteBuffer.DEFAULT_NOASSERT;
+ if (!noAssert) {
+ capacity = capacity | 0;
+ if (capacity < 0)
+ throw RangeError("Illegal capacity");
+ littleEndian = !!littleEndian;
+ noAssert = !!noAssert;
+ }
+
+ /**
+ * Backing ArrayBuffer.
+ * @type {!ArrayBuffer}
+ * @expose
+ */
+ this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
+
+ /**
+ * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
+ * @type {?Uint8Array}
+ * @expose
+ */
+ this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
+
+ /**
+ * Absolute read/write offset.
+ * @type {number}
+ * @expose
+ * @see ByteBuffer#flip
+ * @see ByteBuffer#clear
+ */
+ this.offset = 0;
+
+ /**
+ * Marked offset.
+ * @type {number}
+ * @expose
+ * @see ByteBuffer#mark
+ * @see ByteBuffer#reset
+ */
+ this.markedOffset = -1;
+
+ /**
+ * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
+ * @type {number}
+ * @expose
+ * @see ByteBuffer#flip
+ * @see ByteBuffer#clear
+ */
+ this.limit = capacity;
+
+ /**
+ * Whether to use little endian byte order, defaults to `false` for big endian.
+ * @type {boolean}
+ * @expose
+ */
+ this.littleEndian = littleEndian;
+
+ /**
+ * Whether to skip assertions of offsets and values, defaults to `false`.
+ * @type {boolean}
+ * @expose
+ */
+ this.noAssert = noAssert;
+ };
+
+ /**
+ * ByteBuffer version.
+ * @type {string}
+ * @const
+ * @expose
+ */
+ ByteBuffer.VERSION = "5.0.1";
+
+ /**
+ * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
+ * @type {boolean}
+ * @const
+ * @expose
+ */
+ ByteBuffer.LITTLE_ENDIAN = true;
+
+ /**
+ * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
+ * @type {boolean}
+ * @const
+ * @expose
+ */
+ ByteBuffer.BIG_ENDIAN = false;
+
+ /**
+ * Default initial capacity of `16`.
+ * @type {number}
+ * @expose
+ */
+ ByteBuffer.DEFAULT_CAPACITY = 16;
+
+ /**
+ * Default endianess of `false` for big endian.
+ * @type {boolean}
+ * @expose
+ */
+ ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
+
+ /**
+ * Default no assertions flag of `false`.
+ * @type {boolean}
+ * @expose
+ */
+ ByteBuffer.DEFAULT_NOASSERT = false;
+
+ /**
+ * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
+ * and int64 support is not available.
+ * @type {?Long}
+ * @const
+ * @see https://github.com/dcodeIO/long.js
+ * @expose
+ */
+ ByteBuffer.Long = Long || null;
+
+ /**
+ * @alias ByteBuffer.prototype
+ * @inner
+ */
+ var ByteBufferPrototype = ByteBuffer.prototype;
+
+ /**
+ * An indicator used to reliably determine if an object is a ByteBuffer or not.
+ * @type {boolean}
+ * @const
+ * @expose
+ * @private
+ */
+ ByteBufferPrototype.__isByteBuffer__;
+
+ Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
+ value: true,
+ enumerable: false,
+ configurable: false
+ });
+
+ // helpers
+
+ /**
+ * @type {!ArrayBuffer}
+ * @inner
+ */
+ var EMPTY_BUFFER = new ArrayBuffer(0);
+
+ /**
+ * String.fromCharCode reference for compile-time renaming.
+ * @type {function(...number):string}
+ * @inner
+ */
+ var stringFromCharCode = String.fromCharCode;
+
+ /**
+ * Creates a source function for a string.
+ * @param {string} s String to read from
+ * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
+ * no more characters left.
+ * @throws {TypeError} If the argument is invalid
+ * @inner
+ */
+ function stringSource(s) {
+ var i=0; return function() {
+ return i < s.length ? s.charCodeAt(i++) : null;
+ };
+ }
+
+ /**
+ * Creates a destination function for a string.
+ * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
+ * Returns the final string when called without arguments.
+ * @inner
+ */
+ function stringDestination() {
+ var cs = [], ps = []; return function() {
+ if (arguments.length === 0)
+ return ps.join('')+stringFromCharCode.apply(String, cs);
+ if (cs.length + arguments.length > 1024)
+ ps.push(stringFromCharCode.apply(String, cs)),
+ cs.length = 0;
+ Array.prototype.push.apply(cs, arguments);
+ };
+ }
+
+ /**
+ * Gets the accessor type.
+ * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
+ * @expose
+ */
+ ByteBuffer.accessor = function() {
+ return Uint8Array;
+ };
+ /**
+ * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
+ * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer}
+ * @expose
+ */
+ ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
+ return new ByteBuffer(capacity, littleEndian, noAssert);
+ };
+
+ /**
+ * Concatenates multiple ByteBuffers into one.
+ * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
+ * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
+ * defaults to "utf8")
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
+ * to {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer} Concatenated ByteBuffer
+ * @expose
+ */
+ ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
+ if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
+ noAssert = littleEndian;
+ littleEndian = encoding;
+ encoding = undefined;
+ }
+ var capacity = 0;
+ for (var i=0, k=buffers.length, length; i<k; ++i) {
+ if (!ByteBuffer.isByteBuffer(buffers[i]))
+ buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
+ length = buffers[i].limit - buffers[i].offset;
+ if (length > 0) capacity += length;
+ }
+ if (capacity === 0)
+ return new ByteBuffer(0, littleEndian, noAssert);
+ var bb = new ByteBuffer(capacity, littleEndian, noAssert),
+ bi;
+ i=0; while (i<k) {
+ bi = buffers[i++];
+ length = bi.limit - bi.offset;
+ if (length <= 0) continue;
+ bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
+ bb.offset += length;
+ }
+ bb.limit = bb.offset;
+ bb.offset = 0;
+ return bb;
+ };
+
+ /**
+ * Tests if the specified type is a ByteBuffer.
+ * @param {*} bb ByteBuffer to test
+ * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
+ * @expose
+ */
+ ByteBuffer.isByteBuffer = function(bb) {
+ return (bb && bb["__isByteBuffer__"]) === true;
+ };
+ /**
+ * Gets the backing buffer type.
+ * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
+ * @expose
+ */
+ ByteBuffer.type = function() {
+ return ArrayBuffer;
+ };
+ /**
+ * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
+ * {@link ByteBuffer#limit} to the length of the wrapped data.
+ * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
+ * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
+ * "utf8")
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
+ * @expose
+ */
+ ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
+ if (typeof encoding !== 'string') {
+ noAssert = littleEndian;
+ littleEndian = encoding;
+ encoding = undefined;
+ }
+ if (typeof buffer === 'string') {
+ if (typeof encoding === 'undefined')
+ encoding = "utf8";
+ switch (encoding) {
+ case "base64":
+ return ByteBuffer.fromBase64(buffer, littleEndian);
+ case "hex":
+ return ByteBuffer.fromHex(buffer, littleEndian);
+ case "binary":
+ return ByteBuffer.fromBinary(buffer, littleEndian);
+ case "utf8":
+ return ByteBuffer.fromUTF8(buffer, littleEndian);
+ case "debug":
+ return ByteBuffer.fromDebug(buffer, littleEndian);
+ default:
+ throw Error("Unsupported encoding: "+encoding);
+ }
+ }
+ if (buffer === null || typeof buffer !== 'object')
+ throw TypeError("Illegal buffer");
+ var bb;
+ if (ByteBuffer.isByteBuffer(buffer)) {
+ bb = ByteBufferPrototype.clone.call(buffer);
+ bb.markedOffset = -1;
+ return bb;
+ }
+ if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
+ bb = new ByteBuffer(0, littleEndian, noAssert);
+ if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
+ bb.buffer = buffer.buffer;
+ bb.offset = buffer.byteOffset;
+ bb.limit = buffer.byteOffset + buffer.byteLength;
+ bb.view = new Uint8Array(buffer.buffer);
+ }
+ } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
+ bb = new ByteBuffer(0, littleEndian, noAssert);
+ if (buffer.byteLength > 0) {
+ bb.buffer = buffer;
+ bb.offset = 0;
+ bb.limit = buffer.byteLength;
+ bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
+ }
+ } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
+ bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
+ bb.limit = buffer.length;
+ for (var i=0; i<buffer.length; ++i)
+ bb.view[i] = buffer[i];
+ } else
+ throw TypeError("Illegal buffer"); // Otherwise fail
+ return bb;
+ };
+
+ /**
+ * Writes the array as a bitset.
+ * @param {Array<boolean>} value Array of booleans to write
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
+ * @returns {!ByteBuffer}
+ * @expose
+ */
+ ByteBufferPrototype.writeBitSet = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (!(value instanceof Array))
+ throw TypeError("Illegal BitSet: Not an array");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+
+ var start = offset,
+ bits = value.length,
+ bytes = (bits >> 3),
+ bit = 0,
+ k;
+
+ offset += this.writeVarint32(bits,offset);
+
+ while(bytes--) {
+ k = (!!value[bit++] & 1) |
+ ((!!value[bit++] & 1) << 1) |
+ ((!!value[bit++] & 1) << 2) |
+ ((!!value[bit++] & 1) << 3) |
+ ((!!value[bit++] & 1) << 4) |
+ ((!!value[bit++] & 1) << 5) |
+ ((!!value[bit++] & 1) << 6) |
+ ((!!value[bit++] & 1) << 7);
+ this.writeByte(k,offset++);
+ }
+
+ if(bit < bits) {
+ var m = 0; k = 0;
+ while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
+ this.writeByte(k,offset++);
+ }
+
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return offset - start;
+ }
+
+ /**
+ * Reads a BitSet as an array of booleans.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
+ * @returns {Array<boolean>
+ * @expose
+ */
+ ByteBufferPrototype.readBitSet = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+
+ var ret = this.readVarint32(offset),
+ bits = ret.value,
+ bytes = (bits >> 3),
+ bit = 0,
+ value = [],
+ k;
+
+ offset += ret.length;
+
+ while(bytes--) {
+ k = this.readByte(offset++);
+ value[bit++] = !!(k & 0x01);
+ value[bit++] = !!(k & 0x02);
+ value[bit++] = !!(k & 0x04);
+ value[bit++] = !!(k & 0x08);
+ value[bit++] = !!(k & 0x10);
+ value[bit++] = !!(k & 0x20);
+ value[bit++] = !!(k & 0x40);
+ value[bit++] = !!(k & 0x80);
+ }
+
+ if(bit < bits) {
+ var m = 0;
+ k = this.readByte(offset++);
+ while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
+ }
+
+ if (relative) {
+ this.offset = offset;
+ }
+ return value;
+ }
+ /**
+ * Reads the specified number of bytes.
+ * @param {number} length Number of bytes to read
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
+ * @returns {!ByteBuffer}
+ * @expose
+ */
+ ByteBufferPrototype.readBytes = function(length, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + length > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
+ }
+ var slice = this.slice(offset, offset + length);
+ if (relative) this.offset += length;
+ return slice;
+ };
+
+ /**
+ * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
+ * @function
+ * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
+ * will be modified according to the performed read operation.
+ * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
+
+ // types/ints/int8
+
+ /**
+ * Writes an 8bit signed integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeInt8 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value |= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 1;
+ var capacity0 = this.buffer.byteLength;
+ if (offset > capacity0)
+ this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
+ offset -= 1;
+ this.view[offset] = value;
+ if (relative) this.offset += 1;
+ return this;
+ };
+
+ /**
+ * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
+
+ /**
+ * Reads an 8bit signed integer.
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readInt8 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ var value = this.view[offset];
+ if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
+ if (relative) this.offset += 1;
+ return value;
+ };
+
+ /**
+ * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
+
+ /**
+ * Writes an 8bit unsigned integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeUint8 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value >>>= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 1;
+ var capacity1 = this.buffer.byteLength;
+ if (offset > capacity1)
+ this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
+ offset -= 1;
+ this.view[offset] = value;
+ if (relative) this.offset += 1;
+ return this;
+ };
+
+ /**
+ * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
+
+ /**
+ * Reads an 8bit unsigned integer.
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readUint8 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ var value = this.view[offset];
+ if (relative) this.offset += 1;
+ return value;
+ };
+
+ /**
+ * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
+
+ // types/ints/int16
+
+ /**
+ * Writes a 16bit signed integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @throws {TypeError} If `offset` or `value` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.writeInt16 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value |= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 2;
+ var capacity2 = this.buffer.byteLength;
+ if (offset > capacity2)
+ this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
+ offset -= 2;
+ if (this.littleEndian) {
+ this.view[offset+1] = (value & 0xFF00) >>> 8;
+ this.view[offset ] = value & 0x00FF;
+ } else {
+ this.view[offset] = (value & 0xFF00) >>> 8;
+ this.view[offset+1] = value & 0x00FF;
+ }
+ if (relative) this.offset += 2;
+ return this;
+ };
+
+ /**
+ * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @throws {TypeError} If `offset` or `value` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
+
+ /**
+ * Reads a 16bit signed integer.
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @returns {number} Value read
+ * @throws {TypeError} If `offset` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.readInt16 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 2 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
+ }
+ var value = 0;
+ if (this.littleEndian) {
+ value = this.view[offset ];
+ value |= this.view[offset+1] << 8;
+ } else {
+ value = this.view[offset ] << 8;
+ value |= this.view[offset+1];
+ }
+ if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
+ if (relative) this.offset += 2;
+ return value;
+ };
+
+ /**
+ * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @returns {number} Value read
+ * @throws {TypeError} If `offset` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
+
+ /**
+ * Writes a 16bit unsigned integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @throws {TypeError} If `offset` or `value` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.writeUint16 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value >>>= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 2;
+ var capacity3 = this.buffer.byteLength;
+ if (offset > capacity3)
+ this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
+ offset -= 2;
+ if (this.littleEndian) {
+ this.view[offset+1] = (value & 0xFF00) >>> 8;
+ this.view[offset ] = value & 0x00FF;
+ } else {
+ this.view[offset] = (value & 0xFF00) >>> 8;
+ this.view[offset+1] = value & 0x00FF;
+ }
+ if (relative) this.offset += 2;
+ return this;
+ };
+
+ /**
+ * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @throws {TypeError} If `offset` or `value` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
+
+ /**
+ * Reads a 16bit unsigned integer.
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @returns {number} Value read
+ * @throws {TypeError} If `offset` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.readUint16 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 2 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
+ }
+ var value = 0;
+ if (this.littleEndian) {
+ value = this.view[offset ];
+ value |= this.view[offset+1] << 8;
+ } else {
+ value = this.view[offset ] << 8;
+ value |= this.view[offset+1];
+ }
+ if (relative) this.offset += 2;
+ return value;
+ };
+
+ /**
+ * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
+ * @returns {number} Value read
+ * @throws {TypeError} If `offset` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
+
+ // types/ints/int32
+
+ /**
+ * Writes a 32bit signed integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @expose
+ */
+ ByteBufferPrototype.writeInt32 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value |= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 4;
+ var capacity4 = this.buffer.byteLength;
+ if (offset > capacity4)
+ this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
+ offset -= 4;
+ if (this.littleEndian) {
+ this.view[offset+3] = (value >>> 24) & 0xFF;
+ this.view[offset+2] = (value >>> 16) & 0xFF;
+ this.view[offset+1] = (value >>> 8) & 0xFF;
+ this.view[offset ] = value & 0xFF;
+ } else {
+ this.view[offset ] = (value >>> 24) & 0xFF;
+ this.view[offset+1] = (value >>> 16) & 0xFF;
+ this.view[offset+2] = (value >>> 8) & 0xFF;
+ this.view[offset+3] = value & 0xFF;
+ }
+ if (relative) this.offset += 4;
+ return this;
+ };
+
+ /**
+ * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @expose
+ */
+ ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
+
+ /**
+ * Reads a 32bit signed integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readInt32 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 4 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
+ }
+ var value = 0;
+ if (this.littleEndian) {
+ value = this.view[offset+2] << 16;
+ value |= this.view[offset+1] << 8;
+ value |= this.view[offset ];
+ value += this.view[offset+3] << 24 >>> 0;
+ } else {
+ value = this.view[offset+1] << 16;
+ value |= this.view[offset+2] << 8;
+ value |= this.view[offset+3];
+ value += this.view[offset ] << 24 >>> 0;
+ }
+ value |= 0; // Cast to signed
+ if (relative) this.offset += 4;
+ return value;
+ };
+
+ /**
+ * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
+ * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
+
+ /**
+ * Writes a 32bit unsigned integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @expose
+ */
+ ByteBufferPrototype.writeUint32 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value >>>= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 4;
+ var capacity5 = this.buffer.byteLength;
+ if (offset > capacity5)
+ this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
+ offset -= 4;
+ if (this.littleEndian) {
+ this.view[offset+3] = (value >>> 24) & 0xFF;
+ this.view[offset+2] = (value >>> 16) & 0xFF;
+ this.view[offset+1] = (value >>> 8) & 0xFF;
+ this.view[offset ] = value & 0xFF;
+ } else {
+ this.view[offset ] = (value >>> 24) & 0xFF;
+ this.view[offset+1] = (value >>> 16) & 0xFF;
+ this.view[offset+2] = (value >>> 8) & 0xFF;
+ this.view[offset+3] = value & 0xFF;
+ }
+ if (relative) this.offset += 4;
+ return this;
+ };
+
+ /**
+ * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @expose
+ */
+ ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
+
+ /**
+ * Reads a 32bit unsigned integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readUint32 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 4 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
+ }
+ var value = 0;
+ if (this.littleEndian) {
+ value = this.view[offset+2] << 16;
+ value |= this.view[offset+1] << 8;
+ value |= this.view[offset ];
+ value += this.view[offset+3] << 24 >>> 0;
+ } else {
+ value = this.view[offset+1] << 16;
+ value |= this.view[offset+2] << 8;
+ value |= this.view[offset+3];
+ value += this.view[offset ] << 24 >>> 0;
+ }
+ if (relative) this.offset += 4;
+ return value;
+ };
+
+ /**
+ * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number} Value read
+ * @expose
+ */
+ ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
+
+ // types/ints/int64
+
+ if (Long) {
+
+ /**
+ * Writes a 64bit signed integer.
+ * @param {number|!Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeInt64 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ else if (!(value && value instanceof Long))
+ throw TypeError("Illegal value: "+value+" (not an integer or Long)");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ offset += 8;
+ var capacity6 = this.buffer.byteLength;
+ if (offset > capacity6)
+ this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
+ offset -= 8;
+ var lo = value.low,
+ hi = value.high;
+ if (this.littleEndian) {
+ this.view[offset+3] = (lo >>> 24) & 0xFF;
+ this.view[offset+2] = (lo >>> 16) & 0xFF;
+ this.view[offset+1] = (lo >>> 8) & 0xFF;
+ this.view[offset ] = lo & 0xFF;
+ offset += 4;
+ this.view[offset+3] = (hi >>> 24) & 0xFF;
+ this.view[offset+2] = (hi >>> 16) & 0xFF;
+ this.view[offset+1] = (hi >>> 8) & 0xFF;
+ this.view[offset ] = hi & 0xFF;
+ } else {
+ this.view[offset ] = (hi >>> 24) & 0xFF;
+ this.view[offset+1] = (hi >>> 16) & 0xFF;
+ this.view[offset+2] = (hi >>> 8) & 0xFF;
+ this.view[offset+3] = hi & 0xFF;
+ offset += 4;
+ this.view[offset ] = (lo >>> 24) & 0xFF;
+ this.view[offset+1] = (lo >>> 16) & 0xFF;
+ this.view[offset+2] = (lo >>> 8) & 0xFF;
+ this.view[offset+3] = lo & 0xFF;
+ }
+ if (relative) this.offset += 8;
+ return this;
+ };
+
+ /**
+ * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
+ * @param {number|!Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
+
+ /**
+ * Reads a 64bit signed integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!Long}
+ * @expose
+ */
+ ByteBufferPrototype.readInt64 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 8 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
+ }
+ var lo = 0,
+ hi = 0;
+ if (this.littleEndian) {
+ lo = this.view[offset+2] << 16;
+ lo |= this.view[offset+1] << 8;
+ lo |= this.view[offset ];
+ lo += this.view[offset+3] << 24 >>> 0;
+ offset += 4;
+ hi = this.view[offset+2] << 16;
+ hi |= this.view[offset+1] << 8;
+ hi |= this.view[offset ];
+ hi += this.view[offset+3] << 24 >>> 0;
+ } else {
+ hi = this.view[offset+1] << 16;
+ hi |= this.view[offset+2] << 8;
+ hi |= this.view[offset+3];
+ hi += this.view[offset ] << 24 >>> 0;
+ offset += 4;
+ lo = this.view[offset+1] << 16;
+ lo |= this.view[offset+2] << 8;
+ lo |= this.view[offset+3];
+ lo += this.view[offset ] << 24 >>> 0;
+ }
+ var value = new Long(lo, hi, false);
+ if (relative) this.offset += 8;
+ return value;
+ };
+
+ /**
+ * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!Long}
+ * @expose
+ */
+ ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
+
+ /**
+ * Writes a 64bit unsigned integer.
+ * @param {number|!Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeUint64 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ else if (!(value && value instanceof Long))
+ throw TypeError("Illegal value: "+value+" (not an integer or Long)");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ offset += 8;
+ var capacity7 = this.buffer.byteLength;
+ if (offset > capacity7)
+ this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
+ offset -= 8;
+ var lo = value.low,
+ hi = value.high;
+ if (this.littleEndian) {
+ this.view[offset+3] = (lo >>> 24) & 0xFF;
+ this.view[offset+2] = (lo >>> 16) & 0xFF;
+ this.view[offset+1] = (lo >>> 8) & 0xFF;
+ this.view[offset ] = lo & 0xFF;
+ offset += 4;
+ this.view[offset+3] = (hi >>> 24) & 0xFF;
+ this.view[offset+2] = (hi >>> 16) & 0xFF;
+ this.view[offset+1] = (hi >>> 8) & 0xFF;
+ this.view[offset ] = hi & 0xFF;
+ } else {
+ this.view[offset ] = (hi >>> 24) & 0xFF;
+ this.view[offset+1] = (hi >>> 16) & 0xFF;
+ this.view[offset+2] = (hi >>> 8) & 0xFF;
+ this.view[offset+3] = hi & 0xFF;
+ offset += 4;
+ this.view[offset ] = (lo >>> 24) & 0xFF;
+ this.view[offset+1] = (lo >>> 16) & 0xFF;
+ this.view[offset+2] = (lo >>> 8) & 0xFF;
+ this.view[offset+3] = lo & 0xFF;
+ }
+ if (relative) this.offset += 8;
+ return this;
+ };
+
+ /**
+ * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
+ * @function
+ * @param {number|!Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
+
+ /**
+ * Reads a 64bit unsigned integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!Long}
+ * @expose
+ */
+ ByteBufferPrototype.readUint64 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 8 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
+ }
+ var lo = 0,
+ hi = 0;
+ if (this.littleEndian) {
+ lo = this.view[offset+2] << 16;
+ lo |= this.view[offset+1] << 8;
+ lo |= this.view[offset ];
+ lo += this.view[offset+3] << 24 >>> 0;
+ offset += 4;
+ hi = this.view[offset+2] << 16;
+ hi |= this.view[offset+1] << 8;
+ hi |= this.view[offset ];
+ hi += this.view[offset+3] << 24 >>> 0;
+ } else {
+ hi = this.view[offset+1] << 16;
+ hi |= this.view[offset+2] << 8;
+ hi |= this.view[offset+3];
+ hi += this.view[offset ] << 24 >>> 0;
+ offset += 4;
+ lo = this.view[offset+1] << 16;
+ lo |= this.view[offset+2] << 8;
+ lo |= this.view[offset+3];
+ lo += this.view[offset ] << 24 >>> 0;
+ }
+ var value = new Long(lo, hi, true);
+ if (relative) this.offset += 8;
+ return value;
+ };
+
+ /**
+ * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!Long}
+ * @expose
+ */
+ ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
+
+ } // Long
+
+
+ // types/floats/float32
+
+ /*
+ ieee754 - https://github.com/feross/ieee754
+
+ The MIT License (MIT)
+
+ Copyright (c) Feross Aboukhadijeh
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+ /**
+ * Reads an IEEE754 float from a byte array.
+ * @param {!Array} buffer
+ * @param {number} offset
+ * @param {boolean} isLE
+ * @param {number} mLen
+ * @param {number} nBytes
+ * @returns {number}
+ * @inner
+ */
+ function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
+ var e, m,
+ eLen = nBytes * 8 - mLen - 1,
+ eMax = (1 << eLen) - 1,
+ eBias = eMax >> 1,
+ nBits = -7,
+ i = isLE ? (nBytes - 1) : 0,
+ d = isLE ? -1 : 1,
+ s = buffer[offset + i];
+
+ i += d;
+
+ e = s & ((1 << (-nBits)) - 1);
+ s >>= (-nBits);
+ nBits += eLen;
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
+
+ m = e & ((1 << (-nBits)) - 1);
+ e >>= (-nBits);
+ nBits += mLen;
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
+
+ if (e === 0) {
+ e = 1 - eBias;
+ } else if (e === eMax) {
+ return m ? NaN : ((s ? -1 : 1) * Infinity);
+ } else {
+ m = m + Math.pow(2, mLen);
+ e = e - eBias;
+ }
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
+ }
+
+ /**
+ * Writes an IEEE754 float to a byte array.
+ * @param {!Array} buffer
+ * @param {number} value
+ * @param {number} offset
+ * @param {boolean} isLE
+ * @param {number} mLen
+ * @param {number} nBytes
+ * @inner
+ */
+ function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
+ var e, m, c,
+ eLen = nBytes * 8 - mLen - 1,
+ eMax = (1 << eLen) - 1,
+ eBias = eMax >> 1,
+ rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
+ i = isLE ? 0 : (nBytes - 1),
+ d = isLE ? 1 : -1,
+ s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
+
+ value = Math.abs(value);
+
+ if (isNaN(value) || value === Infinity) {
+ m = isNaN(value) ? 1 : 0;
+ e = eMax;
+ } else {
+ e = Math.floor(Math.log(value) / Math.LN2);
+ if (value * (c = Math.pow(2, -e)) < 1) {
+ e--;
+ c *= 2;
+ }
+ if (e + eBias >= 1) {
+ value += rt / c;
+ } else {
+ value += rt * Math.pow(2, 1 - eBias);
+ }
+ if (value * c >= 2) {
+ e++;
+ c /= 2;
+ }
+
+ if (e + eBias >= eMax) {
+ m = 0;
+ e = eMax;
+ } else if (e + eBias >= 1) {
+ m = (value * c - 1) * Math.pow(2, mLen);
+ e = e + eBias;
+ } else {
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
+ e = 0;
+ }
+ }
+
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
+
+ e = (e << mLen) | m;
+ eLen += mLen;
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
+
+ buffer[offset + i - d] |= s * 128;
+ }
+
+ /**
+ * Writes a 32bit float.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeFloat32 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number')
+ throw TypeError("Illegal value: "+value+" (not a number)");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 4;
+ var capacity8 = this.buffer.byteLength;
+ if (offset > capacity8)
+ this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
+ offset -= 4;
+ ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
+ if (relative) this.offset += 4;
+ return this;
+ };
+
+ /**
+ * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
+
+ /**
+ * Reads a 32bit float.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number}
+ * @expose
+ */
+ ByteBufferPrototype.readFloat32 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 4 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
+ }
+ var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
+ if (relative) this.offset += 4;
+ return value;
+ };
+
+ /**
+ * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
+ * @returns {number}
+ * @expose
+ */
+ ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
+
+ // types/floats/float64
+
+ /**
+ * Writes a 64bit float.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeFloat64 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number')
+ throw TypeError("Illegal value: "+value+" (not a number)");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ offset += 8;
+ var capacity9 = this.buffer.byteLength;
+ if (offset > capacity9)
+ this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
+ offset -= 8;
+ ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
+ if (relative) this.offset += 8;
+ return this;
+ };
+
+ /**
+ * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
+ * @function
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
+
+ /**
+ * Reads a 64bit float.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {number}
+ * @expose
+ */
+ ByteBufferPrototype.readFloat64 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 8 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
+ }
+ var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
+ if (relative) this.offset += 8;
+ return value;
+ };
+
+ /**
+ * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
+ * @function
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
+ * @returns {number}
+ * @expose
+ */
+ ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
+
+
+ // types/varints/varint32
+
+ /**
+ * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ByteBuffer.MAX_VARINT32_BYTES = 5;
+
+ /**
+ * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
+ * @param {number} value Value to encode
+ * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
+ * @expose
+ */
+ ByteBuffer.calculateVarint32 = function(value) {
+ // ref: src/google/protobuf/io/coded_stream.cc
+ value = value >>> 0;
+ if (value < 1 << 7 ) return 1;
+ else if (value < 1 << 14) return 2;
+ else if (value < 1 << 21) return 3;
+ else if (value < 1 << 28) return 4;
+ else return 5;
+ };
+
+ /**
+ * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
+ * @param {number} n Signed 32bit integer
+ * @returns {number} Unsigned zigzag encoded 32bit integer
+ * @expose
+ */
+ ByteBuffer.zigZagEncode32 = function(n) {
+ return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
+ };
+
+ /**
+ * Decodes a zigzag encoded signed 32bit integer.
+ * @param {number} n Unsigned zigzag encoded 32bit integer
+ * @returns {number} Signed 32bit integer
+ * @expose
+ */
+ ByteBuffer.zigZagDecode32 = function(n) {
+ return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
+ };
+
+ /**
+ * Writes a 32bit base 128 variable-length integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
+ * @expose
+ */
+ ByteBufferPrototype.writeVarint32 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value |= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ var size = ByteBuffer.calculateVarint32(value),
+ b;
+ offset += size;
+ var capacity10 = this.buffer.byteLength;
+ if (offset > capacity10)
+ this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
+ offset -= size;
+ value >>>= 0;
+ while (value >= 0x80) {
+ b = (value & 0x7f) | 0x80;
+ this.view[offset++] = b;
+ value >>>= 7;
+ }
+ this.view[offset++] = value;
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return size;
+ };
+
+ /**
+ * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
+ * @param {number} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
+ * @expose
+ */
+ ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
+ return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
+ };
+
+ /**
+ * Reads a 32bit base 128 variable-length integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
+ * and the actual number of bytes read.
+ * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
+ * to fully decode the varint.
+ * @expose
+ */
+ ByteBufferPrototype.readVarint32 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ var c = 0,
+ value = 0 >>> 0,
+ b;
+ do {
+ if (!this.noAssert && offset > this.limit) {
+ var err = Error("Truncated");
+ err['truncated'] = true;
+ throw err;
+ }
+ b = this.view[offset++];
+ if (c < 5)
+ value |= (b & 0x7f) << (7*c);
+ ++c;
+ } while ((b & 0x80) !== 0);
+ value |= 0;
+ if (relative) {
+ this.offset = offset;
+ return value;
+ }
+ return {
+ "value": value,
+ "length": c
+ };
+ };
+
+ /**
+ * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
+ * and the actual number of bytes read.
+ * @throws {Error} If it's not a valid varint
+ * @expose
+ */
+ ByteBufferPrototype.readVarint32ZigZag = function(offset) {
+ var val = this.readVarint32(offset);
+ if (typeof val === 'object')
+ val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
+ else
+ val = ByteBuffer.zigZagDecode32(val);
+ return val;
+ };
+
+ // types/varints/varint64
+
+ if (Long) {
+
+ /**
+ * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
+ * @type {number}
+ * @const
+ * @expose
+ */
+ ByteBuffer.MAX_VARINT64_BYTES = 10;
+
+ /**
+ * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
+ * @param {number|!Long} value Value to encode
+ * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
+ * @expose
+ */
+ ByteBuffer.calculateVarint64 = function(value) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ // ref: src/google/protobuf/io/coded_stream.cc
+ var part0 = value.toInt() >>> 0,
+ part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
+ part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
+ if (part2 == 0) {
+ if (part1 == 0) {
+ if (part0 < 1 << 14)
+ return part0 < 1 << 7 ? 1 : 2;
+ else
+ return part0 < 1 << 21 ? 3 : 4;
+ } else {
+ if (part1 < 1 << 14)
+ return part1 < 1 << 7 ? 5 : 6;
+ else
+ return part1 < 1 << 21 ? 7 : 8;
+ }
+ } else
+ return part2 < 1 << 7 ? 9 : 10;
+ };
+
+ /**
+ * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
+ * @param {number|!Long} value Signed long
+ * @returns {!Long} Unsigned zigzag encoded long
+ * @expose
+ */
+ ByteBuffer.zigZagEncode64 = function(value) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value, false);
+ else if (typeof value === 'string')
+ value = Long.fromString(value, false);
+ else if (value.unsigned !== false) value = value.toSigned();
+ // ref: src/google/protobuf/wire_format_lite.h
+ return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
+ };
+
+ /**
+ * Decodes a zigzag encoded signed 64bit integer.
+ * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
+ * @returns {!Long} Signed long
+ * @expose
+ */
+ ByteBuffer.zigZagDecode64 = function(value) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value, false);
+ else if (typeof value === 'string')
+ value = Long.fromString(value, false);
+ else if (value.unsigned !== false) value = value.toSigned();
+ // ref: src/google/protobuf/wire_format_lite.h
+ return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
+ };
+
+ /**
+ * Writes a 64bit base 128 variable-length integer.
+ * @param {number|Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
+ * @expose
+ */
+ ByteBufferPrototype.writeVarint64 = function(value, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof value === 'number')
+ value = Long.fromNumber(value);
+ else if (typeof value === 'string')
+ value = Long.fromString(value);
+ else if (!(value && value instanceof Long))
+ throw TypeError("Illegal value: "+value+" (not an integer or Long)");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ if (typeof value === 'number')
+ value = Long.fromNumber(value, false);
+ else if (typeof value === 'string')
+ value = Long.fromString(value, false);
+ else if (value.unsigned !== false) value = value.toSigned();
+ var size = ByteBuffer.calculateVarint64(value),
+ part0 = value.toInt() >>> 0,
+ part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
+ part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
+ offset += size;
+ var capacity11 = this.buffer.byteLength;
+ if (offset > capacity11)
+ this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
+ offset -= size;
+ switch (size) {
+ case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
+ case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
+ case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
+ case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
+ case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
+ case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
+ case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
+ case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
+ case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
+ case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
+ }
+ if (relative) {
+ this.offset += size;
+ return this;
+ } else {
+ return size;
+ }
+ };
+
+ /**
+ * Writes a zig-zag encoded 64bit base 128 variable-length integer.
+ * @param {number|Long} value Value to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
+ * @expose
+ */
+ ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
+ return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
+ };
+
+ /**
+ * Reads a 64bit base 128 variable-length integer. Requires Long.js.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
+ * the actual number of bytes read.
+ * @throws {Error} If it's not a valid varint
+ * @expose
+ */
+ ByteBufferPrototype.readVarint64 = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ // ref: src/google/protobuf/io/coded_stream.cc
+ var start = offset,
+ part0 = 0,
+ part1 = 0,
+ part2 = 0,
+ b = 0;
+ b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
+ b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
+ throw Error("Buffer overrun"); }}}}}}}}}}
+ var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
+ if (relative) {
+ this.offset = offset;
+ return value;
+ } else {
+ return {
+ 'value': value,
+ 'length': offset-start
+ };
+ }
+ };
+
+ /**
+ * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
+ * the actual number of bytes read.
+ * @throws {Error} If it's not a valid varint
+ * @expose
+ */
+ ByteBufferPrototype.readVarint64ZigZag = function(offset) {
+ var val = this.readVarint64(offset);
+ if (val && val['value'] instanceof Long)
+ val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
+ else
+ val = ByteBuffer.zigZagDecode64(val);
+ return val;
+ };
+
+ } // Long
+
+
+ // types/strings/cstring
+
+ /**
+ * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
+ * characters itself.
+ * @param {string} str String to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * contained in `str` + 1 if omitted.
+ * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
+ * @expose
+ */
+ ByteBufferPrototype.writeCString = function(str, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ var i,
+ k = str.length;
+ if (!this.noAssert) {
+ if (typeof str !== 'string')
+ throw TypeError("Illegal str: Not a string");
+ for (i=0; i<k; ++i) {
+ if (str.charCodeAt(i) === 0)
+ throw RangeError("Illegal str: Contains NULL-characters");
+ }
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ // UTF8 strings do not contain zero bytes in between except for the zero character, so:
+ k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
+ offset += k+1;
+ var capacity12 = this.buffer.byteLength;
+ if (offset > capacity12)
+ this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
+ offset -= k+1;
+ utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
+ this.view[offset++] = b;
+ }.bind(this));
+ this.view[offset++] = 0;
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return k;
+ };
+
+ /**
+ * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
+ * itself.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
+ * read and the actual number of bytes read.
+ * @expose
+ */
+ ByteBufferPrototype.readCString = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ var start = offset,
+ temp;
+ // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
+ var sd, b = -1;
+ utfx.decodeUTF8toUTF16(function() {
+ if (b === 0) return null;
+ if (offset >= this.limit)
+ throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
+ b = this.view[offset++];
+ return b === 0 ? null : b;
+ }.bind(this), sd = stringDestination(), true);
+ if (relative) {
+ this.offset = offset;
+ return sd();
+ } else {
+ return {
+ "string": sd(),
+ "length": offset - start
+ };
+ }
+ };
+
+ // types/strings/istring
+
+ /**
+ * Writes a length as uint32 prefixed UTF8 encoded string.
+ * @param {string} str String to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
+ * @expose
+ * @see ByteBuffer#writeVarint32
+ */
+ ByteBufferPrototype.writeIString = function(str, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof str !== 'string')
+ throw TypeError("Illegal str: Not a string");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ var start = offset,
+ k;
+ k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
+ offset += 4+k;
+ var capacity13 = this.buffer.byteLength;
+ if (offset > capacity13)
+ this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
+ offset -= 4+k;
+ if (this.littleEndian) {
+ this.view[offset+3] = (k >>> 24) & 0xFF;
+ this.view[offset+2] = (k >>> 16) & 0xFF;
+ this.view[offset+1] = (k >>> 8) & 0xFF;
+ this.view[offset ] = k & 0xFF;
+ } else {
+ this.view[offset ] = (k >>> 24) & 0xFF;
+ this.view[offset+1] = (k >>> 16) & 0xFF;
+ this.view[offset+2] = (k >>> 8) & 0xFF;
+ this.view[offset+3] = k & 0xFF;
+ }
+ offset += 4;
+ utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
+ this.view[offset++] = b;
+ }.bind(this));
+ if (offset !== start + 4 + k)
+ throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return offset - start;
+ };
+
+ /**
+ * Reads a length as uint32 prefixed UTF8 encoded string.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
+ * read and the actual number of bytes read.
+ * @expose
+ * @see ByteBuffer#readVarint32
+ */
+ ByteBufferPrototype.readIString = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 4 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
+ }
+ var start = offset;
+ var len = this.readUint32(offset);
+ var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
+ offset += str['length'];
+ if (relative) {
+ this.offset = offset;
+ return str['string'];
+ } else {
+ return {
+ 'string': str['string'],
+ 'length': offset - start
+ };
+ }
+ };
+
+ // types/strings/utf8string
+
+ /**
+ * Metrics representing number of UTF8 characters. Evaluates to `c`.
+ * @type {string}
+ * @const
+ * @expose
+ */
+ ByteBuffer.METRICS_CHARS = 'c';
+
+ /**
+ * Metrics representing number of bytes. Evaluates to `b`.
+ * @type {string}
+ * @const
+ * @expose
+ */
+ ByteBuffer.METRICS_BYTES = 'b';
+
+ /**
+ * Writes an UTF8 encoded string.
+ * @param {string} str String to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
+ * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
+ * @expose
+ */
+ ByteBufferPrototype.writeUTF8String = function(str, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ var k;
+ var start = offset;
+ k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
+ offset += k;
+ var capacity14 = this.buffer.byteLength;
+ if (offset > capacity14)
+ this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
+ offset -= k;
+ utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
+ this.view[offset++] = b;
+ }.bind(this));
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return offset - start;
+ };
+
+ /**
+ * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
+ * @function
+ * @param {string} str String to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
+ * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
+ * @expose
+ */
+ ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
+
+ /**
+ * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
+ * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
+ * @param {string} str String to calculate
+ * @returns {number} Number of UTF8 characters
+ * @expose
+ */
+ ByteBuffer.calculateUTF8Chars = function(str) {
+ return utfx.calculateUTF16asUTF8(stringSource(str))[0];
+ };
+
+ /**
+ * Calculates the number of UTF8 bytes of a string.
+ * @param {string} str String to calculate
+ * @returns {number} Number of UTF8 bytes
+ * @expose
+ */
+ ByteBuffer.calculateUTF8Bytes = function(str) {
+ return utfx.calculateUTF16asUTF8(stringSource(str))[1];
+ };
+
+ /**
+ * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
+ * @function
+ * @param {string} str String to calculate
+ * @returns {number} Number of UTF8 bytes
+ * @expose
+ */
+ ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
+
+ /**
+ * Reads an UTF8 encoded string.
+ * @param {number} length Number of characters or bytes to read.
+ * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
+ * {@link ByteBuffer.METRICS_CHARS}.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
+ * read and the actual number of bytes read.
+ * @expose
+ */
+ ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
+ if (typeof metrics === 'number') {
+ offset = metrics;
+ metrics = undefined;
+ }
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
+ if (!this.noAssert) {
+ if (typeof length !== 'number' || length % 1 !== 0)
+ throw TypeError("Illegal length: "+length+" (not an integer)");
+ length |= 0;
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ var i = 0,
+ start = offset,
+ sd;
+ if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
+ sd = stringDestination();
+ utfx.decodeUTF8(function() {
+ return i < length && offset < this.limit ? this.view[offset++] : null;
+ }.bind(this), function(cp) {
+ ++i; utfx.UTF8toUTF16(cp, sd);
+ });
+ if (i !== length)
+ throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
+ if (relative) {
+ this.offset = offset;
+ return sd();
+ } else {
+ return {
+ "string": sd(),
+ "length": offset - start
+ };
+ }
+ } else if (metrics === ByteBuffer.METRICS_BYTES) {
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + length > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
+ }
+ var k = offset + length;
+ utfx.decodeUTF8toUTF16(function() {
+ return offset < k ? this.view[offset++] : null;
+ }.bind(this), sd = stringDestination(), this.noAssert);
+ if (offset !== k)
+ throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
+ if (relative) {
+ this.offset = offset;
+ return sd();
+ } else {
+ return {
+ 'string': sd(),
+ 'length': offset - start
+ };
+ }
+ } else
+ throw TypeError("Unsupported metrics: "+metrics);
+ };
+
+ /**
+ * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
+ * @function
+ * @param {number} length Number of characters or bytes to read
+ * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
+ * {@link ByteBuffer.METRICS_CHARS}.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
+ * read and the actual number of bytes read.
+ * @expose
+ */
+ ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
+
+ // types/strings/vstring
+
+ /**
+ * Writes a length as varint32 prefixed UTF8 encoded string.
+ * @param {string} str String to write
+ * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
+ * @expose
+ * @see ByteBuffer#writeVarint32
+ */
+ ByteBufferPrototype.writeVString = function(str, offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof str !== 'string')
+ throw TypeError("Illegal str: Not a string");
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ var start = offset,
+ k, l;
+ k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
+ l = ByteBuffer.calculateVarint32(k);
+ offset += l+k;
+ var capacity15 = this.buffer.byteLength;
+ if (offset > capacity15)
+ this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
+ offset -= l+k;
+ offset += this.writeVarint32(k, offset);
+ utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
+ this.view[offset++] = b;
+ }.bind(this));
+ if (offset !== start+k+l)
+ throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
+ if (relative) {
+ this.offset = offset;
+ return this;
+ }
+ return offset - start;
+ };
+
+ /**
+ * Reads a length as varint32 prefixed UTF8 encoded string.
+ * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
+ * read and the actual number of bytes read.
+ * @expose
+ * @see ByteBuffer#readVarint32
+ */
+ ByteBufferPrototype.readVString = function(offset) {
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 1 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
+ }
+ var start = offset;
+ var len = this.readVarint32(offset);
+ var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
+ offset += str['length'];
+ if (relative) {
+ this.offset = offset;
+ return str['string'];
+ } else {
+ return {
+ 'string': str['string'],
+ 'length': offset - start
+ };
+ }
+ };
+
+
+ /**
+ * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
+ * data's length.
+ * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
+ * will be modified according to the performed read operation.
+ * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
+ * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
+ * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
+ */
+ ByteBufferPrototype.append = function(source, encoding, offset) {
+ if (typeof encoding === 'number' || typeof encoding !== 'string') {
+ offset = encoding;
+ encoding = undefined;
+ }
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ if (!(source instanceof ByteBuffer))
+ source = ByteBuffer.wrap(source, encoding);
+ var length = source.limit - source.offset;
+ if (length <= 0) return this; // Nothing to append
+ offset += length;
+ var capacity16 = this.buffer.byteLength;
+ if (offset > capacity16)
+ this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
+ offset -= length;
+ this.view.set(source.view.subarray(source.offset, source.limit), offset);
+ source.offset += length;
+ if (relative) this.offset += length;
+ return this;
+ };
+
+ /**
+ * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
+ specified offset up to the length of this ByteBuffer's data.
+ * @param {!ByteBuffer} target Target ByteBuffer
+ * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * read if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ * @see ByteBuffer#append
+ */
+ ByteBufferPrototype.appendTo = function(target, offset) {
+ target.append(this, offset);
+ return this;
+ };
+
+ /**
+ * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
+ * disable them if your code already makes sure that everything is valid.
+ * @param {boolean} assert `true` to enable assertions, otherwise `false`
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.assert = function(assert) {
+ this.noAssert = !assert;
+ return this;
+ };
+
+ /**
+ * Gets the capacity of this ByteBuffer's backing buffer.
+ * @returns {number} Capacity of the backing buffer
+ * @expose
+ */
+ ByteBufferPrototype.capacity = function() {
+ return this.buffer.byteLength;
+ };
+ /**
+ * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
+ * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.clear = function() {
+ this.offset = 0;
+ this.limit = this.buffer.byteLength;
+ this.markedOffset = -1;
+ return this;
+ };
+
+ /**
+ * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
+ * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
+ * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
+ * @returns {!ByteBuffer} Cloned instance
+ * @expose
+ */
+ ByteBufferPrototype.clone = function(copy) {
+ var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
+ if (copy) {
+ bb.buffer = new ArrayBuffer(this.buffer.byteLength);
+ bb.view = new Uint8Array(bb.buffer);
+ } else {
+ bb.buffer = this.buffer;
+ bb.view = this.view;
+ }
+ bb.offset = this.offset;
+ bb.markedOffset = this.markedOffset;
+ bb.limit = this.limit;
+ return bb;
+ };
+
+ /**
+ * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
+ * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
+ * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
+ * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
+ * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.compact = function(begin, end) {
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ if (begin === 0 && end === this.buffer.byteLength)
+ return this; // Already compacted
+ var len = end - begin;
+ if (len === 0) {
+ this.buffer = EMPTY_BUFFER;
+ this.view = null;
+ if (this.markedOffset >= 0) this.markedOffset -= begin;
+ this.offset = 0;
+ this.limit = 0;
+ return this;
+ }
+ var buffer = new ArrayBuffer(len);
+ var view = new Uint8Array(buffer);
+ view.set(this.view.subarray(begin, end));
+ this.buffer = buffer;
+ this.view = view;
+ if (this.markedOffset >= 0) this.markedOffset -= begin;
+ this.offset = 0;
+ this.limit = len;
+ return this;
+ };
+
+ /**
+ * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
+ * {@link ByteBuffer#limit}.
+ * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
+ * @returns {!ByteBuffer} Copy
+ * @expose
+ */
+ ByteBufferPrototype.copy = function(begin, end) {
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ if (begin === end)
+ return new ByteBuffer(0, this.littleEndian, this.noAssert);
+ var capacity = end - begin,
+ bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
+ bb.offset = 0;
+ bb.limit = capacity;
+ if (bb.markedOffset >= 0) bb.markedOffset -= begin;
+ this.copyTo(bb, 0, begin, end);
+ return bb;
+ };
+
+ /**
+ * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
+ * {@link ByteBuffer#limit}.
+ * @param {!ByteBuffer} target Target ByteBuffer
+ * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
+ * by the number of bytes copied if omitted.
+ * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
+ * number of bytes copied if omitted.
+ * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
+ var relative,
+ targetRelative;
+ if (!this.noAssert) {
+ if (!ByteBuffer.isByteBuffer(target))
+ throw TypeError("Illegal target: Not a ByteBuffer");
+ }
+ targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
+ sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
+ sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
+
+ if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
+ throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
+ if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
+ throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
+
+ var len = sourceLimit - sourceOffset;
+ if (len === 0)
+ return target; // Nothing to copy
+
+ target.ensureCapacity(targetOffset + len);
+
+ target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
+
+ if (relative) this.offset += len;
+ if (targetRelative) target.offset += len;
+
+ return this;
+ };
+
+ /**
+ * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
+ * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
+ * the required capacity will be used instead.
+ * @param {number} capacity Required capacity
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.ensureCapacity = function(capacity) {
+ var current = this.buffer.byteLength;
+ if (current < capacity)
+ return this.resize((current *= 2) > capacity ? current : capacity);
+ return this;
+ };
+
+ /**
+ * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
+ * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
+ * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
+ * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
+ * written if omitted. defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
+ * @returns {!ByteBuffer} this
+ * @expose
+ * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
+ */
+ ByteBufferPrototype.fill = function(value, begin, end) {
+ var relative = typeof begin === 'undefined';
+ if (relative) begin = this.offset;
+ if (typeof value === 'string' && value.length > 0)
+ value = value.charCodeAt(0);
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof value !== 'number' || value % 1 !== 0)
+ throw TypeError("Illegal value: "+value+" (not an integer)");
+ value |= 0;
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ if (begin >= end)
+ return this; // Nothing to fill
+ while (begin < end) this.view[begin++] = value;
+ if (relative) this.offset = begin;
+ return this;
+ };
+
+ /**
+ * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
+ * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.flip = function() {
+ this.limit = this.offset;
+ this.offset = 0;
+ return this;
+ };
+ /**
+ * Marks an offset on this ByteBuffer to be used later.
+ * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
+ * @returns {!ByteBuffer} this
+ * @throws {TypeError} If `offset` is not a valid number
+ * @throws {RangeError} If `offset` is out of bounds
+ * @see ByteBuffer#reset
+ * @expose
+ */
+ ByteBufferPrototype.mark = function(offset) {
+ offset = typeof offset === 'undefined' ? this.offset : offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ this.markedOffset = offset;
+ return this;
+ };
+ /**
+ * Sets the byte order.
+ * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.order = function(littleEndian) {
+ if (!this.noAssert) {
+ if (typeof littleEndian !== 'boolean')
+ throw TypeError("Illegal littleEndian: Not a boolean");
+ }
+ this.littleEndian = !!littleEndian;
+ return this;
+ };
+
+ /**
+ * Switches (to) little endian byte order.
+ * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.LE = function(littleEndian) {
+ this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
+ return this;
+ };
+
+ /**
+ * Switches (to) big endian byte order.
+ * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.BE = function(bigEndian) {
+ this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
+ return this;
+ };
+ /**
+ * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
+ * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
+ * will be resized and its contents moved accordingly.
+ * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
+ * modified according to the performed read operation.
+ * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
+ * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
+ * prepended if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
+ * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
+ */
+ ByteBufferPrototype.prepend = function(source, encoding, offset) {
+ if (typeof encoding === 'number' || typeof encoding !== 'string') {
+ offset = encoding;
+ encoding = undefined;
+ }
+ var relative = typeof offset === 'undefined';
+ if (relative) offset = this.offset;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: "+offset+" (not an integer)");
+ offset >>>= 0;
+ if (offset < 0 || offset + 0 > this.buffer.byteLength)
+ throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
+ }
+ if (!(source instanceof ByteBuffer))
+ source = ByteBuffer.wrap(source, encoding);
+ var len = source.limit - source.offset;
+ if (len <= 0) return this; // Nothing to prepend
+ var diff = len - offset;
+ if (diff > 0) { // Not enough space before offset, so resize + move
+ var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
+ var view = new Uint8Array(buffer);
+ view.set(this.view.subarray(offset, this.buffer.byteLength), len);
+ this.buffer = buffer;
+ this.view = view;
+ this.offset += diff;
+ if (this.markedOffset >= 0) this.markedOffset += diff;
+ this.limit += diff;
+ offset += diff;
+ } else {
+ var arrayView = new Uint8Array(this.buffer);
+ }
+ this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
+
+ source.offset = source.limit;
+ if (relative)
+ this.offset -= len;
+ return this;
+ };
+
+ /**
+ * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
+ * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
+ * will be resized and its contents moved accordingly.
+ * @param {!ByteBuffer} target Target ByteBuffer
+ * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
+ * prepended if omitted.
+ * @returns {!ByteBuffer} this
+ * @expose
+ * @see ByteBuffer#prepend
+ */
+ ByteBufferPrototype.prependTo = function(target, offset) {
+ target.prepend(this, offset);
+ return this;
+ };
+ /**
+ * Prints debug information about this ByteBuffer's contents.
+ * @param {function(string)=} out Output function to call, defaults to console.log
+ * @expose
+ */
+ ByteBufferPrototype.printDebug = function(out) {
+ if (typeof out !== 'function') out = console.log.bind(console);
+ out(
+ this.toString()+"\n"+
+ "-------------------------------------------------------------------\n"+
+ this.toDebug(/* columns */ true)
+ );
+ };
+
+ /**
+ * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
+ * {@link ByteBuffer#limit}, so this returns `limit - offset`.
+ * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
+ * @expose
+ */
+ ByteBufferPrototype.remaining = function() {
+ return this.limit - this.offset;
+ };
+ /**
+ * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
+ * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
+ * marked, sets `offset = 0`.
+ * @returns {!ByteBuffer} this
+ * @see ByteBuffer#mark
+ * @expose
+ */
+ ByteBufferPrototype.reset = function() {
+ if (this.markedOffset >= 0) {
+ this.offset = this.markedOffset;
+ this.markedOffset = -1;
+ } else {
+ this.offset = 0;
+ }
+ return this;
+ };
+ /**
+ * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
+ * large or larger.
+ * @param {number} capacity Capacity required
+ * @returns {!ByteBuffer} this
+ * @throws {TypeError} If `capacity` is not a number
+ * @throws {RangeError} If `capacity < 0`
+ * @expose
+ */
+ ByteBufferPrototype.resize = function(capacity) {
+ if (!this.noAssert) {
+ if (typeof capacity !== 'number' || capacity % 1 !== 0)
+ throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
+ capacity |= 0;
+ if (capacity < 0)
+ throw RangeError("Illegal capacity: 0 <= "+capacity);
+ }
+ if (this.buffer.byteLength < capacity) {
+ var buffer = new ArrayBuffer(capacity);
+ var view = new Uint8Array(buffer);
+ view.set(this.view);
+ this.buffer = buffer;
+ this.view = view;
+ }
+ return this;
+ };
+ /**
+ * Reverses this ByteBuffer's contents.
+ * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
+ * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.reverse = function(begin, end) {
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ if (begin === end)
+ return this; // Nothing to reverse
+ Array.prototype.reverse.call(this.view.subarray(begin, end));
+ return this;
+ };
+ /**
+ * Skips the next `length` bytes. This will just advance
+ * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
+ * @returns {!ByteBuffer} this
+ * @expose
+ */
+ ByteBufferPrototype.skip = function(length) {
+ if (!this.noAssert) {
+ if (typeof length !== 'number' || length % 1 !== 0)
+ throw TypeError("Illegal length: "+length+" (not an integer)");
+ length |= 0;
+ }
+ var offset = this.offset + length;
+ if (!this.noAssert) {
+ if (offset < 0 || offset > this.buffer.byteLength)
+ throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
+ }
+ this.offset = offset;
+ return this;
+ };
+
+ /**
+ * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
+ * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
+ * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
+ * @expose
+ */
+ ByteBufferPrototype.slice = function(begin, end) {
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ var bb = this.clone();
+ bb.offset = begin;
+ bb.limit = end;
+ return bb;
+ };
+ /**
+ * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
+ * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
+ * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
+ * possible. Defaults to `false`
+ * @returns {!ArrayBuffer} Contents as an ArrayBuffer
+ * @expose
+ */
+ ByteBufferPrototype.toBuffer = function(forceCopy) {
+ var offset = this.offset,
+ limit = this.limit;
+ if (!this.noAssert) {
+ if (typeof offset !== 'number' || offset % 1 !== 0)
+ throw TypeError("Illegal offset: Not an integer");
+ offset >>>= 0;
+ if (typeof limit !== 'number' || limit % 1 !== 0)
+ throw TypeError("Illegal limit: Not an integer");
+ limit >>>= 0;
+ if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
+ }
+ // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
+ // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
+ if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
+ return this.buffer;
+ if (offset === limit)
+ return EMPTY_BUFFER;
+ var buffer = new ArrayBuffer(limit - offset);
+ new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
+ return buffer;
+ };
+
+ /**
+ * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
+ * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
+ * @function
+ * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
+ * Defaults to `false`
+ * @returns {!ArrayBuffer} Contents as an ArrayBuffer
+ * @expose
+ */
+ ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
+
+ /**
+ * Converts the ByteBuffer's contents to a string.
+ * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
+ * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
+ * highlighted offsets.
+ * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
+ * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
+ * @returns {string} String representation
+ * @throws {Error} If `encoding` is invalid
+ * @expose
+ */
+ ByteBufferPrototype.toString = function(encoding, begin, end) {
+ if (typeof encoding === 'undefined')
+ return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
+ if (typeof encoding === 'number')
+ encoding = "utf8",
+ begin = encoding,
+ end = begin;
+ switch (encoding) {
+ case "utf8":
+ return this.toUTF8(begin, end);
+ case "base64":
+ return this.toBase64(begin, end);
+ case "hex":
+ return this.toHex(begin, end);
+ case "binary":
+ return this.toBinary(begin, end);
+ case "debug":
+ return this.toDebug();
+ case "columns":
+ return this.toColumns();
+ default:
+ throw Error("Unsupported encoding: "+encoding);
+ }
+ };
+
+ // lxiv-embeddable
+
+ /**
+ * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/lxiv for details
+ */
+ var lxiv = function() {
+ "use strict";
+
+ /**
+ * lxiv namespace.
+ * @type {!Object.<string,*>}
+ * @exports lxiv
+ */
+ var lxiv = {};
+
+ /**
+ * Character codes for output.
+ * @type {!Array.<number>}
+ * @inner
+ */
+ var aout = [
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
+ 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
+ ];
+
+ /**
+ * Character codes for input.
+ * @type {!Array.<number>}
+ * @inner
+ */
+ var ain = [];
+ for (var i=0, k=aout.length; i<k; ++i)
+ ain[aout[i]] = i;
+
+ /**
+ * Encodes bytes to base64 char codes.
+ * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
+ * there are no more bytes left.
+ * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
+ * code.
+ */
+ lxiv.encode = function(src, dst) {
+ var b, t;
+ while ((b = src()) !== null) {
+ dst(aout[(b>>2)&0x3f]);
+ t = (b&0x3)<<4;
+ if ((b = src()) !== null) {
+ t |= (b>>4)&0xf;
+ dst(aout[(t|((b>>4)&0xf))&0x3f]);
+ t = (b&0xf)<<2;
+ if ((b = src()) !== null)
+ dst(aout[(t|((b>>6)&0x3))&0x3f]),
+ dst(aout[b&0x3f]);
+ else
+ dst(aout[t&0x3f]),
+ dst(61);
+ } else
+ dst(aout[t&0x3f]),
+ dst(61),
+ dst(61);
+ }
+ };
+
+ /**
+ * Decodes base64 char codes to bytes.
+ * @param {!function():number|null} src Characters source as a function returning the next char code respectively
+ * `null` if there are no more characters left.
+ * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
+ * @throws {Error} If a character code is invalid
+ */
+ lxiv.decode = function(src, dst) {
+ var c, t1, t2;
+ function fail(c) {
+ throw Error("Illegal character code: "+c);
+ }
+ while ((c = src()) !== null) {
+ t1 = ain[c];
+ if (typeof t1 === 'undefined') fail(c);
+ if ((c = src()) !== null) {
+ t2 = ain[c];
+ if (typeof t2 === 'undefined') fail(c);
+ dst((t1<<2)>>>0|(t2&0x30)>>4);
+ if ((c = src()) !== null) {
+ t1 = ain[c];
+ if (typeof t1 === 'undefined')
+ if (c === 61) break; else fail(c);
+ dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
+ if ((c = src()) !== null) {
+ t2 = ain[c];
+ if (typeof t2 === 'undefined')
+ if (c === 61) break; else fail(c);
+ dst(((t1&0x3)<<6)>>>0|t2);
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * Tests if a string is valid base64.
+ * @param {string} str String to test
+ * @returns {boolean} `true` if valid, otherwise `false`
+ */
+ lxiv.test = function(str) {
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
+ };
+
+ return lxiv;
+ }();
+
+ // encodings/base64
+
+ /**
+ * Encodes this ByteBuffer's contents to a base64 encoded string.
+ * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
+ * @returns {string} Base64 encoded string
+ * @throws {RangeError} If `begin` or `end` is out of bounds
+ * @expose
+ */
+ ByteBufferPrototype.toBase64 = function(begin, end) {
+ if (typeof begin === 'undefined')
+ begin = this.offset;
+ if (typeof end === 'undefined')
+ end = this.limit;
+ begin = begin | 0; end = end | 0;
+ if (begin < 0 || end > this.capacity || begin > end)
+ throw RangeError("begin, end");
+ var sd; lxiv.encode(function() {
+ return begin < end ? this.view[begin++] : null;
+ }.bind(this), sd = stringDestination());
+ return sd();
+ };
+
+ /**
+ * Decodes a base64 encoded string to a ByteBuffer.
+ * @param {string} str String to decode
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @returns {!ByteBuffer} ByteBuffer
+ * @expose
+ */
+ ByteBuffer.fromBase64 = function(str, littleEndian) {
+ if (typeof str !== 'string')
+ throw TypeError("str");
+ var bb = new ByteBuffer(str.length/4*3, littleEndian),
+ i = 0;
+ lxiv.decode(stringSource(str), function(b) {
+ bb.view[i++] = b;
+ });
+ bb.limit = i;
+ return bb;
+ };
+
+ /**
+ * Encodes a binary string to base64 like `window.btoa` does.
+ * @param {string} str Binary string
+ * @returns {string} Base64 encoded string
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
+ * @expose
+ */
+ ByteBuffer.btoa = function(str) {
+ return ByteBuffer.fromBinary(str).toBase64();
+ };
+
+ /**
+ * Decodes a base64 encoded string to binary like `window.atob` does.
+ * @param {string} b64 Base64 encoded string
+ * @returns {string} Binary string
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
+ * @expose
+ */
+ ByteBuffer.atob = function(b64) {
+ return ByteBuffer.fromBase64(b64).toBinary();
+ };
+
+ // encodings/binary
+
+ /**
+ * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
+ * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
+ * @returns {string} Binary encoded string
+ * @throws {RangeError} If `offset > limit`
+ * @expose
+ */
+ ByteBufferPrototype.toBinary = function(begin, end) {
+ if (typeof begin === 'undefined')
+ begin = this.offset;
+ if (typeof end === 'undefined')
+ end = this.limit;
+ begin |= 0; end |= 0;
+ if (begin < 0 || end > this.capacity() || begin > end)
+ throw RangeError("begin, end");
+ if (begin === end)
+ return "";
+ var chars = [],
+ parts = [];
+ while (begin < end) {
+ chars.push(this.view[begin++]);
+ if (chars.length >= 1024)
+ parts.push(String.fromCharCode.apply(String, chars)),
+ chars = [];
+ }
+ return parts.join('') + String.fromCharCode.apply(String, chars);
+ };
+
+ /**
+ * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
+ * @param {string} str String to decode
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @returns {!ByteBuffer} ByteBuffer
+ * @expose
+ */
+ ByteBuffer.fromBinary = function(str, littleEndian) {
+ if (typeof str !== 'string')
+ throw TypeError("str");
+ var i = 0,
+ k = str.length,
+ charCode,
+ bb = new ByteBuffer(k, littleEndian);
+ while (i<k) {
+ charCode = str.charCodeAt(i);
+ if (charCode > 0xff)
+ throw RangeError("illegal char code: "+charCode);
+ bb.view[i++] = charCode;
+ }
+ bb.limit = k;
+ return bb;
+ };
+
+ // encodings/debug
+
+ /**
+ * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
+ * * `<` : offset,
+ * * `'` : markedOffset,
+ * * `>` : limit,
+ * * `|` : offset and limit,
+ * * `[` : offset and markedOffset,
+ * * `]` : markedOffset and limit,
+ * * `!` : offset, markedOffset and limit
+ * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
+ * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
+ * @expose
+ * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
+ * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
+ * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
+ * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
+ */
+ ByteBufferPrototype.toDebug = function(columns) {
+ var i = -1,
+ k = this.buffer.byteLength,
+ b,
+ hex = "",
+ asc = "",
+ out = "";
+ while (i<k) {
+ if (i !== -1) {
+ b = this.view[i];
+ if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
+ else hex += b.toString(16).toUpperCase();
+ if (columns)
+ asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
+ }
+ ++i;
+ if (columns) {
+ if (i > 0 && i % 16 === 0 && i !== k) {
+ while (hex.length < 3*16+3) hex += " ";
+ out += hex+asc+"\n";
+ hex = asc = "";
+ }
+ }
+ if (i === this.offset && i === this.limit)
+ hex += i === this.markedOffset ? "!" : "|";
+ else if (i === this.offset)
+ hex += i === this.markedOffset ? "[" : "<";
+ else if (i === this.limit)
+ hex += i === this.markedOffset ? "]" : ">";
+ else
+ hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
+ }
+ if (columns && hex !== " ") {
+ while (hex.length < 3*16+3)
+ hex += " ";
+ out += hex + asc + "\n";
+ }
+ return columns ? out : hex;
+ };
+
+ /**
+ * Decodes a hex encoded string with marked offsets to a ByteBuffer.
+ * @param {string} str Debug string to decode (not be generated with `columns = true`)
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer} ByteBuffer
+ * @expose
+ * @see ByteBuffer#toDebug
+ */
+ ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
+ var k = str.length,
+ bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
+ var i = 0, j = 0, ch, b,
+ rs = false, // Require symbol next
+ ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
+ fail = false;
+ while (i<k) {
+ switch (ch = str.charAt(i++)) {
+ case '!':
+ if (!noAssert) {
+ if (ho || hm || hl) {
+ fail = true;
+ break;
+ }
+ ho = hm = hl = true;
+ }
+ bb.offset = bb.markedOffset = bb.limit = j;
+ rs = false;
+ break;
+ case '|':
+ if (!noAssert) {
+ if (ho || hl) {
+ fail = true;
+ break;
+ }
+ ho = hl = true;
+ }
+ bb.offset = bb.limit = j;
+ rs = false;
+ break;
+ case '[':
+ if (!noAssert) {
+ if (ho || hm) {
+ fail = true;
+ break;
+ }
+ ho = hm = true;
+ }
+ bb.offset = bb.markedOffset = j;
+ rs = false;
+ break;
+ case '<':
+ if (!noAssert) {
+ if (ho) {
+ fail = true;
+ break;
+ }
+ ho = true;
+ }
+ bb.offset = j;
+ rs = false;
+ break;
+ case ']':
+ if (!noAssert) {
+ if (hl || hm) {
+ fail = true;
+ break;
+ }
+ hl = hm = true;
+ }
+ bb.limit = bb.markedOffset = j;
+ rs = false;
+ break;
+ case '>':
+ if (!noAssert) {
+ if (hl) {
+ fail = true;
+ break;
+ }
+ hl = true;
+ }
+ bb.limit = j;
+ rs = false;
+ break;
+ case "'":
+ if (!noAssert) {
+ if (hm) {
+ fail = true;
+ break;
+ }
+ hm = true;
+ }
+ bb.markedOffset = j;
+ rs = false;
+ break;
+ case ' ':
+ rs = false;
+ break;
+ default:
+ if (!noAssert) {
+ if (rs) {
+ fail = true;
+ break;
+ }
+ }
+ b = parseInt(ch+str.charAt(i++), 16);
+ if (!noAssert) {
+ if (isNaN(b) || b < 0 || b > 255)
+ throw TypeError("Illegal str: Not a debug encoded string");
+ }
+ bb.view[j++] = b;
+ rs = true;
+ }
+ if (fail)
+ throw TypeError("Illegal str: Invalid symbol at "+i);
+ }
+ if (!noAssert) {
+ if (!ho || !hl)
+ throw TypeError("Illegal str: Missing offset or limit");
+ if (j<bb.buffer.byteLength)
+ throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
+ }
+ return bb;
+ };
+
+ // encodings/hex
+
+ /**
+ * Encodes this ByteBuffer's contents to a hex encoded string.
+ * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
+ * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
+ * @returns {string} Hex encoded string
+ * @expose
+ */
+ ByteBufferPrototype.toHex = function(begin, end) {
+ begin = typeof begin === 'undefined' ? this.offset : begin;
+ end = typeof end === 'undefined' ? this.limit : end;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ var out = new Array(end - begin),
+ b;
+ while (begin < end) {
+ b = this.view[begin++];
+ if (b < 0x10)
+ out.push("0", b.toString(16));
+ else out.push(b.toString(16));
+ }
+ return out.join('');
+ };
+
+ /**
+ * Decodes a hex encoded string to a ByteBuffer.
+ * @param {string} str String to decode
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer} ByteBuffer
+ * @expose
+ */
+ ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
+ if (!noAssert) {
+ if (typeof str !== 'string')
+ throw TypeError("Illegal str: Not a string");
+ if (str.length % 2 !== 0)
+ throw TypeError("Illegal str: Length not a multiple of 2");
+ }
+ var k = str.length,
+ bb = new ByteBuffer((k / 2) | 0, littleEndian),
+ b;
+ for (var i=0, j=0; i<k; i+=2) {
+ b = parseInt(str.substring(i, i+2), 16);
+ if (!noAssert)
+ if (!isFinite(b) || b < 0 || b > 255)
+ throw TypeError("Illegal str: Contains non-hex characters");
+ bb.view[j++] = b;
+ }
+ bb.limit = j;
+ return bb;
+ };
+
+ // utfx-embeddable
+
+ /**
+ * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/utfx for details
+ */
+ var utfx = function() {
+ "use strict";
+
+ /**
+ * utfx namespace.
+ * @inner
+ * @type {!Object.<string,*>}
+ */
+ var utfx = {};
+
+ /**
+ * Maximum valid code point.
+ * @type {number}
+ * @const
+ */
+ utfx.MAX_CODEPOINT = 0x10FFFF;
+
+ /**
+ * Encodes UTF8 code points to UTF8 bytes.
+ * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
+ * respectively `null` if there are no more code points left or a single numeric code point.
+ * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
+ */
+ utfx.encodeUTF8 = function(src, dst) {
+ var cp = null;
+ if (typeof src === 'number')
+ cp = src,
+ src = function() { return null; };
+ while (cp !== null || (cp = src()) !== null) {
+ if (cp < 0x80)
+ dst(cp&0x7F);
+ else if (cp < 0x800)
+ dst(((cp>>6)&0x1F)|0xC0),
+ dst((cp&0x3F)|0x80);
+ else if (cp < 0x10000)
+ dst(((cp>>12)&0x0F)|0xE0),
+ dst(((cp>>6)&0x3F)|0x80),
+ dst((cp&0x3F)|0x80);
+ else
+ dst(((cp>>18)&0x07)|0xF0),
+ dst(((cp>>12)&0x3F)|0x80),
+ dst(((cp>>6)&0x3F)|0x80),
+ dst((cp&0x3F)|0x80);
+ cp = null;
+ }
+ };
+
+ /**
+ * Decodes UTF8 bytes to UTF8 code points.
+ * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
+ * are no more bytes left.
+ * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
+ * @throws {RangeError} If a starting byte is invalid in UTF8
+ * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
+ * remaining bytes.
+ */
+ utfx.decodeUTF8 = function(src, dst) {
+ var a, b, c, d, fail = function(b) {
+ b = b.slice(0, b.indexOf(null));
+ var err = Error(b.toString());
+ err.name = "TruncatedError";
+ err['bytes'] = b;
+ throw err;
+ };
+ while ((a = src()) !== null) {
+ if ((a&0x80) === 0)
+ dst(a);
+ else if ((a&0xE0) === 0xC0)
+ ((b = src()) === null) && fail([a, b]),
+ dst(((a&0x1F)<<6) | (b&0x3F));
+ else if ((a&0xF0) === 0xE0)
+ ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
+ dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
+ else if ((a&0xF8) === 0xF0)
+ ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
+ dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
+ else throw RangeError("Illegal starting byte: "+a);
+ }
+ };
+
+ /**
+ * Converts UTF16 characters to UTF8 code points.
+ * @param {!function():number|null} src Characters source as a function returning the next char code respectively
+ * `null` if there are no more characters left.
+ * @param {!function(number)} dst Code points destination as a function successively called with each converted code
+ * point.
+ */
+ utfx.UTF16toUTF8 = function(src, dst) {
+ var c1, c2 = null;
+ while (true) {
+ if ((c1 = c2 !== null ? c2 : src()) === null)
+ break;
+ if (c1 >= 0xD800 && c1 <= 0xDFFF) {
+ if ((c2 = src()) !== null) {
+ if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
+ dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
+ c2 = null; continue;
+ }
+ }
+ }
+ dst(c1);
+ }
+ if (c2 !== null) dst(c2);
+ };
+
+ /**
+ * Converts UTF8 code points to UTF16 characters.
+ * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
+ * respectively `null` if there are no more code points left or a single numeric code point.
+ * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
+ * @throws {RangeError} If a code point is out of range
+ */
+ utfx.UTF8toUTF16 = function(src, dst) {
+ var cp = null;
+ if (typeof src === 'number')
+ cp = src, src = function() { return null; };
+ while (cp !== null || (cp = src()) !== null) {
+ if (cp <= 0xFFFF)
+ dst(cp);
+ else
+ cp -= 0x10000,
+ dst((cp>>10)+0xD800),
+ dst((cp%0x400)+0xDC00);
+ cp = null;
+ }
+ };
+
+ /**
+ * Converts and encodes UTF16 characters to UTF8 bytes.
+ * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
+ * if there are no more characters left.
+ * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
+ */
+ utfx.encodeUTF16toUTF8 = function(src, dst) {
+ utfx.UTF16toUTF8(src, function(cp) {
+ utfx.encodeUTF8(cp, dst);
+ });
+ };
+
+ /**
+ * Decodes and converts UTF8 bytes to UTF16 characters.
+ * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
+ * are no more bytes left.
+ * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
+ * @throws {RangeError} If a starting byte is invalid in UTF8
+ * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
+ */
+ utfx.decodeUTF8toUTF16 = function(src, dst) {
+ utfx.decodeUTF8(src, function(cp) {
+ utfx.UTF8toUTF16(cp, dst);
+ });
+ };
+
+ /**
+ * Calculates the byte length of an UTF8 code point.
+ * @param {number} cp UTF8 code point
+ * @returns {number} Byte length
+ */
+ utfx.calculateCodePoint = function(cp) {
+ return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
+ };
+
+ /**
+ * Calculates the number of UTF8 bytes required to store UTF8 code points.
+ * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
+ * `null` if there are no more code points left.
+ * @returns {number} The number of UTF8 bytes required
+ */
+ utfx.calculateUTF8 = function(src) {
+ var cp, l=0;
+ while ((cp = src()) !== null)
+ l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
+ return l;
+ };
+
+ /**
+ * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
+ * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
+ * `null` if there are no more characters left.
+ * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
+ */
+ utfx.calculateUTF16asUTF8 = function(src) {
+ var n=0, l=0;
+ utfx.UTF16toUTF8(src, function(cp) {
+ ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
+ });
+ return [n,l];
+ };
+
+ return utfx;
+ }();
+
+ // encodings/utf8
+
+ /**
+ * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
+ * string.
+ * @returns {string} Hex encoded string
+ * @throws {RangeError} If `offset > limit`
+ * @expose
+ */
+ ByteBufferPrototype.toUTF8 = function(begin, end) {
+ if (typeof begin === 'undefined') begin = this.offset;
+ if (typeof end === 'undefined') end = this.limit;
+ if (!this.noAssert) {
+ if (typeof begin !== 'number' || begin % 1 !== 0)
+ throw TypeError("Illegal begin: Not an integer");
+ begin >>>= 0;
+ if (typeof end !== 'number' || end % 1 !== 0)
+ throw TypeError("Illegal end: Not an integer");
+ end >>>= 0;
+ if (begin < 0 || begin > end || end > this.buffer.byteLength)
+ throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
+ }
+ var sd; try {
+ utfx.decodeUTF8toUTF16(function() {
+ return begin < end ? this.view[begin++] : null;
+ }.bind(this), sd = stringDestination());
+ } catch (e) {
+ if (begin !== end)
+ throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
+ }
+ return sd();
+ };
+
+ /**
+ * Decodes an UTF8 encoded string to a ByteBuffer.
+ * @param {string} str String to decode
+ * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
+ * {@link ByteBuffer.DEFAULT_ENDIAN}.
+ * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
+ * {@link ByteBuffer.DEFAULT_NOASSERT}.
+ * @returns {!ByteBuffer} ByteBuffer
+ * @expose
+ */
+ ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
+ if (!noAssert)
+ if (typeof str !== 'string')
+ throw TypeError("Illegal str: Not a string");
+ var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
+ i = 0;
+ utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
+ bb.view[i++] = b;
+ });
+ bb.limit = i;
+ return bb;
+ };
+
+ return ByteBuffer;
+ });
+
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
+
+/***/ },
+/* 33 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {/*
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>
+ Copyright 2009 The Closure Library Authors. All Rights Reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS-IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+ /**
+ * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ * Released under the Apache License, Version 2.0
+ * see: https://github.com/dcodeIO/long.js for details
+ */
+ (function(global, factory) {
+
+ /* AMD */ if ("function" === 'function' && __webpack_require__(31)["amd"])
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ /* CommonJS */ else if ("function" === 'function' && typeof module === "object" && module && module["exports"])
+ module["exports"] = factory();
+ /* Global */ else
+ (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
+
+ })(this, function() {
+ "use strict";
+
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ * See the from* functions below for more convenient ways of constructing Longs.
+ * @exports Long
+ * @class A Long class for representing a 64 bit two's-complement integer value.
+ * @param {number} low The low (signed) 32 bits of the long
+ * @param {number} high The high (signed) 32 bits of the long
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
+ * @constructor
+ */
+ function Long(low, high, unsigned) {
+
+ /**
+ * The low 32 bits as a signed value.
+ * @type {number}
+ */
+ this.low = low | 0;
+
+ /**
+ * The high 32 bits as a signed value.
+ * @type {number}
+ */
+ this.high = high | 0;
+
+ /**
+ * Whether unsigned or not.
+ * @type {boolean}
+ */
+ this.unsigned = !!unsigned;
+ }
+
+ // The internal representation of a long is the two given signed, 32-bit values.
+ // We use 32-bit pieces because these are the size of integers on which
+ // Javascript performs bit-operations. For operations like addition and
+ // multiplication, we split each number into 16 bit pieces, which can easily be
+ // multiplied within Javascript's floating-point representation without overflow
+ // or change in sign.
+ //
+ // In the algorithms below, we frequently reduce the negative case to the
+ // positive case by negating the input(s) and then post-processing the result.
+ // Note that we must ALWAYS check specially whether those values are MIN_VALUE
+ // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+ // a positive number, it overflows back into a negative). Not handling this
+ // case would often result in infinite recursion.
+ //
+ // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
+ // methods on which they depend.
+
+ /**
+ * An indicator used to reliably determine if an object is a Long or not.
+ * @type {boolean}
+ * @const
+ * @private
+ */
+ Long.prototype.__isLong__;
+
+ Object.defineProperty(Long.prototype, "__isLong__", {
+ value: true,
+ enumerable: false,
+ configurable: false
+ });
+
+ /**
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ * @inner
+ */
+ function isLong(obj) {
+ return (obj && obj["__isLong__"]) === true;
+ }
+
+ /**
+ * Tests if the specified object is a Long.
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ */
+ Long.isLong = isLong;
+
+ /**
+ * A cache of the Long representations of small integer values.
+ * @type {!Object}
+ * @inner
+ */
+ var INT_CACHE = {};
+
+ /**
+ * A cache of the Long representations of small unsigned integer values.
+ * @type {!Object}
+ * @inner
+ */
+ var UINT_CACHE = {};
+
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromInt(value, unsigned) {
+ var obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if (cache = (0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+ if (cache = (-128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ * @function
+ * @param {number} value The 32 bit integer in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromInt = fromInt;
+
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromNumber(value, unsigned) {
+ if (isNaN(value) || !isFinite(value))
+ return unsigned ? UZERO : ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL)
+ return MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return MAX_VALUE;
+ }
+ if (value < 0)
+ return fromNumber(-value, unsigned).neg();
+ return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @function
+ * @param {number} value The number in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromNumber = fromNumber;
+
+ /**
+ * @param {number} lowBits
+ * @param {number} highBits
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
+ * assumed to use 32 bits.
+ * @function
+ * @param {number} lowBits The low 32 bits
+ * @param {number} highBits The high 32 bits
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromBits = fromBits;
+
+ /**
+ * @function
+ * @param {number} base
+ * @param {number} exponent
+ * @returns {number}
+ * @inner
+ */
+ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
+
+ /**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @returns {!Long}
+ * @inner
+ */
+ function fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw Error('empty string');
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
+ return ZERO;
+ if (typeof unsigned === 'number') {
+ // For goog.math.long compatibility
+ radix = unsigned,
+ unsigned = false;
+ } else {
+ unsigned = !! unsigned;
+ }
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw RangeError('radix');
+
+ var p;
+ if ((p = str.indexOf('-')) > 0)
+ throw Error('interior hyphen');
+ else if (p === 0) {
+ return fromString(str.substring(1), unsigned, radix).neg();
+ }
+
+ // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
+
+ var result = ZERO;
+ for (var i = 0; i < str.length; i += 8) {
+ var size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ var power = fromNumber(pow_dbl(radix, size));
+ result = result.mul(power).add(fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * @function
+ * @param {string} str The textual representation of the Long
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromString = fromString;
+
+ /**
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
+ * @returns {!Long}
+ * @inner
+ */
+ function fromValue(val) {
+ if (val /* is compatible */ instanceof Long)
+ return val;
+ if (typeof val === 'number')
+ return fromNumber(val);
+ if (typeof val === 'string')
+ return fromString(val);
+ // Throws for non-objects, converts non-instanceof Long:
+ return fromBits(val.low, val.high, val.unsigned);
+ }
+
+ /**
+ * Converts the specified value to a Long.
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
+ * @returns {!Long}
+ */
+ Long.fromValue = fromValue;
+
+ // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
+ // no runtime penalty for these.
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_16_DBL = 1 << 16;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_24_DBL = 1 << 24;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+
+ /**
+ * @type {!Long}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var ZERO = fromInt(0);
+
+ /**
+ * Signed zero.
+ * @type {!Long}
+ */
+ Long.ZERO = ZERO;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var UZERO = fromInt(0, true);
+
+ /**
+ * Unsigned zero.
+ * @type {!Long}
+ */
+ Long.UZERO = UZERO;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var ONE = fromInt(1);
+
+ /**
+ * Signed one.
+ * @type {!Long}
+ */
+ Long.ONE = ONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var UONE = fromInt(1, true);
+
+ /**
+ * Unsigned one.
+ * @type {!Long}
+ */
+ Long.UONE = UONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var NEG_ONE = fromInt(-1);
+
+ /**
+ * Signed negative one.
+ * @type {!Long}
+ */
+ Long.NEG_ONE = NEG_ONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
+
+ /**
+ * Maximum signed value.
+ * @type {!Long}
+ */
+ Long.MAX_VALUE = MAX_VALUE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
+
+ /**
+ * Maximum unsigned value.
+ * @type {!Long}
+ */
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MIN_VALUE = fromBits(0, 0x80000000|0, false);
+
+ /**
+ * Minimum signed value.
+ * @type {!Long}
+ */
+ Long.MIN_VALUE = MIN_VALUE;
+
+ /**
+ * @alias Long.prototype
+ * @inner
+ */
+ var LongPrototype = Long.prototype;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ * @returns {number}
+ */
+ LongPrototype.toInt = function toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ };
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ * @returns {number}
+ */
+ LongPrototype.toNumber = function toNumber() {
+ if (this.unsigned)
+ return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ };
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ * @param {number=} radix Radix (2-36), defaults to 10
+ * @returns {string}
+ * @override
+ * @throws {RangeError} If `radix` is out of range
+ */
+ LongPrototype.toString = function toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw RangeError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) { // Unsigned Longs are never negative
+ if (this.eq(MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ var radixLong = fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else
+ return '-' + this.neg().toString(radix);
+ }
+
+ // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
+ rem = this;
+ var result = '';
+ while (true) {
+ var remDiv = rem.div(radixToPower),
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
+ digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero())
+ return digits + result;
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ };
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ * @returns {number} Signed high bits
+ */
+ LongPrototype.getHighBits = function getHighBits() {
+ return this.high;
+ };
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ * @returns {number} Unsigned high bits
+ */
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
+ return this.high >>> 0;
+ };
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ * @returns {number} Signed low bits
+ */
+ LongPrototype.getLowBits = function getLowBits() {
+ return this.low;
+ };
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ * @returns {number} Unsigned low bits
+ */
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
+ return this.low >>> 0;
+ };
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ * @returns {number}
+ */
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
+ if (this.isNegative()) // Unsigned Longs are never negative
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ var val = this.high != 0 ? this.high : this.low;
+ for (var bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) != 0)
+ break;
+ return this.high != 0 ? bit + 33 : bit + 1;
+ };
+
+ /**
+ * Tests if this Long's value equals zero.
+ * @returns {boolean}
+ */
+ LongPrototype.isZero = function isZero() {
+ return this.high === 0 && this.low === 0;
+ };
+
+ /**
+ * Tests if this Long's value is negative.
+ * @returns {boolean}
+ */
+ LongPrototype.isNegative = function isNegative() {
+ return !this.unsigned && this.high < 0;
+ };
+
+ /**
+ * Tests if this Long's value is positive.
+ * @returns {boolean}
+ */
+ LongPrototype.isPositive = function isPositive() {
+ return this.unsigned || this.high >= 0;
+ };
+
+ /**
+ * Tests if this Long's value is odd.
+ * @returns {boolean}
+ */
+ LongPrototype.isOdd = function isOdd() {
+ return (this.low & 1) === 1;
+ };
+
+ /**
+ * Tests if this Long's value is even.
+ * @returns {boolean}
+ */
+ LongPrototype.isEven = function isEven() {
+ return (this.low & 1) === 0;
+ };
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.equals = function equals(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ };
+
+ /**
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.eq = LongPrototype.equals;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.notEquals = function notEquals(other) {
+ return !this.eq(/* validates */ other);
+ };
+
+ /**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.neq = LongPrototype.notEquals;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lessThan = function lessThan(other) {
+ return this.comp(/* validates */ other) < 0;
+ };
+
+ /**
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lt = LongPrototype.lessThan;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
+ return this.comp(/* validates */ other) <= 0;
+ };
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.greaterThan = function greaterThan(other) {
+ return this.comp(/* validates */ other) > 0;
+ };
+
+ /**
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.gt = LongPrototype.greaterThan;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
+ return this.comp(/* validates */ other) >= 0;
+ };
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
+
+ /**
+ * Compares this Long's value with the specified's.
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+ LongPrototype.compare = function compare(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ if (this.eq(other))
+ return 0;
+ var thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ // At this point the sign bits are the same
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ // Both are positive if at least one is unsigned
+ return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
+ };
+
+ /**
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
+ * @function
+ * @param {!Long|number|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+ LongPrototype.comp = LongPrototype.compare;
+
+ /**
+ * Negates this Long's value.
+ * @returns {!Long} Negated Long
+ */
+ LongPrototype.negate = function negate() {
+ if (!this.unsigned && this.eq(MIN_VALUE))
+ return MIN_VALUE;
+ return this.not().add(ONE);
+ };
+
+ /**
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
+ * @function
+ * @returns {!Long} Negated Long
+ */
+ LongPrototype.neg = LongPrototype.negate;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ * @param {!Long|number|string} addend Addend
+ * @returns {!Long} Sum
+ */
+ LongPrototype.add = function add(addend) {
+ if (!isLong(addend))
+ addend = fromValue(addend);
+
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+
+ var b48 = addend.high >>> 16;
+ var b32 = addend.high & 0xFFFF;
+ var b16 = addend.low >>> 16;
+ var b00 = addend.low & 0xFFFF;
+
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 + b48;
+ c48 &= 0xFFFF;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ };
+
+ /**
+ * Returns the difference of this and the specified Long.
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+ LongPrototype.subtract = function subtract(subtrahend) {
+ if (!isLong(subtrahend))
+ subtrahend = fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ };
+
+ /**
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
+ * @function
+ * @param {!Long|number|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+ LongPrototype.sub = LongPrototype.subtract;
+
+ /**
+ * Returns the product of this and the specified Long.
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+ LongPrototype.multiply = function multiply(multiplier) {
+ if (this.isZero())
+ return ZERO;
+ if (!isLong(multiplier))
+ multiplier = fromValue(multiplier);
+ if (multiplier.isZero())
+ return ZERO;
+ if (this.eq(MIN_VALUE))
+ return multiplier.isOdd() ? MIN_VALUE : ZERO;
+ if (multiplier.eq(MIN_VALUE))
+ return this.isOdd() ? MIN_VALUE : ZERO;
+
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+
+ // If both longs are small, use float multiplication
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
+ return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xFFFF;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xFFFF;
+
+ var b48 = multiplier.high >>> 16;
+ var b32 = multiplier.high & 0xFFFF;
+ var b16 = multiplier.low >>> 16;
+ var b00 = multiplier.low & 0xFFFF;
+
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xFFFF;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xFFFF;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xFFFF;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xFFFF;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ };
+
+ /**
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
+ * @function
+ * @param {!Long|number|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+ LongPrototype.mul = LongPrototype.multiply;
+
+ /**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
+ * unsigned if this Long is unsigned.
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+ LongPrototype.divide = function divide(divisor) {
+ if (!isLong(divisor))
+ divisor = fromValue(divisor);
+ if (divisor.isZero())
+ throw Error('division by zero');
+ if (this.isZero())
+ return this.unsigned ? UZERO : ZERO;
+ var approx, rem, res;
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(MIN_VALUE)) {
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
+ return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(MIN_VALUE))
+ return ONE;
+ else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ var halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(ZERO)) {
+ return divisor.isNegative() ? ONE : NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(MIN_VALUE))
+ return this.unsigned ? UZERO : ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return UZERO;
+ if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return UONE;
+ res = UZERO;
+ }
+
+ // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+ rem = this;
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+
+ // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
+ delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
+
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ approxRes = fromNumber(approx),
+ approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+
+ // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+ if (approxRes.isZero())
+ approxRes = ONE;
+
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ };
+
+ /**
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+ LongPrototype.div = LongPrototype.divide;
+
+ /**
+ * Returns this Long modulo the specified.
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+ LongPrototype.modulo = function modulo(divisor) {
+ if (!isLong(divisor))
+ divisor = fromValue(divisor);
+ return this.sub(this.div(divisor).mul(divisor));
+ };
+
+ /**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+ LongPrototype.mod = LongPrototype.modulo;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ * @returns {!Long}
+ */
+ LongPrototype.not = function not() {
+ return fromBits(~this.low, ~this.high, this.unsigned);
+ };
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.and = function and(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ };
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.or = function or(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ };
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ * @param {!Long|number|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.xor = function xor(other) {
+ if (!isLong(other))
+ other = fromValue(other);
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ };
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
+ if (isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return fromBits(0, this.low << (numBits - 32), this.unsigned);
+ };
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shl = LongPrototype.shiftLeft;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftRight = function shiftRight(numBits) {
+ if (isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ };
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shr = LongPrototype.shiftRight;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
+ if (isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ var high = this.high;
+ if (numBits < 32) {
+ var low = this.low;
+ return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ } else if (numBits === 32)
+ return fromBits(high, 0, this.unsigned);
+ else
+ return fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ };
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
+
+ /**
+ * Converts this Long to signed.
+ * @returns {!Long} Signed long
+ */
+ LongPrototype.toSigned = function toSigned() {
+ if (!this.unsigned)
+ return this;
+ return fromBits(this.low, this.high, false);
+ };
+
+ /**
+ * Converts this Long to unsigned.
+ * @returns {!Long} Unsigned long
+ */
+ LongPrototype.toUnsigned = function toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return fromBits(this.low, this.high, true);
+ };
+
+ /**
+ * Converts this Long to its byte representation.
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @returns {!Array.<number>} Byte representation
+ */
+ LongPrototype.toBytes = function(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ * @returns {!Array.<number>} Little endian byte representation
+ */
+ LongPrototype.toBytesLE = function() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ (lo >>> 24) & 0xff,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ (hi >>> 24) & 0xff
+ ];
+ }
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ * @returns {!Array.<number>} Big endian byte representation
+ */
+ LongPrototype.toBytesBE = function() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ (hi >>> 24) & 0xff,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ (lo >>> 24) & 0xff,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+
+ return Long;
+ });
+
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
+
+/***/ },
+/* 34 */
+/***/ function(module, exports) {
+
+ /* (ignored) */
+
+/***/ },
+/* 35 */
+/***/ function(module, exports) {
+
+ /* (ignored) */
+
+/***/ },
+/* 36 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ var _default = "\n//start\n// pdu_def.proto\n\n// syntax = \"proto3\";\n\noption optimize_for = LITE_RUNTIME;\nenum RCPduPriority_E {\n DP_TOP = 0;\n DP_HIGH = 1;\n DP_MEDIUM = 2;\n DP_LOW = 3;\n}\n\nenum RCPduSegment_E {\n SEG_BEGIN = 0;\n SEG_END = 1;\n SEG_ONCE = 2;\n}\n\nenum RCPduTokenStatus_E {\n TS_NOT_IN_USE = 0;\n TS_SELF_GRABBED = 1;\n TS_OTHER_GRABBED = 2;\n TS_SELF_INHIBITED = 3;\n TS_OTHER_INHIBITED = 4;\n TS_SELF_RECIPIENT = 5;\n TS_SELF_GIVING = 6;\n TS_OTHER_GIVING = 7;\n}\n\nenum RCPduType_E {\n// GCC PDU\n RCPDU_CONNECT_PROVIDER_REQUEST = 0;\n RCPDU_CONNECT_PROVIDER_RESPONSE = 1;\n RCPDU_CONFERENCE_JOIN_REQUEST = 2;\n RCPDU_CONFERENCE_JOIN_RESPONSE = 3;\n RCPDU_CONFERENCE_INVITE_REQUEST = 10;\n RCPDU_CONFERENCE_INVITE_RESPONSE = 11;\n RCPDU_CONFERENCE_LOCK_REQUEST = 20;\n RCPDU_CONFERENCE_LOCK_RESPONSE = 21;\n RCPDU_CONFERENCE_LOCK_INDICATION = 22;\n RCPDU_CONFERENCE_UNLOCK_REQUEST = 30;\n RCPDU_CONFERENCE_UNLOCK_RESPONSE = 31;\n RCPDU_CONFERENCE_UNLOCK_INDICATION = 32;\n RCPDU_CONFERENCE_LEAVE_REQUEST = 39;\n RCPDU_CONFERENCE_TERMINATE_REQUEST = 40;\n RCPDU_CONFERENCE_TERMINATE_RESPONSE = 41;\n RCPDU_CONFERENCE_TERMINATE_INDICATION = 42;\n RCPDU_CONFERENCE_EJECT_USER_REQUEST = 50;\n RCPDU_CONFERENCE_EJECT_USER_RESPONSE = 51;\n RCPDU_CONFERENCE_EJECT_USER_INDICATION = 52;\n RCPDU_ROSTER_UPDATE_INDICATION = 60;\n RCPDU_REGISTRY_UPDATE_REQUEST = 70; // INCLUDE ALL OBJS OPERATION\n RCPDU_REGISTRY_UPDATE_RESPONSE = 71;\n RCPDU_REGISTRY_UPDATE_INDICATION = 72;\n RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE = 80;\n\n // MCS PDU\n RCPDU_SESSION_JOIN_REQUEST = 90;\n RCPDU_SESSION_JOIN_RESPONSE = 91;\n RCPDU_CHANNEL_GRAB_REQUEST = 100;\n RCPDU_CHANNEL_GRAB_RESPONSE = 101;\n RCPDU_CHANNEL_GRAB_INDICATION = 102;\n RCPDU_CHANNEL_JOIN_REQUEST = 103;\n RCPDU_CHANNEL_JOIN_RESPONSE = 104;\n RCPDU_CHANNEL_LEAVE_REQUEST = 105;\n RCPDU_CHANNEL_RELEASE_REQUEST = 106;\n RCPDU_CHANNEL_RELEASE_INDICATION = 107;\n RCPDU_SEND_DATA_REQUEST = 120;\n RCPDU_SEND_DATA_INDICATION = 121;\n RCPDU_UNIFORM_SEND_DATA_REQUEST = 125;\n RCPDU_UNIFORM_SEND_DATA_INDICATION = 126;\n RCPDU_TOKEN_GRAB_REQUEST = 130;\n RCPDU_TOKEN_GRAB_CONFIRM = 131;\n RCPDU_TOKEN_INHIBIT_REQUEST = 132;\n RCPDU_TOKEN_INHIBIT_CONFIRM = 133;\n RCPDU_TOKEN_GIVE_REQUEST = 134;\n RCPDU_TOKEN_GIVE_INDICATION = 135;\n RCPDU_TOKEN_GIVE_RESPONSE = 136;\n RCPDU_TOKEN_GIVE_CONFIRM = 137;\n RCPDU_TOKEN_PLEASE_REQUEST = 138;\n RCPDU_TOKEN_PLEASE_INDICATION = 139;\n RCPDU_TOKEN_RELEASE_REQUEST = 140;\n RCPDU_TOKEN_RELEASE_CONFIRM = 141;\n RCPDU_TOKEN_TEST_REQUEST = 142;\n RCPDU_TOKEN_TEST_CONFIRM = 143;\n\n // Registry PDU\n RCPDU_REG_REGISTER_KEY = 200;\n RCPDU_REG_UNREGISTER_KEY = 201;\n RCPDU_REG_REGISTER_ROSTER = 202;\n RCPDU_REG_REGISTER_TOKEN = 203;\n RCPDU_REG_REGISTER_PARAMETER = 204;\n RCPDU_REG_REGISTER_COUNTER = 205;\n RCPDU_REG_REGISTER_TABLE = 206;\n RCPDU_REG_REGISTER_CACHE = 207;\n RCPDU_REG_REGISTER_OBJ = 208;\n RCPDU_REG_UNREGISTER_OBJ = 209;\n RCPDU_REG_UPDATE_OBJ = 210;\n RCPDU_REG_ADAPTER = 211;\n RCPDU_REG_CLEANUP_NODE = 212;\n RCPDU_REG_REGISTER_QUEUE = 213;\n\n // Registry Obj update PDU\n RCPDU_REG_TABLE_INSERT_PDU = 230;\n RCPDU_REG_TABLE_DELETE_PDU = 231;\n RCPDU_REG_TABLE_UPDATE_PDU = 232;\n RCPDU_REG_ROSTER_INSERT_PDU = 240;\n RCPDU_REG_ROSTER_DELETE_PDU = 241;\n RCPDU_REG_ROSTER_UPDATE_PDU = 242;\n RCPDU_REG_PARAMETER_UPDATE_PDU = 250;\n RCPDU_REG_QUEUE_INSERT_PDU = 255;\n RCPDU_REG_QUEUE_DELETE_PDU = 256;\n RCPDU_REG_QUEUE_UPDATE_PDU = 257;\n\n // data\n RCPDU_CONFERENCE_SEND_DATA_REQUEST = 259;\n RCPDU_VIDEO_SEND_DATA_REQUEST = 260;\n RCPDU_AUDIO_SEND_DATA_REQUEST = 261;\n RCPDU_GIFT_SEND_DATA_REQUEST = 262;\n RCPDU_CHAT_SEND_DATA_REQUEST = 263;\n RCPDU_VOTING_POLL_RECORD = 265;\n\n // Registry resource request or response PDU\n RCPDU_REG_REQUEST_OBJ = 290;\n RCPDU_REG_RESPONSE_OBJ = 291;\n RCPDU_REG_COUNTER_REQUEST_PDU = 292;\n RCPDU_REG_COUNTER_RESPONSE_PDU = 293;\n\n // Index exchange\n RCPDU_INDEX_ADAPTER = 300;\n RCPDU_INDEX_SERVER_USERS = 301;\n RCPDU_INDEX_CONFERENCE_USER_JOINED = 302;\n RCPDU_INDEX_CONFERENCE_USER_EXITED = 303;\n RCPDU_INDEX_CONFERENCE_USERS = 304;\n}\n\nenum RCPduNodeType_E {\n NT_TERMINAL = 0;\n NT_MULTIPORT_TERMINAL = 1;\n NT_MCU = 2;\n}\n\nenum RCPduReason_E {\n RSN_USERINITIATED = 0;\n RSN_DISCONNECTED = 1;\n RSN_SUPER_LEFT = 2;\n}\n\nenum RCPduResult_E {\n RET_SUCCESS = 0;\n RET_USER_REJECTED = 1;\n RET_INVALID_CONFERENCE = 2;\n RET_INVALID_PASSWORD = 3;\n RET_INVALID_CONVENER_PASSWORD = 4;\n RET_CHALLENGE_RESPONSE_REQUIRED = 5;\n RET_INVALID_CHALLENGE_RESPONSE = 6;\n RET_NO_CONNECTION = 7;\n RET_FULL_CAPACITY = 8;\n}\n\nenum RCPduNodeCategory_E {\n NC_CONVENTIONAL = 0;\n NC_COUNTED = 1;\n NC_ANONYMOUS = 2;\n}\n\nmessage RCConferenceDescriptorPdu {\n required uint32 id = 1;\n required bytes name = 2;\n optional bytes description = 3;\n //optional string net_address = 4;\n optional uint32 mode = 4;\n optional string password = 5;\n optional uint32 capacity = 6;\n optional bytes user_data = 7;\n}\n\nmessage RCNodeRecordPdu {\n required uint32 id = 1;\n optional uint32 superior_node = 2;\n required RCPduNodeType_E type = 3;\n required string name = 4;\n required uint32 capability = 5;\n optional string net_address = 6;\n optional RCPduNodeCategory_E category = 7;\n}\n\nmessage RCApplicationRecordPdu {\n required uint32 id = 1; // session id\n required string name = 2;\n required string tag = 3;\n repeated uint32 channel_ids = 4 [packed = true];\n optional uint32 capability = 5;\n}\n\n//reg.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCRegistryRegisterKeyPdu {\n required RCPduType_E type = 1 [default = RCPDU_REG_REGISTER_KEY];\n required uint32 id = 2;\n required string name = 3;\n required string tag = 4;\n optional bytes user_data = 5;\n}\n\nmessage RCRegistryUnregisterKeyPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_KEY];\n required uint32 key_id = 2;\n}\n\nmessage RCRegistryRegisterObjPdu {\n optional RCPduType_E type = 1;\n required uint32 obj_id = 2;\n required string name = 3;\n required string tag = 4;\n optional uint32 owner = 5;\n optional bytes user_data = 6;\n}\n\nmessage RCRegistryUnregisterObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_OBJ];\n required uint32 obj_id = 2;\n}\n\nmessage RCRegistryUpdateObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_UPDATE_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCAdapterItemPdu {\n required RCPduType_E type = 1;\n required bytes item_data = 2;\n}\n\n// adapter pdu that used to package a list of pdu.\nmessage RCAdapterPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ADAPTER];\n repeated RCAdapterItemPdu item = 2;\n}\n\n// table operation pdu\nmessage RCRegistryTableItemPdu {\n required uint32 item_idx = 1;\n required uint32 owner = 2;\n required bytes item_data = 3;\n}\n\nmessage RCRegistryTableInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_INSERT_PDU];\n repeated RCRegistryTableItemPdu items = 2;\n}\n\nmessage RCRegistryTableDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_DELETE_PDU];\n repeated uint32 item_idx = 2;\n}\n\nmessage RCRegistryTableUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU];\n repeated RCRegistryTableItemPdu items = 2;\n}\n\n// roster operation pdu\nmessage RCRegistryRosterItemPdu {\n required uint32 node_id = 1;\n required bytes node_data = 2;\n}\n\nmessage RCRegistryRosterInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_INSERT_PDU];\n repeated RCRegistryRosterItemPdu items = 2;\n}\n\nmessage RCRegistryRosterDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_DELETE_PDU];\n required uint32 node_id = 2;\n}\n\nmessage RCRegistryRosterUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_UPDATE_PDU];\n repeated RCRegistryRosterItemPdu items = 2;\n}\n\n//message RCCleanupNodePdu\n//{\n// optional RCPduType_E type = 1 [default = RCPDU_REG_CLEANUP_NODE];\n// required uint32 node_id = 2;\n//}\n\n// parameter operation pdu\nmessage RCRegistryParameterUpdatePdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_PARAMETER_UPDATE_PDU];\n required uint32 value = 2 [default = 0];\n optional uint32 begin_bit = 3 [default = 31];\n optional uint32 end_bit = 4;\n}\n\n// queue operation pdu\nmessage RCRegistryQueueItemPdu {\n required uint32 owner = 1;\n required uint32 item_id = 2;\n optional bytes item_data = 3;\n optional uint32 item_idx = 4;\n}\n\nmessage RCRegstryQueueInsertItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_INSERT_PDU];\n repeated RCRegistryQueueItemPdu items = 2;\n}\n\nmessage RCRegistryQueueDeleteItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_DELETE_PDU];\n required uint32 item_id = 2;\n}\n\nmessage RCRegistryQueueUpdateItemPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_UPDATE_PDU];\n repeated RCRegistryQueueItemPdu items = 2;\n}\n\nmessage RCRegistryRequestObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_REQUEST_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryResponseObjPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_RESPONSE_OBJ];\n required RCPduType_E sub_type = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryCounterRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_REQUEST_PDU];\n required uint32 count = 2;\n}\n\nmessage RCRegistryCounterResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_RESPONSE_PDU];\n required uint32 start = 2;\n required uint32 end = 3;\n}\n\n// mcs\noption optimize_for = LITE_RUNTIME;\n\n// Session management\nmessage RCSessionJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_REQUEST];\n required uint32 id = 2;\n required string name = 3;\n required string tag = 4;\n optional bytes session_data = 5; //\u805A\u5408\u5728\u4E00\u8D77\u7684registry\u4FE1\u606F\n}\n\nmessage RCSessionJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_RESPONSE];\n required uint32 id = 2;\n optional bytes response_data = 3;\n}\n\n// Channel management\nmessage RCChannelGrabRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelGrabResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_RESPONSE];\n required uint32 initiator = 2;\n required uint32 requested_channel_id = 3;\n required RCPduResult_E result = 4;\n optional uint32 channel_id = 5;\n}\n\nmessage RCChannelGrabIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_INDICATION];\n required uint32 initiator = 2;\n optional uint32 channel_id = 3;\n}\n\nmessage RCChannelJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_RESPONSE];\n required uint32 initiator = 2;\n required uint32 requested_channel_id = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCChannelLeaveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_LEAVE_REQUEST];\n required uint32 initiator = 2;\n repeated uint32 channel_ids = 3 [packed = true];\n}\n\nmessage RCChannelReleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_RELEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\nmessage RCChannelReleaseIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CHANNEL_RELEASE_INDICATION];\n required uint32 initiator = 2;\n required uint32 channel_id = 3;\n}\n\n// Data transfer\nmessage RCSendDataPdu {\n required RCPduType_E type = 1 [default = RCPDU_SEND_DATA_REQUEST];\n required RCPduType_E sub_type = 2;\n required uint32 initiator = 3;\n required uint32 conf_id = 4;\n required uint32 session_id = 5;\n required uint32 channel_id = 6;\n required bool upward = 7;\n required bool reliability = 8;\n required RCPduPriority_E priority = 9;\n required bytes data = 10;\n optional uint32 peer = 11;\n optional RCPduSegment_E seg = 12;\n optional uint32 total_size = 13;\n optional uint32 site_id = 14;\n optional string user_id = 15;\n optional string user_name = 16;\n optional string user_role = 17;\n optional string device_type = 18;\n optional string site = 19;\n}\n\n// Token management\nmessage RCTokenGrabRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenGrabConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenInhibitRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenInhibitConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenGiveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required uint64 recipient = 4;\n}\n\nmessage RCTokenGiveIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_INDICATION];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required uint64 recipient = 4;\n}\n\nmessage RCTokenGiveResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_RESPONSE];\n required uint32 token_id = 2;\n required uint64 recipient = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCTokenGiveConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_CONFIRM];\n required uint32 token_id = 2;\n required uint64 recipient = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenPleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenPleaseIndicationPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_INDICATION];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenReleaseRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_RELEASE_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenReleaseConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduResult_E result = 4;\n required RCPduTokenStatus_E status = 5;\n}\n\nmessage RCTokenTestRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n}\n\nmessage RCTokenTestConfirmPdu {\n optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_CONFIRM];\n required uint32 initiator = 2;\n required uint32 token_id = 3;\n required RCPduTokenStatus_E status = 4;\n}\n\n//gcc.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCConferenceJoinRequestPdu {\n required RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_REQUEST];\n required uint32 initiator = 2;\n required RCPduNodeType_E node_type = 3;\n required RCConferenceDescriptorPdu conf_desc = 4;\n}\n\nmessage RCConferenceJoinResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_RESPONSE];\n required uint32 conf_id = 2;\n required RCPduResult_E result = 3;\n optional RCConferenceDescriptorPdu conf_desc = 4;\n}\n\nmessage RCConferenceInviteRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_INVITE_REQUEST];\n required uint32 initiator = 2;\n required RCConferenceDescriptorPdu conf_desc = 3;\n}\n\nmessage RCConferenceInviteResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_INVITE_RESPONSE];\n required RCPduResult_E result = 2;\n optional bytes user_data = 3;\n}\n\nmessage RCConferenceLockRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_REQUEST];\n}\n\nmessage RCConferenceLockResponsePdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceLockIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_LOCK_INDICATION];\n}\n\nmessage RCConferenceUnlockRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_UNLOCK_REQUEST];\n}\n\nmessage RCConferenceUnlockResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_UNLOCK_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceUnlockIndicationPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_UNLOCK_INDICATION];\n}\n\nmessage RCConferenceLeaveRequestPdu {\n optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LEAVE_REQUEST];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceTerminateRequestPdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_REQUEST];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceTerminateResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_RESPONSE];\n required RCPduResult_E result = 2;\n}\n\nmessage RCConferenceTerminateIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_TERMINATE_INDICATION];\n required RCPduReason_E reason = 2;\n}\n\nmessage RCConferenceEjectUserRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_REQUEST];\n required uint32 ejected_node_id = 2;\n required RCPduReason_E reason = 3;\n}\n\nmessage RCConferenceEjectUserResponsePdu { // MCS_Send_Data on Node ID Channel of requester\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_RESPONSE];\n required uint32 ejected_node_id = 2;\n required RCPduResult_E result = 3;\n}\n\nmessage RCConferenceEjectUserIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1\n [default = RCPDU_CONFERENCE_EJECT_USER_INDICATION];\n required uint32 ejected_node_id = 2;\n required RCPduReason_E reason = 3;\n}\n\nmessage RCRosterUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel or\n// MCS_Uniform_Send_Data on GCC_Broadcast_Channel\n optional RCPduType_E type = 1 [default = RCPDU_ROSTER_UPDATE_INDICATION];\n required bool full_refresh = 2; // Conference Roster and all\n repeated RCNodeRecordPdu node_record = 3;\n repeated RCApplicationRecordPdu app_record = 4;\n}\n\nmessage RCRegistryUpdateRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_REQUEST];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel of Top GCC\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_RESPONSE];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required bytes user_data = 4;\n}\n\nmessage RCRegistryUpdateResponsePdu { // MCS_Send_Data on Node ID Channel of requester\n optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_INDICATION];\n required uint32 key_id = 2;\n required uint32 obj_id = 3;\n required RCPduResult_E result = 4;\n}\n\nmessage RCFunctionNotSupportedResponsePdu {\n optional RCPduType_E type = 1\n [default = RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE];\n required uint32 request_pdu_id = 2;\n}\n\n//ape.proto\n\noption optimize_for = LITE_RUNTIME;\nmessage RCConferenceSendDataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required bytes user_data = 4;\n}\n\nmessage RCChatSendDataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required bytes user_data = 4;\n required uint32 from_role = 5;\n required bytes from_name = 6;\n}\n\nmessage RCChatSendH5DataRequestPdu {\n optional uint32 initiator = 1;\n optional uint32 peer = 2;\n required bool is_public = 3;\n required string user_data = 4;\n required string from_role = 5;\n required string from_name = 6;\n}\n\nmessage RCDocSendDataRequestPdu {\n required int32 id = 1;\n required string doc_type = 2;\n required string uri = 3;\n optional int32 owner = 4;\n optional int32 from = 5;\n optional string name = 6;\n optional int32 cur_page_no = 7;\n optional int32 cur_H = 8;\n optional int32 cur_V = 9;\n optional int32 scale = 10;\n optional int32 page_num = 11;\n}\n\nmessage RCGiftSendDataRequestPdu {\n optional uint32 initiator = 1;\n required uint32 peer = 2;\n required uint32 index = 3;\n required uint32 num = 4;\n optional bytes user_data = 5;\n}\n\nmessage RCAudioSendDataRequestPdu {\n optional uint32 initiator = 1;\n required bytes user_data = 2;\n}\n\nmessage RCVideoSendDataRequestPdu {\n optional uint32 initiator = 1;\n required bool key_frame = 2;\n required uint32 sequence_id = 3;\n required uint32 slice_id = 4;\n required bytes user_data = 5;\n}\n\nmessage RCAudioChannelInfoRecordPdu {\n required uint32 status = 1;\n required uint32 device_id = 2;\n required uint32 framerate = 3;\n required uint32 bitrate = 4;\n required uint32 codec = 5;\n}\n\nmessage RCVideoChannelInfoRecordPdu {\n optional uint32 status = 1;\n optional uint32 device_id = 2;\n optional uint32 width = 3;\n optional uint32 height = 4;\n optional uint32 framerate = 5;\n optional uint32 bitrate = 6;\n optional uint32 codec = 7;\n optional string peer_id = 8;\n optional string url = 9;\n optional uint32 type = 10;\n optional string shamlive = 11;\n optional uint32 livetype = 12;\n optional uint32 releaseGrab = 13;\n optional string curTime = 14;\n}\n\nmessage RCAudioDeviceInfoRecordPdu {\n required uint32 device_id = 1;\n required string device_name = 2;\n}\n\nmessage RCVideoDeviceInfoRecordPdu {\n required uint32 device_id = 1;\n required string device_name = 2;\n}\n\nmessage RCNodeInfoRecordPdu {\n required uint32 node_id = 1;\n required string name = 2;\n required uint32 role = 3;\n required uint32 level = 4;\n repeated RCAudioDeviceInfoRecordPdu audio_records = 5;\n repeated RCVideoDeviceInfoRecordPdu video_records = 6;\n optional uint32 status = 7;\n optional bytes user_data = 8;\n optional string user_id = 9;\n optional uint32 handUpTime = 10;\n optional uint32 deviceType = 11;\n optional uint32 mobileDirection = 12;\n}\n\nmessage RCVotingPollSettingsPdu {\n required bool timer = 1;\n optional uint32 time_limit = 2;\n optional uint32 total_score = 3;\n}\n\nmessage RCVotingPollResultPdu {\n required string title = 1;\n required string content = 2;\n optional uint32 score = 3;\n}\n\nmessage RCVotingPollQuestionPdu {\n required uint32 index = 1;\n required uint32 type = 2;\n required string title = 3;\n repeated string options = 4;\n optional uint32 score = 5;\n optional uint32 time_limit = 6;\n optional string restrict_input = 7;\n optional uint32 char_limit = 8;\n optional string answer = 9;\n repeated uint32 selections = 10;\n repeated string responses = 11;\n}\n\nmessage RCVotingPollRecordPdu {\n required RCVotingPollSettingsPdu settings = 1;\n required string title = 2;\n repeated RCVotingPollResultPdu results = 3;\n repeated RCVotingPollQuestionPdu questions = 4;\n}\n\nmessage RCNodeInfoUserDataPdu {\n optional string qq = 1;\n optional string skype = 2;\n optional string mobile = 3;\n}\n\nmessage RCWhiteboardDataRequestPdu {\n required uint32 id = 1;\n required uint32 type = 2;\n required uint32 initiator = 3;\n optional bytes action = 4;\n optional uint32 uncomprLen = 5;\n}\n\nmessage RCTabUpdateDataRequestPdu {\n optional uint32 id = 1;\n optional bytes action = 2;\n optional uint32 uncomprLen =3;\n}\n\n\n\n//end\n";
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(_default, "default", "D:/work/McuClient/src/pdu/pro.js");
+ }();
+
+ ;
+
+/***/ },
+/* 37 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.default = RCPduPackage;
+ function RCPduPackage(targe_type_id) {};
+ RCPduPackage.RCPDU_CONNECT_PROVIDER_REQUEST = 0;
+ RCPduPackage.RCPDU_CONNECT_PROVIDER_RESPONSE = 1;
+ RCPduPackage.RCPDU_CONFERENCE_JOIN_REQUEST = 2;
+ RCPduPackage.RCPDU_CONFERENCE_JOIN_RESPONSE = 3;
+ RCPduPackage.RCPDU_CONFERENCE_INVITE_REQUEST = 10;
+ RCPduPackage.RCPDU_CONFERENCE_INVITE_RESPONSE = 11;
+ RCPduPackage.RCPDU_CONFERENCE_LOCK_REQUEST = 20;
+ RCPduPackage.RCPDU_CONFERENCE_LOCK_RESPONSE = 21;
+ RCPduPackage.RCPDU_CONFERENCE_LOCK_INDICATION = 22;
+ RCPduPackage.RCPDU_CONFERENCE_UNLOCK_REQUEST = 30;
+ RCPduPackage.RCPDU_CONFERENCE_UNLOCK_RESPONSE = 31;
+ RCPduPackage.RCPDU_CONFERENCE_UNLOCK_INDICATION = 32;
+ RCPduPackage.RCPDU_CONFERENCE_LEAVE_REQUEST = 39;
+ RCPduPackage.RCPDU_CONFERENCE_TERMINATE_REQUEST = 40;
+ RCPduPackage.RCPDU_CONFERENCE_TERMINATE_RESPONSE = 41;
+ RCPduPackage.RCPDU_CONFERENCE_TERMINATE_INDICATION = 42;
+ RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_REQUEST = 50;
+ RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_RESPONSE = 51;
+ RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_INDICATION = 52;
+ RCPduPackage.RCPDU_ROSTER_UPDATE_INDICATION = 60;
+ RCPduPackage.RCPDU_REGISTRY_UPDATE_REQUEST = 70;
+ RCPduPackage.RCPDU_REGISTRY_UPDATE_RESPONSE = 71;
+ RCPduPackage.RCPDU_REGISTRY_UPDATE_INDICATION = 72;
+ RCPduPackage.RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE = 80;
+ RCPduPackage.RCPDU_SESSION_JOIN_REQUEST = 90;
+ RCPduPackage.RCPDU_SESSION_JOIN_RESPONSE = 91;
+ RCPduPackage.RCPDU_CHANNEL_GRAB_REQUEST = 100;
+ RCPduPackage.RCPDU_CHANNEL_GRAB_RESPONSE = 101;
+ RCPduPackage.RCPDU_CHANNEL_GRAB_INDICATION = 102;
+ RCPduPackage.RCPDU_CHANNEL_JOIN_REQUEST = 103;
+ RCPduPackage.RCPDU_CHANNEL_JOIN_RESPONSE = 104;
+ RCPduPackage.RCPDU_CHANNEL_LEAVE_REQUEST = 105;
+ RCPduPackage.RCPDU_CHANNEL_RELEASE_REQUEST = 106;
+ RCPduPackage.RCPDU_CHANNEL_RELEASE_INDICATION = 107;
+ RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120;
+ RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120;
+ RCPduPackage.RCPDU_SEND_DATA_INDICATION = 121;
+ RCPduPackage.RCPDU_UNIFORM_SEND_DATA_REQUEST = 125;
+ RCPduPackage.RCPDU_UNIFORM_SEND_DATA_INDICATION = 126;
+ RCPduPackage.RCPDU_TOKEN_GRAB_REQUEST = 130;
+ RCPduPackage.RCPDU_TOKEN_GRAB_CONFIRM = 131;
+ RCPduPackage.RCPDU_TOKEN_INHIBIT_REQUEST = 132;
+ RCPduPackage.RCPDU_TOKEN_INHIBIT_CONFIRM = 133;
+ RCPduPackage.RCPDU_TOKEN_GIVE_REQUEST = 134;
+ RCPduPackage.RCPDU_TOKEN_GIVE_INDICATION = 135;
+ RCPduPackage.RCPDU_TOKEN_GIVE_RESPONSE = 136;
+ RCPduPackage.RCPDU_TOKEN_GIVE_CONFIRM = 137;
+ RCPduPackage.RCPDU_TOKEN_PLEASE_REQUEST = 138;
+ RCPduPackage.RCPDU_TOKEN_PLEASE_INDICATION = 139;
+ RCPduPackage.RCPDU_TOKEN_RELEASE_REQUEST = 140;
+ RCPduPackage.RCPDU_TOKEN_RELEASE_CONFIRM = 141;
+ RCPduPackage.RCPDU_TOKEN_TEST_REQUEST = 142;
+ RCPduPackage.RCPDU_TOKEN_TEST_CONFIRM = 143;
+ RCPduPackage.RCPDU_REG_REGISTER_KEY = 200;
+ RCPduPackage.RCPDU_REG_UNREGISTER_KEY = 201;
+ RCPduPackage.RCPDU_REG_REGISTER_ROSTER = 202;
+ RCPduPackage.RCPDU_REG_REGISTER_TOKEN = 203;
+ RCPduPackage.RCPDU_REG_REGISTER_PARAMETER = 204;
+ RCPduPackage.RCPDU_REG_REGISTER_COUNTER = 205;
+ RCPduPackage.RCPDU_REG_REGISTER_TABLE = 206;
+ RCPduPackage.RCPDU_REG_REGISTER_CACHE = 207;
+ RCPduPackage.RCPDU_REG_REGISTER_OBJ = 208;
+ RCPduPackage.RCPDU_REG_UNREGISTER_OBJ = 209;
+ RCPduPackage.RCPDU_REG_UPDATE_OBJ = 210;
+ RCPduPackage.RCPDU_REG_ADAPTER = 211;
+ RCPduPackage.RCPDU_REG_CLEANUP_NODE = 212;
+ RCPduPackage.RCPDU_REG_REGISTER_QUEUE = 213;
+ RCPduPackage.RCPDU_REG_TABLE_INSERT_PDU = 230;
+ RCPduPackage.RCPDU_REG_TABLE_DELETE_PDU = 231;
+ RCPduPackage.RCPDU_REG_TABLE_UPDATE_PDU = 232;
+ RCPduPackage.RCPDU_REG_ROSTER_INSERT_PDU = 240;
+ RCPduPackage.RCPDU_REG_ROSTER_DELETE_PDU = 241;
+ RCPduPackage.RCPDU_REG_ROSTER_UPDATE_PDU = 242;
+ RCPduPackage.RCPDU_REG_PARAMETER_UPDATE_PDU = 250;
+ RCPduPackage.RCPDU_REG_QUEUE_INSERT_PDU = 255;
+ RCPduPackage.RCPDU_REG_QUEUE_DELETE_PDU = 256;
+ RCPduPackage.RCPDU_REG_QUEUE_UPDATE_PDU = 257;
+ RCPduPackage.RCPDU_CONFERENCE_SEND_DATA_REQUEST = 259;
+ RCPduPackage.RCPDU_VIDEO_SEND_DATA_REQUEST = 260;
+ RCPduPackage.RCPDU_AUDIO_SEND_DATA_REQUEST = 261;
+ RCPduPackage.RCPDU_GIFT_SEND_DATA_REQUEST = 262;
+ RCPduPackage.RCPDU_CHAT_SEND_DATA_REQUEST = 263;
+ RCPduPackage.RCPDU_VOTING_POLL_RECORD = 265;
+ RCPduPackage.RCPDU_REG_REQUEST_OBJ = 290;
+ RCPduPackage.RCPDU_REG_RESPONSE_OBJ = 291;
+ RCPduPackage.RCPDU_REG_COUNTER_REQUEST_PDU = 292;
+ RCPduPackage.RCPDU_REG_COUNTER_RESPONSE_PDU = 293;
+ RCPduPackage.RCPDU_INDEX_ADAPTER = 300;
+ RCPduPackage.RCPDU_INDEX_SERVER_USERS = 301;
+ RCPduPackage.RCPDU_INDEX_CONFERENCE_USER_JOINED = 302;
+ RCPduPackage.RCPDU_INDEX_CONFERENCE_USER_EXITED = 303;
+ RCPduPackage.RCPDU_INDEX_CONFERENCE_USERS = 304;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(RCPduPackage, "RCPduPackage", "D:/work/McuClient/src/pdu/PduType.js");
+ }();
+
+ ;
+
+/***/ },
+/* 38 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.default = PduConsts;
+ function PduConsts() {}
+
+ PduConsts.NT_TERMINAL = 0;
+ PduConsts.NT_MULTIPORT_TERMINAL = 1;
+ PduConsts.NT_MCU = 2;
+
+ // PduPriority
+
+ PduConsts.DP_TOP = 0;
+ PduConsts.DP_HIGH = 1;
+ PduConsts.DP_MEDIUM = 2;
+ PduConsts.DP_LOW = 3;
+
+ // PduSegment
+ PduConsts.SEG_BEGIN = 0;
+ PduConsts.SEG_END = 1;
+ PduConsts.SEG_ONCE = 2;
+
+ // PduReturnType
+ PduConsts.RET_SUCCESS = 0;
+ PduConsts.RET_USER_REJECTED = 1;
+ PduConsts.RET_INVALID_CONFERENCE = 2;
+ PduConsts.RET_INVALID_PASSWORD = 3;
+ PduConsts.RET_INVALID_CONVENER_PASSWORD = 4;
+ PduConsts.RET_CHALLENGE_RESPONSE_REQUIRED = 5;
+ PduConsts.RET_INVALID_CHALLENGE_RESPONSE = 6;
+ PduConsts.RET_NO_CONNECTION = 7;
+ PduConsts.RET_FULL_CAPACITY = 8;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(PduConsts, "PduConsts", "D:/work/McuClient/src/pdu/PduConsts.js");
+ }();
+
+ ;
+
+/***/ },
+/* 39 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.default = ApeConsts;
+ function ApeConsts(id) {
+ for (var type_const in ApeConsts) {
+ if (ApeConsts[type_const] === id) {
+ return type_const;
+ }
+ }
+ }
+
+ ApeConsts.NR_GUEST = 0;
+ ApeConsts.NR_NORMAL = 1;
+ ApeConsts.NR_ADMIN = 2;
+ ApeConsts.NR_MASTER = 4;
+ ApeConsts.NR_SLAVE = 8;
+ ApeConsts.NR_ASSISTANT = 16;
+ ApeConsts.NR_INVISIBLE = 32;
+
+ ApeConsts.INVALIDATE_CHANNEL_ID = -1;
+ ApeConsts.INVALIDATE_NODE_ID = -1;
+
+ // doc update status
+ ApeConsts.DOCUMENT_LOAD = 0;
+ ApeConsts.DOCUMENT_DEL = 1;
+
+ // RCChannelGrabStatus
+ ApeConsts.CGS_RELEASED = 0;
+ ApeConsts.CGS_PENDING = 1;
+ ApeConsts.CGS_OPENNED = 2;
+ ApeConsts.CGS_GRABBING = 3;
+
+ // defs for common session id
+ ApeConsts.CONFERENCE_SESSION_ID = 11;
+ ApeConsts.CHAT_SESSION_ID = 12;
+ ApeConsts.GIFT_SESSION_ID = 13;
+ ApeConsts.AUDIO_SESSION_ID = 14;
+ ApeConsts.VIDEO_SESSION_ID = 15;
+ ApeConsts.WEBSHARING_SESSION_ID = 16;
+ ApeConsts.DOCSHARING_SESSION_ID = 17;
+ ApeConsts.WHITEBOARD_SESSION_ID = 18;
+ ApeConsts.MEDIA_SESSION_ID = 19;
+ ApeConsts.SCREENSHARING_SESSION_ID = 20;
+ ApeConsts.POLL_SESSION_ID = 21;
+
+ // defs for common channel id
+ ApeConsts.BROADCAST_CHANNEL_ID = 0;
+ ApeConsts.CONFERENCE_CHANNEL_ID = ApeConsts.CONFERENCE_SESSION_ID;
+ ApeConsts.CHAT_CHANNEL_ID = ApeConsts.CHAT_SESSION_ID;
+ ApeConsts.GIFT_CHANNEL_ID = ApeConsts.GIFT_SESSION_ID;
+ ApeConsts.WEBSHARING_CHANNEL_ID = ApeConsts.WEBSHARING_SESSION_ID;
+ ApeConsts.DOCSHARING_CHANNEL_ID = ApeConsts.DOCSHARING_SESSION_ID;
+ ApeConsts.WHITEBOARD_CHANNEL_ID = ApeConsts.WHITEBOARD_SESSION_ID;
+ ApeConsts.MEDIA_CHANNEL_ID = ApeConsts.MEDIA_SESSION_ID;
+ ApeConsts.SCREENSHARING_CHANNEL_ID = ApeConsts.SCREENSHARING_SESSION_ID;
+
+ // defs for common session name
+ ApeConsts.CONFERENCE_SESSION_NAME = "conference app";
+ ApeConsts.CHAT_SESSION_NAME = "chat app";
+ ApeConsts.GIFT_SESSION_NAME = "gift app";
+ ApeConsts.AUDIO_SESSION_NAME = "audio app";
+ ApeConsts.VIDEO_SESSION_NAME = "video app";
+ ApeConsts.WEBSHARING_SESSION_NAME = "web sharing app";
+ ApeConsts.DOCSHARING_SESSION_NAME = "doc sharing app";
+ ApeConsts.WHITEBOARD_SESSION_NAME = "whiteboard app";
+ ApeConsts.MEDIA_SESSION_NAME = "media sharing app";
+ ApeConsts.SCREENSHARING_SESSION_NAME = "screen sharing app";
+
+ // def for common session tag
+ ApeConsts.CONFERENCE_SESSION_TAG = "con-tag";
+ ApeConsts.CHAT_SESSION_TAG = "cha-tag";
+ ApeConsts.GIFT_SESSION_TAG = "gif-tag";
+ ApeConsts.AUDIO_SESSION_TAG = "aud-tag";
+ ApeConsts.VIDEO_SESSION_TAG = "vid-tag";
+ ApeConsts.WEBSHARING_SESSION_TAG = "web-tag";
+ ApeConsts.DOCSHARING_SESSION_TAG = "doc-tag";
+ ApeConsts.WHITEBOARD_SESSION_TAG = "wbd-tag";
+ ApeConsts.MEDIA_SESSION_TAG = "med-tag";
+ ApeConsts.SCREENSHARING_SESSION_TAG = "scr-tag";
+
+ ApeConsts.CONFERENCE_OBJ_ROSTER_ID = (ApeConsts.CONFERENCE_SESSION_ID << 16) + 1;
+ ApeConsts.CONFERENCE_OBJ_ROSTER_NAME = "node list";
+ ApeConsts.CONFERENCE_OBJ_ROSTER_TAG = "node list tag";
+
+ ApeConsts.CONFERENCE_OBJ_QUEUE_ID = (ApeConsts.CONFERENCE_SESSION_ID << 16) + 2;
+ ApeConsts.CONFERENCE_OBJ_QUEUE_NAME = "mic list";
+ ApeConsts.CONFERENCE_OBJ_QUEUE_TAG = "mic list tag";
+
+ // conference tab pages
+ ApeConsts.CONFERENCE_OBJ_TABLE_ID = (ApeConsts.CONFERENCE_SESSION_ID << 16) + 3;
+ ApeConsts.CONFERENCE_OBJ_TABLE_NAME = "tabbar list";
+ ApeConsts.CONFERENCE_OBJ_TABLE_TAG = "tabbar list tag";
+
+ // owned id list is unique in conference
+ ApeConsts.CONFERENCE_OBJ_COUNTER_ID = (ApeConsts.CONFERENCE_SESSION_ID << 16) + 4;
+ ApeConsts.CONFERENCE_OBJ_COUNTER_NAME = "id list";
+ ApeConsts.CONFERENCE_OBJ_COUNTER_TAG = "id list tag";
+
+ // web sharing objects
+ ApeConsts.WEBSHARING_OBJ_TABLE_ID = (ApeConsts.WEBSHARING_SESSION_ID << 16) + 1;
+ ApeConsts.WEBSHARING_OBJ_TABLE_NAME = "web list";
+ ApeConsts.WEBSHARING_OBJ_TABLE_TAG = "web list tag";
+
+ // doc sharing objects
+ ApeConsts.DOCSHARING_OBJ_TABLE_ID = (ApeConsts.DOCSHARING_SESSION_ID << 16) + 1;
+ ApeConsts.DOCSHARING_OBJ_TABLE_NAME = "doc list";
+ ApeConsts.DOCSHARING_OBJ_TABLE_TAG = "doc list tag";
+
+ // doc sharing objects h5
+ ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5 = (ApeConsts.DOCSHARING_SESSION_ID << 16) + 2;
+ ApeConsts.DOCSHARING_OBJ_TABLE_NAME_H5 = "doc list h5";
+ ApeConsts.DOCSHARING_OBJ_TABLE_TAG_H5 = "doc list tag h5";
+
+ // whiteboard objects
+ ApeConsts.WHITEBOARD_OBJ_TABLE_ID = (ApeConsts.WHITEBOARD_SESSION_ID << 16) + 1;
+ ApeConsts.WHITEBOARD_OBJ_TABLE_NAME = "wbd list";
+ ApeConsts.WHITEBOARD_OBJ_TABLE_TAG = "wbd list tag";
+
+ // media sharing objects
+ ApeConsts.MEDIA_OBJ_TABLE_ID = (ApeConsts.MEDIA_SESSION_ID << 16) + 1;
+ ApeConsts.MEDIA_OBJ_TABLE_NAME = "med list";
+ ApeConsts.MEDIA_OBJ_TABLE_TAG = "med list tag";
+
+ // chat sharing objects
+ ApeConsts.CHAT_OBJ_TABLE_ID = (ApeConsts.CHAT_SESSION_ID << 16) + 1;
+ ApeConsts.CHAT_OBJ_TABLE_NAME = "chat list";
+ ApeConsts.CHAT_OBJ_TABLE_TAG = "chat list tag";
+
+ ApeConsts.AUDIO_OBJ_TABLE_ID = (ApeConsts.AUDIO_SESSION_ID << 16) + 1;
+ ApeConsts.AUDIO_OBJ_TABLE_NAME = "audio channel list";
+ ApeConsts.AUDIO_OBJ_TABLE_TAG = "audio channel list tag";
+
+ ApeConsts.VIDEO_OBJ_TABLE_ID = (ApeConsts.VIDEO_SESSION_ID << 16) + 1;
+ ApeConsts.VIDEO_OBJ_TABLE_NAME = "video channel list";
+ ApeConsts.VIDEO_OBJ_TABLE_TAG = "video channel list tag";
+
+ // screen sharing objects
+ ApeConsts.SCREENSHARING_OBJ_TABLE_ID = (ApeConsts.SCREENSHARING_SESSION_ID << 16) + 1;
+ ApeConsts.SCREEN_OBJ_TABLE_NAME = "scr list";
+ ApeConsts.SCREEN_OBJ_TABLE_TAG = "scr list tag";
+
+ // poll sharing objects
+ ApeConsts.POLL_OBJ_TABLE_ID = (ApeConsts.POLL_SESSION_ID << 16) + 1;
+ ApeConsts.VOTE_OBJ_TABLE_ID = (ApeConsts.POLL_SESSION_ID << 16) + 2;
+ ApeConsts.RECORD_OBJ_TABLE_ID = (ApeConsts.POLL_SESSION_ID << 16) + 3;
+ ApeConsts.SHAMLIVE_OBJ_TABLE_ID = (ApeConsts.POLL_SESSION_ID << 16) + 4;
+
+ ApeConsts.POLL_OBJ_TABLE_NAME = "poll list";
+ ApeConsts.POLL_OBJ_TABLE_TAG = "poll list tag";
+
+ // registry operation const
+ ApeConsts.REG_TABLE_INSERT_TAIL = 0xFFFFFF;
+ ApeConsts.REG_TABLE_DELETE_ALL = 0xFFFFFF;
+
+ ApeConsts.CJS_RELEASED = 0;
+ ApeConsts.CJS_JOINNING = 1;
+ ApeConsts.CJS_JOINNED = 2;
+
+ // 白板动作
+ ApeConsts.WBA_CLOSE = 1;
+ ApeConsts.WBA_CHANGE = 2;
+ ApeConsts.WBA_OPEN = 3;
+ ApeConsts.WBA_DOC_ANNOTATION = 4;
+ ApeConsts.WBA_LASER_PEN = 5;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(ApeConsts, "ApeConsts", "D:/work/McuClient/src/apes/ApeConsts.js");
+ }();
+
+ ;
+
+/***/ },
+/* 40 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Ape2 = __webpack_require__(41);
+
+ var _Ape3 = _interopRequireDefault(_Ape2);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _zlib = __webpack_require__(43);
+
+ var _utf = __webpack_require__(44);
+
+ var _utf2 = _interopRequireDefault(_utf);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-22 09:57:12
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-07 16:16:35
+ // Description: LiveClass-ConferApe
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('ConferApe');
+
+ var ConferApe = function (_Ape) {
+ _inherits(ConferApe, _Ape);
+
+ function ConferApe() {
+ _classCallCheck(this, ConferApe);
+
+ // Attribures
+ var _this = _possibleConstructorReturn(this, (ConferApe.__proto__ || Object.getPrototypeOf(ConferApe)).call(this, _ApeConsts2.default.CONFERENCE_SESSION_ID, _ApeConsts2.default.CONFERENCE_SESSION_NAME, _ApeConsts2.default.CONFERENCE_SESSION_TAG));
+
+ _this.hostNodeId = -1;
+ _this.hostUserId = '';
+ _this.rosters = {};
+ _this.activeDocId = '';
+
+ // Ape Models
+ _this.registerKey(_this._session_id, _this._session_name, _this._session_tag, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_ROSTER, _ApeConsts2.default.CONFERENCE_OBJ_ROSTER_ID, _ApeConsts2.default.CONFERENCE_OBJ_ROSTER_NAME, _ApeConsts2.default.CONFERENCE_OBJ_ROSTER_TAG, 0, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_QUEUE, _ApeConsts2.default.CONFERENCE_OBJ_QUEUE_ID, _ApeConsts2.default.CONFERENCE_OBJ_QUEUE_NAME, _ApeConsts2.default.CONFERENCE_OBJ_QUEUE_TAG, 0, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_TABLE, _ApeConsts2.default.CONFERENCE_OBJ_TABLE_ID, _ApeConsts2.default.CONFERENCE_OBJ_TABLE_NAME, _ApeConsts2.default.CONFERENCE_OBJ_TABLE_TAG, 0, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_COUNTER, _ApeConsts2.default.CONFERENCE_OBJ_COUNTER_ID, _ApeConsts2.default.CONFERENCE_OBJ_COUNTER_NAME, _ApeConsts2.default.CONFERENCE_OBJ_COUNTER_TAG, 0, new ArrayBuffer());
+
+ _this.on(_pdu2.default.RCPDU_SESSION_JOIN_RESPONSE, _this._joinSessionHandler.bind(_this));
+ return _this;
+ }
+
+ _createClass(ConferApe, [{
+ key: '_joinSessionHandler',
+ value: function _joinSessionHandler(confInfo) {
+ var nodeInfoRecordPdu = this.mcu.mcuConfInfo.self;
+
+ var userDataPdu = new _pdu2.default['RCNodeInfoUserDataPdu']();
+ userDataPdu.qq = '';
+ userDataPdu.skype = '';
+ userDataPdu.mobile = '';
+
+ nodeInfoRecordPdu.userData = userDataPdu.toArrayBuffer();
+ nodeInfoRecordPdu.deviceType = 3;
+
+ var item = new _pdu2.default['RCRegistryRosterItemPdu']();
+ item.nodeId = nodeInfoRecordPdu.nodeId;
+ item.nodeData = nodeInfoRecordPdu.toArrayBuffer();
+
+ var rosterUpdateItem = new _pdu2.default['RCRegistryRosterUpdateItemPdu']();
+ rosterUpdateItem.type = _pdu2.default.RCPDU_REG_ROSTER_UPDATE_PDU;
+ rosterUpdateItem.items.push(item);
+
+ var updateObjPdu = new _pdu2.default['RCRegistryUpdateObjPdu']();
+ updateObjPdu.objId = _ApeConsts2.default.CONFERENCE_OBJ_ROSTER_ID;
+ updateObjPdu.subType = rosterUpdateItem.type;
+ updateObjPdu.userData = rosterUpdateItem.toArrayBuffer();
+
+ var adapterItemPdu = new _pdu2.default['RCAdapterItemPdu']();
+ adapterItemPdu.type = _pdu2.default.RCPDU_REG_UPDATE_OBJ;
+ adapterItemPdu.itemData = updateObjPdu.toArrayBuffer();
+
+ var adapterPdu = new _pdu2.default['RCAdapterPdu']();
+ adapterPdu.type = _pdu2.default.RCPDU_REG_ADAPTER;
+ adapterPdu.item.push(adapterItemPdu);
+
+ this.sendUniform(adapterPdu, true);
+ }
+ }, {
+ key: 'tableUpdateHandler',
+ value: function tableUpdateHandler(owner, recordId, recordData) {
+ try {
+ var tabUpdatePdu = _pdu2.default.RCTabUpdateDataRequestPdu.decode(recordData);
+ var uncompressedBytes = new _zlib.Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress();
+ var tabInfo = _utf2.default.getStringFromBytes(uncompressedBytes);
+ var tabTypeMatches = tabInfo.match(/<TabType>(.+)<\/TabType>/);
+ if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') {
+ if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') {
+ this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1];
+ this._emit(_MessageTypes2.default.DOC_SWITCH, this.activeDocId);
+ }
+ }
+ } catch (e) {
+ loger.warn('ConferApe table update got exception.');
+ }
+ }
+ }, {
+ key: 'rosterInsertHandler',
+ value: function rosterInsertHandler(nodeId, nodeData) {
+ this.rosterUpdateHandler(nodeId, nodeData);
+ }
+
+ //更新人员列表数据
+
+ }, {
+ key: 'rosterUpdateHandler',
+ value: function rosterUpdateHandler(nodeId, nodeData) {
+ if (nodeData.role === _ApeConsts2.default.NR_MASTER || nodeData.role === _ApeConsts2.default.NR_SLAVE) {
+ this.hostNodeId = nodeData.nodeId;
+ this.hostUserId = nodeData.userId;
+ }
+ if (nodeData.role === _ApeConsts2.default.NR_NORMAL && this.hostNodeId === nodeData.nodeId) {
+ this.hostNodeId = -1;
+ this.hostUserId = '';
+ }
+ var rosterExists = this.rosters[nodeId];
+ this.rosters[nodeId] = nodeData;
+ if (!rosterExists) {
+ this.emitRosterChange();
+ }
+ }
+ }, {
+ key: 'rosterDelHandler',
+ value: function rosterDelHandler(nodeId) {
+ delete this.rosters[nodeId];
+ this.emitRosterChange();
+ // 自己退出
+ if (nodeId == this._confInfo.nodeId) {
+ this._emit(_MessageTypes2.default.CLASS_EXIT);
+ }
+ }
+ }, {
+ key: 'emitRosterChange',
+ value: function emitRosterChange() {
+ this._emit(_MessageTypes2.default.CLASS_SHOW_ROSTER_NUM, Object.keys(this.rosters).length);
+ }
+ }]);
+
+ return ConferApe;
+ }(_Ape3.default);
+
+ var _default = ConferApe;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/ConferApe.js');
+
+ __REACT_HOT_LOADER__.register(ConferApe, 'ConferApe', 'D:/work/McuClient/src/apes/ConferApe.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/ConferApe.js');
+ }();
+
+ ;
+
+/***/ },
+/* 41 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _Emiter2 = __webpack_require__(17);
+
+ var _Emiter3 = _interopRequireDefault(_Emiter2);
+
+ var _mcu = __webpack_require__(26);
+
+ var _mcu2 = _interopRequireDefault(_mcu);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _ArrayBufferUtil = __webpack_require__(42);
+
+ var _ArrayBufferUtil2 = _interopRequireDefault(_ArrayBufferUtil);
+
+ var _PduConsts = __webpack_require__(38);
+
+ var _PduConsts2 = _interopRequireDefault(_PduConsts);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-26 11:19:56
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2017-01-04 14:38:20
+ // Description: LiveClass-Ape
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ // 日志对象
+ var loger = _Loger2.default.getLoger('Ape');
+
+ var Ape = function (_Emiter) {
+ _inherits(Ape, _Emiter);
+
+ function Ape(session_id, session_name, session_tag) {
+ _classCallCheck(this, Ape);
+
+ var _this = _possibleConstructorReturn(this, (Ape.__proto__ || Object.getPrototypeOf(Ape)).call(this));
+
+ _this._session_id = session_id;
+ _this._channel_id = session_id; // session_id === channel_id
+ _this._session_name = session_name;
+ _this._session_tag = session_tag;
+ _this._session_channels = {};
+ _this._adapter_pdu = new _pdu2.default['RCAdapterPdu']();
+ _this._confInfo = null;
+ _this._rCArrayBufferUtil = _ArrayBufferUtil2.default;
+ _this._apeDelayed = false;
+ _this._apeDelayedMsgs = [];
+ _this._apeDelayedTimer = 0;
+
+ //Ape 通用消息处理
+ _this.on(_pdu2.default.RCPDU_SESSION_JOIN_RESPONSE, _this._joinSessionHandler.bind(_this));
+ _this.on(_pdu2.default.RCPDU_CHANNEL_JOIN_RESPONSE, _this._joinChannelHandler.bind(_this));
+ _this.on(_pdu2.default.RCPDU_REG_ADAPTER, _this._pduMessageHandler.bind(_this));
+
+ // 监听底层MCU会议
+ _this.mcu = _mcu2.default;
+ _this.mcu.on(_MessageTypes2.default.CLASS_JOIN_SUCCESS, _this._mcuConferenceJoinSuccessHandler.bind(_this));
+ _this.mcu.registerApe(_this);
+ return _this;
+ }
+
+ _createClass(Ape, [{
+ key: 'regResponsePduHandler',
+ value: function regResponsePduHandler() {}
+
+ // 消息处理
+
+ }, {
+ key: '_pduMessageHandler',
+ value: function _pduMessageHandler(regBuffer) {
+ var _this2 = this;
+
+ if (this._apeDelayed) {
+ // this._apeDelayedMsgs.push(regBuffer);
+ // this._apeDelayedStart();
+ setTimeout(function () {
+ _this2._pduRegAdapterHandler(regBuffer);
+ }, this._confInfo['mcuDelay'] || 12000);
+ return;
+ }
+ this._pduRegAdapterHandler(regBuffer);
+ }
+
+ // _apeDelayedStart() {
+ // if (this._apeDelayed && !this._apeDelayedTimer) {
+ // this._apeDelayedTimer = setInterval(this._delayedMsgHandler.bind(this), this._confInfo['mcuDelay'] || 10000);
+ // }
+ // }
+
+ // _apeDelayedStop() {
+ // clearInterval(this._apeDelayedTimer);
+ // this._apeDelayedTimer = 0;
+ // }
+
+ // // 延迟消息处理
+ // _delayedMsgHandler() {
+ // if (this._apeDelayedMsgs.length) {
+ // this._pduRegAdapterHandler(this._apeDelayedMsgs.pop());
+ // if (!this._apeDelayedMsgs.length) this._apeDelayedStop();
+ // }
+ // }
+
+ // 数据同步处理
+
+ }, {
+ key: '_pduRegAdapterHandler',
+ value: function _pduRegAdapterHandler(regBuffer) {
+ var regPdu = _pdu2.default['RCAdapterPdu'].decode(regBuffer);
+ var regItems = regPdu.item;
+ var regItemSize = regItems.length;
+
+ loger.log(this._session_name + '数据同步消息.同步条数', regItemSize);
+
+ for (var i = 0; i < regItemSize; ++i) {
+ var regItem = regItems[i];
+ var regItemType = regItem.type;
+ var regItemData = regItem.itemData;
+
+ if (_pdu2.default.RCPDU_REG_UPDATE_OBJ !== regItemType) {
+ if (_pdu2.default.RCPDU_REG_RESPONSE_OBJ == regItemType) {
+ var regResponsePdu = _pdu2.default['RCRegistryResponseObjPdu'].decode(regItemData);
+ this.regResponsePduHandler(regResponsePdu);
+ }
+ // 只处理两种类型
+ continue;
+ }
+
+ var regUpdatedItem = _pdu2.default['RCRegistryUpdateObjPdu'].decode(regItemData);
+ var sub_type = regUpdatedItem.subType;
+ var object_id = regUpdatedItem.objId;
+ var user_data = regUpdatedItem.userData;
+
+ loger.log('REG OBJECT EVENT ->', _pdu2.default.id2type(sub_type));
+ switch (sub_type) {
+ case _pdu2.default.RCPDU_REG_ROSTER_INSERT_PDU:
+ var rosterInsertData = _pdu2.default['RCRegstryRosterInsertItemPdu'].decode(user_data);
+ var rosterInsertItems = rosterInsertData.items;
+ var rosterInsertItemsLen = rosterInsertItems.length;
+ for (var _i = 0; _i < rosterInsertItemsLen; ++_i) {
+ var record = rosterInsertItems[_i];
+ var recordId = record.item_id;
+ var recordData = _pdu2.default['RCNodeInfoRecordPdu'].decode(record.item_data);
+ this.rosterInsertHandler(recordId, recordData);
+ }
+ break;
+ case _pdu2.default.RCPDU_REG_ROSTER_DELETE_PDU:
+ var rosterDelData = _pdu2.default['RCRegistryRosterDeleteItemPdu'].decode(user_data);
+ this.rosterDelHandler(rosterDelData.nodeId);
+ break;
+ case _pdu2.default.RCPDU_REG_ROSTER_UPDATE_PDU:
+ var rosterUpdateData = _pdu2.default['RCRegistryRosterUpdateItemPdu'].decode(user_data);
+ var rosterUpdateItems = rosterUpdateData.items;
+ var rosterUpdateItemsLen = rosterUpdateItems.length;
+ for (var _i2 = 0; _i2 < rosterUpdateItemsLen; ++_i2) {
+ var node = rosterUpdateItems[_i2];
+ var nodeId = node.nodeId;
+ var nodeData = _pdu2.default['RCNodeInfoRecordPdu'].decode(node.nodeData);
+ this.rosterUpdateHandler(nodeId, nodeData);
+ }
+ break;
+ case _pdu2.default.RCPDU_REG_TABLE_INSERT_PDU:
+ var tableInsertData = _pdu2.default['RCRegistryTableInsertItemPdu'].decode(user_data);
+ var tableInsertItems = tableInsertData.items;
+ var tableInsertItemsLen = tableInsertItems.length;
+ for (var _i3 = 0; _i3 < tableInsertItemsLen; ++_i3) {
+ var insertItem = tableInsertItems[_i3];
+ this.tableInsertHandler(insertItem.owner, insertItem.itemIdx, insertItem.itemData);
+ }
+ break;
+ case _pdu2.default.RCPDU_REG_TABLE_DELETE_PDU:
+ var tableDeleteData = _pdu2.default['RCRegistryTableDeleteItemPdu'].decode(user_data);
+ this.tableDeleteHandler(object_id, tableDeleteData);
+ break;
+ case _pdu2.default.RCPDU_REG_TABLE_UPDATE_PDU:
+ var tableUpdateData = _pdu2.default['RCRegistryTableUpdateItemPdu'].decode(user_data);
+ var tableUpdateItems = tableUpdateData.items;
+ var tableUpdateItemsLen = tableUpdateItems.length;
+ for (var _i4 = 0; _i4 < tableUpdateItemsLen; ++_i4) {
+ var tableItem = tableUpdateItems[_i4];
+ this.tableUpdateHandler(tableItem.owner, tableItem.itemIdx, tableItem.itemData);
+ }
+ break;
+ case _pdu2.default.RCPDU_REG_QUEUE_UPDATE_PDU:
+ case _pdu2.default.RCPDU_REG_QUEUE_DELETE_PDU:
+ case _pdu2.default.RCPDU_REG_QUEUE_INSERT_PDU:
+ loger.warn('REG QUEUE ARE IGNORED');
+ break;
+
+ }
+ }
+ }
+ }, {
+ key: 'rosterInsertHandler',
+ value: function rosterInsertHandler(recordId, recordData) {
+ loger.warn(this._session_name + ' rosterInsertHandler 应有子类具体覆盖处理.');
+ }
+ }, {
+ key: 'rosterUpdateHandler',
+ value: function rosterUpdateHandler(nodeId, nodeData) {
+ loger.warn(this._session_name + ' rosterUpdateHandler 应有子类具体覆盖处理.');
+ }
+ }, {
+ key: 'rosterDelHandler',
+ value: function rosterDelHandler(recordData) {
+ loger.warn(this._session_name + ' rosterDelHandler 应有子类具体覆盖处理.');
+ }
+ }, {
+ key: 'tableInsertHandler',
+ value: function tableInsertHandler(tableId, record) {
+ loger.warn(this._session_name + ' tableInsertHandler 应有子类具体覆盖处理.');
+ }
+ }, {
+ key: 'tableUpdateHandler',
+ value: function tableUpdateHandler(ownerId, recordId, recordData) {
+ loger.warn(this._session_name + ' tableUpdateHandler 应有子类具体覆盖处理.');
+ }
+ }, {
+ key: 'tableDeleteHandler',
+ value: function tableDeleteHandler(tableId, record) {
+ loger.warn(this._session_name + ' tableDelHandler 应有子类具体覆盖处理.');
+ }
+
+ // 加入Session处理
+
+ }, {
+ key: '_joinSessionHandler',
+ value: function _joinSessionHandler(data) {
+ loger.log(this._session_name, ' -> 加入Session');
+ }
+
+ // 加入Channel处理
+
+ }, {
+ key: '_joinChannelHandler',
+ value: function _joinChannelHandler(data) {
+ var joinedChannel = _pdu2.default['RCChannelJoinResponsePdu'].decode(data);
+ if (joinedChannel.result === _pdu2.default.RET_SUCCESS) {
+ loger.log(this._session_name, ' -> 加入Channel成功. ChannelId', joinedChannel.requestedChannelId);
+ this._session_channels[joinedChannel.requestedChannelId] = _ApeConsts2.default.CJS_JOINNED;
+ } else {
+ loger.log(this._session_name, ' -> 加入Channel失败.', joinedChannel);
+ }
+ }
+
+ // 依赖的会议创建完毕 - 发起Ape加入
+
+ }, {
+ key: '_mcuConferenceJoinSuccessHandler',
+ value: function _mcuConferenceJoinSuccessHandler(confInfo) {
+ loger.log('创建Ape->', 'SessionId', this._session_id, 'SessionName', this._session_name, 'SessionTag', this._session_tag);
+
+ // 会议依赖底层会议信息
+ this._confInfo = confInfo;
+
+ var joinSessionPdu = new _pdu2.default['RCSessionJoinRequestPdu']();
+ joinSessionPdu.id = this._session_id;
+ joinSessionPdu.name = this._session_name;
+ joinSessionPdu.tag = this._session_tag;
+ joinSessionPdu.sessionData = this._adapter_pdu.toArrayBuffer();
+ this.sendUniform(joinSessionPdu, true);
+
+ var joinChannelPdu = new _pdu2.default['RCChannelJoinRequestPdu']();
+ joinChannelPdu.initiator = this.mcu.confInfo.nodeId;
+ joinChannelPdu.channelId = this._session_id;
+ this.send(joinChannelPdu);
+ }
+
+ // 注册Key对象
+
+ }, {
+ key: 'registerKey',
+ value: function registerKey(id, name, tag, user_data) {
+ var adapterItemPdu = new _pdu2.default['RCAdapterItemPdu']();
+ adapterItemPdu.type = _pdu2.default.RCPDU_REG_REGISTER_KEY;
+
+ // pack register key pdu
+ var registerKeyPdu = new _pdu2.default['RCRegistryRegisterKeyPdu']();
+ registerKeyPdu.id = id;
+ registerKeyPdu.name = name;
+ registerKeyPdu.tag = tag;
+ if (user_data.length) {
+ registerKeyPdu.userData = user_data;
+ }
+
+ adapterItemPdu.itemData = registerKeyPdu.toArrayBuffer();
+ this._adapter_pdu.item.push(adapterItemPdu);
+ }
+
+ // 注册Object对象
+
+ }, {
+ key: 'registerObj',
+ value: function registerObj(type, id, name, tag, owner, user_data) {
+ var adapterItemPdu = new _pdu2.default['RCAdapterItemPdu']();
+ adapterItemPdu.type = _pdu2.default.RCPDU_REG_REGISTER_OBJ;
+
+ var registerObjPdu = new _pdu2.default['RCRegistryRegisterObjPdu']();
+ registerObjPdu.type = type;
+ registerObjPdu.objId = id;
+ registerObjPdu.name = name;
+ registerObjPdu.tag = tag;
+ if (owner) {
+ registerObjPdu.owner = owner;
+ }
+ if (user_data.length) {
+ registerObjPdu.userData = user_data;
+ }
+
+ adapterItemPdu.itemData = registerObjPdu.toArrayBuffer();
+ this._adapter_pdu.item.push(adapterItemPdu);
+ }
+ }, {
+ key: 'send',
+ value: function send(appPdu) {
+ loger.log('Ape发送数据NORMAL PDU', appPdu);
+ var normalPdu = _pdu2.default.create_normal_pdu(appPdu.type, this._confInfo.nodeId, this._confInfo.confId, this._session_id, this._channel_id, true, true, _PduConsts2.default.DP_TOP, this._confInfo.topNodeID, _PduConsts2.default.SEG_ONCE);
+ normalPdu.data = appPdu.toArrayBuffer();
+ // Mcu发送
+ this.mcu.send(normalPdu);
+ }
+
+ // 发送当前APE(session uniform包)
+
+ }, {
+ key: 'sendUniform',
+ value: function sendUniform(appPdu, top) {
+ loger.log('Ape发送数据UNIFORM PDU', appPdu);
+ var uniformPdu = _pdu2.default.create_uniform_pdu(appPdu.type, this._confInfo.nodeId, this._confInfo.confId, this._session_id, top ? _ApeConsts2.default.BROADCAST_CHANNEL_ID : this._channel_id, true, _PduConsts2.default.DP_TOP, top ? this._confInfo.topNodeID : appPdu.peer || 0, _PduConsts2.default.SEG_ONCE);
+ uniformPdu.data = appPdu.toArrayBuffer();
+ // Mcu发送
+ this.mcu.send(uniformPdu);
+ }
+ }]);
+
+ return Ape;
+ }(_Emiter3.default);
+
+ var _default = Ape;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/Ape.js');
+
+ __REACT_HOT_LOADER__.register(Ape, 'Ape', 'D:/work/McuClient/src/apes/Ape.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/Ape.js');
+ }();
+
+ ;
+
+/***/ },
+/* 42 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ var ArrayBufferUtil = function () {
+ function ArrayBufferUtil() {
+ _classCallCheck(this, ArrayBufferUtil);
+ }
+
+ _createClass(ArrayBufferUtil, null, [{
+ key: "ab2str",
+ value: function ab2str(buf) {
+ return String.fromCharCode.apply(null, new Uint16Array(buf));
+ }
+ }, {
+ key: "str2ab",
+ value: function str2ab(str) {
+ var buf = new ArrayBuffer(str.length * 2); // one char use 2 byte
+ var bufView = new Uint16Array(buf);
+ for (var i = 0, strLen = str.length; i < strLen; i++) {
+ bufView[i] = str.charCodeAt(i);
+ }
+ return buf;
+ }
+ }, {
+ key: "strToUint8Array",
+ value: function strToUint8Array(str) {
+ var out = void 0,
+ i = void 0,
+ len = void 0,
+ c = void 0;
+ out = "";
+ len = str.length;
+ var uintArray = [];
+ for (i = 0; i < len; i++) {
+ c = str.charCodeAt(i);
+ if (c >= 0x0001 && c <= 0x007F) {
+ uintArray.push(c);
+ } else if (c > 0x07FF) {
+ uintArray.push(0xE0 | c >> 12 & 0x0F);
+ uintArray.push(0x80 | c >> 6 & 0x3F);
+ uintArray.push(0x80 | c >> 0 & 0x3F);
+ //out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
+ //out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
+ //out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
+ } else {
+ uintArray.push(0xC0 | c >> 6 & 0x1F);
+ uintArray.push(0x80 | c >> 0 & 0x3F);
+ //out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
+ //out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
+ }
+ }
+ return new Uint8Array(uintArray);
+ }
+ }, {
+ key: "uint8ArrayToStr",
+ value: function uint8ArrayToStr(uint8, index) {
+ var out = void 0,
+ i = void 0,
+ len = void 0,
+ c = void 0;
+ var char2 = void 0,
+ char3 = void 0;
+ out = "";
+ len = uint8.buffer.byteLength;
+ i = uint8.offset + index; //pzm update 前两个字符乱码
+ while (i < uint8.limit) {
+ c = uint8.view[i++];
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ // 0xxxxxxx
+ out += String.fromCharCode(uint8.view[i - 1]);
+ break;
+ case 12:
+ case 13:
+ // 110x xxxx 10xx xxxx
+ char2 = uint8.view[i++];
+ out += String.fromCharCode((c & 0x1F) << 6 | char2 & 0x3F);
+ break;
+ case 14:
+ // 1110 xxxx 10xx xxxx 10xx xxxx
+ char2 = uint8.view[i++];
+ char3 = uint8.view[i++];
+ out += String.fromCharCode((c & 0x0F) << 12 | (char2 & 0x3F) << 6 | (char3 & 0x3F) << 0);
+ break;
+ }
+ }
+ return out;
+ }
+ }]);
+
+ return ArrayBufferUtil;
+ }();
+
+ var _default = ArrayBufferUtil;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(ArrayBufferUtil, "ArrayBufferUtil", "D:/work/McuClient/src/libs/ArrayBufferUtil.js");
+
+ __REACT_HOT_LOADER__.register(_default, "default", "D:/work/McuClient/src/libs/ArrayBufferUtil.js");
+ }();
+
+ ;
+
+/***/ },
+/* 43 */
+/***/ function(module, exports) {
+
+ /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function l(d){throw d;}var v=void 0,x=!0,aa=this;function D(d,a){var c=d.split("."),e=aa;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var b;c.length&&(b=c.shift());)!c.length&&a!==v?e[b]=a:e=e[b]?e[b]:e[b]={}};var F="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function H(d,a){this.index="number"===typeof a?a:0;this.i=0;this.buffer=d instanceof(F?Uint8Array:Array)?d:new (F?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&l(Error("invalid index"));this.buffer.length<=this.index&&this.f()}H.prototype.f=function(){var d=this.buffer,a,c=d.length,e=new (F?Uint8Array:Array)(c<<1);if(F)e.set(d);else for(a=0;a<c;++a)e[a]=d[a];return this.buffer=e};
+ H.prototype.d=function(d,a,c){var e=this.buffer,b=this.index,f=this.i,g=e[b],h;c&&1<a&&(d=8<a?(N[d&255]<<24|N[d>>>8&255]<<16|N[d>>>16&255]<<8|N[d>>>24&255])>>32-a:N[d]>>8-a);if(8>a+f)g=g<<a|d,f+=a;else for(h=0;h<a;++h)g=g<<1|d>>a-h-1&1,8===++f&&(f=0,e[b++]=N[g],g=0,b===e.length&&(e=this.f()));e[b]=g;this.buffer=e;this.i=f;this.index=b};H.prototype.finish=function(){var d=this.buffer,a=this.index,c;0<this.i&&(d[a]<<=8-this.i,d[a]=N[d[a]],a++);F?c=d.subarray(0,a):(d.length=a,c=d);return c};
+ var fa=new (F?Uint8Array:Array)(256),O;for(O=0;256>O;++O){for(var P=O,Q=P,ga=7,P=P>>>1;P;P>>>=1)Q<<=1,Q|=P&1,--ga;fa[O]=(Q<<ga&255)>>>0}var N=fa;function ha(d){this.buffer=new (F?Uint16Array:Array)(2*d);this.length=0}ha.prototype.getParent=function(d){return 2*((d-2)/4|0)};ha.prototype.push=function(d,a){var c,e,b=this.buffer,f;c=this.length;b[this.length++]=a;for(b[this.length++]=d;0<c;)if(e=this.getParent(c),b[c]>b[e])f=b[c],b[c]=b[e],b[e]=f,f=b[c+1],b[c+1]=b[e+1],b[e+1]=f,c=e;else break;return this.length};
+ ha.prototype.pop=function(){var d,a,c=this.buffer,e,b,f;a=c[0];d=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f=0;;){b=2*f+2;if(b>=this.length)break;b+2<this.length&&c[b+2]>c[b]&&(b+=2);if(c[b]>c[f])e=c[f],c[f]=c[b],c[b]=e,e=c[f+1],c[f+1]=c[b+1],c[b+1]=e;else break;f=b}return{index:d,value:a,length:this.length}};function R(d){var a=d.length,c=0,e=Number.POSITIVE_INFINITY,b,f,g,h,k,n,q,r,p,m;for(r=0;r<a;++r)d[r]>c&&(c=d[r]),d[r]<e&&(e=d[r]);b=1<<c;f=new (F?Uint32Array:Array)(b);g=1;h=0;for(k=2;g<=c;){for(r=0;r<a;++r)if(d[r]===g){n=0;q=h;for(p=0;p<g;++p)n=n<<1|q&1,q>>=1;m=g<<16|r;for(p=n;p<b;p+=k)f[p]=m;++h}++g;h<<=1;k<<=1}return[f,c,e]};function ia(d,a){this.h=ma;this.w=0;this.input=F&&d instanceof Array?new Uint8Array(d):d;this.b=0;a&&(a.lazy&&(this.w=a.lazy),"number"===typeof a.compressionType&&(this.h=a.compressionType),a.outputBuffer&&(this.a=F&&a.outputBuffer instanceof Array?new Uint8Array(a.outputBuffer):a.outputBuffer),"number"===typeof a.outputIndex&&(this.b=a.outputIndex));this.a||(this.a=new (F?Uint8Array:Array)(32768))}var ma=2,na={NONE:0,r:1,k:ma,O:3},oa=[],S;
+ for(S=0;288>S;S++)switch(x){case 143>=S:oa.push([S+48,8]);break;case 255>=S:oa.push([S-144+400,9]);break;case 279>=S:oa.push([S-256+0,7]);break;case 287>=S:oa.push([S-280+192,8]);break;default:l("invalid literal: "+S)}
+ ia.prototype.j=function(){var d,a,c,e,b=this.input;switch(this.h){case 0:c=0;for(e=b.length;c<e;){a=F?b.subarray(c,c+65535):b.slice(c,c+65535);c+=a.length;var f=a,g=c===e,h=v,k=v,n=v,q=v,r=v,p=this.a,m=this.b;if(F){for(p=new Uint8Array(this.a.buffer);p.length<=m+f.length+5;)p=new Uint8Array(p.length<<1);p.set(this.a)}h=g?1:0;p[m++]=h|0;k=f.length;n=~k+65536&65535;p[m++]=k&255;p[m++]=k>>>8&255;p[m++]=n&255;p[m++]=n>>>8&255;if(F)p.set(f,m),m+=f.length,p=p.subarray(0,m);else{q=0;for(r=f.length;q<r;++q)p[m++]=
+ f[q];p.length=m}this.b=m;this.a=p}break;case 1:var s=new H(F?new Uint8Array(this.a.buffer):this.a,this.b);s.d(1,1,x);s.d(1,2,x);var w=pa(this,b),y,ja,A;y=0;for(ja=w.length;y<ja;y++)if(A=w[y],H.prototype.d.apply(s,oa[A]),256<A)s.d(w[++y],w[++y],x),s.d(w[++y],5),s.d(w[++y],w[++y],x);else if(256===A)break;this.a=s.finish();this.b=this.a.length;break;case ma:var C=new H(F?new Uint8Array(this.a.buffer):this.a,this.b),Ea,M,U,V,W,gb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ba,Fa,ca,Ga,ka,ra=Array(19),
+ Ha,X,la,z,Ia;Ea=ma;C.d(1,1,x);C.d(Ea,2,x);M=pa(this,b);ba=qa(this.M,15);Fa=sa(ba);ca=qa(this.L,7);Ga=sa(ca);for(U=286;257<U&&0===ba[U-1];U--);for(V=30;1<V&&0===ca[V-1];V--);var Ja=U,Ka=V,I=new (F?Uint32Array:Array)(Ja+Ka),t,J,u,da,G=new (F?Uint32Array:Array)(316),E,B,K=new (F?Uint8Array:Array)(19);for(t=J=0;t<Ja;t++)I[J++]=ba[t];for(t=0;t<Ka;t++)I[J++]=ca[t];if(!F){t=0;for(da=K.length;t<da;++t)K[t]=0}t=E=0;for(da=I.length;t<da;t+=J){for(J=1;t+J<da&&I[t+J]===I[t];++J);u=J;if(0===I[t])if(3>u)for(;0<
+ u--;)G[E++]=0,K[0]++;else for(;0<u;)B=138>u?u:138,B>u-3&&B<u&&(B=u-3),10>=B?(G[E++]=17,G[E++]=B-3,K[17]++):(G[E++]=18,G[E++]=B-11,K[18]++),u-=B;else if(G[E++]=I[t],K[I[t]]++,u--,3>u)for(;0<u--;)G[E++]=I[t],K[I[t]]++;else for(;0<u;)B=6>u?u:6,B>u-3&&B<u&&(B=u-3),G[E++]=16,G[E++]=B-3,K[16]++,u-=B}d=F?G.subarray(0,E):G.slice(0,E);ka=qa(K,7);for(z=0;19>z;z++)ra[z]=ka[gb[z]];for(W=19;4<W&&0===ra[W-1];W--);Ha=sa(ka);C.d(U-257,5,x);C.d(V-1,5,x);C.d(W-4,4,x);for(z=0;z<W;z++)C.d(ra[z],3,x);z=0;for(Ia=d.length;z<
+ Ia;z++)if(X=d[z],C.d(Ha[X],ka[X],x),16<=X){z++;switch(X){case 16:la=2;break;case 17:la=3;break;case 18:la=7;break;default:l("invalid code: "+X)}C.d(d[z],la,x)}var La=[Fa,ba],Ma=[Ga,ca],L,Na,ea,ua,Oa,Pa,Qa,Ra;Oa=La[0];Pa=La[1];Qa=Ma[0];Ra=Ma[1];L=0;for(Na=M.length;L<Na;++L)if(ea=M[L],C.d(Oa[ea],Pa[ea],x),256<ea)C.d(M[++L],M[++L],x),ua=M[++L],C.d(Qa[ua],Ra[ua],x),C.d(M[++L],M[++L],x);else if(256===ea)break;this.a=C.finish();this.b=this.a.length;break;default:l("invalid compression type")}return this.a};
+ function ta(d,a){this.length=d;this.H=a}
+ var va=function(){function d(b){switch(x){case 3===b:return[257,b-3,0];case 4===b:return[258,b-4,0];case 5===b:return[259,b-5,0];case 6===b:return[260,b-6,0];case 7===b:return[261,b-7,0];case 8===b:return[262,b-8,0];case 9===b:return[263,b-9,0];case 10===b:return[264,b-10,0];case 12>=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,
+ b-31,2];case 42>=b:return[273,b-35,3];case 50>=b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:l("invalid length: "+b)}}var a=[],c,e;for(c=3;258>=c;c++)e=d(c),a[c]=e[2]<<24|e[1]<<
+ 16|e[0];return a}(),wa=F?new Uint32Array(va):va;
+ function pa(d,a){function c(b,c){var a=b.H,d=[],e=0,f;f=wa[b.length];d[e++]=f&65535;d[e++]=f>>16&255;d[e++]=f>>24;var g;switch(x){case 1===a:g=[0,a-1,0];break;case 2===a:g=[1,a-2,0];break;case 3===a:g=[2,a-3,0];break;case 4===a:g=[3,a-4,0];break;case 6>=a:g=[4,a-5,1];break;case 8>=a:g=[5,a-7,1];break;case 12>=a:g=[6,a-9,2];break;case 16>=a:g=[7,a-13,2];break;case 24>=a:g=[8,a-17,3];break;case 32>=a:g=[9,a-25,3];break;case 48>=a:g=[10,a-33,4];break;case 64>=a:g=[11,a-49,4];break;case 96>=a:g=[12,a-
+ 65,5];break;case 128>=a:g=[13,a-97,5];break;case 192>=a:g=[14,a-129,6];break;case 256>=a:g=[15,a-193,6];break;case 384>=a:g=[16,a-257,7];break;case 512>=a:g=[17,a-385,7];break;case 768>=a:g=[18,a-513,8];break;case 1024>=a:g=[19,a-769,8];break;case 1536>=a:g=[20,a-1025,9];break;case 2048>=a:g=[21,a-1537,9];break;case 3072>=a:g=[22,a-2049,10];break;case 4096>=a:g=[23,a-3073,10];break;case 6144>=a:g=[24,a-4097,11];break;case 8192>=a:g=[25,a-6145,11];break;case 12288>=a:g=[26,a-8193,12];break;case 16384>=
+ a:g=[27,a-12289,12];break;case 24576>=a:g=[28,a-16385,13];break;case 32768>=a:g=[29,a-24577,13];break;default:l("invalid distance")}f=g;d[e++]=f[0];d[e++]=f[1];d[e++]=f[2];var h,k;h=0;for(k=d.length;h<k;++h)p[m++]=d[h];w[d[0]]++;y[d[3]]++;s=b.length+c-1;r=null}var e,b,f,g,h,k={},n,q,r,p=F?new Uint16Array(2*a.length):[],m=0,s=0,w=new (F?Uint32Array:Array)(286),y=new (F?Uint32Array:Array)(30),ja=d.w,A;if(!F){for(f=0;285>=f;)w[f++]=0;for(f=0;29>=f;)y[f++]=0}w[256]=1;e=0;for(b=a.length;e<b;++e){f=h=0;
+ for(g=3;f<g&&e+f!==b;++f)h=h<<8|a[e+f];k[h]===v&&(k[h]=[]);n=k[h];if(!(0<s--)){for(;0<n.length&&32768<e-n[0];)n.shift();if(e+3>=b){r&&c(r,-1);f=0;for(g=b-e;f<g;++f)A=a[e+f],p[m++]=A,++w[A];break}0<n.length?(q=xa(a,e,n),r?r.length<q.length?(A=a[e-1],p[m++]=A,++w[A],c(q,0)):c(r,-1):q.length<ja?r=q:c(q,0)):r?c(r,-1):(A=a[e],p[m++]=A,++w[A])}n.push(e)}p[m++]=256;w[256]++;d.M=w;d.L=y;return F?p.subarray(0,m):p}
+ function xa(d,a,c){var e,b,f=0,g,h,k,n,q=d.length;h=0;n=c.length;a:for(;h<n;h++){e=c[n-h-1];g=3;if(3<f){for(k=f;3<k;k--)if(d[e+k-1]!==d[a+k-1])continue a;g=f}for(;258>g&&a+g<q&&d[e+g]===d[a+g];)++g;g>f&&(b=e,f=g);if(258===g)break}return new ta(f,a-b)}
+ function qa(d,a){var c=d.length,e=new ha(572),b=new (F?Uint8Array:Array)(c),f,g,h,k,n;if(!F)for(k=0;k<c;k++)b[k]=0;for(k=0;k<c;++k)0<d[k]&&e.push(k,d[k]);f=Array(e.length/2);g=new (F?Uint32Array:Array)(e.length/2);if(1===f.length)return b[e.pop().index]=1,b;k=0;for(n=e.length/2;k<n;++k)f[k]=e.pop(),g[k]=f[k].value;h=ya(g,g.length,a);k=0;for(n=f.length;k<n;++k)b[f[k].index]=h[k];return b}
+ function ya(d,a,c){function e(b){var c=k[b][n[b]];c===a?(e(b+1),e(b+1)):--g[c];++n[b]}var b=new (F?Uint16Array:Array)(c),f=new (F?Uint8Array:Array)(c),g=new (F?Uint8Array:Array)(a),h=Array(c),k=Array(c),n=Array(c),q=(1<<c)-a,r=1<<c-1,p,m,s,w,y;b[c-1]=a;for(m=0;m<c;++m)q<r?f[m]=0:(f[m]=1,q-=r),q<<=1,b[c-2-m]=(b[c-1-m]/2|0)+a;b[0]=f[0];h[0]=Array(b[0]);k[0]=Array(b[0]);for(m=1;m<c;++m)b[m]>2*b[m-1]+f[m]&&(b[m]=2*b[m-1]+f[m]),h[m]=Array(b[m]),k[m]=Array(b[m]);for(p=0;p<a;++p)g[p]=c;for(s=0;s<b[c-1];++s)h[c-
+ 1][s]=d[s],k[c-1][s]=s;for(p=0;p<c;++p)n[p]=0;1===f[c-1]&&(--g[0],++n[c-1]);for(m=c-2;0<=m;--m){w=p=0;y=n[m+1];for(s=0;s<b[m];s++)w=h[m+1][y]+h[m+1][y+1],w>d[p]?(h[m][s]=w,k[m][s]=a,y+=2):(h[m][s]=d[p],k[m][s]=p,++p);n[m]=0;1===f[m]&&e(m)}return g}
+ function sa(d){var a=new (F?Uint16Array:Array)(d.length),c=[],e=[],b=0,f,g,h,k;f=0;for(g=d.length;f<g;f++)c[d[f]]=(c[d[f]]|0)+1;f=1;for(g=16;f<=g;f++)e[f]=b,b+=c[f]|0,b<<=1;f=0;for(g=d.length;f<g;f++){b=e[d[f]];e[d[f]]+=1;h=a[f]=0;for(k=d[f];h<k;h++)a[f]=a[f]<<1|b&1,b>>>=1}return a};function T(d,a){this.l=[];this.m=32768;this.e=this.g=this.c=this.q=0;this.input=F?new Uint8Array(d):d;this.s=!1;this.n=za;this.C=!1;if(a||!(a={}))a.index&&(this.c=a.index),a.bufferSize&&(this.m=a.bufferSize),a.bufferType&&(this.n=a.bufferType),a.resize&&(this.C=a.resize);switch(this.n){case Aa:this.b=32768;this.a=new (F?Uint8Array:Array)(32768+this.m+258);break;case za:this.b=0;this.a=new (F?Uint8Array:Array)(this.m);this.f=this.K;this.t=this.I;this.o=this.J;break;default:l(Error("invalid inflate mode"))}}
+ var Aa=0,za=1,Ba={F:Aa,D:za};
+ T.prototype.p=function(){for(;!this.s;){var d=Y(this,3);d&1&&(this.s=x);d>>>=1;switch(d){case 0:var a=this.input,c=this.c,e=this.a,b=this.b,f=a.length,g=v,h=v,k=e.length,n=v;this.e=this.g=0;c+1>=f&&l(Error("invalid uncompressed block header: LEN"));g=a[c++]|a[c++]<<8;c+1>=f&&l(Error("invalid uncompressed block header: NLEN"));h=a[c++]|a[c++]<<8;g===~h&&l(Error("invalid uncompressed block header: length verify"));c+g>a.length&&l(Error("input buffer is broken"));switch(this.n){case Aa:for(;b+g>e.length;){n=
+ k-b;g-=n;if(F)e.set(a.subarray(c,c+n),b),b+=n,c+=n;else for(;n--;)e[b++]=a[c++];this.b=b;e=this.f();b=this.b}break;case za:for(;b+g>e.length;)e=this.f({v:2});break;default:l(Error("invalid inflate mode"))}if(F)e.set(a.subarray(c,c+g),b),b+=g,c+=g;else for(;g--;)e[b++]=a[c++];this.c=c;this.b=b;this.a=e;break;case 1:this.o(Ca,Da);break;case 2:Sa(this);break;default:l(Error("unknown BTYPE: "+d))}}return this.t()};
+ var Ta=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ua=F?new Uint16Array(Ta):Ta,Va=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],Wa=F?new Uint16Array(Va):Va,Xa=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Ya=F?new Uint8Array(Xa):Xa,Za=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],$a=F?new Uint16Array(Za):Za,ab=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,
+ 10,11,11,12,12,13,13],bb=F?new Uint8Array(ab):ab,cb=new (F?Uint8Array:Array)(288),Z,db;Z=0;for(db=cb.length;Z<db;++Z)cb[Z]=143>=Z?8:255>=Z?9:279>=Z?7:8;var Ca=R(cb),eb=new (F?Uint8Array:Array)(30),fb,hb;fb=0;for(hb=eb.length;fb<hb;++fb)eb[fb]=5;var Da=R(eb);function Y(d,a){for(var c=d.g,e=d.e,b=d.input,f=d.c,g=b.length,h;e<a;)f>=g&&l(Error("input buffer is broken")),c|=b[f++]<<e,e+=8;h=c&(1<<a)-1;d.g=c>>>a;d.e=e-a;d.c=f;return h}
+ function ib(d,a){for(var c=d.g,e=d.e,b=d.input,f=d.c,g=b.length,h=a[0],k=a[1],n,q;e<k&&!(f>=g);)c|=b[f++]<<e,e+=8;n=h[c&(1<<k)-1];q=n>>>16;d.g=c>>q;d.e=e-q;d.c=f;return n&65535}
+ function Sa(d){function a(a,b,c){var d,e=this.z,f,g;for(g=0;g<a;)switch(d=ib(this,b),d){case 16:for(f=3+Y(this,2);f--;)c[g++]=e;break;case 17:for(f=3+Y(this,3);f--;)c[g++]=0;e=0;break;case 18:for(f=11+Y(this,7);f--;)c[g++]=0;e=0;break;default:e=c[g++]=d}this.z=e;return c}var c=Y(d,5)+257,e=Y(d,5)+1,b=Y(d,4)+4,f=new (F?Uint8Array:Array)(Ua.length),g,h,k,n;for(n=0;n<b;++n)f[Ua[n]]=Y(d,3);if(!F){n=b;for(b=f.length;n<b;++n)f[Ua[n]]=0}g=R(f);h=new (F?Uint8Array:Array)(c);k=new (F?Uint8Array:Array)(e);
+ d.z=0;d.o(R(a.call(d,c,g,h)),R(a.call(d,e,g,k)))}T.prototype.o=function(d,a){var c=this.a,e=this.b;this.u=d;for(var b=c.length-258,f,g,h,k;256!==(f=ib(this,d));)if(256>f)e>=b&&(this.b=e,c=this.f(),e=this.b),c[e++]=f;else{g=f-257;k=Wa[g];0<Ya[g]&&(k+=Y(this,Ya[g]));f=ib(this,a);h=$a[f];0<bb[f]&&(h+=Y(this,bb[f]));e>=b&&(this.b=e,c=this.f(),e=this.b);for(;k--;)c[e]=c[e++-h]}for(;8<=this.e;)this.e-=8,this.c--;this.b=e};
+ T.prototype.J=function(d,a){var c=this.a,e=this.b;this.u=d;for(var b=c.length,f,g,h,k;256!==(f=ib(this,d));)if(256>f)e>=b&&(c=this.f(),b=c.length),c[e++]=f;else{g=f-257;k=Wa[g];0<Ya[g]&&(k+=Y(this,Ya[g]));f=ib(this,a);h=$a[f];0<bb[f]&&(h+=Y(this,bb[f]));e+k>b&&(c=this.f(),b=c.length);for(;k--;)c[e]=c[e++-h]}for(;8<=this.e;)this.e-=8,this.c--;this.b=e};
+ T.prototype.f=function(){var d=new (F?Uint8Array:Array)(this.b-32768),a=this.b-32768,c,e,b=this.a;if(F)d.set(b.subarray(32768,d.length));else{c=0;for(e=d.length;c<e;++c)d[c]=b[c+32768]}this.l.push(d);this.q+=d.length;if(F)b.set(b.subarray(a,a+32768));else for(c=0;32768>c;++c)b[c]=b[a+c];this.b=32768;return b};
+ T.prototype.K=function(d){var a,c=this.input.length/this.c+1|0,e,b,f,g=this.input,h=this.a;d&&("number"===typeof d.v&&(c=d.v),"number"===typeof d.G&&(c+=d.G));2>c?(e=(g.length-this.c)/this.u[2],f=258*(e/2)|0,b=f<h.length?h.length+f:h.length<<1):b=h.length*c;F?(a=new Uint8Array(b),a.set(h)):a=h;return this.a=a};
+ T.prototype.t=function(){var d=0,a=this.a,c=this.l,e,b=new (F?Uint8Array:Array)(this.q+(this.b-32768)),f,g,h,k;if(0===c.length)return F?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);f=0;for(g=c.length;f<g;++f){e=c[f];h=0;for(k=e.length;h<k;++h)b[d++]=e[h]}f=32768;for(g=this.b;f<g;++f)b[d++]=a[f];this.l=[];return this.buffer=b};
+ T.prototype.I=function(){var d,a=this.b;F?this.C?(d=new Uint8Array(a),d.set(this.a.subarray(0,a))):d=this.a.subarray(0,a):(this.a.length>a&&(this.a.length=a),d=this.a);return this.buffer=d};function jb(d){if("string"===typeof d){var a=d.split(""),c,e;c=0;for(e=a.length;c<e;c++)a[c]=(a[c].charCodeAt(0)&255)>>>0;d=a}for(var b=1,f=0,g=d.length,h,k=0;0<g;){h=1024<g?1024:g;g-=h;do b+=d[k++],f+=b;while(--h);b%=65521;f%=65521}return(f<<16|b)>>>0};function kb(d,a){var c,e;this.input=d;this.c=0;if(a||!(a={}))a.index&&(this.c=a.index),a.verify&&(this.N=a.verify);c=d[this.c++];e=d[this.c++];switch(c&15){case lb:this.method=lb;break;default:l(Error("unsupported compression method"))}0!==((c<<8)+e)%31&&l(Error("invalid fcheck flag:"+((c<<8)+e)%31));e&32&&l(Error("fdict flag is not supported"));this.B=new T(d,{index:this.c,bufferSize:a.bufferSize,bufferType:a.bufferType,resize:a.resize})}
+ kb.prototype.p=function(){var d=this.input,a,c;a=this.B.p();this.c=this.B.c;this.N&&(c=(d[this.c++]<<24|d[this.c++]<<16|d[this.c++]<<8|d[this.c++])>>>0,c!==jb(a)&&l(Error("invalid adler-32 checksum")));return a};var lb=8;function mb(d,a){this.input=d;this.a=new (F?Uint8Array:Array)(32768);this.h=$.k;var c={},e;if((a||!(a={}))&&"number"===typeof a.compressionType)this.h=a.compressionType;for(e in a)c[e]=a[e];c.outputBuffer=this.a;this.A=new ia(this.input,c)}var $=na;
+ mb.prototype.j=function(){var d,a,c,e,b,f,g,h=0;g=this.a;d=lb;switch(d){case lb:a=Math.LOG2E*Math.log(32768)-8;break;default:l(Error("invalid compression method"))}c=a<<4|d;g[h++]=c;switch(d){case lb:switch(this.h){case $.NONE:b=0;break;case $.r:b=1;break;case $.k:b=2;break;default:l(Error("unsupported compression type"))}break;default:l(Error("invalid compression method"))}e=b<<6|0;g[h++]=e|31-(256*c+e)%31;f=jb(this.input);this.A.b=h;g=this.A.j();h=g.length;F&&(g=new Uint8Array(g.buffer),g.length<=
+ h+4&&(this.a=new Uint8Array(g.length+4),this.a.set(g),g=this.a),g=g.subarray(0,h+4));g[h++]=f>>24&255;g[h++]=f>>16&255;g[h++]=f>>8&255;g[h++]=f&255;return g};function nb(d,a){var c,e,b,f;if(Object.keys)c=Object.keys(a);else for(e in c=[],b=0,a)c[b++]=e;b=0;for(f=c.length;b<f;++b)e=c[b],D(d+"."+e,a[e])};D("Zlib.Inflate",kb);D("Zlib.Inflate.prototype.decompress",kb.prototype.p);nb("Zlib.Inflate.BufferType",{ADAPTIVE:Ba.D,BLOCK:Ba.F});D("Zlib.Deflate",mb);D("Zlib.Deflate.compress",function(d,a){return(new mb(d,a)).j()});D("Zlib.Deflate.prototype.compress",mb.prototype.j);nb("Zlib.Deflate.CompressionType",{NONE:$.NONE,FIXED:$.r,DYNAMIC:$.k});}).call(this); //@ sourceMappingURL=zlib.min.js.map
+
+
+/***/ },
+/* 44 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(module) {// UTF8 : Manage UTF-8 strings in ArrayBuffers
+ if(module.require) {
+ __webpack_require__(45);
+ __webpack_require__(46);
+ }
+
+ var UTF8={
+ // non UTF8 encoding detection (cf README file for details)
+ 'isNotUTF8': function(bytes, byteOffset, byteLength) {
+ try {
+ UTF8.getStringFromBytes(bytes, byteOffset, byteLength, true);
+ } catch(e) {
+ return true;
+ }
+ return false;
+ },
+ // UTF8 decoding functions
+ 'getCharLength': function(theByte) {
+ // 4 bytes encoded char (mask 11110000)
+ if(0xF0 == (theByte&0xF0)) {
+ return 4;
+ // 3 bytes encoded char (mask 11100000)
+ } else if(0xE0 == (theByte&0xE0)) {
+ return 3;
+ // 2 bytes encoded char (mask 11000000)
+ } else if(0xC0 == (theByte&0xC0)) {
+ return 2;
+ // 1 bytes encoded char
+ } else if(theByte == (theByte&0x7F)) {
+ return 1;
+ }
+ return 0;
+ },
+ 'getCharCode': function(bytes, byteOffset, charLength) {
+ var charCode = 0, mask = '';
+ byteOffset = byteOffset || 0;
+ // Retrieve charLength if not given
+ charLength = charLength || UTF8.getCharLength(bytes[byteOffset]);
+ if(charLength == 0) {
+ throw new Error(bytes[byteOffset].toString(2)+' is not a significative' +
+ ' byte (offset:'+byteOffset+').');
+ }
+ // Return byte value if charlength is 1
+ if(1 === charLength) {
+ return bytes[byteOffset];
+ }
+ // Test UTF8 integrity
+ mask = '00000000'.slice(0, charLength) + 1 + '00000000'.slice(charLength + 1);
+ if(bytes[byteOffset]&(parseInt(mask, 2))) {
+ throw Error('Index ' + byteOffset + ': A ' + charLength + ' bytes' +
+ ' encoded char' +' cannot encode the '+(charLength+1)+'th rank bit to 1.');
+ }
+ // Reading the first byte
+ mask='0000'.slice(0,charLength+1)+'11111111'.slice(charLength+1);
+ charCode+=(bytes[byteOffset]&parseInt(mask,2))<<((--charLength)*6);
+ // Reading the next bytes
+ while(charLength) {
+ if(0x80!==(bytes[byteOffset+1]&0x80)
+ ||0x40===(bytes[byteOffset+1]&0x40)) {
+ throw Error('Index '+(byteOffset+1)+': Next bytes of encoded char'
+ +' must begin with a "10" bit sequence.');
+ }
+ charCode += ((bytes[++byteOffset]&0x3F) << ((--charLength) * 6));
+ }
+ return charCode;
+ },
+ 'getStringFromBytes': function(bytes, byteOffset, byteLength, strict) {
+ var charLength, chars = [];
+ byteOffset = byteOffset|0;
+ byteLength=('number' === typeof byteLength ?
+ byteLength :
+ bytes.byteLength || bytes.length
+ );
+ for(; byteOffset < byteLength; byteOffset++) {
+ charLength = UTF8.getCharLength(bytes[byteOffset]);
+ if(byteOffset + charLength > byteLength) {
+ if(strict) {
+ throw Error('Index ' + byteOffset + ': Found a ' + charLength +
+ ' bytes encoded char declaration but only ' +
+ (byteLength - byteOffset) +' bytes are available.');
+ }
+ } else {
+ chars.push(String.fromCodePoint(
+ UTF8.getCharCode(bytes, byteOffset, charLength, strict)
+ ));
+ }
+ byteOffset += charLength - 1;
+ }
+ return chars.join('');
+ },
+ // UTF8 encoding functions
+ 'getBytesForCharCode': function(charCode) {
+ if(charCode < 128) {
+ return 1;
+ } else if(charCode < 2048) {
+ return 2;
+ } else if(charCode < 65536) {
+ return 3;
+ } else if(charCode < 2097152) {
+ return 4;
+ }
+ throw new Error('CharCode '+charCode+' cannot be encoded with UTF8.');
+ },
+ 'setBytesFromCharCode': function(charCode, bytes, byteOffset, neededBytes) {
+ charCode = charCode|0;
+ bytes = bytes || [];
+ byteOffset = byteOffset|0;
+ neededBytes = neededBytes || UTF8.getBytesForCharCode(charCode);
+ // Setting the charCode as it to bytes if the byte length is 1
+ if(1 == neededBytes) {
+ bytes[byteOffset] = charCode;
+ } else {
+ // Computing the first byte
+ bytes[byteOffset++] =
+ (parseInt('1111'.slice(0, neededBytes), 2) << 8 - neededBytes) +
+ (charCode >>> ((--neededBytes) * 6));
+ // Computing next bytes
+ for(;neededBytes>0;) {
+ bytes[byteOffset++] = ((charCode>>>((--neededBytes) * 6))&0x3F)|0x80;
+ }
+ }
+ return bytes;
+ },
+ 'setBytesFromString': function(string, bytes, byteOffset, byteLength, strict) {
+ string = string || '';
+ bytes = bytes || [];
+ byteOffset = byteOffset|0;
+ byteLength = ('number' === typeof byteLength ?
+ byteLength :
+ bytes.byteLength||Infinity
+ );
+ for(var i = 0, j = string.length; i < j; i++) {
+ var neededBytes = UTF8.getBytesForCharCode(string[i].codePointAt(0));
+ if(strict && byteOffset + neededBytes > byteLength) {
+ throw new Error('Not enought bytes to encode the char "' + string[i] +
+ '" at the offset "' + byteOffset + '".');
+ }
+ UTF8.setBytesFromCharCode(string[i].codePointAt(0),
+ bytes, byteOffset, neededBytes, strict);
+ byteOffset += neededBytes;
+ }
+ return bytes;
+ }
+ };
+
+ if(true) {
+ module.exports = UTF8;
+ }
+
+
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
+
+/***/ },
+/* 45 */
+/***/ function(module, exports) {
+
+ /*! http://mths.be/fromcodepoint v0.2.1 by @mathias */
+ if (!String.fromCodePoint) {
+ (function() {
+ var defineProperty = (function() {
+ // IE 8 only supports `Object.defineProperty` on DOM elements
+ try {
+ var object = {};
+ var $defineProperty = Object.defineProperty;
+ var result = $defineProperty(object, object, object) && $defineProperty;
+ } catch(error) {}
+ return result;
+ }());
+ var stringFromCharCode = String.fromCharCode;
+ var floor = Math.floor;
+ var fromCodePoint = function(_) {
+ var MAX_SIZE = 0x4000;
+ var codeUnits = [];
+ var highSurrogate;
+ var lowSurrogate;
+ var index = -1;
+ var length = arguments.length;
+ if (!length) {
+ return '';
+ }
+ var result = '';
+ while (++index < length) {
+ var codePoint = Number(arguments[index]);
+ if (
+ !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
+ codePoint < 0 || // not a valid Unicode code point
+ codePoint > 0x10FFFF || // not a valid Unicode code point
+ floor(codePoint) != codePoint // not an integer
+ ) {
+ throw RangeError('Invalid code point: ' + codePoint);
+ }
+ if (codePoint <= 0xFFFF) { // BMP code point
+ codeUnits.push(codePoint);
+ } else { // Astral code point; split in surrogate halves
+ // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ codePoint -= 0x10000;
+ highSurrogate = (codePoint >> 10) + 0xD800;
+ lowSurrogate = (codePoint % 0x400) + 0xDC00;
+ codeUnits.push(highSurrogate, lowSurrogate);
+ }
+ if (index + 1 == length || codeUnits.length > MAX_SIZE) {
+ result += stringFromCharCode.apply(null, codeUnits);
+ codeUnits.length = 0;
+ }
+ }
+ return result;
+ };
+ if (defineProperty) {
+ defineProperty(String, 'fromCodePoint', {
+ 'value': fromCodePoint,
+ 'configurable': true,
+ 'writable': true
+ });
+ } else {
+ String.fromCodePoint = fromCodePoint;
+ }
+ }());
+ }
+
+
+/***/ },
+/* 46 */
+/***/ function(module, exports) {
+
+ /*! http://mths.be/codepointat v0.2.0 by @mathias */
+ if (!String.prototype.codePointAt) {
+ (function() {
+ 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
+ var defineProperty = (function() {
+ // IE 8 only supports `Object.defineProperty` on DOM elements
+ try {
+ var object = {};
+ var $defineProperty = Object.defineProperty;
+ var result = $defineProperty(object, object, object) && $defineProperty;
+ } catch(error) {}
+ return result;
+ }());
+ var codePointAt = function(position) {
+ if (this == null) {
+ throw TypeError();
+ }
+ var string = String(this);
+ var size = string.length;
+ // `ToInteger`
+ var index = position ? Number(position) : 0;
+ if (index != index) { // better `isNaN`
+ index = 0;
+ }
+ // Account for out-of-bounds indices:
+ if (index < 0 || index >= size) {
+ return undefined;
+ }
+ // Get the first code unit
+ var first = string.charCodeAt(index);
+ var second;
+ if ( // check if it’s the start of a surrogate pair
+ first >= 0xD800 && first <= 0xDBFF && // high surrogate
+ size > index + 1 // there is a next code unit
+ ) {
+ second = string.charCodeAt(index + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
+ // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return first;
+ };
+ if (defineProperty) {
+ defineProperty(String.prototype, 'codePointAt', {
+ 'value': codePointAt,
+ 'configurable': true,
+ 'writable': true
+ });
+ } else {
+ String.prototype.codePointAt = codePointAt;
+ }
+ }());
+ }
+
+
+/***/ },
+/* 47 */
+/***/ function(module, exports) {
+
+ 'use strict'
+
+ exports.byteLength = byteLength
+ exports.toByteArray = toByteArray
+ exports.fromByteArray = fromByteArray
+
+ var lookup = []
+ var revLookup = []
+ var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
+
+ var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+ for (var i = 0, len = code.length; i < len; ++i) {
+ lookup[i] = code[i]
+ revLookup[code.charCodeAt(i)] = i
+ }
+
+ revLookup['-'.charCodeAt(0)] = 62
+ revLookup['_'.charCodeAt(0)] = 63
+
+ function placeHoldersCount (b64) {
+ var len = b64.length
+ if (len % 4 > 0) {
+ throw new Error('Invalid string. Length must be a multiple of 4')
+ }
+
+ // the number of equal signs (place holders)
+ // if there are two placeholders, than the two characters before it
+ // represent one byte
+ // if there is only one, then the three characters before it represent 2 bytes
+ // this is just a cheap hack to not do indexOf twice
+ return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
+ }
+
+ function byteLength (b64) {
+ // base64 is 4/3 + up to two characters of the original data
+ return b64.length * 3 / 4 - placeHoldersCount(b64)
+ }
+
+ function toByteArray (b64) {
+ var i, j, l, tmp, placeHolders, arr
+ var len = b64.length
+ placeHolders = placeHoldersCount(b64)
+
+ arr = new Arr(len * 3 / 4 - placeHolders)
+
+ // if there are placeholders, only get up to the last complete 4 chars
+ l = placeHolders > 0 ? len - 4 : len
+
+ var L = 0
+
+ for (i = 0, j = 0; i < l; i += 4, j += 3) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
+ arr[L++] = (tmp >> 16) & 0xFF
+ arr[L++] = (tmp >> 8) & 0xFF
+ arr[L++] = tmp & 0xFF
+ }
+
+ if (placeHolders === 2) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
+ arr[L++] = tmp & 0xFF
+ } else if (placeHolders === 1) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
+ arr[L++] = (tmp >> 8) & 0xFF
+ arr[L++] = tmp & 0xFF
+ }
+
+ return arr
+ }
+
+ function tripletToBase64 (num) {
+ return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
+ }
+
+ function encodeChunk (uint8, start, end) {
+ var tmp
+ var output = []
+ for (var i = start; i < end; i += 3) {
+ tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
+ output.push(tripletToBase64(tmp))
+ }
+ return output.join('')
+ }
+
+ function fromByteArray (uint8) {
+ var tmp
+ var len = uint8.length
+ var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+ var output = ''
+ var parts = []
+ var maxChunkLength = 16383 // must be multiple of 3
+
+ // go through the array every three bytes, we'll deal with trailing stuff later
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
+ }
+
+ // pad the end with zeros, but make sure to not forget the extra bytes
+ if (extraBytes === 1) {
+ tmp = uint8[len - 1]
+ output += lookup[tmp >> 2]
+ output += lookup[(tmp << 4) & 0x3F]
+ output += '=='
+ } else if (extraBytes === 2) {
+ tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
+ output += lookup[tmp >> 10]
+ output += lookup[(tmp >> 4) & 0x3F]
+ output += lookup[(tmp << 2) & 0x3F]
+ output += '='
+ }
+
+ parts.push(output)
+
+ return parts.join('')
+ }
+
+
+/***/ },
+/* 48 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Ape2 = __webpack_require__(41);
+
+ var _Ape3 = _interopRequireDefault(_Ape2);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _EngineUtils = __webpack_require__(49);
+
+ var _EngineUtils2 = _interopRequireDefault(_EngineUtils);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-14 15:55:42
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-06 16:28:14
+ // Description: LiveClass-ChatApe
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('ChatApe');
+
+ var ChatApe = function (_Ape) {
+ _inherits(ChatApe, _Ape);
+
+ function ChatApe() {
+ _classCallCheck(this, ChatApe);
+
+ //Ape Models
+ var _this = _possibleConstructorReturn(this, (ChatApe.__proto__ || Object.getPrototypeOf(ChatApe)).call(this, _ApeConsts2.default.CHAT_SESSION_ID, _ApeConsts2.default.CHAT_SESSION_NAME, _ApeConsts2.default.CHAT_SESSION_TAG));
+
+ _this.registerKey(_this._session_id, _this._session_name, _this._session_tag, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_TABLE, _ApeConsts2.default.CHAT_OBJ_TABLE_ID, _ApeConsts2.default.CHAT_OBJ_TABLE_NAME, _ApeConsts2.default.CHAT_OBJ_TABLE_TAG, 0, new ArrayBuffer());
+
+ // ape listeners
+ _this.on(_pdu2.default.RCPDU_CHAT_SEND_DATA_REQUEST, _this.chatMsgIncomingHandler.bind(_this));
+ return _this;
+ }
+
+ //chatMsgIncomingHandler(pdu) {
+ //
+ //}
+
+ _createClass(ChatApe, [{
+ key: 'sendChatMsg',
+ value: function sendChatMsg(_messageInfo) {
+ if (this._confInfo === null || _EngineUtils2.default.isEmptyObject(this._confInfo)) {
+ loger.log('不能发送聊天消息.McuClient还未初始化数据!');
+ return;
+ }
+
+ // to, message
+ loger.log('发送聊天消息.', _messageInfo.to, _messageInfo.message);
+
+ var chatSendPdu = new _pdu2.default['RCChatSendDataRequestPdu']();
+ chatSendPdu.type = _pdu2.default.RCPDU_CHAT_SEND_DATA_REQUEST;
+ chatSendPdu.initiator = this._confInfo.nodeId; //发起人
+ chatSendPdu.peer = parseInt(_messageInfo.to); //发送给谁,公聊的时候是0,私聊的时候是指定的用户id
+ chatSendPdu.isPublic = true;
+ chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" + _messageInfo.message);
+ chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName);
+ chatSendPdu.fromRole = this._confInfo.classRole;
+
+ if (!(chatSendPdu.isPublic || 0 === chatSendPdu.peer)) {
+ //发送给制定的人
+ this.send(chatSendPdu);
+ } else {
+ //发送给所有人
+ this.sendUniform(chatSendPdu);
+ }
+ }
+ }, {
+ key: 'chatMsgIncomingHandler',
+ value: function chatMsgIncomingHandler(chatBuffer) {
+ var chatReceivePdu = _pdu2.default['RCChatSendDataRequestPdu'].decode(chatBuffer);
+
+ var chatMsg = {};
+ chatMsg.fromNodeID = chatReceivePdu.initiator;
+ chatMsg.toNodeID = chatReceivePdu.peer;
+ chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2);
+ chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2);
+ chatMsg.fromRole = chatReceivePdu.fromRole;
+
+ loger.log('接收聊天消息.', chatMsg);
+
+ this._emit(_MessageTypes2.default.CHAT_RECEIVE, chatMsg);
+ }
+ }]);
+
+ return ChatApe;
+ }(_Ape3.default);
+
+ var _default = ChatApe;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/ChatApe.js');
+
+ __REACT_HOT_LOADER__.register(ChatApe, 'ChatApe', 'D:/work/McuClient/src/apes/ChatApe.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/ChatApe.js');
+ }();
+
+ ;
+
+/***/ },
+/* 49 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ /**
+ * Created by hoopoe8 on 2017/1/8.
+ */
+
+ var EngineUtils = function () {
+ function EngineUtils() {
+ _classCallCheck(this, EngineUtils);
+ }
+
+ _createClass(EngineUtils, null, [{
+ key: "isEmptyObject",
+ value: function isEmptyObject(O) {
+ for (var x in O) {
+ return false;
+ }
+ return true;
+ }
+ }]);
+
+ return EngineUtils;
+ }();
+
+ var _default = EngineUtils;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(EngineUtils, "EngineUtils", "D:/work/McuClient/src/EngineUtils.js");
+
+ __REACT_HOT_LOADER__.register(_default, "default", "D:/work/McuClient/src/EngineUtils.js");
+ }();
+
+ ;
+
+/***/ },
+/* 50 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Ape2 = __webpack_require__(41);
+
+ var _Ape3 = _interopRequireDefault(_Ape2);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-23 18:07:28
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-06 11:13:59
+ // Description: LiveClass-VideoApe
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('VideoChat');
+
+ var VideoChat = function (_Ape) {
+ _inherits(VideoChat, _Ape);
+
+ function VideoChat() {
+ _classCallCheck(this, VideoChat);
+
+ //Attributes
+ var _this = _possibleConstructorReturn(this, (VideoChat.__proto__ || Object.getPrototypeOf(VideoChat)).call(this, _ApeConsts2.default.VIDEO_SESSION_ID, _ApeConsts2.default.VIDEO_SESSION_NAME, _ApeConsts2.default.VIDEO_SESSION_TAG));
+
+ _this.videoChannels = {};
+ _this.activeChannelId = 0;
+ _this.activeURL = '';
+
+ // Ape Models
+ _this.registerKey(_this._session_id, _this._session_name, _this._session_tag, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_TABLE, _ApeConsts2.default.VIDEO_OBJ_TABLE_ID, _ApeConsts2.default.VIDEO_OBJ_TABLE_NAME, _ApeConsts2.default.VIDEO_OBJ_TABLE_TAG, 0, new ArrayBuffer());
+
+ // ape listeners
+ _this.on(_pdu2.default.RCPDU_VIDEO_SEND_DATA_REQUEST, _this.videoIncomingHandler.bind(_this));
+ return _this;
+ }
+
+ // 视频消息处理
+
+
+ _createClass(VideoChat, [{
+ key: 'videoIncomingHandler',
+ value: function videoIncomingHandler(videoBuffer) {
+ var videoReceivePdu = _pdu2.default['VideoSendDataRequestPdu'].decode(videoBuffer);
+
+ var video_data = {};
+ video_data._initiator = videoReceivePdu.initiator;
+ video_data._is_key_frame = videoReceivePdu.keyFrame;
+ video_data._sequence_id = videoReceivePdu.sequenceId;
+ video_data._slice_id = videoReceivePdu.sliceId;
+ video_data._data = videoReceivePdu.userData;
+
+ // this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data);
+ loger.log('视频消息处理 videoIncomingHandler.', video_data);
+ this._emit(_MessageTypes2.default.VIDEO_SHOW, video_data);
+ }
+ }, {
+ key: 'tableUpdateHandler',
+ value: function tableUpdateHandler(ownerId, channelId, channelInfo) {
+
+ // debugger;
+ var videoChannelInfo = _pdu2.default['RCVideoChannelInfoRecordPdu'].decode(channelInfo);
+ videoChannelInfo.owner = ownerId;
+ videoChannelInfo.channelId = channelId;
+ videoChannelInfo.status = ownerId === 0 ? _ApeConsts2.default.CGS_RELEASED : videoChannelInfo.status;
+
+ loger.log('视频消息处理 tableUpdateHandler.', videoChannelInfo);
+
+ this.videoChannels[channelId] = videoChannelInfo;
+ switch (videoChannelInfo.status) {
+ case _ApeConsts2.default.CGS_RELEASED:
+ case _ApeConsts2.default.CGS_PENDING:
+ case _ApeConsts2.default.CGS_GRABBING:
+ // 只能关闭自己的流
+ if (this.activeChannelId === videoChannelInfo.channelId) {
+ this.activeChannelId = 0;
+ this.activeURL = '';
+ this.emitVideoChange();
+ }
+ break;
+ case _ApeConsts2.default.CGS_OPENNED:
+ this.activeChannelId = videoChannelInfo.channelId;
+ // AMS
+ if (this._confInfo.msType === '1') {
+
+ this.activeURL = 'http://dazhi.3mang.com/live/' + this._confInfo.confId + '/' + this._confInfo.confId + '_' + videoChannelInfo.channelId + '_flash_cam_mic_aac/playlist.m3u8';
+ } else {
+ this.activeURL = 'http://hls.3mang.com/live/' + this._confInfo.confId + '_' + videoChannelInfo.channelId + '_flash_cam_mic_aac/playlist.m3u8';
+ }
+ // 任何人都可以打开流
+ this.emitVideoChange();
+ break;
+ }
+ }
+ }, {
+ key: 'emitVideoChange',
+ value: function emitVideoChange() {
+
+ this._emit(_MessageTypes2.default.VIDEO_SHOW, {
+ activeChannelId: this.activeChannelId,
+ HLSURL: this.activeURL
+ });
+ }
+ }]);
+
+ return VideoChat;
+ }(_Ape3.default);
+
+ var _default = VideoChat;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/VideoApe.js');
+
+ __REACT_HOT_LOADER__.register(VideoChat, 'VideoChat', 'D:/work/McuClient/src/apes/VideoApe.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/VideoApe.js');
+ }();
+
+ ;
+
+/***/ },
+/* 51 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Ape2 = __webpack_require__(41);
+
+ var _Ape3 = _interopRequireDefault(_Ape2);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-26 17:30:43
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-21 14:12:25
+ // Description: LiveClass-DocApe
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('DocApe');
+
+ var DocApe = function (_Ape) {
+ _inherits(DocApe, _Ape);
+
+ function DocApe() {
+ _classCallCheck(this, DocApe);
+
+ var _this = _possibleConstructorReturn(this, (DocApe.__proto__ || Object.getPrototypeOf(DocApe)).call(this, _ApeConsts2.default.DOCSHARING_SESSION_ID, _ApeConsts2.default.DOCSHARING_SESSION_NAME, _ApeConsts2.default.DOCSHARING_SESSION_TAG));
+
+ _this.docList = {};
+
+ // Ape Models
+ _this.registerKey(_this._session_id, _this._session_name, _this._session_tag, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_TABLE, _ApeConsts2.default.DOCSHARING_OBJ_TABLE_ID_H5, _ApeConsts2.default.DOCSHARING_OBJ_TABLE_NAME_H5, _ApeConsts2.default.DOCSHARING_OBJ_TABLE_TAG_H5, 0, new ArrayBuffer());
+
+ // 延迟
+ _this._apeDelayed = true;
+ return _this;
+ }
+
+ _createClass(DocApe, [{
+ key: 'tableInsertHandler',
+ value: function tableInsertHandler(owner, tableId, recordData) {
+ this.tableUpdateHandler(owner, tableId, recordData);
+ }
+ }, {
+ key: 'tableDeleteHandler',
+ value: function tableDeleteHandler(tableId, record) {
+ var re = {};
+ re.type = _ApeConsts2.default.DOCUMENT_DEL;
+ this._emit(_MessageTypes2.default.DOC_DEL, re);
+ }
+ }, {
+ key: 'tableUpdateHandler',
+ value: function tableUpdateHandler(owner, recordId, recordData) {
+ try {
+ var recordInfo = _pdu2.default['RCDocSendDataRequestPdu'].decode(recordData);
+ recordInfo.type = _ApeConsts2.default.DOCUMENT_LOAD;
+
+ recordInfo.ext = recordInfo.name.substr(recordInfo.name.indexOf('.') + 1);
+ recordInfo.wbid = (recordInfo.id << 10) + recordInfo.curPageNo;
+ recordInfo.isPicture = ~['bmp', 'png', 'gif', 'jpg', 'jpeg'].indexOf(recordInfo.ext);
+
+ if (recordInfo.isPicture) {
+ recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('.'));
+ recordInfo.loadURL = recordInfo.namePath + '.' + recordInfo.ext;
+ } else {
+ recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('/'));
+ recordInfo.loadURL = recordInfo.namePath + '/' + recordInfo.curPageNo + '.jpg';
+ }
+ this.docList[recordId] = recordInfo;
+ this._emit(_MessageTypes2.default.DOC_UPDATE, recordInfo);
+ loger.log('Doc update ->' + recordId);
+ } catch (e) {
+ loger.warn('Doc Table Update Decode包异常');
+ }
+ }
+ }]);
+
+ return DocApe;
+ }(_Ape3.default);
+
+ var _default = DocApe;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/DocApe.js');
+
+ __REACT_HOT_LOADER__.register(DocApe, 'DocApe', 'D:/work/McuClient/src/apes/DocApe.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/DocApe.js');
+ }();
+
+ ;
+
+/***/ },
+/* 52 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+ var _Ape2 = __webpack_require__(41);
+
+ var _Ape3 = _interopRequireDefault(_Ape2);
+
+ var _ApeConsts = __webpack_require__(39);
+
+ var _ApeConsts2 = _interopRequireDefault(_ApeConsts);
+
+ var _pdu = __webpack_require__(28);
+
+ var _pdu2 = _interopRequireDefault(_pdu);
+
+ var _Loger = __webpack_require__(19);
+
+ var _Loger2 = _interopRequireDefault(_Loger);
+
+ var _MessageTypes = __webpack_require__(20);
+
+ var _MessageTypes2 = _interopRequireDefault(_MessageTypes);
+
+ var _zlib = __webpack_require__(43);
+
+ var _utf = __webpack_require__(44);
+
+ var _utf2 = _interopRequireDefault(_utf);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // //////////////////////////////////////////////////////////////////////////////
+ //
+ // Copyright (C) 2016-present All Rights Reserved.
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Github Home: https://github.com/AlexWang1987
+ // Author: AlexWang
+ // Date: 2016-08-26 17:36:20
+ // QQ Email: 1669499355@qq.com
+ // Last Modified time: 2016-09-21 14:06:12
+ // Description: LiveClass-WhiteBoardApe
+ //
+ // //////////////////////////////////////////////////////////////////////////////
+
+ var loger = _Loger2.default.getLoger('WhiteBoardApe');
+
+ var WhiteBoardApe = function (_Ape) {
+ _inherits(WhiteBoardApe, _Ape);
+
+ function WhiteBoardApe() {
+ _classCallCheck(this, WhiteBoardApe);
+
+ // properties
+ var _this = _possibleConstructorReturn(this, (WhiteBoardApe.__proto__ || Object.getPrototypeOf(WhiteBoardApe)).call(this, _ApeConsts2.default.WHITEBOARD_SESSION_ID, _ApeConsts2.default.WHITEBOARD_SESSION_NAME, _ApeConsts2.default.WHITEBOARD_SESSION_TAG));
+
+ _this.annoInfos = {};
+
+ //Ape Models
+ _this.registerKey(_this._session_id, _this._session_name, _this._session_tag, new ArrayBuffer());
+ _this.registerObj(_pdu2.default.RCPDU_REG_REGISTER_TABLE, _ApeConsts2.default.WHITEBOARD_OBJ_TABLE_ID, _ApeConsts2.default.WHITEBOARD_OBJ_TABLE_NAME, _ApeConsts2.default.WHITEBOARD_OBJ_TABLE_TAG, 0, new ArrayBuffer());
+
+ // ape listeners
+ _this.on(_pdu2.default.RCPDU_CONFERENCE_SEND_DATA_REQUEST, _this.whiteboardMsgComingHandler.bind(_this));
+
+ // 白板延迟
+ _this._apeDelayed = true;
+ return _this;
+ }
+
+ _createClass(WhiteBoardApe, [{
+ key: 'whiteboardMsgComingHandler',
+ value: function whiteboardMsgComingHandler(pdu) {
+ loger.warn('whiteboardMsgComingHandler needs to be handled.');
+ }
+ }, {
+ key: 'tableInsertHandler',
+ value: function tableInsertHandler(tableId, record) {
+ this.emitDocChange(_ApeConsts2.default.DOCUMENT_DEL);
+ }
+ }, {
+ key: 'tableUpdateHandler',
+ value: function tableUpdateHandler(owner, recordId, recordData) {
+ var recordInfo = _pdu2.default['RCWhiteboardDataRequestPdu'].decode(recordData);
+ // 目前只处理 文档标注
+ if (recordInfo.type == _ApeConsts2.default.WBA_DOC_ANNOTATION) {
+ var uncompressedBytes = new _zlib.Zlib.Inflate(recordInfo.action.compact().view).decompress();
+ var annoInfo = {
+ id: recordId,
+ svg: _utf2.default.getStringFromBytes(uncompressedBytes)
+ };
+ this.annoInfos[recordId] = annoInfo;
+ this._emit(_MessageTypes2.default.ANNO_UPDATE, annoInfo);
+ } else {
+ loger.log('白板动作忽略,类型:', (0, _ApeConsts2.default)(recordInfo.type));
+ }
+ }
+ }]);
+
+ return WhiteBoardApe;
+ }(_Ape3.default);
+
+ var _default = WhiteBoardApe;
+ exports.default = _default;
+ ;
+
+ var _temp = function () {
+ if (typeof __REACT_HOT_LOADER__ === 'undefined') {
+ return;
+ }
+
+ __REACT_HOT_LOADER__.register(loger, 'loger', 'D:/work/McuClient/src/apes/WhiteBoardApe.js');
+
+ __REACT_HOT_LOADER__.register(WhiteBoardApe, 'WhiteBoardApe', 'D:/work/McuClient/src/apes/WhiteBoardApe.js');
+
+ __REACT_HOT_LOADER__.register(_default, 'default', 'D:/work/McuClient/src/apes/WhiteBoardApe.js');
+ }();
+
+ ;
+
+/***/ }
+/******/ ])
+});
+;
\ No newline at end of file
diff --git a/src/EngineEntrance.js b/src/EngineEntrance.js
index 8010453..913ac16 100644
--- a/src/EngineEntrance.js
+++ b/src/EngineEntrance.js
@@ -106,7 +106,7 @@ export default class MessageEntrance extends Emiter {
//获取课堂校验信息
if(_sass){
- _sass.sassGetJoinParams(GlobalConfig.getConfInfo());
+ _sass.getJoinParams(GlobalConfig.getConfInfo());
}
}
@@ -131,7 +131,7 @@ export default class MessageEntrance extends Emiter {
//开始校验
if(_sass){
- _sass.sassChecking(GlobalConfig.getConfInfo());
+ _sass.passwordAndMd5Checking(GlobalConfig.getConfInfo());
}
}
// 离开会议
diff --git a/src/Sass.js b/src/Sass.js
index 440922c..d1bf6d3 100644
--- a/src/Sass.js
+++ b/src/Sass.js
@@ -7,7 +7,6 @@ import MD5 from "md5";
const loger = Loger.getLoger('Sass');
let confInfo = {};
-let initInfo={};
class Sass extends Emiter {
constructor() {
super();
@@ -15,7 +14,7 @@ class Sass extends Emiter {
//Sass 接口
//----1.校验之前的接口-----
- //sassGetJoinParams 获取课堂校验信息 let url = `http://${_initInfo.portal}/3m/api/meeting/joinParams.do?meetingNumber=${_initInfo.confId}&userID=${_initInfo.userId}`;
+ //getJoinParams 获取课堂校验信息 let url = `http://${_initInfo.portal}/3m/api/meeting/joinParams.do?meetingNumber=${_initInfo.confId}&userID=${_initInfo.userId}`;
//-----2.开始校验,如果有密码先校验密码,否则直接开始MD5验证-----
//sendPWDChecking入会密码校验 let url = `http://${confInfo.portal}/3m/getCheckMeetinig.do?siteId=${confInfo.siteId}&classId=${confInfo.confId}&password=${confInfo.password}`;
@@ -27,7 +26,7 @@ class Sass extends Emiter {
//Sass获取课堂校验信息
- sassGetJoinParams(_initInfo) {
+ getJoinParams(_initInfo) {
loger.log('Sass获取课堂校验信息', _initInfo);
/* 获取用于加入课堂的参数
/3m/api/meeting/joinParams.do
@@ -78,7 +77,7 @@ class Sass extends Emiter {
}
// Sass校验开始
- sassChecking(_param) {
+ passwordAndMd5Checking(_param) {
loger.log('发起Sass校验', _param);
confInfo = _param;
// 密码校验
diff --git a/src/apes/ChatApe.js b/src/apes/ChatApe.js
index 9d83d9c..1972200 100644
--- a/src/apes/ChatApe.js
+++ b/src/apes/ChatApe.js
@@ -62,8 +62,10 @@ class ChatApe extends Ape {
chatSendPdu.fromRole = this._confInfo.classRole;
if (!(chatSendPdu.isPublic || 0 === chatSendPdu.peer)) {
+ //发送给制定的人
this.send(chatSendPdu);
} else {
+ //发送给所有人
this.sendUniform(chatSendPdu);
}
}
diff --git a/src/apes/ConferApe.js b/src/apes/ConferApe.js
index 020316e..e27ea52 100644
--- a/src/apes/ConferApe.js
+++ b/src/apes/ConferApe.js
@@ -110,6 +110,7 @@ class ConferApe extends Ape {
this.rosterUpdateHandler(nodeId, nodeData);
}
+ //更新人员列表数据
rosterUpdateHandler(nodeId, nodeData) {
if (nodeData.role === ApeConsts.NR_MASTER ||
nodeData.role === ApeConsts.NR_SLAVE) {
diff --git a/src/apes/VideoApe.js b/src/apes/VideoApe.js
index 04a62fa..03dd227 100644
--- a/src/apes/VideoApe.js
+++ b/src/apes/VideoApe.js
@@ -59,18 +59,21 @@ class VideoChat extends Ape {
// this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data);
- loger.log('接受视频消息.', video_data);
+ loger.log('视频消息处理 videoIncomingHandler.', video_data);
this._emit(MessageTypes.VIDEO_SHOW, video_data);
}
tableUpdateHandler(ownerId, channelId, channelInfo) {
+
// debugger;
let videoChannelInfo = pdu['RCVideoChannelInfoRecordPdu'].decode(channelInfo);
videoChannelInfo.owner = ownerId;
videoChannelInfo.channelId = channelId;
videoChannelInfo.status = ownerId === 0 ? ApeConsts.CGS_RELEASED : videoChannelInfo.status;
+ loger.log('视频消息处理 tableUpdateHandler.',videoChannelInfo);
+
this.videoChannels[channelId] = videoChannelInfo;
switch (videoChannelInfo.status) {
case ApeConsts.CGS_RELEASED:
@@ -101,6 +104,7 @@ class VideoChat extends Ape {
}
emitVideoChange() {
+
this._emit(MessageTypes.VIDEO_SHOW, {
activeChannelId: this.activeChannelId,
HLSURL: this.activeURL,
diff --git a/src/mcu.js b/src/mcu.js
index ee10a5b..140edd5 100644
--- a/src/mcu.js
+++ b/src/mcu.js
@@ -31,6 +31,11 @@ class MCU extends Emiter {
// EverSocket建立通道完毕
_everSocketOpenHandler() {
+ this._sendJoinClassRequest();
+ }
+
+ //MCU-发送加入会议请求
+ _sendJoinClassRequest(){
loger.log('MCU-发送加入会议请求.');
const confInfo = this.confInfo;
@@ -50,15 +55,15 @@ class MCU extends Emiter {
joinRequestPdu.confDesc = descriptorPdu;
let pduMsg = pdu.create_connect_provider_request_pdu(
- joinRequestPdu.type,
+ joinRequestPdu.type,
confInfo.nodeId,
confInfo.confId,
- 0,
- ApeConsts.BROADCAST_CHANNEL_ID,
- true,
- PduConsts.DP_TOP,
+ 0,
+ ApeConsts.BROADCAST_CHANNEL_ID,
+ true,
+ PduConsts.DP_TOP,
confInfo.topNodeID,
- PduConsts.SEG_ONCE
+ PduConsts.SEG_ONCE
);
pduMsg.set("site", confInfo.siteId);
@@ -78,22 +83,24 @@ class MCU extends Emiter {
let pduData = pduMsg.get("data");
loger.log('MCU-FirstLayer封装消息', 'type', pdu.id2type(pduMsg.type), pduMsg.type, 'sessionId', ApeConsts(pduMsg.sessionId), pduMsg.sessionId);
switch (pduType) {
- case PduType.RCPDU_CONNECT_PROVIDER_RESPONSE:
- let joinConfPdu = pdu['RCConferenceJoinResponsePdu'].decode(pduData);
- let pduResultCode = joinConfPdu.get("result");
- switch (pduResultCode) {
- case PduConsts.RET_SUCCESS:
- this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc"));
- this._emit(MessageTypes.CLASS_JOIN_SUCCESS, this.confInfo);
- break;
- case PduConsts.RET_FULL_CAPACITY:
- this._emit(MessageTypes.CLASS_JOIN_FAILED,MessageTypes.ERROR_CLASS_JOIN_FULL);
- //this._emit(MessageTypes.CLASS_JOIN_FULL);
- break;
-
- default:
- loger.warn('JoinConfPdu-未知类型-等待处理.', pduResultCode);
- }
+ case PduType.RCPDU_CONNECT_PROVIDER_RESPONSE:
+ //加入会议请求返回数据处理
+ let joinConfPdu = pdu['RCConferenceJoinResponsePdu'].decode(pduData);
+ let pduResultCode = joinConfPdu.get("result");
+ switch (pduResultCode) {
+ case PduConsts.RET_SUCCESS:
+ //加入成功
+ this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc"));
+ this._emit(MessageTypes.CLASS_JOIN_SUCCESS, this.confInfo);
+ break;
+ case PduConsts.RET_FULL_CAPACITY:
+ this._emit(MessageTypes.CLASS_JOIN_FAILED,MessageTypes.ERROR_CLASS_JOIN_FULL);
+ //this._emit(MessageTypes.CLASS_JOIN_FULL);
+ break;
+ default:
+ loger.arn('JoinConfPdu-未知类型-等待处理.', pduResultCode);
+ break
+ }
break;
case PduType.RCPDU_SEND_DATA_REQUEST:
let ape = this._apes[pduMsg.sessionId];
@@ -101,6 +108,7 @@ class MCU extends Emiter {
if (ape) {
let subTypeLabel = pdu.id2type(pduMsg.subType);
loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType);
+ loger.log("ape._emit("+pduMsg.subType+", "+pduMsg.data+")---------------------------");
ape._emit(pduMsg.subType, pduMsg.data);
} else {
loger.warn(sessionLabel + '尚未注册');
diff --git a/src/pdu/index.js b/src/pdu/index.js
index 3bf6477..c191a41 100644
--- a/src/pdu/index.js
+++ b/src/pdu/index.js
@@ -48,6 +48,7 @@ pdu.create_connect_provider_request_pdu = function (
reliability, priority, peer, seg);
};
+ //upward 是否向顶层抛 create_uniform_pdu默认为true
pdu.create_uniform_pdu = function (
sub_type,
initiator,
@@ -64,6 +65,7 @@ pdu.create_uniform_pdu = function (
reliability, priority, peer, seg);
};
+//upward 是否向顶层抛 create_normal_pdu 中由外部定义
pdu.create_normal_pdu = function (
sub_type,
initiator,