@rongcloud/engine 4.4.9 → 5.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1576 -1481
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RCEngine={})}(this,(function(e){"use strict";var t;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(t||(t={}));var n=t,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){var t={exports:{}};return e(t,t.exports),t.exports}var s=function(e){return e&&e.Math==Math&&e},o=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof r&&r)||function(){return this}()||Function("return this")(),a=function(e){try{return!!e()}catch(e){return!0}},u=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,h={f:l&&!c.call({1:2},1)?function(e){var t=l(this,e);return!!t&&t.enumerable}:c},f=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},d={}.toString,p=function(e){return d.call(e).slice(8,-1)},v="".split,y=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?v.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},_=function(e){return y(m(e))},E=function(e){return"object"==typeof e?null!==e:"function"==typeof e},T=function(e,t){if(!E(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!E(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},R=function(e){return Object(m(e))},I={}.hasOwnProperty,C=function(e,t){return I.call(R(e),t)},S=o.document,b=E(S)&&E(S.createElement),w=function(e){return b?S.createElement(e):{}},N=!u&&!a((function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a})),O=Object.getOwnPropertyDescriptor,k={f:u?O:function(e,t){if(e=_(e),t=T(t,!0),N)try{return O(e,t)}catch(e){}if(C(e,t))return f(!h.f.call(e,t),e[t])}},A=function(e){if(!E(e))throw TypeError(String(e)+" is not an object");return e},M=Object.defineProperty,x={f:u?M:function(e,t,n){if(A(e),t=T(t,!0),A(n),N)try{return M(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},L=u?function(e,t,n){return x.f(e,t,f(1,n))}:function(e,t,n){return e[t]=n,e},U=function(e,t){try{L(o,e,t)}catch(n){o[e]=t}return t},P="__core-js_shared__",D=o[P]||U(P,{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return V.call(e)});var B,F,j,Y=D.inspectSource,q=o.WeakMap,G="function"==typeof q&&/native code/.test(Y(q)),H=i((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),K=0,W=Math.random(),Q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++K+W).toString(36)},J=H("keys"),z=function(e){return J[e]||(J[e]=Q(e))},Z={},$="Object already initialized",X=o.WeakMap;if(G){var ee=D.state||(D.state=new X),te=ee.get,ne=ee.has,re=ee.set;B=function(e,t){if(ne.call(ee,e))throw new TypeError($);return t.facade=e,re.call(ee,e,t),t},F=function(e){return te.call(ee,e)||{}},j=function(e){return ne.call(ee,e)}}else{var ie=z("state");Z[ie]=!0,B=function(e,t){if(C(e,ie))throw new TypeError($);return t.facade=e,L(e,ie,t),t},F=function(e){return C(e,ie)?e[ie]:{}},j=function(e){return C(e,ie)}}var se={set:B,get:F,has:j,enforce:function(e){return j(e)?F(e):B(e,{})},getterFor:function(e){return function(t){var n;if(!E(t)||(n=F(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},oe=i((function(e){var t=se.get,n=se.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a,u=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||C(i,"name")||L(i,"name",t),(a=n(i)).source||(a.source=r.join("string"==typeof t?t:""))),e!==o?(u?!l&&e[t]&&(c=!0):delete e[t],c?e[t]=i:L(e,t,i)):c?e[t]=i:U(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||Y(this)}))})),ae=o,ue=function(e){return"function"==typeof e?e:void 0},ce=function(e,t){return arguments.length<2?ue(ae[e])||ue(o[e]):ae[e]&&ae[e][t]||o[e]&&o[e][t]},le=Math.ceil,he=Math.floor,fe=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)},de=Math.min,ge=function(e){return e>0?de(fe(e),9007199254740991):0},pe=Math.max,ve=Math.min,ye=function(e,t){var n=fe(e);return n<0?pe(n+t,0):ve(n,t)},me=function(e){return function(t,n,r){var i,s=_(t),o=ge(s.length),a=ye(r,o);if(e&&n!=n){for(;o>a;)if((i=s[a++])!=i)return!0}else for(;o>a;a++)if((e||a in s)&&s[a]===n)return e||a||0;return!e&&-1}},_e={includes:me(!0),indexOf:me(!1)},Ee=_e.indexOf,Te=function(e,t){var n,r=_(e),i=0,s=[];for(n in r)!C(Z,n)&&C(r,n)&&s.push(n);for(;t.length>i;)C(r,n=t[i++])&&(~Ee(s,n)||s.push(n));return s},Re=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ie=Re.concat("length","prototype"),Ce={f:Object.getOwnPropertyNames||function(e){return Te(e,Ie)}},Se={f:Object.getOwnPropertySymbols},be=ce("Reflect","ownKeys")||function(e){var t=Ce.f(A(e)),n=Se.f;return n?t.concat(n(e)):t},we=function(e,t){for(var n=be(t),r=x.f,i=k.f,s=0;s<n.length;s++){var o=n[s];C(e,o)||r(e,o,i(t,o))}},Ne=/#|\.prototype\./,Oe=function(e,t){var n=Ae[ke(e)];return n==xe||n!=Me&&("function"==typeof t?a(t):!!t)},ke=Oe.normalize=function(e){return String(e).replace(Ne,".").toLowerCase()},Ae=Oe.data={},Me=Oe.NATIVE="N",xe=Oe.POLYFILL="P",Le=Oe,Ue=k.f,Pe=function(e,t){var n,r,i,s,a,u=e.target,c=e.global,l=e.stat;if(n=c?o:l?o[u]||U(u,{}):(o[u]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=Ue(n,r))&&a.value:n[r],!Le(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;we(s,i)}(e.sham||i&&i.sham)&&L(s,"sham",!0),oe(n,r,s,e)}},De=function(){var e=A(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function Ve(e,t){return RegExp(e,t)}var Be={UNSUPPORTED_Y:a((function(){var e=Ve("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:a((function(){var e=Ve("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Fe=RegExp.prototype.exec,je=H("native-string-replace",String.prototype.replace),Ye=Fe,qe=function(){var e=/a/,t=/b*/g;return Fe.call(e,"a"),Fe.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ge=Be.UNSUPPORTED_Y||Be.BROKEN_CARET,He=void 0!==/()??/.exec("")[1];(qe||He||Ge)&&(Ye=function(e){var t,n,r,i,s=this,o=Ge&&s.sticky,a=De.call(s),u=s.source,c=0,l=e;return o&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(e).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==e[s.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,c++),n=new RegExp("^(?:"+u+")",a)),He&&(n=new RegExp("^"+u+"$(?!\\s)",a)),qe&&(t=s.lastIndex),r=Fe.call(o?n:s,l),o?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=s.lastIndex,s.lastIndex+=r[0].length):s.lastIndex=0:qe&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),He&&r&&r.length>1&&je.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var Ke=Ye;Pe({target:"RegExp",proto:!0,forced:/./.exec!==Ke},{exec:Ke});var We,Qe,Je="process"==p(o.process),ze=ce("navigator","userAgent")||"",Ze=o.process,$e=Ze&&Ze.versions,Xe=$e&&$e.v8;Xe?Qe=(We=Xe.split("."))[0]+We[1]:ze&&(!(We=ze.match(/Edge\/(\d+)/))||We[1]>=74)&&(We=ze.match(/Chrome\/(\d+)/))&&(Qe=We[1]);var et=Qe&&+Qe,tt=!!Object.getOwnPropertySymbols&&!a((function(){return!Symbol.sham&&(Je?38===et:et>37&&et<41)})),nt=tt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rt=H("wks"),it=o.Symbol,st=nt?it:it&&it.withoutSetter||Q,ot=function(e){return C(rt,e)&&(tt||"string"==typeof rt[e])||(tt&&C(it,e)?rt[e]=it[e]:rt[e]=st("Symbol."+e)),rt[e]},at=ot("species"),ut=!a((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),ct="$0"==="a".replace(/./,"$0"),lt=ot("replace"),ht=!!/./[lt]&&""===/./[lt]("a","$0"),ft=!a((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),dt=function(e,t,n,r){var i=ot(e),s=!a((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=s&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[at]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!o||"replace"===e&&(!ut||!ct||ht)||"split"===e&&!ft){var u=/./[i],c=n(i,""[e],(function(e,t,n,r,i){return t.exec===RegExp.prototype.exec?s&&!i?{done:!0,value:u.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:ct,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:ht}),l=c[0],h=c[1];oe(String.prototype,e,l),oe(RegExp.prototype,i,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}r&&L(RegExp.prototype[i],"sham",!0)},gt=function(e){return function(t,n){var r,i,s=String(m(t)),o=fe(n),a=s.length;return o<0||o>=a?e?"":void 0:(r=s.charCodeAt(o))<55296||r>56319||o+1===a||(i=s.charCodeAt(o+1))<56320||i>57343?e?s.charAt(o):r:e?s.slice(o,o+2):i-56320+(r-55296<<10)+65536}},pt={codeAt:gt(!1),charAt:gt(!0)},vt=pt.charAt,yt=function(e,t,n){return t+(n?vt(e,t).length:1)},mt=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return Ke.call(e,t)};function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Et(e,t,n,r,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function Tt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){Et(s,r,i,o,a,"next",e)}function a(e){Et(s,r,i,o,a,"throw",e)}o(void 0)}))}}function Rt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(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)}}function Ct(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&kt(e,t)}function Ot(e){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function kt(e,t){return(kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Mt(e,t,n){return(Mt=At()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&kt(i,n.prototype),i}).apply(null,arguments)}function xt(e){var t="function"==typeof Map?new Map:void 0;return(xt=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Mt(e,arguments,Ot(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),kt(r,e)})(e)}function Lt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ut(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Lt(e):t}function Pt(e){var t=At();return function(){var n,r=Ot(e);if(t){var i=Ot(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ut(this,n)}}function Dt(e,t,n){return(Dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ot(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw i}}return s}(e,t)||Ft(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e){return function(e){if(Array.isArray(e))return jt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e,t){if(e){if("string"==typeof e)return jt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jt(e,t):void 0}}function jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}dt("match",1,(function(e,t,n){return[function(t){var n=m(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=A(e),s=String(this);if(!i.global)return mt(i,s);var o=i.unicode;i.lastIndex=0;for(var a,u=[],c=0;null!==(a=mt(i,s));){var l=String(a[0]);u[c]=l,""===l&&(i.lastIndex=yt(s,ge(i.lastIndex),o)),c++}return 0===c?null:u}]}));var Yt=Array.isArray||function(e){return"Array"==p(e)},qt=function(e,t,n){var r=T(t);r in e?x.f(e,r,f(0,n)):e[r]=n},Gt=ot("species"),Ht=function(e,t){var n;return Yt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Yt(n.prototype)?E(n)&&null===(n=n[Gt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Kt=ot("species"),Wt=function(e){return et>=51||!a((function(){var t=[];return(t.constructor={})[Kt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qt=ot("isConcatSpreadable"),Jt=9007199254740991,zt="Maximum allowed index exceeded",Zt=et>=51||!a((function(){var e=[];return e[Qt]=!1,e.concat()[0]!==e})),$t=Wt("concat"),Xt=function(e){if(!E(e))return!1;var t=e[Qt];return void 0!==t?!!t:Yt(e)};Pe({target:"Array",proto:!0,forced:!Zt||!$t},{concat:function(e){var t,n,r,i,s,o=R(this),a=Ht(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(Xt(s=-1===t?o:arguments[t])){if(u+(i=ge(s.length))>Jt)throw TypeError(zt);for(n=0;n<i;n++,u++)n in s&&qt(a,u,s[n])}else{if(u>=Jt)throw TypeError(zt);qt(a,u++,s)}return a.length=u,a}});var en,tn,nn=72e5,rn=5e3,sn=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],on=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],an=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],un=3e4,cn=131072,ln="RCV4-",hn={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"RC:FileMsg":{isCounted:!0,isPersited:!0},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1}},fn=["RC:TypSts"];e.CONNECTION_TYPE=void 0,(en=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",en.COMET="comet";var dn=function(e){return tn||(tn={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),tn},gn=function(){function e(t){Rt(this,e),this._caches={},t&&(this._caches=t)}return Ct(e,[{key:"set",value:function(e,t){this._caches[e]=t}},{key:"remove",value:function(e){var t=this.get(e);return delete this._caches[e],t}},{key:"get",value:function(e){return this._caches[e]}},{key:"getKeys",value:function(){var e=[];for(var t in this._caches)e.push(t);return e}}]),e}(),pn=function(){function e(t,n){Rt(this,e);var r=n?"".concat(ln).concat(n):ln;this._rootStorage=dn(t);var i=this._rootStorage.get(r)||{};this._cache=new gn(St({},r,i)),this._storageKey=r}return Ct(e,[{key:"_get",value:function(){var e=this._storageKey;return this._cache.get(e)||{}}},{key:"_set",value:function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)}},{key:"set",value:function(e,t){var n=this._get();n[e]=t,this._set(n)}},{key:"remove",value:function(e){var t=this._get();delete t[e],this._set(t)}},{key:"clear",value:function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)}},{key:"get",value:function(e){return this._get()[e]}},{key:"getKeys",value:function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t}},{key:"getValues",value:function(){return this._get()||{}}}]),e}(),vn=function(e){Nt(n,e);var t=Pt(n);function n(e){return Rt(this,n),t.call(this,"TODO => ".concat(e))}return n}(xt(Error)),yn=Wt("slice"),mn=ot("species"),_n=[].slice,En=Math.max;Pe({target:"Array",proto:!0,forced:!yn},{slice:function(e,t){var n,r,i,s=_(this),o=ge(s.length),a=ye(e,o),u=ye(void 0===t?o:t,o);if(Yt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!Yt(n.prototype)?E(n)&&null===(n=n[mn])&&(n=void 0):n=void 0,n===Array||void 0===n))return _n.call(s,a,u);for(r=new(void 0===n?Array:n)(En(u-a,0)),i=0;a<u;a++,i++)a in s&&qt(r,i,s[a]);return r.length=i,r}});var Tn=Math.floor,Rn="".replace,In=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Cn=/\$([$&'`]|\d{1,2})/g,Sn=function(e,t,n,r,i,s){var o=n+e.length,a=r.length,u=Cn;return void 0!==i&&(i=R(i),u=In),Rn.call(s,u,(function(s,u){var c;switch(u.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":c=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return s;if(l>a){var h=Tn(l/10);return 0===h?s:h<=a?void 0===r[h-1]?u.charAt(1):r[h-1]+u.charAt(1):s}c=r[l-1]}return void 0===c?"":c}))},bn=Math.max,wn=Math.min;dt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=m(this),s=null==n?void 0:n[e];return void 0!==s?s.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&s||"string"==typeof r&&-1===r.indexOf(o)){var a=n(t,e,this,r);if(a.done)return a.value}var u=A(e),c=String(this),l="function"==typeof r;l||(r=String(r));var h=u.global;if(h){var f=u.unicode;u.lastIndex=0}for(var d=[];;){var g=mt(u,c);if(null===g)break;if(d.push(g),!h)break;""===String(g[0])&&(u.lastIndex=yt(c,ge(u.lastIndex),f))}for(var p,v="",y=0,m=0;m<d.length;m++){g=d[m];for(var _=String(g[0]),E=bn(wn(fe(g.index),c.length),0),T=[],R=1;R<g.length;R++)T.push(void 0===(p=g[R])?p:String(p));var I=g.groups;if(l){var C=[_].concat(T,E,c);void 0!==I&&C.push(I);var S=String(r.apply(void 0,C))}else S=Sn(_,c,E,T,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var Nn=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},On=function(e,t,n){if(Nn(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},kn=[].push,An=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,o=7==e,a=5==e||s;return function(u,c,l,h){for(var f,d,g=R(u),p=y(g),v=On(c,l,3),m=ge(p.length),_=0,E=h||Ht,T=t?E(u,m):n||o?E(u,0):void 0;m>_;_++)if((a||_ in p)&&(d=v(f=p[_],_,g),e))if(t)T[_]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:kn.call(T,f)}else switch(e){case 4:return!1;case 7:kn.call(T,f)}return s?-1:r||i?i:T}},Mn={forEach:An(0),map:An(1),filter:An(2),some:An(3),every:An(4),find:An(5),findIndex:An(6),filterOut:An(7)},xn=Mn.filter,Ln=Wt("filter");Pe({target:"Array",proto:!0,forced:!Ln},{filter:function(e){return xn(this,e,arguments.length>1?arguments[1]:void 0)}});var Un=Mn.map,Pn=Wt("map");Pe({target:"Array",proto:!0,forced:!Pn},{map:function(e){return Un(this,e,arguments.length>1?arguments[1]:void 0)}});var Dn=Object.keys||function(e){return Te(e,Re)},Vn=a((function(){Dn(1)}));Pe({target:"Object",stat:!0,forced:Vn},{keys:function(e){return Dn(R(e))}});var Bn=function(e,t){var n=[][e];return!!n&&a((function(){n.call(null,t||function(){throw 1},1)}))},Fn=[].join,jn=y!=Object,Yn=Bn("join",",");Pe({target:"Array",proto:!0,forced:jn||!Yn},{join:function(e){return Fn.call(_(this),void 0===e?",":e)}});var qn=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},Gn=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8",r=0;if("utf-16"===n)for(var i=0,s=e.length;i<s;i++)r+=(t=e.charCodeAt(i))<=65535?2:4;else for(var o=0,a=e.length;o<a;o++)r+=(t=e.charCodeAt(o))<127?1:t<=2047?2:t<=65535?3:4;return r},Hn=function(e){return e.match(/\d+(\.\d+){2}/)[0]};i((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),o=new N(r||[]);return s._invoke=function(e,t,n){var r=h;return function(i,s){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw s;return k()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:f,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,o),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",d="executing",g="completed",p={};function v(){}function y(){}function m(){}var _={};_[s]=function(){return this};var E=Object.getPrototypeOf,T=E&&E(E(O([])));T&&T!==n&&r.call(T,s)&&(_=T);var R=m.prototype=v.prototype=Object.create(_);function I(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,s,o,a){var u=l(e[i],e,s);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,o,a)}),(function(e){n("throw",e,o,a)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,a)}))}a(u.arg)}var i;this._invoke=function(e,r){function s(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(s,s):s()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var s=i.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function O(e){if(e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=R.constructor=m,m.constructor=y,y.displayName=u(m,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,a,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},I(C.prototype),C.prototype[o]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var o=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(R),u(R,a,"Generator"),R[s]=function(){return this},R.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));var Kn=x.f,Wn=Function.prototype,Qn=Wn.toString,Jn=/^\s*function ([^ (]*)/,zn="name";u&&!(zn in Wn)&&Kn(Wn,zn,{configurable:!0,get:function(){try{return Qn.call(this).match(Jn)[1]}catch(e){return""}}});var Zn,$n=u?Object.defineProperties:function(e,t){A(e);for(var n,r=Dn(t),i=r.length,s=0;i>s;)x.f(e,n=r[s++],t[n]);return e},Xn=ce("document","documentElement"),er=z("IE_PROTO"),tr=function(){},nr=function(e){return"<script>"+e+"</"+"script>"},rr=function(){try{Zn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;rr=Zn?function(e){e.write(nr("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Zn):((t=w("iframe")).style.display="none",Xn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(nr("document.F=Object")),e.close(),e.F);for(var n=Re.length;n--;)delete rr.prototype[Re[n]];return rr()};Z[er]=!0;var ir=Object.create||function(e,t){var n;return null!==e?(tr.prototype=A(e),n=new tr,tr.prototype=null,n[er]=e):n=rr(),void 0===t?n:$n(n,t)},sr=ot("unscopables"),or=Array.prototype;null==or[sr]&&x.f(or,sr,{configurable:!0,value:ir(null)});var ar,ur,cr=function(e){or[sr][e]=!0},lr=_e.includes;Pe({target:"Array",proto:!0},{includes:function(e){return lr(this,e,arguments.length>1?arguments[1]:void 0)}}),cr("includes"),e.LogLevel=void 0,(ar=e.LogLevel||(e.LogLevel={}))[ar.LOG=0]="LOG",ar[ar.DEBUG=0]="DEBUG",ar[ar.INFO=1]="INFO",ar[ar.WARN=2]="WARN",ar[ar.ERROR=3]="ERROR",ar[ar.FATAL=4]="FATAL",ar[ar.NONE=1e3]="NONE",e.LogType=void 0,(ur=e.LogType||(e.LogType={})).IM="IM",ur.RTC="RTC";var hr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},fr=Mn.forEach,dr=Bn("forEach")?[].forEach:function(e){return fr(this,e,arguments.length>1?arguments[1]:void 0)};for(var gr in hr){var pr=o[gr],vr=pr&&pr.prototype;if(vr&&vr.forEach!==dr)try{L(vr,"forEach",dr)}catch(e){vr.forEach=dr}}var yr={};yr[ot("toStringTag")]="z";var mr="[object z]"===String(yr),_r=ot("toStringTag"),Er="Arguments"==p(function(){return arguments}()),Tr=mr?p:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),_r))?n:Er?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Rr=mr?{}.toString:function(){return"[object "+Tr(this)+"]"};mr||oe(Object.prototype,"toString",Rr,{unsafe:!0});var Ir=o.Promise,Cr=function(e,t,n){for(var r in t)oe(e,r,t[r],n);return e},Sr=x.f,br=ot("toStringTag"),wr=function(e,t,n){e&&!C(e=n?e:e.prototype,br)&&Sr(e,br,{configurable:!0,value:t})},Nr=ot("species"),Or=function(e){var t=ce(e),n=x.f;u&&t&&!t[Nr]&&n(t,Nr,{configurable:!0,get:function(){return this}})},kr=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Ar={},Mr=ot("iterator"),xr=Array.prototype,Lr=function(e){return void 0!==e&&(Ar.Array===e||xr[Mr]===e)},Ur=ot("iterator"),Pr=function(e){if(null!=e)return e[Ur]||e["@@iterator"]||Ar[Tr(e)]},Dr=function(e){var t=e.return;if(void 0!==t)return A(t.call(e)).value},Vr=function(e,t){this.stopped=e,this.result=t},Br=function(e,t,n){var r,i,s,o,a,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=On(t,l,1+h+d),p=function(e){return r&&Dr(r),new Vr(!0,e)},v=function(e){return h?(A(e),d?g(e[0],e[1],p):g(e[0],e[1])):d?g(e,p):g(e)};if(f)r=e;else{if("function"!=typeof(i=Pr(e)))throw TypeError("Target is not iterable");if(Lr(i)){for(s=0,o=ge(e.length);o>s;s++)if((a=v(e[s]))&&a instanceof Vr)return a;return new Vr(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{a=v(c.value)}catch(e){throw Dr(r),e}if("object"==typeof a&&a&&a instanceof Vr)return a}return new Vr(!1)},Fr=ot("iterator"),jr=!1;try{var Yr=0,qr={next:function(){return{done:!!Yr++}},return:function(){jr=!0}};qr[Fr]=function(){return this},Array.from(qr,(function(){throw 2}))}catch(e){}var Gr,Hr,Kr,Wr=function(e,t){if(!t&&!jr)return!1;var n=!1;try{var r={};r[Fr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Qr=ot("species"),Jr=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[Qr])?t:Nn(n)},zr=/(?:iphone|ipod|ipad).*applewebkit/i.test(ze),Zr=o.location,$r=o.setImmediate,Xr=o.clearImmediate,ei=o.process,ti=o.MessageChannel,ni=o.Dispatch,ri=0,ii={},si="onreadystatechange",oi=function(e){if(ii.hasOwnProperty(e)){var t=ii[e];delete ii[e],t()}},ai=function(e){return function(){oi(e)}},ui=function(e){oi(e.data)},ci=function(e){o.postMessage(e+"",Zr.protocol+"//"+Zr.host)};$r&&Xr||($r=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return ii[++ri]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Gr(ri),ri},Xr=function(e){delete ii[e]},Je?Gr=function(e){ei.nextTick(ai(e))}:ni&&ni.now?Gr=function(e){ni.now(ai(e))}:ti&&!zr?(Kr=(Hr=new ti).port2,Hr.port1.onmessage=ui,Gr=On(Kr.postMessage,Kr,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&Zr&&"file:"!==Zr.protocol&&!a(ci)?(Gr=ci,o.addEventListener("message",ui,!1)):Gr=si in w("script")?function(e){Xn.appendChild(w("script")).onreadystatechange=function(){Xn.removeChild(this),oi(e)}}:function(e){setTimeout(ai(e),0)});var li,hi,fi,di,gi,pi,vi,yi,mi={set:$r,clear:Xr},_i=/web0s(?!.*chrome)/i.test(ze),Ei=k.f,Ti=mi.set,Ri=o.MutationObserver||o.WebKitMutationObserver,Ii=o.document,Ci=o.process,Si=o.Promise,bi=Ei(o,"queueMicrotask"),wi=bi&&bi.value;wi||(li=function(){var e,t;for(Je&&(e=Ci.domain)&&e.exit();hi;){t=hi.fn,hi=hi.next;try{t()}catch(e){throw hi?di():fi=void 0,e}}fi=void 0,e&&e.enter()},zr||Je||_i||!Ri||!Ii?Si&&Si.resolve?(vi=Si.resolve(void 0),yi=vi.then,di=function(){yi.call(vi,li)}):di=Je?function(){Ci.nextTick(li)}:function(){Ti.call(o,li)}:(gi=!0,pi=Ii.createTextNode(""),new Ri(li).observe(pi,{characterData:!0}),di=function(){pi.data=gi=!gi}));var Ni,Oi,ki,Ai,Mi=wi||function(e){var t={fn:e,next:void 0};fi&&(fi.next=t),hi||(hi=t,di()),fi=t},xi=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=Nn(t),this.reject=Nn(n)},Li={f:function(e){return new xi(e)}},Ui=function(e,t){if(A(e),E(t)&&t.constructor===e)return t;var n=Li.f(e);return(0,n.resolve)(t),n.promise},Pi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Di=mi.set,Vi=ot("species"),Bi="Promise",Fi=se.get,ji=se.set,Yi=se.getterFor(Bi),qi=Ir,Gi=o.TypeError,Hi=o.document,Ki=o.process,Wi=ce("fetch"),Qi=Li.f,Ji=Qi,zi=!!(Hi&&Hi.createEvent&&o.dispatchEvent),Zi="function"==typeof PromiseRejectionEvent,$i="unhandledrejection",Xi=Le(Bi,(function(){if(!(Y(qi)!==String(qi))){if(66===et)return!0;if(!Je&&!Zi)return!0}if(et>=51&&/native code/.test(qi))return!1;var e=qi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Vi]=t,!(e.then((function(){}))instanceof t)})),es=Xi||!Wr((function(e){qi.all(e).catch((function(){}))})),ts=function(e){var t;return!(!E(e)||"function"!=typeof(t=e.then))&&t},ns=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Mi((function(){for(var r=e.value,i=1==e.state,s=0;n.length>s;){var o,a,u,c=n[s++],l=i?c.ok:c.fail,h=c.resolve,f=c.reject,d=c.domain;try{l?(i||(2===e.rejection&&os(e),e.rejection=1),!0===l?o=r:(d&&d.enter(),o=l(r),d&&(d.exit(),u=!0)),o===c.promise?f(Gi("Promise-chain cycle")):(a=ts(o))?a.call(o,h,f):h(o)):f(r)}catch(e){d&&!u&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&is(e)}))}},rs=function(e,t,n){var r,i;zi?((r=Hi.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),o.dispatchEvent(r)):r={promise:t,reason:n},!Zi&&(i=o["on"+e])?i(r):e===$i&&function(e,t){var n=o.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},is=function(e){Di.call(o,(function(){var t,n=e.facade,r=e.value;if(ss(e)&&(t=Pi((function(){Je?Ki.emit("unhandledRejection",r,n):rs($i,n,r)})),e.rejection=Je||ss(e)?2:1,t.error))throw t.value}))},ss=function(e){return 1!==e.rejection&&!e.parent},os=function(e){Di.call(o,(function(){var t=e.facade;Je?Ki.emit("rejectionHandled",t):rs("rejectionhandled",t,e.value)}))},as=function(e,t,n){return function(r){e(t,r,n)}},us=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,ns(e,!0))},cs=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Gi("Promise can't be resolved itself");var r=ts(t);r?Mi((function(){var n={done:!1};try{r.call(t,as(cs,n,e),as(us,n,e))}catch(t){us(n,t,e)}})):(e.value=t,e.state=1,ns(e,!1))}catch(t){us({done:!1},t,e)}}};Xi&&(qi=function(e){kr(this,qi,Bi),Nn(e),Ni.call(this);var t=Fi(this);try{e(as(cs,t),as(us,t))}catch(e){us(t,e)}},(Ni=function(e){ji(this,{type:Bi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Cr(qi.prototype,{then:function(e,t){var n=Yi(this),r=Qi(Jr(this,qi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Je?Ki.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&ns(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Oi=function(){var e=new Ni,t=Fi(e);this.promise=e,this.resolve=as(cs,t),this.reject=as(us,t)},Li.f=Qi=function(e){return e===qi||e===ki?new Oi(e):Ji(e)},"function"==typeof Ir&&(Ai=Ir.prototype.then,oe(Ir.prototype,"then",(function(e,t){var n=this;return new qi((function(e,t){Ai.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Wi&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Ui(qi,Wi.apply(o,arguments))}}))),Pe({global:!0,wrap:!0,forced:Xi},{Promise:qi}),wr(qi,Bi,!1),Or(Bi),ki=ce(Bi),Pe({target:Bi,stat:!0,forced:Xi},{reject:function(e){var t=Qi(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Bi,stat:!0,forced:Xi},{resolve:function(e){return Ui(this,e)}}),Pe({target:Bi,stat:!0,forced:es},{all:function(e){var t=this,n=Qi(t),r=n.resolve,i=n.reject,s=Pi((function(){var n=Nn(t.resolve),s=[],o=0,a=1;Br(e,(function(e){var u=o++,c=!1;s.push(void 0),a++,n.call(t,e).then((function(e){c||(c=!0,s[u]=e,--a||r(s))}),i)})),--a||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Qi(t),r=n.reject,i=Pi((function(){var i=Nn(t.resolve);Br(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var ls="RC_Logs";function hs(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(ls),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=wt({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,ls,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var fs=function(){function e(){Rt(this,e)}return Ct(e,[{key:"addList",value:function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),s=i.objectStore(t);n.forEach((function(e){null==s||s.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))}},{key:"getRangeData",value:function(t,n,r,i){return new Promise((function(s){if(e._db){var o=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=o.index(n),c=[],l=u.openCursor(a);l.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):s(c)},l.onerror=function(e){console.error(e),s([])}}else s([])}))}},{key:"getCount",value:function(t,n){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readonly").objectStore(t).count();r.onsuccess=function(){n(r.result)},r.onerror=function(e){console.error(e),n(0)}}else n(0)}))}},{key:"removeFirstData",value:function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),s=i.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var e=s.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))}}],[{key:"init",value:function(){if("undefined"!=typeof window&&window&&window.indexedDB){var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(e){console.warn("open indexDB request failed "+e.target.error)},t.onsuccess=function(t){e._db=t.target.result,e._instance=new e},t.onupgradeneeded=function(t){e._db=t.target.result,hs(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();fs._db=null;var ds=ot("match"),gs=function(e){var t;return E(e)&&(void 0!==(t=e[ds])?!!t:"RegExp"==p(e))},ps=Be.UNSUPPORTED_Y,vs=[].push,ys=Math.min,ms=4294967295;dt("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(m(this)),i=void 0===n?ms:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!gs(e))return t.call(r,e,i);for(var s,o,a,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=Ke.call(h,r))&&!((o=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&vs.apply(u,s.slice(1)),a=s[0].length,l=o,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!a&&h.test("")||u.push(""):u.push(r.slice(l)),u.length>i?u.slice(0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=m(this),s=null==t?void 0:t[e];return void 0!==s?s.call(t,i,n):r.call(String(i),t,n)},function(e,i){var s=n(r,e,this,i,r!==t);if(s.done)return s.value;var o=A(e),a=String(this),u=Jr(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(ps?"g":"y"),h=new u(ps?"^(?:"+o.source+")":o,l),f=void 0===i?ms:i>>>0;if(0===f)return[];if(0===a.length)return null===mt(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=ps?0:g;var v,y=mt(h,ps?a.slice(g):a);if(null===y||(v=ys(ge(h.lastIndex+(ps?g:0)),a.length))===d)g=yt(a,g,c);else{if(p.push(a.slice(d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(p.push(y[m]),p.length===f)return p;g=d=v}}return p.push(a.slice(d)),p}]}),ps);var _s="toString",Es=RegExp.prototype,Ts=Es.toString,Rs=a((function(){return"/a/b"!=Ts.call({source:"a",flags:"b"})})),Is=Ts.name!=_s;(Rs||Is)&&oe(RegExp.prototype,_s,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Es)?De.call(e):n)}),{unsafe:!0});var Cs,Ss=function(e,t){return e+Math.floor(Math.random()*(t-e))},bs=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},ws=function(){var e=bs();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var s=r%n;r=(r-s)/n,i.unshift(t[s])}while(r);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e};!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.RTC_ROOM=12]="RTC_ROOM"}(Cs||(Cs={}));var Ns,Os=Cs;!function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(Ns||(Ns={}));var ks,As=Ns,Ms=function(e){return"string"==typeof e},xs=function(e){return"boolean"==typeof e},Ls=function(e){return"number"==typeof e&&!isNaN(e)},Us=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ps=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Ds=function(e){return Ms(e)&&e.length>0},Vs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Bs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Fs=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},js=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ys=function(e){for(var t in e)return!0;return!1},qs=(St(ks={},e.LogLevel.DEBUG,console.debug.bind(console)),St(ks,e.LogLevel.INFO,console.info.bind(console)),St(ks,e.LogLevel.WARN,console.warn.bind(console)),St(ks,e.LogLevel.ERROR,console.error.bind(console)),St(ks,e.LogLevel.FATAL,console.log.bind(console)),ks),Gs=function(e){return Ms(e)||Ls(e)||Fs(e)||xs(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Hs=function(){function t(n,r,i){Rt(this,t),this.tag=n,this.type=r,this.initiator=i,this._outLevel=e.LogLevel.WARN,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}var n;return Ct(t,[{key:"_defaultStdout",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];qs[e].apply(qs,["".concat(t,":")].concat(r))}},{key:"__pushLocalLog",value:function(n,r,i){var s;s=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?e.LogType.RTC:e.LogType.IM;var o=Date.now();Gn(r)>=1e3&&(r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf-8";if(!e||!t)return"";var r="utf-8"===n?3:2,i=0,s=0,o="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return o;o+=e.charAt(s)}return e}(r,1e3));var a=JSON.stringify({message:r,userId:t.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(i)?i:"".concat(this.initiator||"L","-").concat(i,"-O"),c={sessionId:t.sessionId,time:o,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(a,'"\n'),userId:t.userId};t.databaseLogList.push(c),t.databaseLogList.length>=100&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=Tt(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Bt(t.databaseLogList),t.databaseLogList=[],!(r=fs.getInstance())){e.next=14;break}return e.next=6,r.addList(ls,n);case 6:return i=e.sent,e.next=9,r.getCount(ls,"time");case 9:return e.sent>1e5&&r.removeFirstData(ls,"time",2e3),e.abrupt("return",i);case 14:return e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"setLogLevel",value:function(t){this._outLevel="number"!=typeof t?e.LogLevel.WARN:t}},{key:"setLogStdout",value:function(e){this._logStdout=e}},{key:"log",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(this.__pushLocalLog(t,r.map(Gs).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),o="".concat(s," - ").concat(r.map(Gs).join(" "));this._logStdout?this._logStdout(t,o):this._stdout?this._stdout(t,o):this._defaultStdout.apply(this,[t,s].concat(r))}}},{key:"reportLog",value:function(e,n,r){this.__pushLocalLog(4-e,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'.concat(i,'"');var s={level:e,content:[t.sessionId,Date.now(),this.type,e,n,i].join()+"\n"};t.realTimeLogList.push(s),t.realTimeLogList.length>=600&&(t.realTimeLogList=t.realTimeLogList.slice(-500))}},{key:"set",value:function(e,t){this.warn("logger.set has being deprecated!")}},{key:"setStdout",value:function(e){this._stdout=e}},{key:"__clearRealTimeLog",value:function(){t.realTimeLogList=[]}}],[{key:"init",value:function(e){t.userId=e}},{key:"reset",value:function(){t.userId=""}}]),t}();Hs.databaseLogList=[],Hs.realTimeLogList=[],Hs.sessionId=ws(),Hs.userId="";var Ks=new Hs("RCLog"),Ws=Wt("splice"),Qs=Math.max,Js=Math.min,zs=9007199254740991,Zs="Maximum allowed length exceeded";Pe({target:"Array",proto:!0,forced:!Ws},{splice:function(e,t){var n,r,i,s,o,a,u=R(this),c=ge(u.length),l=ye(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=Js(Qs(fe(t),0),c-l)),c+n-r>zs)throw TypeError(Zs);for(i=Ht(u,r),s=0;s<r;s++)(o=l+s)in u&&qt(i,s,u[o]);if(i.length=r,n<r){for(s=l;s<c-r;s++)a=s+n,(o=s+r)in u?u[a]=u[o]:delete u[a];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)a=s+n-1,(o=s+r-1)in u?u[a]=u[o]:delete u[a];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var $s,Xs=function(){function e(){Rt(this,e),this._map={}}return Ct(e,[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var s=t.length-1;s>=0;s-=1){var o=t[s],a=o.target,u=o.once,c=o.listener;u&&t.splice(s,1);try{c.call.apply(c,[a].concat(r))}catch(e){Ks.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}]),e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}($s||($s={}));var eo,to=$s;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33101]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=34009]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE"}(eo||(eo={}));var no,ro=eo;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"}(no||(no={}));var io,so=no,oo={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13};!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg"}(io||(io={}));var ao,uo=io;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(ao||(ao={}));var co,lo=ao;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(co||(co={}));var ho,fo=co;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(ho||(ho={}));var go,po=ho;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(go||(go={}));var vo,yo,mo,_o=go;e.RTCMode=void 0,(vo=e.RTCMode||(e.RTCMode={}))[vo.RTC=0]="RTC",vo[vo.LIVE=2]="LIVE",e.LiveType=void 0,(yo=e.LiveType||(e.LiveType={}))[yo.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",yo[yo.AUDIO=1]="AUDIO",e.LiveRole=void 0,(mo=e.LiveRole||(e.LiveRole={}))[mo.ANCHOR=1]="ANCHOR",mo[mo.AUDIENCE=2]="AUDIENCE";var Eo,To,Ro,Io,Co={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};e.RTCApiType=void 0,(Eo=e.RTCApiType||(e.RTCApiType={}))[Eo.ROOM=1]="ROOM",Eo[Eo.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(To=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[To.AnchorToViewer=1]="AnchorToViewer",To[To.ViewerToAnchor=2]="ViewerToAnchor",e.AssertRules=void 0,(Io=e.AssertRules||(e.AssertRules={}))[Io.STRING=0]="STRING",Io[Io.ONLY_STRING=1]="ONLY_STRING",Io[Io.NUMBER=2]="NUMBER",Io[Io.BOOLEAN=3]="BOOLEAN",Io[Io.OBJECT=4]="OBJECT",Io[Io.ARRAY=5]="ARRAY",Io[Io.CALLBACK=6]="CALLBACK";var So=(St(Ro={},e.AssertRules.STRING,Ds),St(Ro,e.AssertRules.ONLY_STRING,Ms),St(Ro,e.AssertRules.NUMBER,Ls),St(Ro,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),St(Ro,e.AssertRules.OBJECT,Vs),St(Ro,e.AssertRules.ARRAY,Us),St(Ro,e.AssertRules.CALLBACK,(function(e){var t=!0;return Vs(e)||(t=!1),(e=e||{}).onSuccess&&!Bs(e.onSuccess)&&(t=!1),e.onError&&!Bs(e.onError)&&(t=!1),t})),Ro),bo=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(xt(Error)),wo=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=So[n]||n;var i=r&&!n(t)||!r&&!(Fs(t)||null===t||n(t));return i&&Ks.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},No=[].slice,Oo=/MSIE .\./.test(ze),ko=function(e){return function(t,n){var r=arguments.length>2,i=r?No.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};Pe({global:!0,bind:!0,forced:Oo},{setTimeout:ko(o.setTimeout),setInterval:ko(o.setInterval)});var Ao=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return A(n),function(e){if(!E(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Mo=function(e,t,n){var r,i;return Ao&&"function"==typeof(r=t.constructor)&&r!==n&&E(i=r.prototype)&&i!==n.prototype&&Ao(e,i),e},xo=x.f,Lo=Ce.f,Uo=se.enforce,Po=ot("match"),Do=o.RegExp,Vo=Do.prototype,Bo=/a/g,Fo=/a/g,jo=new Do(Bo)!==Bo,Yo=Be.UNSUPPORTED_Y;if(u&&Le("RegExp",!jo||Yo||a((function(){return Fo[Po]=!1,Do(Bo)!=Bo||Do(Fo)==Fo||"/a/i"!=Do(Bo,"i")})))){for(var qo=function(e,t){var n,r=this instanceof qo,i=gs(e),s=void 0===t;if(!r&&i&&e.constructor===qo&&s)return e;jo?i&&!s&&(e=e.source):e instanceof qo&&(s&&(t=De.call(e)),e=e.source),Yo&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Mo(jo?new Do(e,t):Do(e,t),r?this:Vo,qo);Yo&&n&&(Uo(o).sticky=!0);return o},Go=function(e){e in qo||xo(qo,e,{configurable:!0,get:function(){return Do[e]},set:function(t){Do[e]=t}})},Ho=Lo(Do),Ko=0;Ho.length>Ko;)Go(Ho[Ko++]);Vo.constructor=qo,qo.prototype=Vo,oe(o,"RegExp",qo)}Or("RegExp");var Wo,Qo,Jo,zo=function(e){if(!Vs(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{"+t.length+"}$"),t),16)},Zo=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=bs(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),s=(new Date).getTime(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(o)},$o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.threadId,r=e.apnsCollapseId,i=e.category,s=e.richMediaUri,o=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h={};h["thread-id"]=n||"",h["apns-collapse-id"]=r||"",h.category=i||"",h.richMediaUri=s||"";var f={};f.collapse_key=null==l?void 0:l.collapseKey,f.imageUrl=null==l?void 0:l.imageUrl;var d=null==l?void 0:l.priority;d&&!["high","normal"].includes(d)&&(d="normal"),f.priority=d;var g=[{HW:{channelId:a||""}},{MI:{channelId:o||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},Xo=function(e,t){var n={},r={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:r};try{var i=JSON.parse(e);null==i||i.forEach((function(e){var t,i,s,o,a=Object.keys(e);if(0!==a.length){var u=a[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(s=e[u])||void 0===s?void 0:s.channelId);case"VIVO":return void(r.typeVivo=null===(o=e[u])||void 0===o?void 0:o.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){Ks.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},ea=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},ta=function(e){var t=e.length;return t<=4096&&t>=1},na=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Vs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Us(e)||Ms(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,s=e.length;i<s;i++)t(e[i],i)}()},ra=function(e,t){return na(e,(function(n,r){e[r]=t(n,r)})),e},ia=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return na(e,(function(e,r){t===e&&(n=r)})),n},sa=function(e,t){var n=[];return na(e,(function(e){n.push(e)})),-1!==ia(n,t)},oa=function(e){return JSON.parse(JSON.stringify(e))},aa=function(){return"undefined"!=typeof RCCppEngine},ua=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var s in i)if(i.hasOwnProperty(s)){var o=r.match(i[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},ca=function(e){switch(e){case oo.SERVER_UNAVAILABLE:return ro.SERVER_UNAVAILABLE;case oo.TOKEN_INCORRECT:return ro.RC_CONN_USER_OR_PASSWD_ERROR;case oo.REDIRECT:return ro.RC_CONN_REDIRECTED;case oo.APP_BLOCK_OR_DELETE:return ro.RC_CONN_APP_BLOCKED_OR_DELETED;case oo.BLOCK:return ro.RC_CONN_USER_BLOCKED;case oo.TOKEN_EXPIRE:return ro.RC_CONN_USER_OR_PASSWD_ERROR;case oo.HOSTNAME_ERROR:return ro.HOSTNAME_ERROR;case oo.HASOHTERSAMECLIENTONLINE:return ro.HAS_OHTER_SAME_CLIENT_ON_LINE;default:return ro.RC_NET_UNAVAILABLE}},la=function(e){var t={},n=JSON.parse(e);return na(n,(function(e,n){t[n]=e.v})),t},ha={_delayTime:0,setTime:function(e){var t=(new Date).getTime();ha._delayTime=t-e},getTime:function(){var e=ha._delayTime;return(new Date).getTime()-e}},fa=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),da=z("IE_PROTO"),ga=Object.prototype,pa=fa?Object.getPrototypeOf:function(e){return e=R(e),C(e,da)?e[da]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ga:null},va=ot("iterator"),ya=!1;[].keys&&("next"in(Jo=[].keys())?(Qo=pa(pa(Jo)))!==Object.prototype&&(Wo=Qo):ya=!0),(null==Wo||a((function(){var e={};return Wo[va].call(e)!==e})))&&(Wo={}),C(Wo,va)||L(Wo,va,(function(){return this}));var ma={IteratorPrototype:Wo,BUGGY_SAFARI_ITERATORS:ya},_a=ma.IteratorPrototype,Ea=function(){return this},Ta=ma.IteratorPrototype,Ra=ma.BUGGY_SAFARI_ITERATORS,Ia=ot("iterator"),Ca="keys",Sa="values",ba="entries",wa=function(){return this},Na=function(e,t,n,r,i,s,o){!function(e,t,n){var r=t+" Iterator";e.prototype=ir(_a,{next:f(1,n)}),wr(e,r,!1),Ar[r]=Ea}(n,t,r);var a,u,c,l=function(e){if(e===i&&v)return v;if(!Ra&&e in g)return g[e];switch(e){case Ca:case Sa:case ba:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",d=!1,g=e.prototype,p=g[Ia]||g["@@iterator"]||i&&g[i],v=!Ra&&p||l(i),y="Array"==t&&g.entries||p;if(y&&(a=pa(y.call(new e)),Ta!==Object.prototype&&a.next&&(pa(a)!==Ta&&(Ao?Ao(a,Ta):"function"!=typeof a[Ia]&&L(a,Ia,wa)),wr(a,h,!0))),i==Sa&&p&&p.name!==Sa&&(d=!0,v=function(){return p.call(this)}),g[Ia]!==v&&L(g,Ia,v),Ar[t]=v,i)if(u={values:l(Sa),keys:s?v:l(Ca),entries:l(ba)},o)for(c in u)(Ra||d||!(c in g))&&oe(g,c,u[c]);else Pe({target:t,proto:!0,forced:Ra||d},u);return u},Oa=pt.charAt,ka="String Iterator",Aa=se.set,Ma=se.getterFor(ka);Na(String,"String",(function(e){Aa(this,{type:ka,string:String(e),index:0})}),(function(){var e,t=Ma(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Oa(n,r),t.index+=e.length,{value:e,done:!1})}));var xa="Array Iterator",La=se.set,Ua=se.getterFor(xa),Pa=Na(Array,"Array",(function(e,t){La(this,{type:xa,target:_(e),index:0,kind:t})}),(function(){var e=Ua(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");Ar.Arguments=Ar.Array,cr("keys"),cr("values"),cr("entries");var Da=ot("iterator"),Va=ot("toStringTag"),Ba=Pa.values;for(var Fa in hr){var ja=o[Fa],Ya=ja&&ja.prototype;if(Ya){if(Ya[Da]!==Ba)try{L(Ya,Da,Ba)}catch(e){Ya[Da]=Ba}if(Ya[Va]||L(Ya,Va,Fa),hr[Fa])for(var qa in Pa)if(Ya[qa]!==Pa[qa])try{L(Ya,qa,Pa[qa])}catch(e){Ya[qa]=Pa[qa]}}}var Ga="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Ha=function(e){if(void 0===e)return 0;var t=fe(e),n=ge(t);if(t!==n)throw RangeError("Wrong length or index");return n},Ka=Math.abs,Wa=Math.pow,Qa=Math.floor,Ja=Math.log,za=Math.LN2,Za=function(e,t,n){var r,i,s,o=new Array(n),a=8*n-t-1,u=(1<<a)-1,c=u>>1,l=23===t?Wa(2,-24)-Wa(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=Ka(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Qa(Ja(e)/za),e*(s=Wa(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*Wa(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*Wa(2,t),r+=c):(i=e*Wa(2,c-1)*Wa(2,t),r=0));t>=8;o[f++]=255&i,i/=256,t-=8);for(r=r<<t|i,a+=t;a>0;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*h,o},$a=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,o=s>>1,a=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;a>0;l=256*l+e[u],u--,a-=8);for(n=l&(1<<-a)-1,l>>=-a,a+=t;a>0;n=256*n+e[u],u--,a-=8);if(0===l)l=1-o;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=Wa(2,t),l-=o}return(c?-1:1)*n*Wa(2,l-t)},Xa=function(e){for(var t=R(this),n=ge(t.length),r=arguments.length,i=ye(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,o=void 0===s?n:ye(s,n);o>i;)t[i++]=e;return t},eu=Ce.f,tu=x.f,nu=se.get,ru=se.set,iu="ArrayBuffer",su="DataView",ou="Wrong index",au=o.ArrayBuffer,uu=au,cu=o.DataView,lu=cu&&cu.prototype,hu=Object.prototype,fu=o.RangeError,du=Za,gu=$a,pu=function(e){return[255&e]},vu=function(e){return[255&e,e>>8&255]},yu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},mu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},_u=function(e){return du(e,23,4)},Eu=function(e){return du(e,52,8)},Tu=function(e,t){tu(e.prototype,t,{get:function(){return nu(this)[t]}})},Ru=function(e,t,n,r){var i=Ha(n),s=nu(e);if(i+t>s.byteLength)throw fu(ou);var o=nu(s.buffer).bytes,a=i+s.byteOffset,u=o.slice(a,a+t);return r?u:u.reverse()},Iu=function(e,t,n,r,i,s){var o=Ha(n),a=nu(e);if(o+t>a.byteLength)throw fu(ou);for(var u=nu(a.buffer).bytes,c=o+a.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Ga){if(!a((function(){au(1)}))||!a((function(){new au(-1)}))||a((function(){return new au,new au(1.5),new au(NaN),au.name!=iu}))){for(var Cu,Su=(uu=function(e){return kr(this,uu),new au(Ha(e))}).prototype=au.prototype,bu=eu(au),wu=0;bu.length>wu;)(Cu=bu[wu++])in uu||L(uu,Cu,au[Cu]);Su.constructor=uu}Ao&&pa(lu)!==hu&&Ao(lu,hu);var Nu=new cu(new uu(2)),Ou=lu.setInt8;Nu.setInt8(0,2147483648),Nu.setInt8(1,2147483649),!Nu.getInt8(0)&&Nu.getInt8(1)||Cr(lu,{setInt8:function(e,t){Ou.call(this,e,t<<24>>24)},setUint8:function(e,t){Ou.call(this,e,t<<24>>24)}},{unsafe:!0})}else uu=function(e){kr(this,uu,iu);var t=Ha(e);ru(this,{bytes:Xa.call(new Array(t),0),byteLength:t}),u||(this.byteLength=t)},cu=function(e,t,n){kr(this,cu,su),kr(e,uu,su);var r=nu(e).byteLength,i=fe(t);if(i<0||i>r)throw fu("Wrong offset");if(i+(n=void 0===n?r-i:ge(n))>r)throw fu("Wrong length");ru(this,{buffer:e,byteLength:n,byteOffset:i}),u||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},u&&(Tu(uu,"byteLength"),Tu(cu,"buffer"),Tu(cu,"byteLength"),Tu(cu,"byteOffset")),Cr(cu.prototype,{getInt8:function(e){return Ru(this,1,e)[0]<<24>>24},getUint8:function(e){return Ru(this,1,e)[0]},getInt16:function(e){var t=Ru(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Ru(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return mu(Ru(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return mu(Ru(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return gu(Ru(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return gu(Ru(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){Iu(this,1,e,pu,t)},setUint8:function(e,t){Iu(this,1,e,pu,t)},setInt16:function(e,t){Iu(this,2,e,vu,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){Iu(this,2,e,vu,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){Iu(this,4,e,yu,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){Iu(this,4,e,yu,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){Iu(this,4,e,_u,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){Iu(this,8,e,Eu,t,arguments.length>2?arguments[2]:void 0)}});wr(uu,iu),wr(cu,su);var ku={ArrayBuffer:uu,DataView:cu},Au=ku.ArrayBuffer,Mu=ku.DataView,xu=Au.prototype.slice,Lu=a((function(){return!new Au(2).slice(1,void 0).byteLength}));Pe({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Lu},{slice:function(e,t){if(void 0!==xu&&void 0===t)return xu.call(A(this),e);for(var n=A(this).byteLength,r=ye(e,n),i=ye(void 0===t?n:t,n),s=new(Jr(this,Au))(ge(i-r)),o=new Mu(this),a=new Mu(s),u=0;r<i;)a.setUint8(u++,o.getUint8(r++));return s}});var Uu,Pu=x.f,Du=o.Int8Array,Vu=Du&&Du.prototype,Bu=o.Uint8ClampedArray,Fu=Bu&&Bu.prototype,ju=Du&&pa(Du),Yu=Vu&&pa(Vu),qu=Object.prototype,Gu=qu.isPrototypeOf,Hu=ot("toStringTag"),Ku=Q("TYPED_ARRAY_TAG"),Wu=Ga&&!!Ao&&"Opera"!==Tr(o.opera),Qu=!1,Ju={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zu={BigInt64Array:8,BigUint64Array:8},Zu=function(e){if(!E(e))return!1;var t=Tr(e);return C(Ju,t)||C(zu,t)};for(Uu in Ju)o[Uu]||(Wu=!1);if((!Wu||"function"!=typeof ju||ju===Function.prototype)&&(ju=function(){throw TypeError("Incorrect invocation")},Wu))for(Uu in Ju)o[Uu]&&Ao(o[Uu],ju);if((!Wu||!Yu||Yu===qu)&&(Yu=ju.prototype,Wu))for(Uu in Ju)o[Uu]&&Ao(o[Uu].prototype,Yu);if(Wu&&pa(Fu)!==Yu&&Ao(Fu,Yu),u&&!C(Yu,Hu))for(Uu in Qu=!0,Pu(Yu,Hu,{get:function(){return E(this)?this[Ku]:void 0}}),Ju)o[Uu]&&L(o[Uu],Ku,Uu);var $u={NATIVE_ARRAY_BUFFER_VIEWS:Wu,TYPED_ARRAY_TAG:Qu&&Ku,aTypedArray:function(e){if(Zu(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Ao){if(Gu.call(ju,e))return e}else for(var t in Ju)if(C(Ju,Uu)){var n=o[t];if(n&&(e===n||Gu.call(n,e)))return e}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n){if(u){if(n)for(var r in Ju){var i=o[r];i&&C(i.prototype,e)&&delete i.prototype[e]}Yu[e]&&!n||oe(Yu,e,n?t:Wu&&Vu[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(u){if(Ao){if(n)for(r in Ju)(i=o[r])&&C(i,e)&&delete i[e];if(ju[e]&&!n)return;try{return oe(ju,e,n?t:Wu&&Du[e]||t)}catch(e){}}for(r in Ju)!(i=o[r])||i[e]&&!n||oe(i,e,t)}},isView:function(e){if(!E(e))return!1;var t=Tr(e);return"DataView"===t||C(Ju,t)||C(zu,t)},isTypedArray:Zu,TypedArray:ju,TypedArrayPrototype:Yu},Xu=$u.NATIVE_ARRAY_BUFFER_VIEWS,ec=o.ArrayBuffer,tc=o.Int8Array,nc=!Xu||!a((function(){tc(1)}))||!a((function(){new tc(-1)}))||!Wr((function(e){new tc,new tc(null),new tc(1.5),new tc(e)}),!0)||a((function(){return 1!==new tc(new ec(2),1,void 0).length})),rc=function(e,t){var n=function(e){var t=fe(e);if(t<0)throw RangeError("The argument can't be less than 0");return t}(e);if(n%t)throw RangeError("Wrong offset");return n},ic=$u.aTypedArrayConstructor,sc=function(e){var t,n,r,i,s,o,a=R(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Pr(a);if(null!=h&&!Lr(h))for(o=(s=h.call(a)).next,a=[];!(i=o.call(s)).done;)a.push(i.value);for(l&&u>2&&(c=On(c,arguments[2],2)),n=ge(a.length),r=new(ic(this))(n),t=0;n>t;t++)r[t]=l?c(a[t],t):a[t];return r},oc=i((function(e){var t=Ce.f,n=Mn.forEach,r=se.get,i=se.set,s=x.f,a=k.f,c=Math.round,l=o.RangeError,h=ku.ArrayBuffer,d=ku.DataView,g=$u.NATIVE_ARRAY_BUFFER_VIEWS,p=$u.TYPED_ARRAY_TAG,v=$u.TypedArray,y=$u.TypedArrayPrototype,m=$u.aTypedArrayConstructor,_=$u.isTypedArray,R="BYTES_PER_ELEMENT",I="Wrong length",S=function(e,t){for(var n=0,r=t.length,i=new(m(e))(r);r>n;)i[n]=t[n++];return i},b=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},w=function(e){var t;return e instanceof h||"ArrayBuffer"==(t=Tr(e))||"SharedArrayBuffer"==t},N=function(e,t){return _(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},O=function(e,t){return N(e,t=T(t,!0))?f(2,e[t]):a(e,t)},A=function(e,t,n){return!(N(e,t=T(t,!0))&&E(n)&&C(n,"value"))||C(n,"get")||C(n,"set")||n.configurable||C(n,"writable")&&!n.writable||C(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};u?(g||(k.f=O,x.f=A,b(y,"buffer"),b(y,"byteOffset"),b(y,"byteLength"),b(y,"length")),Pe({target:"Object",stat:!0,forced:!g},{getOwnPropertyDescriptor:O,defineProperty:A}),e.exports=function(e,a,u){var f=e.match(/\d+$/)[0]/8,m=e+(u?"Clamped":"")+"Array",T="get"+e,C="set"+e,b=o[m],N=b,O=N&&N.prototype,k={},A=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[T](t*f+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);u&&(n=(n=c(n))<0?0:n>255?255:255&n),i.view[C](t*f+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};g?nc&&(N=a((function(e,t,n,r){return kr(e,N,m),Mo(E(t)?w(t)?void 0!==r?new b(t,rc(n,f),r):void 0!==n?new b(t,rc(n,f)):new b(t):_(t)?S(N,t):sc.call(N,t):new b(Ha(t)),e,N)})),Ao&&Ao(N,v),n(t(b),(function(e){e in N||L(N,e,b[e])})),N.prototype=O):(N=a((function(e,t,n,r){kr(e,N,m);var s,o,a,u=0,c=0;if(E(t)){if(!w(t))return _(t)?S(N,t):sc.call(N,t);s=t,c=rc(n,f);var g=t.byteLength;if(void 0===r){if(g%f)throw l(I);if((o=g-c)<0)throw l(I)}else if((o=ge(r)*f)+c>g)throw l(I);a=o/f}else a=Ha(t),s=new h(o=a*f);for(i(e,{buffer:s,byteOffset:c,byteLength:o,length:a,view:new d(s)});u<a;)A(e,u++)})),Ao&&Ao(N,v),O=N.prototype=ir(y)),O.constructor!==N&&L(O,"constructor",N),p&&L(O,p,m),k[m]=N,Pe({global:!0,forced:N!=b,sham:!g},k),R in N||L(N,R,f),R in O||L(O,R,f),Or(m)}):e.exports=function(){}}));oc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var ac=Math.min,uc=[].copyWithin||function(e,t){var n=R(this),r=ge(n.length),i=ye(e,r),s=ye(t,r),o=arguments.length>2?arguments[2]:void 0,a=ac((void 0===o?r:ye(o,r))-s,r-i),u=1;for(s<i&&i<s+a&&(u=-1,s+=a-1,i+=a-1);a-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},cc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("copyWithin",(function(e,t){return uc.call(cc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var lc=Mn.every,hc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("every",(function(e){return lc(hc(this),e,arguments.length>1?arguments[1]:void 0)}));var fc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("fill",(function(e){return Xa.apply(fc(this),arguments)}));var dc=$u.aTypedArrayConstructor,gc=function(e,t){for(var n=Jr(e,e.constructor),r=0,i=t.length,s=new(dc(n))(i);i>r;)s[r]=t[r++];return s},pc=Mn.filter,vc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("filter",(function(e){var t=pc(vc(this),e,arguments.length>1?arguments[1]:void 0);return gc(this,t)}));var yc=Mn.find,mc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("find",(function(e){return yc(mc(this),e,arguments.length>1?arguments[1]:void 0)}));var _c=Mn.findIndex,Ec=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("findIndex",(function(e){return _c(Ec(this),e,arguments.length>1?arguments[1]:void 0)}));var Tc=Mn.forEach,Rc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("forEach",(function(e){Tc(Rc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ic=_e.includes,Cc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("includes",(function(e){return Ic(Cc(this),e,arguments.length>1?arguments[1]:void 0)}));var Sc=_e.indexOf,bc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("indexOf",(function(e){return Sc(bc(this),e,arguments.length>1?arguments[1]:void 0)}));var wc=ot("iterator"),Nc=o.Uint8Array,Oc=Pa.values,kc=Pa.keys,Ac=Pa.entries,Mc=$u.aTypedArray,xc=$u.exportTypedArrayMethod,Lc=Nc&&Nc.prototype[wc],Uc=!!Lc&&("values"==Lc.name||null==Lc.name),Pc=function(){return Oc.call(Mc(this))};xc("entries",(function(){return Ac.call(Mc(this))})),xc("keys",(function(){return kc.call(Mc(this))})),xc("values",Pc,!Uc),xc(wc,Pc,!Uc);var Dc=$u.aTypedArray,Vc=[].join;(0,$u.exportTypedArrayMethod)("join",(function(e){return Vc.apply(Dc(this),arguments)}));var Bc=Math.min,Fc=[].lastIndexOf,jc=!!Fc&&1/[1].lastIndexOf(1,-0)<0,Yc=Bn("lastIndexOf"),qc=jc||!Yc?function(e){if(jc)return Fc.apply(this,arguments)||0;var t=_(this),n=ge(t.length),r=n-1;for(arguments.length>1&&(r=Bc(r,fe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Fc,Gc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("lastIndexOf",(function(e){return qc.apply(Gc(this),arguments)}));var Hc=Mn.map,Kc=$u.aTypedArray,Wc=$u.aTypedArrayConstructor;(0,$u.exportTypedArrayMethod)("map",(function(e){return Hc(Kc(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Wc(Jr(e,e.constructor)))(t)}))}));var Qc=function(e){return function(t,n,r,i){Nn(n);var s=R(t),o=y(s),a=ge(s.length),u=e?a-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:a<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:a>u;u+=c)u in o&&(i=n(i,o[u],u,s));return i}},Jc={left:Qc(!1),right:Qc(!0)},zc=Jc.left,Zc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("reduce",(function(e){return zc(Zc(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var $c=Jc.right,Xc=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("reduceRight",(function(e){return $c(Xc(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var el=$u.aTypedArray,tl=$u.exportTypedArrayMethod,nl=Math.floor;tl("reverse",(function(){for(var e,t=this,n=el(t).length,r=nl(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var rl=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("set",(function(e){rl(this);var t=rc(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=R(e),i=ge(r.length),s=0;if(i+t>n)throw RangeError("Wrong length");for(;s<i;)this[t+s]=r[s++]}),a((function(){new Int8Array(1).set({})})));var il=$u.aTypedArray,sl=$u.aTypedArrayConstructor,ol=[].slice;(0,$u.exportTypedArrayMethod)("slice",(function(e,t){for(var n=ol.call(il(this),e,t),r=Jr(this,this.constructor),i=0,s=n.length,o=new(sl(r))(s);s>i;)o[i]=n[i++];return o}),a((function(){new Int8Array(1).slice()})));var al=Mn.some,ul=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("some",(function(e){return al(ul(this),e,arguments.length>1?arguments[1]:void 0)}));var cl=$u.aTypedArray,ll=[].sort;(0,$u.exportTypedArrayMethod)("sort",(function(e){return ll.call(cl(this),e)}));var hl=$u.aTypedArray;(0,$u.exportTypedArrayMethod)("subarray",(function(e,t){var n=hl(this),r=n.length,i=ye(e,r);return new(Jr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ge((void 0===t?r:ye(t,r))-i))}));var fl=o.Int8Array,dl=$u.aTypedArray,gl=$u.exportTypedArrayMethod,pl=[].toLocaleString,vl=[].slice,yl=!!fl&&a((function(){pl.call(new fl(1))}));gl("toLocaleString",(function(){return pl.apply(yl?vl.call(dl(this)):dl(this),arguments)}),a((function(){return[1,2].toLocaleString()!=new fl([1,2]).toLocaleString()}))||!a((function(){fl.prototype.toLocaleString.call([1,2])})));var ml=$u.exportTypedArrayMethod,_l=o.Uint8Array,El=_l&&_l.prototype||{},Tl=[].toString,Rl=[].join;a((function(){Tl.call({})}))&&(Tl=function(){return Rl.call(this)});var Il=El.toString!=Tl;ml("toString",Tl,Il);var Cl=Object.assign,Sl=Object.defineProperty,bl=!Cl||a((function(){if(u&&1!==Cl({b:1},Cl(Sl({},"a",{enumerable:!0,get:function(){Sl(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=Cl({},e)[n]||Dn(Cl({},t)).join("")!=r}))?function(e,t){for(var n=R(e),r=arguments.length,i=1,s=Se.f,o=h.f;r>i;)for(var a,c=y(arguments[i++]),l=s?Dn(c).concat(s(c)):Dn(c),f=l.length,d=0;f>d;)a=l[d++],u&&!o.call(c,a)||(n[a]=c[a]);return n}:Cl;Pe({target:"Object",stat:!0,forced:Object.assign!==bl},{assign:bl});var wl,Nl,Ol,kl,Al="[\t\n\v\f\r \u2028\u2029\ufeff]",Ml=RegExp("^"+Al+Al+"*"),xl=RegExp(Al+Al+"*$"),Ll=function(e){return function(t){var n=String(m(t));return 1&e&&(n=n.replace(Ml,"")),2&e&&(n=n.replace(xl,"")),n}},Ul={start:Ll(1),end:Ll(2),trim:Ll(3)},Pl=Ce.f,Dl=k.f,Vl=x.f,Bl=Ul.trim,Fl="Number",jl=o.Number,Yl=jl.prototype,ql=p(ir(Yl))==Fl,Gl=function(e){var t,n,r,i,s,o,a,u,c=T(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=Bl(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(o=(s=c.slice(2)).length,a=0;a<o;a++)if((u=s.charCodeAt(a))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(Le(Fl,!jl(" 0o1")||!jl("0b1")||jl("+0x1"))){for(var Hl,Kl=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof Kl&&(ql?a((function(){Yl.valueOf.call(n)})):p(n)!=Fl)?Mo(new jl(Gl(t)),n,Kl):Gl(t)},Wl=u?Pl(jl):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),Ql=0;Wl.length>Ql;Ql++)C(jl,Hl=Wl[Ql])&&!C(Kl,Hl)&&Vl(Kl,Hl,Dl(jl,Hl));Kl.prototype=Yl,Yl.constructor=Kl,oe(o,Fl,Kl)}!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(wl||(wl={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Nl||(Nl={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(Ol||(Ol={})),function(e){e.PUB="pub",e.QUERY="qry"}(kl||(kl={}));var Jl,zl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wl.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Rt(this,e),this._retain=!1,this.qos=wl.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var s=t>0;t&&s&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=n,this.qos=r,this._dup=i)}return Ct(e,[{key:"encode",value:function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0}}]),e}(),Zl=function(){function e(){Rt(this,e)}return Ct(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ms(e))for(var i=0,s=e.length;i<s;i++){var o=e.charCodeAt(i);o>=0&&o<=127?(r+=1,n.push(o)):o>=128&&o<=2047?(r+=2,n.push(192|31&o>>6),n.push(128|63&o)):o>=2048&&o<=65535&&(r+=3,n.push(224|15&o>>12),n.push(128|63&o>>6),n.push(128|63&o))}for(var a=0,u=n.length;a<u;a++)n[a]>255&&(n[a]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)}},{key:"readUTF",value:function(e){for(var t,n,r=[],i=-1,s=e,o="";++i<s.length;){var a=Number(s[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&a)&&(a=(a^=192)<<6|128^s[++i])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(o+=String.fromCharCode.apply(null,r),r.length=0)}return o}}]),e}(),$l=function(){function e(t){Rt(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return Ct(e,[{key:"check",value:function(){return this._position>=this._pool.length}},{key:"readInt",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)}},{key:"readLong",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r}return parseInt(t,16)}},{key:"readByte",value:function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e}},{key:"readUTF",value:function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return Zl.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),Xl=function(){function e(){Rt(this,e),this._pool=[],this._position=0,this._writen=0}return Ct(e,[{key:"write",value:function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e}},{key:"writeArr",value:function(e){return this._pool=this._pool.concat(e),e}},{key:"writeUTF",value:function(e){var t=Zl.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),eh="UpStreamMessage",th="PushExtra",nh="DownStreamMessage",rh="DownStreamMessages",ih="SessionsAttQryInput",sh="SessionsAttOutput",oh="SyncRequestMsg",ah="ChrmPullMsg",uh="NotifyMsg",ch="HistoryMsgInput",lh="HistoryMsgOuput",hh="RelationQryInput",fh="RelationsOutput",dh="DeleteSessionsInput",gh="SessionInfo",ph="DeleteSessionsOutput",vh="RelationsInput",yh="DeleteMsgInput",mh="CleanHisMsgInput",_h="SessionMsgReadInput",Eh="ChrmInput",Th="ChrmOutput",Rh="QueryChatRoomInfoInput",Ih="QueryChatRoomInfoOutput",Ch="RtcInput",Sh="RtcUserListOutput",bh="SetUserStatusInput",wh="RtcSetDataInput",Nh="RtcUserSetDataInput",Oh="RtcDataInput",kh="RtcSetOutDataInput",Ah="MCFollowInput",Mh="RtcTokenOutput",xh="RtcQryOutput",Lh="RtcQryUserOutDataInput",Uh="RtcUserOutDataOutput",Ph="RtcQueryListInput",Dh="RtcRoomInfoOutput",Vh="RtcValueInfo",Bh="RtcKeyDeleteInput",Fh="GetQNupTokenInput",jh="GetQNupTokenOutput",Yh="GetQNdownloadUrlInput",qh="GetDownloadUrlInput",Gh="GetQNdownloadUrlOutput",Hh="GetDownloadUrlOutput",Kh="SetChrmKV",Wh="ChrmKVOutput",Qh="QueryChrmKV",Jh="SetUserSettingInput",zh="SetUserSettingOutput",Zh="PullUserSettingInput",$h="PullUserSettingOutput",Xh="UserSettingNotification",ef="SessionReq",tf="SessionStates",nf="SessionState",rf="SessionStateItem",sf="SessionStateModifyReq",of="SessionStateModifyResp",af="GrpReadReceiptMsg",uf="GrpReadReceiptQryReq",cf="GrpReadReceiptQryResp",lf="GrpMsgReadUser",hf="SessionTagAddInput",ff="SessionTagItem",df="SessionTagDelInput",gf="SessionDisTagReq",pf="ReportSDKInput",vf="ReportSDKOutput",yf="RtcNotifyMsg",mf="RtcPullKV",_f="RtcKVOutput",Ef=(St(Jl={},eh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt"]),St(Jl,rh,["list","syncTime","finished"]),St(Jl,nh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt"]),St(Jl,th,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),St(Jl,ih,["nothing"]),St(Jl,sh,["inboxTime","sendboxTime","totalUnreadCount"]),St(Jl,oh,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),St(Jl,ah,["syncTime","count"]),St(Jl,uh,["type","time","chrmId"]),St(Jl,ch,["targetId","time","count","order"]),St(Jl,lh,["list","syncTime","hasMsg"]),St(Jl,hh,["type","count","startTime","order"]),St(Jl,fh,["info"]),St(Jl,dh,["sessions"]),St(Jl,gh,["type","channelId"]),St(Jl,ph,["nothing"]),St(Jl,vh,["type","msg","count","offset","startTime","endTime"]),St(Jl,yh,["type","conversationId","msgs"]),St(Jl,mh,["targetId","dataTime","conversationType"]),St(Jl,_h,["type","msgTime","channelId"]),St(Jl,Eh,["nothing"]),St(Jl,Th,["nothing","sessionId","joinTime"]),St(Jl,Rh,["count","order"]),St(Jl,Ih,["userTotalNums","userInfos"]),St(Jl,Fh,["type","key","httpMethod","queryString"]),St(Jl,Yh,["type","key","fileName"]),St(Jl,qh,["type","key","fileName"]),St(Jl,jh,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),St(Jl,Gh,["downloadUrl"]),St(Jl,Hh,["downloadUrl"]),St(Jl,Kh,["entry","bNotify","notification","type"]),St(Jl,Wh,["entries","bFullUpdate","syncTime"]),St(Jl,Qh,["timestamp"]),St(Jl,Jh,["version","value"]),St(Jl,zh,["version","reserve"]),St(Jl,Zh,["version","reserve"]),St(Jl,$h,["items","version"]),St(Jl,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),St(Jl,ef,["time"]),St(Jl,tf,["version","state"]),St(Jl,nf,["type","channelId","time","stateItem"]),St(Jl,rf,["sessionStateType","value","tags"]),St(Jl,sf,["version","state"]),St(Jl,of,["version"]),St(Jl,af,["msgId","busChannel"]),St(Jl,uf,["msgId","busChannel"]),St(Jl,cf,["totalMemberNum","list"]),St(Jl,lf,["readTime","userId"]),St(Jl,hf,["version","tags"]),St(Jl,ff,["tagId","name","createdTime","isTop"]),St(Jl,df,["version","tags"]),St(Jl,gf,["tagId"]),St(Jl,Xh,["version","reserve"]),St(Jl,pf,["sdkInfo"]),St(Jl,vf,["nothing"]),St(Jl,Ch,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType"]),St(Jl,Sh,["users","token","sessionId","roomInfo"]),St(Jl,bh,["status"]),St(Jl,wh,["interior","target","key","value","objectName","content"]),St(Jl,Nh,["valueInfo","objectName","content"]),St(Jl,Oh,["interior","target","key","objectName","content"]),St(Jl,kh,["target","valueInfo","objectName","content"]),St(Jl,Ah,["state"]),St(Jl,Mh,["rtcToken"]),St(Jl,xh,["outInfo"]),St(Jl,Lh,["userId"]),St(Jl,Uh,["user"]),St(Jl,Ph,["order"]),St(Jl,Dh,["roomId","roomData","userCount","list"]),St(Jl,Vh,["key","value"]),St(Jl,Bh,["key"]),St(Jl,yf,["type","time","roomId"]),St(Jl,mf,["timestamp","roomId"]),St(Jl,_f,["entries","bFullUpdate","syncTime"]),Jl),Tf={},Rf=function(e){var t=Ef[e];Tf[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(qn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Tf[e].decode=function(e){var t={};Ms(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(qn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var If in Ef)Rf(If);Tf.getModule=function(e){return Tf[e]()},oc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Cf="\npackage Modules;\nmessage probuf {\n message ".concat(bh,"\n {\n optional int32 status=1;\n }\n\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message ").concat(uh," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(oh," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n }\n message ").concat(eh," {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n }\n message ").concat(th," {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message ").concat(rh," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(nh," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(As.IMAGE,";\n audio = ").concat(As.AUDIO,";\n video = ").concat(As.VIDEO,";\n file = ").concat(As.FILE,";\n }\n message ").concat(Fh," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Yh," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(qh," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(jh," {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n }\n message ").concat(Gh," {\n required string downloadUrl = 1;\n }\n message ").concat(Hh," {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message ").concat(Eh," {\n required int32 nothing = 1;\n }\n message ").concat(Th," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(ah," {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message ").concat(hh,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(vh,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional int32 offset = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(fh,"\n {\n repeated RelationInfo info = 1;\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string channelId = 6;\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(mh,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(Rh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Ih,"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message ").concat(Ah,"\n {\n required string state = 1;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message ").concat(ch,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n }\n\n message ").concat(lh,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Ph,"{\n optional int32 order=1;\n }\n\n message ").concat(Bh,"{\n repeated string key=1;\n }\n\n message ").concat(Vh,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Vh," userData=2; //用户资源信息\n }\n\n message ").concat(Sh,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(Vh," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ch,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(xh,"{\n repeated ").concat(Vh," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(Oh,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(wh,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(Nh," {\n repeated ").concat(Vh," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Vh," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Mh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(kh,"{\n required targetType target=1;\n repeated ").concat(Vh," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Lh,"{\n repeated string userId = 1;\n }\n message ").concat(Uh,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(ih,"{\n required int32 nothing = 1;\n }\n message ").concat(sh,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(_h,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(dh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(gh,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n }\n message ").concat(ph,"\n {\n optional int32 nothing=1;\n }\n message ").concat(yh,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(Kh," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Wh," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(Qh," {\n required int64 timestamp = 1;\n }\n message ").concat(Jh," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(zh," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Zh," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat($h," {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message ").concat(ef," {\n required int64 time = 1;\n }\n message ").concat(tf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(nf," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n }\n message ").concat(rf," {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message ").concat(sf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(of," {\n required int64 version=1;\n }\n message ").concat(af," {\n repeated string msgId=1; //已读消息ID\n optional string busChannel = 2; // 该消息所属会话的业务标识\n }\n message ").concat(uf," {\n repeated string msgId=1; //已读消息ID\n optional string busChannel = 2; // 该消息所属会话的业务标识\n }\n message ").concat(cf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(lf," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(hf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ff," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(df," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(gf," {\n repeated string tagId=1;\n }\n message ").concat(Xh," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(pf,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(vf,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(yf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(mf,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(_f,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n}\n"),Sf=/"/g;Pe({target:"String",proto:!0,forced:function(e){return a((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("sub")},{sub:function(){return e="sub",t="",n="",r=String(m(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+String(n).replace(Sf,""")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var bf="ArrayBuffer",wf=ku.ArrayBuffer,Nf=o.ArrayBuffer;Pe({global:!0,forced:Nf!==wf},{ArrayBuffer:wf}),Or(bf),Pe({target:"Array",proto:!0},{fill:Xa}),cr("fill");var Of,kf,Af,Mf,xf,Lf=(Of=Cf,function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||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 e={};return e.IS_NODE=!("object"!==("undefined"==typeof process?"undefined":_t(process))||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),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=0|i*r,!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 1/0*n;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){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var s,o,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,i,s;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();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;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(s=this.source.substring(this.index,this.index=i))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,(o=(s=function(e){this.tn=new u(e),this.proto3=!1}).prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},o._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)},o._parseOption=function(e,n){var r,i=this.tn.next(),s=!1;if("("===i&&(s=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,s&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},o._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)}},o._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},o._parseServiceRPC=function(e){var n,r,i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},o._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())&&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},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,r,i){var s,o,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(s={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.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(s.type=i,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._parseMessageOneOf=function(e){var n,r,i,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(r=s,i=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var r,i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),r={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},o._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},o._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),s=7&r,o=r>>>3;switch(s){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(o,n);break;case t.WIRE_TYPES.ENDGROUP:if(o===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+s)}return!0}var s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T={},R=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=R.prototype;return I.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},I.toString=function(e){return(e?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},T.T=R,(o=(s=function(e,t,n,r,i){R.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(R.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.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)},o.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},o.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,s=0;if(""===r[s]){for(;null!==i.parent;)i=i.parent;s++}do{do{if(!(i instanceof T.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof T.T&&(!t||n instanceof T.Namespace))){i=null;break}i=n,s++}while(s<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},o.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof T.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof s&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},o.buildOpt=function(){var e,t,n,r,i={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],r=this.options[s[e]],i[n]=r;return i},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},T.Namespace=s,u=(a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)}).prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){var i,s,o,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(_t(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(_t(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(_t(n),"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),o=0;o<i.length;o++){if(i[o].name==n)return i[o].id;if(i[o].id==n)return i[o].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),(n>4294967295||n<0)&&a(_t(n),"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===_t(n)||a(_t(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in s={},n)n.hasOwnProperty(o)&&(s[o]=n[o]);n=s}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.calculateLength=function(e,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?n.calculateVarint64(r):n.calculateVarint32(r);case t.TYPES.uint32:return n.calculateVarint32(r);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return n.calculateVarint64(r);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=n.calculateUTF8Bytes(r),n.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return n.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),n.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},u.encodeValue=function(e,r,i){var s,o;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");s=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=s;break;case t.TYPES.message:o=(new n).LE(),this.resolvedType.encode(r,o),i.writeVarint32(o.offset),i.append(o.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},u.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,s;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(s=e.readVarint32(),e.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+s,e.offset+=s,i;case t.TYPES.message:return s=e.readVarint32(),this.resolvedType.decode(e,s);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},T.Element=a,(l=(c=function(e,t,n,r,i,o){s.call(this,e,t,n,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(s.prototype)).build=function(r){var i,s,o,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,s,o){var a,u,c,l,h,f,d;if(null===e||"object"!==_t(e))return o&&o instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(o.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return s?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,s,o)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=i(l.value[1],r,s,e.valueElem.resolvedType);return u}for(d in h=e.$type,f=void 0,e)e.hasOwnProperty(d)&&(u[d]=h&&(f=h.getChild(d))?i(e[d],r,s,f.resolvedType):i(e[d],r,s));return u}var s,o,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function e(i){var s,o,c,l;for(t.Builder.Message.call(this),s=0,o=u.length;o>s;++s)this[u[s].name]=null;for(s=0,o=a.length;o>s;++s)this[(c=a[s]).name]=c.repeated?[]:c.map?new t.Map(c):null,!c.required&&"proto3"!==r.syntax||null===c.defaultValue||(this[c.name]=c.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!==_t(i)||!("function"!=typeof i.encode||i instanceof e)||Array.isArray(i)||i instanceof t.Map||n.isByteBuffer(i)||i instanceof ArrayBuffer||t.Long&&i instanceof t.Long)for(s=0,o=arguments.length;o>s;++s)void 0!==(l=arguments[s])&&this.$set(a[s].name,l);else this.$set(i)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,n,i){var s=r._fieldsByName[e];if(!i){if(!s)throw Error(this+"#"+e+" is undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+e+" is not a repeated field");n=s.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},l.$add=l.add,l.set=function(e,n,i){var s,o,a;if(e&&"object"===_t(e)){for(s in i=n,e)e.hasOwnProperty(s)&&void 0!==(n=e[s])&&this.$set(s,n,i);return this}if(o=r._fieldsByName[e],i)this[e]=n;else{if(!o)throw Error(this+"#"+e+" is not a field: undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));this[o.name]=n=o.verifyValue(n)}return o&&o.oneof&&(a=this[o.oneof.name],null!==n?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===e&&(this[o.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,s=0;s<a.length;s++)(o=a[s])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===r.getChild("set"+s)&&(l["set"+s]=n),null===r.getChild("set_"+t)&&(l["set_"+t]=n),null===r.getChild("get"+s)&&(l["get"+s]=i),null===r.getChild("get_"+t)&&(l["get_"+t]=i)}(o);return l.encode=function(t,n){var i,s;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),s=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(s)}catch(e){throw t.LE(s),e}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return r.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,s;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return s=r.decode(e.LE()),e.LE(i),s}catch(t){throw e.LE(i),t}},c.decodeDelimited=function(e,t){var i,s,o;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(i=e.offset,s=e.readVarint32(),e.remaining()<s)return e.offset=i,null;try{return o=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(l,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof p||s instanceof c||s instanceof m){if(i.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");i[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,s,o,a,u=null;for(s=0,o=this._fields.length;o>s;++s)i=e[(r=this._fields[s]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,s=this._fields.length;s>i;++i){if(n=e[(t=this._fields[i]).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},l.decode=function(e,n,r){var s,o,a,u,c,l,h,f,d,g,p,v;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(s=e.readVarint32())>>>3,(o=7&s)===t.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])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,e)):u.map?(f=u.decode(o,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(o,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(o){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(g=0,p=this._fields.length;p>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(v=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,v;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},T.Message=c,(f=(h=function(e,n,r,i,s,o,a,u,l,h){R.call(this,e,n,o),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=a,this.options=u||{},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 c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(R.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},f.verifyValue=function(e,n){var r,i,s;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===e)return this.required&&r(_t(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(_t(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),s=[],i=0;i<e.length;i++)s.push(this.element.verifyValue(e[i]));return s}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(_t(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(_t(e),"no array expected"),this.element.verifyValue(e))},f.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},f.encode=function(e,r,i){var s,o,a,u,c;if(null===this.type||"object"!==_t(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),o=r.offset,s=0;s<e.length;s++)this.element.encodeValue(this.id,e[s],r);a=r.offset-o,(u=n.calculateVarint32(a))>1&&(c=r.slice(o,r.offset),o+=u-1,r.offset=o,r.append(c)),r.writeVarint32(a,o-u)}else for(s=0;s<e.length;s++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[s],r);else this.map?e.forEach((function(e,i){var s=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(s),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)}),this):this.hasWirePresence(e,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,r))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},f.calculate=function(e,r){var i,s,o;if(e=this.verifyValue(e),null===this.type||"object"!==_t(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),o=0,s=0;s<e.length;s++)o+=this.element.calculateLength(this.id,e[s]);i+=n.calculateVarint32(o),i+=o}else for(s=0;s<e.length;s++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[s]);else this.map?e.forEach((function(e,r){var s=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=n.calculateVarint32(s),i+=s}),this):this.hasWirePresence(e,r)&&(i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},f.decode=function(e,n,r){var i,s,o,u,c,l,h;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(s=n.readVarint32(),s=n.offset+s,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.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());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1==(h=l>>>3))u=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,h)}return[u,i]}return this.element.decode(n,e,this.id)},T.Message.Field=h,(d=function(e,t,n,r,i,s,o){h.call(this,e,t,n,null,r,i,s,o),this.extension}).prototype=Object.create(h.prototype),T.Message.ExtensionField=d,g=function(e,t,n){R.call(this,e,t,n),this.fields=[]},T.Message.OneOf=g,(p=function(e,t,n,r,i){s.call(this,e,t,n,r,i),this.className="Enum",this.object=null}).getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(p.prototype=Object.create(s.prototype)).build=function(e){var n,r,i,s;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,s=(r=this.getChildren(p.Value)).length;s>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},T.Enum=p,(v=function(e,t,n,r){R.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(R.prototype),T.Enum.Value=v,(y=function(e,t,n,r){R.call(this,e,t,n),this.field=r}).prototype=Object.create(R.prototype),T.Extension=y,((m=function(e,t,n,r){s.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(s.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var r,i=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)}},s=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){s[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(n.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!==_t(r))throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(n,r){if(!n){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 "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),i}(t,this)},T.Service=m,((_=function(e,t,n,r){R.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(R.prototype)).buildOpt=o.buildOpt,T.Service.Method=_,(E=function(e,t,n,r,i,s,o,a){_.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}).prototype=Object.create(_.prototype),T.Service.RPCMethod=E,T}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},s=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!==_t(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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 n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},s.create=function(t){var r,s,o,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(s=t.shift(),i.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.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"!==_t(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 n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){r.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(i.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(i.isService(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!i.isExtend(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.fields.forEach((function(t){var r,i,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(r=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var i,s,o,a,u,c,l,h,f="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"===_t(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(f="\\"),s=i+f+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"===_t(n)?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(f="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),f="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+f+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;if(null==this.ptr||"object"===_t(this.ptr.type))return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.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(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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: "+_t(this.ptr)+": "+this.ptr);return this.reset()},s.build=function(e){var t,n,r;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(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},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(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){var r,i,s,o;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(r=Object.keys(n),i=0;i<r.length;i++)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(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).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));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,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"===_t(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)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===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"===_t(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"===_t(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)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Of,i.loadProto(r,void 0,"").build("Modules").probuf}(function(e){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("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.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,c=u>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,g=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(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?f/u:f*Math.pow(2,1-h))*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+d]=255&a,d+=g,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[n+d]=255&o,d+=g,o/=256,c-=8);e[n+d-g]|=128*p}var s,o,a,u,c,l=function e(t,n,r){if(void 0===t&&(t=e.DEFAULT_CAPACITY),void 0===n&&(n=e.DEFAULT_ENDIAN),void 0===r&&(r=e.DEFAULT_NOASSERT),!r){if((t|=0)<0)throw RangeError("Illegal capacity");n=!!n,r=!!r}this.buffer=0===t?o:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=n,this.noAssert=r};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(i+=s);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),o=0;a>o;)(s=(u=e[o++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,o;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==_t(e))throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=s.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(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 l(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");for((i=new l(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},s.writeBitSet=function(e,t){var n,r,i,s,o,a,u=void 0===t;if(u&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,s=(i=e.length)>>3,o=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(i>o){for(a=0,n=0;i>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},s.readBitSet=function(e){var t,n,r,i,s,o,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;i--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(r>s)for(a=0,t=this.readByte(e++);r>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},s.writeBytes=s.append,s.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},s.writeByte=s.writeInt8,s.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},s.readByte=s.readInt8,s.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},s.writeUInt8=s.writeUint8,s.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},s.readUInt8=s.readUint8,s.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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),r&&(this.offset+=2),this},s.writeShort=s.writeInt16,s.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},s.readShort=s.readInt16,s.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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),r&&(this.offset+=2),this},s.writeUInt16=s.writeUint16,s.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},s.readUInt16=s.readUint16,s.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},s.writeInt=s.writeInt32,s.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},s.readInt=s.readInt32,s.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},s.writeUInt32=s.writeUint32,s.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,s=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.readInt64=function(t){var n,r,i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),s&&(this.offset+=8),i},s.readLong=s.readInt64,s.writeUint64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,s=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.readUint64=function(t){var n,r,i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),s&&(this.offset+=8),i},s.readUInt64=s.readUint64),s.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},s.writeFloat=s.writeFloat32,s.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},s.readFloat=s.readFloat32,s.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},s.writeDouble=s.writeFloat64,s.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},s.readDouble=s.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},s.writeVarint32=function(e,t){var n,r,i,s=void 0===t;if(s&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,s?(this.offset=t,this):r},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.readVarint32=function(e){var t,n,r,i,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,s?(this.offset=e,r):{value:r,length:n}},s.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===_t(t)?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.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:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},s.writeVarint64=function(t,n){var r,i,s,o,a,u=void 0===n;if(u&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&o>>>7;case 9:this.view[n+8]=9!==r?128|o:127&o;case 8:this.view[n+7]=8!==r?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==r?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==r?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==r?128|s:127&s;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return u?(this.offset+=r,this):r},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,r,i,s,o,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,i=0,s=0,o=0,r=127&(o=this.view[t++]),128&o&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(i=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),s.writeCString=function(e,n){var r,i,s,o=void 0===n;if(o&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):i},s.readCString=function(e){var t,r,i,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,c.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),s?(this.offset=e,r()):{string:r(),length:e-t}},s.writeIString=function(e,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return o?(this.offset=n,this):n-i},s.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",s.writeUTF8String=function(e,n){var r,i,s,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-i},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateString=l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},s.readUTF8String=function(e,t,r){var i,s,o,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.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)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(o=0,a=r,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(u=r+e,c.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),s=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,s()):{string:s(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var r,i,s,o,a=void 0===n;if(a&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(s=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-s},s.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},s.append=function(e,t,n){var r,i,s;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.clone=function(e){var t=new l(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},s.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===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 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=o,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).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)},s.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===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 l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(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},s.copyTo=function(e,t,n,r){var i,s,o;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===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);return 0==(o=r-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===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(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var r,i,s,o,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=o,this.view=a,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},s.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===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||Array.prototype.reverse.call(this.view.subarray(e,t)),this},s.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},s.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===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},s.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?o:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},s.toArrayBuffer=s.toBuffer,s.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),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)}},u=function(){var e,t,n={},r=[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],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,s,o;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(o=i[r])&&n(r),t(s<<2>>>0|(48&o)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(o=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},s.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);s.view[r++]=n}return s.limit=i,s},s.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",o="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<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},l.fromDebug=function(e,t,n){for(var r,i,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,f=!1,d=!1,g=!1;s>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||f||d){g=!0;break}h=f=d=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||f){g=!0;break}h=f=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}o.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");o.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===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);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,s,o,a;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(i=e.length,s=new l(0|i/2,t),o=0,a=0;i>o;o+=2){if(r=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=r}return s.limit=a,s},c=function(){var e={MAX_CODEPOINT:1114111,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(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},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)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)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)},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):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},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]}};return e}(),s.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===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{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},l}(kf=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,s;return t?(s=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&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:g;if(t){if(e<0)return p;if(e>=h)return E}else{if(-f>=e)return T;if(e+1>=f)return _}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function s(e,t,n){var i,o,a,u,l,h,f;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return s(e.substring(1),t,n).neg();for(o=r(c(n,8)),a=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(f=r(c(n,l)),a=a.mul(f).add(r(h))):a=(a=a.mul(o)).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)}var a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=o,f=(h=(l=4294967296)*l)/2,d=n(16777216),g=n(0),e.ZERO=g,p=n(0,!0),e.UZERO=p,v=n(1),e.ONE=v,y=n(1,!0),e.UONE=y,m=n(-1),e.NEG_ONE=m,_=i(-1,2147483647,!1),e.MAX_VALUE=_,E=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=E,T=i(0,-2147483648,!1),e.MIN_VALUE=T,(R=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},R.toString=function(e){var t,n,i,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(s=r(c(e,6),this.unsigned),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(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},R.isZero=function(){return 0===this.high&&0===this.low},R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.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},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.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},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){var n,r,s,a,u,c,l,h,f,d,g;return t(e)||(e=o(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,f=0,d=0,g=0,d+=(g+=a+(65535&e.low))>>>16,f+=(d+=s+l)>>>16,h+=(f+=r+c)>>>16,h+=n+u,i((d&=65535)<<16|(g&=65535),(h&=65535)<<16|(f&=65535),this.unsigned)},R.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,s,a,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(T)?e.isOdd()?T:g:e.eq(T)?this.isOdd()?T:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(d)&&e.lt(d)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=0,v=0,y=0,m=0,y+=(m+=u*(f=65535&e.low))>>>16,v+=(y+=a*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=a*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+a*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},R.mul=R.multiply,R.divide=function(e){var n,i,s,a,u,l,h;if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return y;s=p}else{if(this.eq(T))return e.eq(v)||e.eq(m)?T:e.eq(T)?v:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:m:(i=this.sub(e.mul(n)),s=n.add(i.div(e)));if(e.eq(T))return this.unsigned?p:g;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=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=v),s=s.add(l),i=i.sub(h)}return s},R.div=R.divide,R.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.not=function(){return i(~this.low,~this.high,this.unsigned)},R.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},R.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)},R.shl=R.shiftLeft,R.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)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},R.shru=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,255&t>>>8,255&t>>>16,255&t>>>24,255&e,255&e>>>8,255&e>>>16,255&e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[255&e>>>24,255&e>>>16,255&e>>>8,255&e,255&t>>>24,255&t>>>16,255&t>>>8,255&t]},e}()),kf));Lf.getModule=function(e){var t=new Lf[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Ps(e)?[].slice.call(new Int8Array(e)):e},t};var Uf="pgMsgP",Pf="chatMsg",Df="pcMsgP",Vf={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Bf="delMsg",Ff="joinChrm",jf="joinChrmR",Yf="exitChrm",qf="setKV",Gf="delKV",Hf="qryRelationR",Kf="delRelation",Wf="setSeAtt",Qf={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Jf="qryPMsg",zf="qryGMsg",Zf="qryCHMsg",$f="qryCMsg",Xf="qrySMsg",ed=(St(Af={},"ppMsgP",Os.PRIVATE),St(Af,Uf,Os.GROUP),St(Af,Pf,Os.CHATROOM),St(Af,Df,Os.CUSTOMER_SERVICE),Af),td=(St(Mf={},Os.PRIVATE,Jf),St(Mf,Os.GROUP,zf),St(Mf,Os.CHATROOM,Zf),St(Mf,Os.CUSTOMER_SERVICE,$f),St(Mf,Os.SYSTEM,Xf),Mf),nd=(St(xf={},Os.PRIVATE,Qf.PRIVATE),St(xf,Os.GROUP,Qf.GROUP),St(xf,Os.CUSTOMER_SERVICE,Qf.CUSTOMER_SERVICE),St(xf,Os.SYSTEM,Qf.SYSTEM),xf),rd="1",id="0",sd=1,od=2,ad=3,ud=function(){function t(e){Rt(this,t),this._codec="websocket"===e?Lf:Tf,this._connectType=e}return Ct(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,o=(St(r={},rh,i._formatSyncMessages),St(r,nh,i._formatReceivedMessage),St(r,eh,i._formatSentMessage),St(r,lh,i._formatHistoryMessages),St(r,fh,i._formatConversationList),St(r,Ih,i._formatChatRoomInfos),St(r,Sh,i._formatRTCUserList),St(r,xh,i._formatRTCData),St(r,Wh,i._formatChatRoomKVList),St(r,$h,i._formatUserSetting),St(r,tf,i._formatConversationStatus),St(r,cf,i._formatGrpReadReceiptQryResp),St(r,zh,i._formatSetUserSettingOutput),St(r,Xh,i._formatUserSettingNotification),St(r,_f,i._formatRTCRoomKVList),St(r,Mh,i._formatRTCAuidenceJoinRoomData),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Vs(s)&&(s=function(e){for(var t in e)Vs(e[t])&&(e[t]=zo(e[t]));return e}(s)),Bs(o)&&(s=o.call(this,s,n))}catch(n){Ks.error("PB parse error\n",n,e,t)}return s}},{key:"_readBytes",value:function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Ps(n)?new Uint8Array(n):n;return Zl.readUTF(i.subarray(t,r))}catch(e){Ks.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Ks.info("formatBytes error\n",e)}return t||e}},{key:"_formatSyncMessages",value:function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,s=e.finished;return(Fs(s)||null===s)&&(e.finished=!0),e.syncTime=zo(i),e.list=ra(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){var r=t=t||{},i=r.currentUserId,s=r.connectedTime,o=e.content,a=e.fromUserId,u=e.type,c=e.groupId,l=e.status,h=e.dataTime,f=e.classname,d=e.msgId,g=e.extraContent,p=e.pushContent,v=e.pushExt,y=e.configFlag,m=(e.direction||to.RECEIVE)===to.SEND,_=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(l),E=_.isPersited,T=_.isCounted,R=_.isMentioned,I=_.disableNotification,C=_.receivedStatus,S=_.canIncludeExpansion,b=[Os.GROUP,Os.CHATROOM,Os.RTC_ROOM].indexOf(u)>-1?c:a,w=m?i:a,N=zo(h),O=N<s,k=u===Os.CHATROOM,A=this._formatBytes(o),M={};v&&(M=Xo(v.pushConfigs,v.pushId));var x,L=wt(wt({},M),{},{pushTitle:null==v?void 0:v.title,pushContent:p,pushData:p,disablePushTitle:!!y&&Boolean(4&y),forceShowDetailContent:!!y&&Boolean(8&y),templateId:null==v?void 0:v.templateId}),U=m?to.SEND:to.RECEIVE;return k&&a===i&&(U=to.SEND),g&&(x={},x=la(g)),{conversationType:u,targetId:b,senderUserId:w,messageType:f,messageUId:d,isPersited:E,isCounted:T,isMentioned:R,sentTime:N,isOffLineMessage:O,messageDirection:U,receivedTime:ha.getTime(),disableNotification:I,receivedStatus:C,canIncludeExpansion:S,content:A,expansion:x,configFlag:y,pushConfig:L}}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,i=e.classname,s=e.sessionId,o=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=t.signal,f=t.currentUserId,d=h.date,g=h.topic,p=h.targetId,v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(s),y=v.isPersited,m=v.isCounted,_=v.disableNotification,E=v.canIncludeExpansion,T=ed[g]||Os.PRIVATE,R=sa(Vf,g),I=this._formatBytes(r),C=p;i===uo.RECALL&&(T=I.conversationType||T,C=I.targetId||p),a&&(n={},n=la(a));var S={};u&&(S=Xo(u.pushConfigs,u.pushId));var b=wt(wt({},S),{},{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:T,targetId:C,messageType:i,messageUId:o,isPersited:y,isCounted:m,isStatusMessage:R,senderUserId:f,content:this._formatBytes(r),sentTime:1e3*d,receivedTime:ha.getTime(),messageDirection:to.SEND,isOffLineMessage:!1,disableNotification:_,canIncludeExpansion:E,expansion:n,pushConfig:b}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,o=r.targetId,a=zo(e.syncTime),u=[];return na(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=ra(r,(function(e){var r=e.msg,s=e.userId,o=e.type,a=e.unreadCount,u=e.channelId,c=n._formatReceivedMessage(r,t);c.targetId=s;var l={targetId:s,conversationType:o,unreadMessageCount:a,latestMessage:c,channelId:u||""};return i(l)||l})))||[]}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:ra(n,(function(e){var t=e.id,n=e.time;return{id:t,time:zo(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=ra(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,o=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?_o.DELETE:_o.UPDATE}}(r);return{key:t,value:n,isAutoDelete:o.isAutoDelete,isOverwrite:o.isOverwrite,type:o.type,userId:s,timestamp:zo(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return na(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=zo(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=zo(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return na(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,o=lo.CLOSE,a=!1,u=[];na(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case sd:o=n===rd?lo.OPEN:lo.CLOSE;break;case od:a=n===rd;break;case ad:u=r}})),n.push({type:t,targetId:r,notificationStatus:o,isTop:a,updatedTime:zo(i),tags:u})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s={};return na(t,(function(e){var t=e.userId,n=e.userData,r={};na(n,(function(e){var t=e.key,n=e.value;r[t]=n})),s[t]=r})),{users:s,token:n,sessionId:r,roomInfo:i}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return na(t,(function(e){n[e.key]=e.value})),n}},{key:"_formatRTCRoomInfo",value:function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return na(r,(function(e){i[e.key]=e.value})),i}},{key:"_formatGrpReadReceiptQryResp",value:function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=zo(e.readTime)})),{totalMemberCount:t,list:n}}},{key:"_formatUserSettingNotification",value:function(e){return e}},{key:"_formatRTCRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:zo(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(ih);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=e.type,i=t.messageType,s=t.isMentioned,o=t.mentionedType,a=t.mentionedUserIdList,u=t.content,c=t.pushContent,l=t.pushData,h=t.directionalUserIdList,f=t.isFilerWhiteBlacklist,d=t.isVoipPush,g=t.canIncludeExpansion,p=t.expansion,v=t.pushConfig,y=r===Os.GROUP,m=this._codec.getModule(eh),_=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),E=v||{},T=E.pushTitle,R=E.pushContent,I=E.pushData,C=E.iOSConfig,S=E.androidConfig,b=E.templateId,w=E.disablePushTitle,N=E.forceShowDetailContent,O=0;m.setSessionId(_),y&&s&&u&&(u.mentionedInfo={userIdList:a,type:o||fo.ALL});var k=R||c||"",A=I||l||"";if(k&&m.setPushText(k),A&&m.setAppData(A),h&&m.setUserId(h),O|=d?1:0,O|=f?2:0,O|=w?4:0,O|=N?8:0,m.setConfigFlag(O),m.setClassname(i),m.setContent(JSON.stringify(u)),g&&p){var M={};na(p,(function(e,t){M[t]={v:e}})),m.setExtraContent(JSON.stringify(M))}if(v){var x=this._codec.getModule(th);if(T&&x.setTitle(T),C&&S){var L=$o(C,S);x.setPushConfigs(L)}(null==S?void 0:S.notificationId)&&x.setPushId(null==S?void 0:S.notificationId),x.setTemplateId(b||""),m.setPushExt(n?x.getArrayData():x)}return m}},{key:"encodeUpMsg",value:function(e,t){return this._getUpMsgModule(e,t).getArrayData()}},{key:"encodeSyncMsg",value:function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(oh);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()}},{key:"encodeChrmSyncMsg",value:function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(ah);return n.setCount(t),n.setSyncTime(e),n.getArrayData()}},{key:"encodeGetHistoryMsg",value:function(e,t){var n=t.count,r=t.order,i=t.timestamp,s=this._codec.getModule(ch);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(hh);return i.setType(1),i.setCount(n),i.setStartTime(r),i.getArrayData()}},{key:"encodeOldConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.type,i=t.startTime,s=t.order;n=n||0,i=i||0,s=s||0;var o=this._codec.getModule(hh);return o.setType(r),o.setCount(n),o.setStartTime(i),o.setOrder(s),o.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(dh),r=[];return na(e,(function(e){var n=e.type,i=e.targetId,s=t._codec.getModule(gh);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n){var r=this._codec.getModule(yh),i=[];return na(n,(function(e){i.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(i),r.getArrayData()}},{key:"encodeClearMessages",value:function(e,t){var n=this._codec.getModule(mh);return t=t||(new Date).getTime(),n.setDataTime(t),n.setTargetId(e),n.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.type,r=e.targetId,i=t.timestamp,s=this._codec.getModule(_h);return i=i||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(i),s.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(Eh);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Rh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(Fh);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()}},{key:"encodeGetFileUrl",value:function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()}},{key:"encodeModifyChatRoomKV",value:function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(Kh),s=t.key,o=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type||_o.UPDATE,l=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n}(t,c),h={key:s,value:o||"",uid:n};if(Fs(l)||(h.status=l),i.setEntry(h),u){var f={type:Os.CHATROOM,targetId:e},d={key:s,value:o,extra:a,type:c},g=this._getUpMsgModule(f,{messageType:uo.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(Os.CHATROOM)}return i.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(Qh);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(Zh);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(ef);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(sf),i=ha.getTime(),s=[];return na(e,(function(e){var r=t._codec.getModule(nf),o=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,l=[];r.setType(o),r.setChannelId(a),r.setTime(i);var h=u===lo.OPEN,f={};Fs(u)||(f[sd]=h),Fs(c)||(f[od]=c),na(f,(function(e,r){if(!Fs(e)){var i=t._codec.getModule(rf);e=e?rd:id,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;l.push(s)}})),r.setStateItem(l);var d=n?r.getArrayData():r;s.push(d)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(af);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeCreateTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(hf),s=[];return e.forEach((function(e){var t=n._codec.getModule(ff);t.setTagId(e.tagId),t.setName(e.tagName),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeMessageReader",value:function(e,t){var n=this._codec.getModule(af);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeRemoveTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(df),s=[];return e.forEach((function(e){var t=n._codec.getModule(ff);t.setTagId(e),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeDisConversationTag",value:function(e){var t=this._codec.getModule(gf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(sf),s=[];return t.forEach((function(t){var i=n._codec.getModule(nf),o=n._codec.getModule(rf),a=[];e.forEach((function(e){var t=n._codec.getModule(ff);t.setTagId(e.tagId),Fs(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),o.setSessionStateType(ad),o.setValue(JSON.stringify(a)),o.setTags(a),i.setType(t.type),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?o.getArrayData():o]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(ha.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(pf);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t){var n=this._codec.getModule(Ch);return e=e||0,n.setRoomType(e),Fs(t)||n.setBroadcastType(t),n.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(bh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(wh);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var o=i.content;o&&(Vs(o)&&(o=JSON.stringify(o)),s.setContent(o))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,o=this._codec.getModule(Nh);o.setObjectName(n);var a=this._codec.getModule(Vh);a.setKey(e.name),a.setValue(e.content),s?o.setContent([a.getArrayData()]):o.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(Vh);n.setKey(e);var o="uris"===e?t:r;n.setValue(o),s?u.push(n.getArrayData()):u.push(n)})),o.setValueInfo(u),o.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(Nh);n.setObjectName(e);var r=this._codec.getModule(Vh);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()}},{key:"encodeGetRTCData",value:function(e,t,n){var r=this._codec.getModule(Oh);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()}},{key:"encodeRemoveRTCData",value:function(e,t,n,r){var i=this._codec.getModule(Oh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},o=s.name,a=s.content;return!Fs(o)&&i.setObjectName(o),Fs(a)||(Vs(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(kh);r.setTarget(t),Us(e)||(e=[e]),na(e,(function(t,n){t.key=t.key?t.key.toString():t.key,t.value=t.value?t.value.toString():t.value,e[n]=t})),r.setValueInfo(e);var i=n=n||{},s=i.name,o=i.content;return!Fs(s)&&r.setObjectName(s),Fs(o)||(Vs(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Lh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(Ah);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Ph);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(Vh);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Bh);return t.setKey(e),t.getArrayData()}},{key:"encodeIdentityChangeInfo",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._codec.getModule(Ch);return i.setRoomType(e.RTCMode.LIVE),n&&i.setBroadcastType(n),i.setIdentityChangeType(t),i.setNeedSysChatroom(r),i.getArrayData()}},{key:"encodePullRTCRoomKV",value:function(e,t){var n=this._codec.getModule(mf);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}}]),t}(),cd=function e(t,n){Rt(this,e),this._watcher=n,this.codec=new ud(t)},ld=function(e,t){return e&&t?t+"_"+e:e||Date.now()},hd=function(){function e(t){Rt(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return ld(e,t)}},{key:"read",value:function(e,t){this.readMessage(e,t)}},{key:"readMessage",value:function(e,t){return{stream:e,length:t}}}]),e}(),fd=function(){function e(t){Rt(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new zl(t,!1,wl.AT_MOST_ONCE,!1)}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return ld(e,t)}},{key:"write",value:function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)}},{key:"setHeaderQos",value:function(e){this._header.qos=e}},{key:"getHeaderFlag",value:function(){return this._header.encode()}},{key:"getLengthSize",value:function(){return this.lengthSize}},{key:"getBufferData",value:function(){var e=new Xl;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),dd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ol.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){if(e.readByte(),this.status=+e.readByte(),t>n.MESSAGE_LENGTH){this.userId=e.readUTF();var r=e.readUTF();Ks.debug("server sessionId -> "+r),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(hd);dd.MESSAGE_LENGTH=2;var gd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ol.DISCONNECT,e.status=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(hd);gd.MESSAGE_LENGTH=2;var pd,vd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.call(this,Nl.PING_REQ))._name=Ol.PING_REQ,e}return Ct(n,[{key:"writeMessage",value:function(e){}}]),n}(fd),yd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,e))._name=Ol.PING_RESP,r}return n}(hd),md=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}}}]),n}(hd),_d=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(fd),Ed=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ol.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=kl.PUB,e}return Ct(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(md),Td=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Rt(this,n),(s=t.call(this,Nl.PUBLISH))._name=Ol.PUBLISH,s.syncMsg=!1,s.identifier=kl.PUB,s.topic=e,s.data=Ms(r)?Zl.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(_d),Rd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ol.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=kl.PUB,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}]),n}(md),Id=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,Nl.PUB_ACK))._name=Ol.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return Ct(n,[{key:"writeMessage",value:function(e){Dt(Ot(n.prototype),"writeMessage",this).call(this,e)}}]),n}(_d),Cd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Rt(this,n),(s=t.call(this,Nl.QUERY)).name=Ol.QUERY,s.identifier=kl.QUERY,s.topic=e,s.data=Ms(r)?Zl.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(_d),Sd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,Nl.QUERY_CONFIRM))._name=Ol.QUERY_CON,r.messageId=e,r}return n}(_d),bd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ol.QUERY_ACK,e.status=0,e.identifier=kl.QUERY,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}]),n}(md),wd=function(e){var t,n=e.type;switch(n){case Nl.CONN_ACK:t=new dd(e);break;case Nl.PUBLISH:(t=new Ed(e)).syncMsg=e.syncMsg;break;case Nl.PUB_ACK:t=new Rd(e);break;case Nl.QUERY_ACK:t=new bd(e);break;case Nl.SUB_ACK:case Nl.UNSUB_ACK:case Nl.PING_RESP:t=new yd(e);break;case Nl.DISCONNECT:t=new gd(e);break;default:t=new hd(e),Ks.error("No support for deserializing "+n+" messages")}return t},Nd=function(e){var t=new Uint8Array(e),n=new $l(t),r=n.readByte(),i=new zl(r),s=wd(i);return s.read(n,t.length-1),s},Od=function(e){var t=e.headerCode,n=new zl(t),r=wd(n);for(var i in e)r[i]=e[i];return r};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.addSeTag=72]="addSeTag",e[e.delSeTag=73]="delSeTag",e[e.addTag=74]="addTag",e[e.delTag=75]="delTag",e[e.disTag=76]="disTag",e[e.reportsdk=77]="reportsdk"}(pd||(pd={}));var kd,Ad,Md=pd,xd=(kd=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=Tt(regeneratorRuntime.mark((function e(t){var i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Date.now(),s="".concat(n,"://").concat(t,"/ping?r=").concat(Ss(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:5e3});case 4:return o=e.sent,e.abrupt("return",{status:o.status,host:t,cost:Date.now()-i});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return(i=(i=e.sent).filter((function(e){return 200===e.status}))).length>1&&(i=i.sort((function(e,t){return e.cost-t.cost}))),e.abrupt("return",i.map((function(e){return e.host})));case 6:case"end":return e.stop()}}),e)}))),function(e,t,n){return kd.apply(this,arguments)}),Ld=function(e,t,n,r,i,s,o){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"")},Ud=function(e){return[Md.ppMsgS,Md.pgMsgS,Md.chatMsgS].map((function(e){return Md[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(Ad||(Ad={}));var Pd,Dd=function(e,t){Ks.debug("websocket send -> messageId: ".concat(e.messageId));var n=e.getBufferData();t.send(n.buffer)},Vd=function(e){Nt(o,e);var t,n,r,i,s=Pt(o);function o(e,t){var n;return Rt(this,o),(n=s.call(this,"websocket",t))._runtime=e,n._socket=null,n._messageIds={},n._syncMessageIds={},n._failedCount=0,n.ALLOW_FAILED_TIMES=2,n._timer=null,n._idCount=0,n._generateMessageId=function(){return n._idCount>=65535&&(n._idCount=0),++n._idCount},n}return Ct(o,[{key:"connect",value:(i=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Hn(s),this._watcher.status(so.CONNECTING),Ks.debug("ping -> protocol: ".concat(i,", hosts: ").concat(JSON.stringify(r))),e.next=5,xd(r,i,this._runtime);case 5:if(o=e.sent,Ks.debug("valid hosts -> ".concat(o.join(","))),0!==o.length){e.next=10;break}return Ks.error("No valid websocket server hosts!"),e.abrupt("return",ro.RC_SOCKET_NOT_CREATED);case 10:a=i.replace("http","ws"),c=regeneratorRuntime.mark((function e(r,i){var c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=Ld(a,o[r],t,n,d._runtime,s),Ks.debug("conenct start -> ".concat(c)),d.sendConnectTime=Date.now(),l=d._runtime.createWebSocket(c),h=function(e){d._timer&&(clearTimeout(d._timer),d._timer=null),d._socket===l&&(d._socket=null,d._watcher.status(e))},e.next=7,new Promise((function(e){l.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=Nd(t);if(n instanceof yd&&d._pingResolve)return d._pingResolve(ro.SUCCESS),void(d._pingResolve=void 0);if(n instanceof dd)return Ks.debug("recv connect ack -> ".concat(n.status)),n.status!==oo.ACCEPTED?(Ks.warn("connect failed: ".concat(n.status)),void e(n.status)):(Ks.info("connect success -> ".concat(c)),d.connectedTime=n.timestamp,d.userId=n.userId||"",void e(ro.SUCCESS));if(n instanceof gd){var r=n.status;switch(Ks.warn("recv disconnect signal -> status: ".concat(r)),r){case Ad.BLOCK:d._watcher.status(so.BLOCKED);break;case Ad.OTHER_DEVICE_LOGIN:d._watcher.status(so.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Ad.REDIRECT_NEW:case Ad.REDIRECT:d._watcher.status(so.REDIRECT);break;default:d._watcher.status(so.DISCONNECT_BY_SERVER)}}else d._onReceiveSignal(n)}else Ks.error("Socket received invalid data:",t)})),l.onClose((function(t,n){Ks.warn("websocket closed! code:",t,"reason:",n),h(so.CONNECTION_CLOSED),e(t)})),l.onError((function(t){Ks.error("websocket error!",null==t?void 0:t.stack),h(so.WEBSOCKET_ERROR),e(ro.NETWORK_ERROR)})),l.onOpen((function(){return Ks.debug("websocket open =>",c)})),setTimeout((function(){e(ro.TIMEOUT)}),rn)}));case 7:if((u=e.sent)!==oo.REDIRECT){e.next=10;break}return e.abrupt("return",{v:u});case 10:if(u!==ro.SUCCESS){e.next=16;break}return d._socket=l,d._checkAlive(),e.abrupt("return",{v:u});case 16:Ks.warn("connect result -> code: ".concat(u,", url: ").concat(c)),u=ca(u);case 18:l.close();case 19:case"end":return e.stop()}}),e)})),l=0,h=o.length;case 13:if(!(l<h)){e.next=21;break}return e.delegateYield(c(l,h),"t0",15);case 15:if("object"!==_t(f=e.t0)){e.next=18;break}return e.abrupt("return",f.v);case 18:l+=1,e.next=13;break;case 21:return e.abrupt("return",void 0!==u?u:ro.RC_NET_UNAVAILABLE);case 22:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=Tt(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._socket){e.next=2;break}return e.abrupt("return");case 2:return Ks.debug("send ping ->"),this.sendOnly(new vd),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(ro.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===ro.SUCCESS){e.next=12;break}return this._failedCount+=1,Ks.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Ks.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close()):this._checkAlive(),e.abrupt("return");case 12:Ks.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3);case 15:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_onReceiveSignal",value:(n=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==wl.AT_MOST_ONCE&&(t instanceof Ed&&!t.syncMsg&&(Ks.debug("send pubAck -> ".concat(n)),this.sendOnly(new Id(n))),t instanceof bd&&(Ks.debug("send queryCon -> ".concat(n)),this.sendOnly(new Sd(n)))),n>0&&(t instanceof Rd||t instanceof bd)&&(Ks.debug("recv ack -> messageId: ".concat(n)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Ed)){e.next=16;break}if(s=t.syncMsg,(o=t.topic)!==Md[Md.userSetData]){e.next=8;break}return e.abrupt("return");case 8:if(s&&!Ud(o)){e.next=11;break}return this._watcher.signal(t),e.abrupt("return");case 11:return e.next=13,new Promise((function(e){u._syncMessageIds[n]=e}));case 13:a=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,a);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&Dd(e,this._socket)}},{key:"send",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=c.length>3&&void 0!==c[3]?c[3]:un,!this._socket){e.next=16;break}return s=this._generateMessageId(),t.messageId=s,Dd(t,this._socket),e.next=7,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){u._messageIds[s]&&delete u._messageIds[s],e()}),i)}));case 7:if(o=e.sent){e.next=11;break}return Ks.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:ro.TIMEOUT});case 11:if(0===o.status){e.next=14;break}return Ks.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(o.status)),e.abrupt("return",{code:o.status});case 14:return a=n?this.codec.decodeByPBName(o.data,n,r):o,e.abrupt("return",{code:ro.SUCCESS,data:a});case 16:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 17:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"close",value:function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(so.DISCONNECTED))}}]),o}(cd);e.HttpMethod=void 0,(Pd=e.HttpMethod||(e.HttpMethod={})).GET="GET",Pd.POST="POST";var Bd=function(e){if(Vs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},Fd=function(t){Nt(a,t);var n,r,i,s,o=Pt(a);function a(e,t){var n;return Rt(this,a),(n=o.call(this,"comet",t))._runtime=e,n._messageIds={},n._syncMessageIds={},n._idCount=0,n._generateMessageId=function(){return++n._idCount},n._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),n}return Ct(a,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ms(e.data)?JSON.parse(e.data):e.data;return n?!Us(n)||(na(n,function(){var e=Tt(regeneratorRuntime.mark((function e(n){var r,i,s,o,a,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=n.sessionid)&&(t._sessionid=r),i=Od(n),s=i.messageId,o=i._header,a=i.status,i.identifier,u=o&&o.qos!==wl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Ed&&!i.syncMsg&&(l=new Id(s),t.sendOnly(l)),i instanceof bd&&(h=new Sd(s),t.sendOnly(h))),!(i instanceof gd)){e.next=20;break}e.t0=a,e.next=e.t0===Ad.OTHER_DEVICE_LOGIN?11:e.t0===Ad.BLOCK?13:e.t0===Ad.REDIRECT_NEW||e.t0===Ad.REDIRECT?15:17;break;case 11:return t._watcher.status(so.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(so.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(so.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(so.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Ed)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!Ud(d)){e.next=25;break}return t._watcher.signal(i),e.abrupt("return",!1);case 25:return e.next=27,new Promise((function(e){t._syncMessageIds[s]=e}));case 27:g=e.sent,delete t._syncMessageIds[s],t._watcher.signal(i,g);case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!0):(Ks.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(s=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),r="".concat(t,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(n,"&pid=").concat(this._pid),e.next=4,this._runtime.httpReq({url:r,body:{pid:this._pid},timeout:45e3});case 4:i=e.sent,s=this.handleCometRes(i),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(so.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"connect",value:(i=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Hn(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(so.CONNECTING),e.next=6,xd(r,i,this._runtime);case 6:if(0!==(o=e.sent).length){e.next=10;break}return Ks.error("No valid comet server hosts!"),e.abrupt("return",ro.RC_SOCKET_NOT_CREATED);case 10:a=function(e){return 200!==e.status&&202!==e.status?(Ks.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(Bd(e.data)?Vs(e.data)?e.data:JSON.parse(e.data):(Ks.error("received data is not a validJson",e.data),!1))},c=0,l=o.length;case 12:if(!(c<l)){e.next=36;break}return h=Ld(i,o[c],t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),e.next=17,this._runtime.httpReq({url:h,body:{pid:this._pid},timeout:rn});case 17:if(f=e.sent,d=a(f),this._domain=o[c],!d||d.status!==oo.REDIRECT){e.next=22;break}return e.abrupt("return",d.status);case 22:if(!d||0!==d.status){e.next=31;break}return this._watcher.status(so.CONNECTED),this._sessionid=d.sessionid,this._startPullSignal(i),this.userId=d.userId,this.connectedTime=d.timestamp,e.abrupt("return",d.status);case 31:Ks.warn("connect result -> code: ".concat(null==d?void 0:d.status,", url: ").concat(h)),u=ca(null==d?void 0:d.status);case 33:c+=1,e.next=12;break;case 36:return e.abrupt("return",void 0!==u?u:ro.RC_NET_UNAVAILABLE);case 37:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=Tt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._domain,i=this._sessionid,s=this._pid,o=n.messageId,a=n.topic,u=n.targetId,n.identifier,c=n.getHeaderFlag(),l=a?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(a,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(s),t.next=7,this._runtime.httpReq({url:l,method:e.HttpMethod.POST,body:n.getCometData()});case 7:h=t.sent,this.handleCometRes(h);case 9:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"sendOnly",value:function(e){this.sendCometData(e)}},{key:"send",value:(n=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=c.length>3&&void 0!==c[3]?c[3]:un,s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),e.next=6,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){delete u._messageIds[s],e()}),i)}));case 6:if(o=e.sent){e.next=9;break}return e.abrupt("return",{code:ro.TIMEOUT});case 9:if(0===o.status){e.next=11;break}return e.abrupt("return",{code:o.status});case 11:return a=n?this.codec.decodeByPBName(o.data,n,r):o,e.abrupt("return",{code:ro.SUCCESS,data:a});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:function(){this._isDisconnected=!0,this._watcher.status(so.DISCONNECTED)}}]),a}(cd),jd=function e(t,n,r){Rt(this,e),this.runtime=t,this._watcher=n,this._options=r,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()},Yd=Mn.find,qd="find",Gd=!0;qd in[]&&Array(1).find((function(){Gd=!1})),Pe({target:"Array",proto:!0,forced:Gd},{find:function(e){return Yd(this,e,arguments.length>1?arguments[1]:void 0)}}),cr(qd);var Hd=function(e){return["navi",e].join("_")},Kd=function(e,t,n){var r,i,s=Hd(e);try{var o=n.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn}))),0===i.length?n.removeItem(s):n.setItem(s,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null},Wd=function(){function e(t,n){Rt(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Hn(this._options.apiVersion)}var t;return Ct(e,[{key:"getInfo",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=Kd(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return o=this._options.navigators.slice(),n.length&&n.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),e.next=9,this._reqNavi(o,this._appkey,t,i);case 9:if(!(s=e.sent)){e.next=14;break}return this._naviInfo=s,this.setNaviInfo2Cache(t,s),e.abrupt("return",s);case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"setNaviInfo2Cache",value:function(e,t){this._naviInfo=t,function(e,t,n,r){var i,s=Hd(e);try{var o=r.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(s,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)}},{key:"getInfoFromCache",value:function(e){return this._naviInfo}},{key:"_clear",value:function(e){!function(e,t,n){var r,i=Hd(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var o=Date.now();r.length>0&&(r=r.filter((function(e){return o-e.timestamp<nn&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),Qd=Mn.findIndex,Jd="findIndex",zd=!0;Jd in[]&&Array(1).findIndex((function(){zd=!1})),Pe({target:"Array",proto:!0,forced:zd},{findIndex:function(e){return Qd(this,e,arguments.length>1?arguments[1]:void 0)}}),cr(Jd);var Zd=function(e){if(gs(e))throw TypeError("The method doesn't accept regular expressions");return e},$d=ot("match");Pe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[$d]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(m(this)).indexOf(Zd(e),arguments.length>1?arguments[1]:void 0)}});var Xd="outbox",eg="inbox",tg=function(e,t,n){return[e,t,n].join("_")},ng=function(){function e(t,n){Rt(this,e),this._runtime=t,this._appkey=n,this._inboxTime=0,this._outboxTime=0}return Ct(e,[{key:"setInboxTime",value:function(e,t){if(!(this._inboxTime>e)){this._inboxTime=e;var n=tg(eg,this._appkey,t);this._runtime.localStorage.setItem(n,e.toString())}}},{key:"getInboxTime",value:function(e){if(0===this._inboxTime){var t=tg(eg,this._appkey,e);this._inboxTime=parseInt(this._runtime.localStorage.getItem(t))||0}return this._inboxTime}},{key:"setOutboxTime",value:function(e,t){if(!(this._outboxTime>=e)){this._outboxTime=e;var n=tg(Xd,this._appkey,t);this._runtime.localStorage.setItem(n,e.toString())}}},{key:"getOutboxTime",value:function(e){if(0===this._outboxTime){var t=tg(Xd,this._appkey,e);this._outboxTime=parseInt(this._runtime.localStorage.getItem(t))||0}return this._outboxTime}}]),e}(),rg={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},ig=function(){function e(t,n){Rt(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return Ct(e,[{key:"_add",value:function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e}},{key:"_remove",value:function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)}},{key:"_setEntry",value:function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,s=e.userId,o=this._getSetUserId(n),a=r===_o.DELETE,u=o===s,c=!this._isExisted(n),l=a?this._remove:this._add;(t||i||u||c)&&l.call(this,e)}},{key:"getValue",value:function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value}},{key:"getAllValue",value:function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e}},{key:"_getSetUserId",value:function(e){return(this._kvCaches[e]||{}).userId}},{key:"_isExisted",value:function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r}},{key:"setEntries",value:function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)})),Ks.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),sg=function(){function e(t){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.chrmId,r=t.timestamp,!((i=rg.get(n))>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullChatroomEntry(n,i);case 11:s=e.sent,o=s.code,a=s.data,this._isPulling=!1,o===ro.SUCCESS?(rg.set(n,a.syncTime||0),this._startPull()):this._startPull();case 16:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(e){rg.clear(e);var t=this._storeCaches[e];t&&t.clear()}},{key:"pullEntry",value:function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()}},{key:"setLocal",value:function(e,t,n){var r=this._storeCaches[e];Ys(r)||(r=new ig(e,n)),r.setEntries(t),this._storeCaches[e]=r}},{key:"getValue",value:function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null}},{key:"getAll",value:function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n}}]),e}(),og=function(){function e(t,n,r,i){Rt(this,e),this._runtime=t,this._appkey=n,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return Ct(e,[{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))}},{key:"get",value:function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){Ks.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],Ys(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()}},{key:"clear",value:function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)}}]),e}(),ag="converStatusChanged",ug=function(){function e(t,n,r){Rt(this,e),this._eventEmitter=new Xs,this._pullQueue=[],this._isPulling=!1,this._storage=dn(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return Ct(e,[{key:"_set",value:function(e){var t=this;if(!Fs(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(ag,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullConversationStatus(t);case 6:n=e.sent,r=n.code,i=n.data,r===ro.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull();case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pull",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"watch",value:function(e){this._eventEmitter.on(ag,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(ag,(function(e){}))}}]),e}(),cg={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}}},lg={};for(var hg in cg){var fg=cg[hg].keyName;lg[fg]=hg}var dg,gg=function(){function e(t,n,r){Rt(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new pn(t,i)}return Ct(e,[{key:"_getStoreKey",value:function(e,t){return"".concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value:function(e){var t=(e=e||"").split("_");return t.length>=2?{conversationType:t[0],targetId:e.match(/_.*/g)[0].substring(1)}:{conversationType:Os.PRIVATE,targetId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,o=e.isMentioned,a=e.content,u=e.senderUserId,c=this._getStoreKey(r,i),l=this.storage.get(c)||{},h=lg.mentionedInfo,f=lg.hasMentioned,d=l[h]||{},g=d.userIdList||[],p=a.mentionedInfo;if(p){if(o&&r===Os.GROUP)(p.userIdList||[]).forEach((function(e){e===n._currentUserId&&g.indexOf(u)<0&&g.push(u)})),p.type===fo.ALL&&g.indexOf(u)<0&&g.push(u);if(s===uo.RECALL&&r===Os.GROUP){var v=g.indexOf(u);v>=0&&g.splice(v,1)}p={userIdList:g,type:(null===(t=p)||void 0===t?void 0:t.type)||d.type},0!==g.length?(l[h]=p,l[f]=!0):(delete l[h],delete l[f]),Ys(l)?this.storage.set(c,l):this.storage.remove(c)}}},{key:"set",value:function(e,t,n){var r=this._getStoreKey(e,t),i=this.storage.get(r)||{};for(var s in n){var o=lg[s],a=n[s];if(!Fs(o)&&!Fs(a)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(a===cg[o].defaultVal||"tags"===s&&!Ys(a))delete i[o];else if("tags"===s){var u=a;for(var c in u)u[c].isTop||delete u[c].isTop;i[o]=a}else i[o]=a;i.c||(delete i.t,delete i.hm,delete i.m)}}Ys(i)?this.storage.set(r,i):this.storage.remove(r)}},{key:"get",value:function(e,t){var n=this._getStoreKey(e,t),r=this.storage.get(n)||{},i={};for(var s in cg){var o=cg[s],a=o.keyName,u=o.defaultVal;i[a]=r[s]||oa(u)}return i}},{key:"getValue",value:function(e){var t=this.storage.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId},o=t[r];for(var a in o){var u=cg[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||oa(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this.storage.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,s=r.targetId,o={},a=e[n];for(var u in a){var c=cg[u],l=c.keyName,h=c.defaultVal;o[l]=a[u]||oa(h)}for(var f in o.tags){Fs(t[f])&&(t[f]=[]);var d=Object.assign({},o,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}}]),e}(),pg=[Os.PRIVATE,Os.GROUP,Os.SYSTEM,Os.PUBLIC_SERVICE,Os.APP_PUBLIC_SERVICE],vg="conversationChanged",yg=function(){function e(t,n,r,i){var s=this;Rt(this,e),this._updatedConversations={},this._eventEmitter=new Xs,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new gg(t.runtime,n,r),this._statusManager=new ug(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(vg,(function(e){i(e)}))}return Ct(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=o===to.SEND&&a===this._loginUserId,c=r===uo.RECALL,l=Vs(n),h=!1,f=t.lastUnreadTime||0,d=t.unreadMessageCount||0;if(f>i||u)return{hasChanged:h,localConversation:t};(s&&(t.unreadMessageCount=d+1,t.lastUnreadTime=i,h=!0),c&&l)&&(f>=n.sentTime&&d&&(t.unreadMessageCount=d-1,h=!0));return{hasChanged:h,localConversation:t}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned);to.SEND;var i=Vs(n),s=!1;return r&&i&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0),{hasChanged:s,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(Vs(e)){var t=e.conversationType,n=e.targetId,r="".concat(t,"_").concat(n),i=this._store.get(t,n)||{};this._updatedConversations[r]=Object.assign(i,e)}}},{key:"addStatus",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,s=e.notificationStatus,o=e.isTop,a=e.tags,u={},c={};Fs(s)||(c.notificationStatus={time:i,val:s}),Fs(o)||(c.isTop={time:i,val:o}),Fs(a)||(c.tags={time:i,val:a},null==a||a.forEach((function(e){u[e.tagId]={isTop:e.isTop}}))),this._store.set(n,r,{notificationStatus:s,isTop:o,tags:u}),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:c}),t&&this._notifyConversationChanged()}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);this._eventEmitter.emit(vg,e),this._updatedConversations={}}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId;if(pg.indexOf(r)>=0){var o=!1,a=this._store.get(r,s);if([this._calcUnreadCount,this._calcMentionedInfo].forEach((function(t){var r=t.call(n,e,a),i=r.hasChanged,s=r.localConversation;o=o||i,a=oa(s)})),o&&this._store.set(r,s,a),this._store.updateMentionedData(e),i){var u=this._store.get(r,s);u.updatedItems={latestMessage:{time:e.sentTime,val:e}},u.latestMessage=e;var c=Object.assign(u,{conversationType:r,targetId:s});this._setUpdatedConversation(c)}t&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){return this._store.get(e,t)}},{key:"getAllUnreadCount",value:function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,s=e.notificationStatus,o=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(o))&&(i+=Number(r)):i+=Number(r))})),i}},{key:"getUnreadCountByTag",value:function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus;(t||1!==i)&&(n=n||0,r+=Number(n))})),r}},{key:"getUnreadCount",value:function(e,t){return this._store.get(e,t).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t){var n=this._store.get(e,t),r=n.unreadMessageCount,i=n.hasMentioned;(r||i)&&(n.unreadMessageCount=0,n.hasMentioned=!1),this._store.set(e,t,n);var s=Object.assign(n,{conversationType:e,targetId:t});this._setUpdatedConversation(s),this._notifyConversationChanged()}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t);this._draftMap[r]=n}},{key:"getDraft",value:function(e,t){var n="".concat(e,"_").concat(t);return this._draftMap[n]}},{key:"clearDraft",value:function(e,t){var n="".concat(e,"_").concat(t);delete this._draftMap[n]}},{key:"addTagStatus",value:function(e,t,n){var r=this._store.get(e,t).tags;r=Object.assign(r,n),this._store.set(e,t,{tags:r})}},{key:"deleteTagStatus",value:function(e,t,n){var r=this._store.get(e,t).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r})}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}}]),e}(),mg=function(){function e(t,n,r,i){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=dn(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return Ct(e,[{key:"_updateTag",value:function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()}},{key:"addTag",value:function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)}},{key:"deleteTag",value:function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)}},{key:"getTagsInfo",value:function(){return this._storage.get(this._storageTagKey)||{}}},{key:"getTags",value:function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))}},{key:"getTagById",value:function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null}},{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullUserSettings(t);case 6:n=e.sent,r=n.code,i=n.data,r!==ro.SUCCESS||Fs(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,o=i.version,a=s.Tag,Fs(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,o),this._isPulling=!1,this._startPull());case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullUserSettings",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"getVersion",value:function(){return this._storage.get(this._storagePullTimeKey)||0}}]),e}(),_g=function(e){Nt(i,e);var t,n,r=Pt(i);function i(e,t){var n;return Rt(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return Ct(i,[{key:"_formatJSONPUrl",value:function(e,t,n,r){var i=this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())}},{key:"getInfo",value:(n=Tt(regeneratorRuntime.mark((function e(t,n,r){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?on.join(","):an.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):o||"",n=[]),e.abrupt("return",Dt(Ot(i.prototype),"getInfo",this).call(this,t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"_reqNavi",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,o=t.length;case 2:if(!(s<o)){e.next=27;break}return a=this._formatJSONPUrl(t[s],r,n,i),Ks.debug("req navi => ".concat(a)),e.next=7,this._runtime.httpReq({url:a,timeout:1e4});case 7:if(200===(u=e.sent).status){e.next=12;break}return 403===u.status&&Ks.error("request navi error: "+ro.RC_CONN_USER_OR_PASSWD_ERROR),401===u.status&&Ks.error("request navi error: "+ro.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",24);case 12:return e.prev=12,c=u.data.replace("".concat(i,"("),"").replace(/\);?$/,""),l=JSON.parse(c),h=/^https/.test(a)?"https":"http",l.protocol=h,this._runtime.useNavi||(l.server="",l.backupServer=this._miniConnectUrl,l.logSwitch=0),e.abrupt("return",l);case 21:e.prev=21,e.t0=e.catch(12),Ks.error("parse navi err =>",e.t0);case 24:s+=1,e.next=2;break;case 27:if(this._runtime.useNavi){e.next=30;break}return f={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl},e.abrupt("return",f);case 30:return e.abrupt("return",null);case 31:case"end":return e.stop()}}),e,this,[[12,21]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(Wd),Eg=function(){function e(t){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.roomId,r=t.timestamp,!((i=this._pullTime)>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullRTCRoomEntry(n,i);case 11:s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS?(this._isPulling=!1,this._pullTime=a.syncTime||0,this._startPull()):this._startPull();case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullEntry",value:function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()}},{key:"reset",value:function(){this._pullTime=0,this._isPulling=!1}}]),e}(),Tg=function(e,t){return["send_msg",e,t].join("_")},Rg=function(){function e(t,n){Rt(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return Ct(e,[{key:"init",value:function(e){this._userId=e;var t=Tg(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}},{key:"_getLocalInfo",value:function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}},{key:"setMessage",value:function(e,t){this._sendMessageMap[e]=t;var n=Tg(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))}},{key:"getSendMessageMap",value:function(){return this._sendMessageMap}},{key:"removeByUID",value:function(e){delete this._sendMessageMap[e]}},{key:"removeByTimestamp",value:function(e){var t=Tg(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))}}]),e}(),Ig=function(e){var t="RCDeviceId",n=dn(e),r="",i=n.get(t);return i?r=i:(r=ws(),n.set(t,r)),r};St(dg={},Os.PRIVATE,Md.qryPMsg),St(dg,Os.GROUP,Md.qryGMsg),St(dg,Os.CHATROOM,Md.qryCHMsg),St(dg,Os.CUSTOMER_SERVICE,Md.qryCMsg),St(dg,Os.SYSTEM,Md.qrySMsg);var Cg=[Md[Md.recallMsg],Md[Md.ppMsgS],Md[Md.pgMsgS],Md[Md.ppMsgP],Md[Md.pgMsgP],Md[Md.chatMsg],Md[Md.pcMsgP],Md[Md.prMsgS]],Sg=function(e){var t;return(t={},St(t,Os.PRIVATE,Md.ppMsgP),St(t,Os.GROUP,Md.pgMsgP),St(t,Os.CHATROOM,Md.chatMsg),St(t,Os.CUSTOMER_SERVICE,Md.pcMsgP),St(t,Os.RTC_ROOM,Md.prMsgS),t)[e]},bg=function(e,t,r,i,s,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:to.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig}},wg=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},Ng=function(t){Nt(he,t);var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R,I,C,S,b,w,N,O,k,A,M,x,L,U,P,D,V,B,F,j,Y,q,G,H,K,W,Q,J,z,Z,$,X,ee,te,ne,re,ie,se,oe,ae,ue,ce,le=Pt(he);function he(e,t,n){var r;return Rt(this,he),(r=le.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._letterbox=new ng(e,n.appkey),r._sendMessageStore=new Rg(e,n.appkey),r._chrmEntryHandler=new sg(Lt(r)),r}return Ct(he,[{key:"_createNavi",value:function(){return new _g(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(ce=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],this._naviInfo=n,n.server?r.push(n.server):Ks.warn("navi.server is invalid"),(i=n.backupServer)&&i.split(",").forEach((function(e){r.indexOf(e)<0&&r.push(e)})),0!==r.length){e.next=8;break}return Ks.error("navi invaild.",r),e.abrupt("return",ro.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){a._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),e.next=11,s.connect(this._appkey,t,r,n.protocol,this._apiVer);case 11:return(o=e.sent)===ro.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(so.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new yg(this,this._appkey,this.currentUserId,this._watcher.conversation),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new mg(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rtcKVManager=new Eg(this),this._joinedChrmManager=new og(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval()):s.close(),e.abrupt("return",o);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Ks.warn("connection status changed:",e),e!==so.CONNECTING&&e!==so.CONNECTED){if(this._channel&&e!==so.DISCONNECTED)return e===so.BLOCKED||e===so.KICKED_OFFLINE_BY_OTHER_CLIENT||e===so.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==so.REDIRECT?this._try2Reconnect(t,n,r):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e)}},{key:"_try2Reconnect",value:(ue=Tt(regeneratorRuntime.mark((function e(t,n,r){var i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._channel.connect(this._appkey,t,n,r,this._apiVer);case 4:if(e.sent!==ro.SUCCESS){e.next=12;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(so.CONNECTED),this._rejoinChrm(),Ks.__insertLogIntoDatabase(),e.abrupt("return");case 12:this._watcher.status(so.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){i._reconnectTimer=-1,i._try2Reconnect(t,n,r)}),5e3);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"_signalHandler",value:function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=Md[r];if(i)switch(i){case Md.s_ntf:Ks.debug("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case Md.s_msg:this._receiveMsg(e);break;case Md.s_cmd:this._receiveStateNotify(e);break;case Md.s_us:this._receiveSettingNotify(e);break;case Md.rtc_ntf:this._receiveRtcKv(e)}else Ks.error("unknown topic:",r)}}},{key:"_receiveStateNotify",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,uh),r=n.time,i=n.type,s=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(s,r);break;case 3:this._conversationManager.startPullConversationStatus(r)}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Xh)).version;this._userSettingManager.pullUserSettings(n)}},{key:"_receiveRtcKv",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,yf),r=n.time,i=n.type,s=n.roomId;switch(i){case 1:this._rtcKVManager.pullEntry(s,r)}}},{key:"_receiveMessageExpansion",value:function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})}},{key:"_receiveSyncMsg",value:function(e,t){var n;if(Cg.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,eh,{currentUserId:this.currentUserId,signal:e});(r=this._handleMsgProperties(r)).sentTime=t.timestamp,r.messageUId=t.messageUId,this._pullingMsg?this._pullQueue.push(t.timestamp):(this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==uo.EXPANSION_NOTIFY?(r.messageType===uo.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId),this._watcher.message(r),this._conversationManager.setConversationCacheByMessage(r,!0)):this._receiveMessageExpansion(r))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,uh),n=t.type,r=t.chrmId,i=t.time;if(Ks.debug("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", time: ").concat(i)),2===n){var s=this._chrmsQueue[r];if(!s)return;s.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}}},{key:"_startSyncInterval",value:function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()}},{key:"_stopSyncInterval",value:function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)}},{key:"_syncMsg",value:(ae=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,u,c,l,h,f,d,g=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._pullingMsg){e.next=2;break}return e.abrupt("return");case 2:if(this._channel){e.next=5;break}return this._pullingMsg=!1,e.abrupt("return");case 5:return this._pullingMsg=!0,n=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),Ks.debug("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Cd(Md[Md.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,rh,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(o=e.sent,a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),a===ro.SUCCESS&&u){e.next=21;break}return Ks.warn("pullMsg failed -> code:",a,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Ks.debug("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,c.forEach((function(e){if(e.messageDirection===to.SEND&&(f=Math.max(e.sentTime,f),g._sendMessageStore.getSendMessageMap()[e.messageUId]))g._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==uo.EXPANSION_NOTIFY){if(e.messageType===uo.SYNC_READ_STATUS){if(e.senderUserId!==g.currentUserId)return;g._conversationManager.clearUnreadCount(e.conversationType,e.targetId)}var t=g._handleMsgProperties(e);g._conversationManager.setConversationCacheByMessage(t,!0),g._watcher.message(t)}else g._receiveMessageExpansion(e)})),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,d=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(t=this._pullQueue).push.apply(t,Bt(d)),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!l||d.length>0)&&this._syncMsg();case 34:case"end":return e.stop()}}),e,this)}))),function(){return ae.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg){var t=this._channel.codec.decodeByPBName(e.data,nh,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});(t=this._handleMsgProperties(t)).senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==uo.EXPANSION_NOTIFY?t.messageType===uo.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.message(t)):this._receiveMessageExpansion(t)}}},{key:"_handleMsgProperties",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.messageType,i=e.isCounted,s=e.isPersited,o=e.isStatusMessage,a=r in hn,u=r in this._customMessageType;return t=a?hn[r]:u?this._customMessageType[r]:{isCounted:!js(i)&&i,isPersited:!js(s)&&s},Object.assign(e,{isCounted:t.isCounted,isPersited:t.isPersited,isStatusMessage:fn.includes(r)}),n&&(e.isStatusMessage=o),e}},{key:"getHistoryMessage",value:(oe=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this.currentUserId,a=this._channel,u=td[t]||Jf,c=1===i&&0===r,!a){e.next=14;break}return l=a.codec.encodeGetHistoryMsg(n,{timestamp:r,count:c?2:i,order:s}),e.next=7,a.send(new Cd(u,l,o),lh,{currentUserId:o,connectedTime:a.connectedTime,conversation:{targetId:n}});case 7:if(h=e.sent,(f=h.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",{code:f});case 11:return d=h.data,c&&2===d.list.length&&(d.hasMore=!0,0===s?d.list.shift():d.list.pop()),e.abrupt("return",{code:f,data:{list:d.list,hasMore:d.hasMore}});case 14:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return oe.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Ks.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Cd(Md[Md.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==ro.SUCCESS&&Ks.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(se=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,!(s=this._channel)){e.next=11;break}return o=s.codec.encodeDeleteMessages(t,n,r),a=new Cd(Bf,o,i),e.next=6,s.send(a);case 6:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=10;break}return e.abrupt("return",c);case 10:return e.abrupt("return",c);case 11:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return se.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(ie=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,!(s=this._channel)){e.next=12;break}return o=s.codec.encodeClearMessages(n,r),a=new Cd(nd[t],o,i),e.next=7,s.send(a);case 7:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",c);case 12:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ie.apply(this,arguments)})},{key:"getConversationList",value:(re=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,u,c,l,h,f=this,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=d.length>0&&void 0!==d[0]?d[0]:300,n=d.length>1?d[1]:void 0,r=d.length>2?d[2]:void 0,i=d.length>3?d[3]:void 0,s=this.currentUserId,o=this._channel,n=n||Os.PRIVATE,!o){e.next=17;break}return a=o.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Cd(Hf,a,s),e.next=12,o.send(u,fh,{currentUserId:s,connectedTime:o.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=f._conversationManager.get(t,n);return Object.assign(e,r),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===ro.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:h});case 17:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return re.apply(this,arguments)})},{key:"removeConversation",value:(ne=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._channel)){e.next=12;break}return i=r.codec.encodeOldConversationList({type:t}),s=new Cd(Kf,i,n),e.next=6,r.send(s);case 6:if(o=e.sent,Ks.info("RemoveConversation =>",o),(a=o.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",a);case 11:return e.abrupt("return",a);case 12:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return ne.apply(this,arguments)})},{key:"getConversation",value:(te=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._conversationManager.get(t,n)){e.next=3;break}return e.abrupt("return",{code:ro.CONVER_GET_ERROR});case 3:return e.next=5,this.getHistoryMessage(t,n,0,1,0);case 5:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:ro.CONVER_GET_ERROR});case 10:return u=(null==a?void 0:a.list[0])||null,c={conversationType:t,targetId:n,channelId:r,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||lo.CLOSE,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0},e.abrupt("return",{code:ro.SUCCESS,data:c});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return te.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:ro.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t){var n=this._conversationManager.getUnreadCount(e,t);return Promise.resolve({code:ro.SUCCESS,data:n})}},{key:"clearConversationUnreadCount",value:function(e,t){return this._conversationManager.clearUnreadCount(e,t),Promise.resolve(ro.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n){return this._conversationManager.setDraft(e,t,n),Promise.resolve(ro.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t){var n=this._conversationManager.getDraft(e,t);return Promise.resolve({code:ro.SUCCESS,data:n})}},{key:"clearConversationMessageDraft",value:function(e,t){return this._conversationManager.clearDraft(e,t),Promise.resolve(ro.SUCCESS)}},{key:"pullConversationStatus",value:(ee=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=11;break}return i=n.codec.encodeGetConversationStatus(t),s=new Cd(Md[Md.pullSeAtts],i,r),e.next=6,n.send(s,tf);case 6:if(o=e.sent,a=o.code,u=o.data,a===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return e.abrupt("return",{code:a,data:u});case 11:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 12:case"end":return e.stop()}}),e,this)}))),function(e){return ee.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(X=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=13;break}return i=r.codec.encodeSetConversationStatus(t),s=new Cd(Wf,i,n),e.next=6,r.send(s,of);case 6:if(o=e.sent,a=o.code,u=o.data,a!==ro.SUCCESS){e.next=12;break}return c=u,t.forEach((function(e){l._conversationManager.addStatus(wt(wt({},e),{},{updatedTime:c.version}),!0)})),e.abrupt("return",a);case 12:return e.abrupt("return",a);case 13:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return X.apply(this,arguments)})},{key:"_joinChrm",value:($=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),o=new Cd(r?jf:Ff,s,t),e.next=8,i.send(o,Th);case 8:return a=e.sent,u=a.code,c=a.data,l=c.joinTime,u===ro.SUCCESS&&(this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,n,l),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,n)),e.abrupt("return",u);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return $.apply(this,arguments)})},{key:"_rejoinChrm",value:(Z=Tt(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this._joinedChrmManager.get(),e.t0=regeneratorRuntime.keys(t);case 2:if((e.t1=e.t0()).done){e.next=10;break}return n=e.t1.value,e.next=6,this._joinChrm(n,t[n]||10,!0);case 6:(r=e.sent)===ro.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:n,count:t[n]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:n,errorCode:r}}),e.next=2;break;case 10:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"_pullChrmMsg",value:(z=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h,f,d,g,p=this,v=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.length>1&&void 0!==v[1]?v[1]:10,r=v.length>2&&void 0!==v[2]?v[2]:0,this._channel){e.next=4;break}return e.abrupt("return");case 4:if(i=this._chrmsQueue[t],s=i.pulling,o=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,a=this._channel.codec.encodeChrmSyncMsg(o,n),u=new Cd(Md[Md.chrmPull],a,t),e.next=13,this._channel.send(u,rh,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===ro.SUCCESS&&h){e.next=20;break}return Ks.warn("pull chatroom msg failed, code:",l,", data:",h),e.abrupt("return");case 20:f=h.list,d=h.syncTime,g=h.finished,i.timestamp=r?Math.max(d,r):d,i.queue=i.queue.filter((function(e){return e>d})),f.forEach((function(e){e.sentTime<o||p._watcher.message(e)})),(!g||i.queue.length>0)&&this._pullChrmMsg(t);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"joinChatroom",value:(J=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!1));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return J.apply(this,arguments)})},{key:"joinExistChatroom",value:(Q=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!0));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return Q.apply(this,arguments)})},{key:"quitChatroom",value:(W=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Cd(Yf,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(o=s.code)===ro.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"getChatroomInfo",value:(K=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),o=new Cd(Md[Md.queryChrmI],s,t),e.next=7,i.send(o,Ih);case 7:if(a=e.sent,u=a.code,c=a.data,u===ro.SUCCESS){e.next=11;break}return e.abrupt("return",{code:u});case 11:return e.abrupt("return",{code:u,data:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return K.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(H=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),a=new Cd(Zf,o,t),e.next=7,s.send(a,lh,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return e.abrupt("return",{code:c,data:{list:l.list,hasMore:l.hasMore}});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return H.apply(this,arguments)})},{key:"_modifyChatroomKV",value:(G=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),o=n.type===_o.UPDATE?qf:Gf,a=new Cd(o,s,t),e.next=8,r.send(a);case 8:if(u=e.sent,(c=u.code)!==ro.SUCCESS){e.next=13;break}return this._chrmEntryHandler.setLocal(t,{kvEntries:[n],syncTime:(new Date).getTime()},i),e.abrupt("return",c);case 13:return e.abrupt("return",c);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"setChatroomEntry",value:(q=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_o.UPDATE,e.abrupt("return",this._modifyChatroomKV(t,n));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(Y=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_o.UPDATE,n.isOverwrite=!0,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"removeChatroomEntry",value:(j=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_o.DELETE,e.abrupt("return",this._modifyChatroomKV(t,n));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(F=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_o.DELETE,n.isOverwrite=!0,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return F.apply(this,arguments)})},{key:"getChatroomEntry",value:function(e,t){var n=this._chrmEntryHandler.getValue(e,t);return n?Promise.resolve({code:ro.SUCCESS,data:n}):Promise.resolve({code:ro.CHATROOM_KEY_NOT_EXIST})}},{key:"getAllChatroomEntry",value:function(e){var t=this._chrmEntryHandler.getAll(e);return Promise.resolve({code:ro.SUCCESS,data:t})}},{key:"pullChatroomEntry",value:(B=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),o=new Cd(Md[Md.pullKV],s,t),e.next=7,r.send(o,Wh);case 7:if(a=e.sent,u=a.code,c=a.data,u!==ro.SUCCESS){e.next=17;break}return Ks.debug("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(t,c,i),Ks.debug("Save into cache success!"),l=c.kvEntries,h=[],l.length>0&&(l.forEach((function(e){var n=e.key,r=e.value,i=e.type,s=e.timestamp;h.push({key:n,value:r,type:i,timestamp:s,chatroomId:t})})),this._watcher.chatroom({updatedEntries:h})),e.abrupt("return",{code:u,data:c});case 17:return e.abrupt("return",{code:u});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return B.apply(this,arguments)})},{key:"sendMessage",value:(V=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(r=wg(r,this.currentUserId),r=this._handleMsgProperties(r,!0),i=!![Os.PRIVATE,Os.GROUP].includes(t)&&r.isStatusMessage,s=i?(g=t,p=void 0,(p={},St(p,Os.PRIVATE,Md.ppMsgS),St(p,Os.GROUP,Md.pgMsgS),p)[g]):Sg(t)||Md.ppMsgP,i&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({type:t,targetId:n},r),(a=new Td(Md[s],o,n)).setHeaderQos(wl.AT_LEAST_ONCE),!i){e.next=13;break}return this._channel.sendOnly(a),e.abrupt("return",{code:ro.SUCCESS,data:bg(t,n,wt({},r),"",0,this.currentUserId)});case 13:return u=Date.now()-this._localConnectedTime+this._connectedTime,c=bg(t,n,wt({},r),"",u,this.currentUserId),e.next=17,this._channel.send(a);case 17:if(l=e.sent,h=l.code,f=l.data,h===ro.SUCCESS){e.next=22;break}return e.abrupt("return",{code:h,data:c});case 22:return d=f,this._sendMessageStore.setMessage(d.messageUId,d.timestamp),c.sentTime=d.timestamp,c.messageUId=d.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),e.abrupt("return",{code:ro.SUCCESS,data:c});case 28:case"end":return e.stop()}var g,p}),e,this)}))),function(e,t,n){return V.apply(this,arguments)})},{key:"recallMsg",value:(D=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return a=s.user,u={content:{conversationType:t,targetId:n,messageUId:r,sentTime:i,user:a},messageType:"RC:RcCmd",disableNotification:null==s?void 0:s.disableNotification,pushConfig:null==s?void 0:s.pushConfig,pushContent:(null===(o=s.pushConfig)||void 0===o?void 0:o.pushContent)||s.pushContent||""},c=Md[Md.recallMsg],l=this._channel.codec.encodeUpMsg({type:t,targetId:n},u),(h=new Td(c,l,this.currentUserId)).setHeaderQos(wl.AT_LEAST_ONCE),e.next=10,this._channel.send(h);case 10:if(f=e.sent,d=f.code,g=f.data,d===ro.SUCCESS){e.next=15;break}return e.abrupt("return",{code:d});case 15:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),e.abrupt("return",{code:ro.SUCCESS,data:bg(t,n,wt({},u),p.messageUId,p.timestamp,this.currentUserId)});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return D.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(P=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Cd(Md[Md.rrMsg],i,t),e.next=6,this._channel.send(s);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return P.apply(this,arguments)})},{key:"getMessageReader",value:(U=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Cd(Md[Md.rrList],i,t),e.next=6,this._channel.send(s,cf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return U.apply(this,arguments)})},{key:"pullUserSettings",value:(L=Tt(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Cd(Md[Md.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,$h));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"getFileToken",value:(x=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":Zo(t,n),o=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),a=new Cd(Md[Md.qnTkn],o,this.currentUserId),e.next=7,this._channel.send(a,jh);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==ro.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c,data:l});case 13:return e.abrupt("return",{code:c});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return x.apply(this,arguments)})},{key:"getFileUrl",value:(M=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s="",o="",a="",n===po.QINIU?(o=Yh,a=Gh):(o=qh,a=Hh),s=n===po.QINIU?Md[Md.qnUrl]:n===po.AWS?Md[Md.s3Url]:n===po.STC?Md[Md.stcUrl]:Md[Md.aliUrl],u=this._channel.codec.encodeGetFileUrl(o,t,r,i),c=new Cd(s,u,this.currentUserId),e.next=11,this._channel.send(c,a);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==ro.SUCCESS){e.next=17;break}return e.abrupt("return",{code:h,data:d});case 17:return e.abrupt("return",{code:h});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return M.apply(this,arguments)})},{key:"disconnect",value:function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._stopSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(A=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Cd(Md[Md.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,zh);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([wt(wt({},t),{},{createdTime:u})],u),e.abrupt("return",{code:ro.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"removeTag",value:(k=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Cd(Md[Md.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,zh);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:ro.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateTag",value:(O=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Cd(Md[Md.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,zh);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:ro.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"getTagList",value:(N=Tt(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._userSettingManager.getTags(),n=this._conversationManager.getConversationListForTag(),t.forEach((function(e){e.conversationCount=n[e.tagId]?n[e.tagId].length:0})),e.abrupt("return",{code:ro.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"addTagForConversations",value:(w=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:ro.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Cd(Md[Md.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(o=s.code)===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return(a={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.type,e.targetId,a)})),e.abrupt("return",{code:ro.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"removeTagForConversations",value:(b=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Cd(Md[Md.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(o=s.code)===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return n.forEach((function(e){a._conversationManager.deleteTagStatus(e.type,e.targetId,[t])})),e.abrupt("return",{code:ro.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"removeTagsForConversation",value:(S=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=t.type,i=t.targetId,s=n.map((function(e){return{tagId:e}})),o=this._channel.codec.encodeUpdateConversationTag(s,[t]),a=new Cd(Md[Md.delTag],o,this.currentUserId),e.next=8,this._channel.send(a);case 8:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return this._conversationManager.deleteTagStatus(r,i,n),e.abrupt("return",{code:ro.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"getConversationListByTag",value:(C=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,s=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeOldConversationList({count:r,type:Os.PRIVATE,startTime:n}),a=new Cd(Hf,o,i),e.next=7,s.send(a,fh,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,l),Ks.info("GetConversationListByTag",h),c===ro.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c});case 13:return e.abrupt("return",{code:c,data:h});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return C.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],i=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=n._conversationManager.get(s,o),u=a.hasMentioned,c=a.mentionedInfo,l=a.lastUnreadTime,h=a.notificationStatus,f=a.isTop,d=a.tags,g=a.unreadMessageCount,p=d&&d[e];if(p){var v=wt(wt({},t),{},{hasMentioned:u,mentionedInfo:c,lastUnreadTime:l,notificationStatus:h,isTop:f,unreadMessageCount:g});p.isTop?r.push(wt(wt({},v),{},{isTopInTag:!0})):i.push(wt(wt({},v),{},{isTopInTag:!1}))}})),[].concat(Bt(r.sort(s)),Bt(i.sort(s)))}},{key:"getUnreadCountByTag",value:(I=Tt(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:ro.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(R=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.type,o=r.isTop,a=[{tagId:t,isTop:o}],(u=this._conversationManager.get(s,i)).tags&&Object.hasOwnProperty.call(u.tags,t)){e.next=8;break}return e.abrupt("return",{code:ro.NO_TAG_IN_CONVER});case 8:return c=this._channel.codec.encodeUpdateConversationTag(a,[n]),l=new Cd(Md[Md.addTag],c,this.currentUserId),e.next=12,this._channel.send(l);case 12:if(h=e.sent,(f=h.code)===ro.SUCCESS){e.next=16;break}return e.abrupt("return",{code:f});case 16:return(d={})[t]={},o&&(d[t].isTop=!0),this._conversationManager.addTagStatus(s,i,d),e.abrupt("return",{code:ro.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return R.apply(this,arguments)})},{key:"getTagsForConversation",value:(T=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.type,t.targetId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(s in n.tags)i.push({tagId:s,tagName:null===(o=r[s])||void 0===o?void 0:o.tagName});return e.abrupt("return",{code:ro.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"joinRTCRoom",value:(E=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Cd(Md[Md.rtcRJoin_data],i,t),e.abrupt("return",this._channel.send(s,Sh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return E.apply(this,arguments)})},{key:"quitRTCRoom",value:(_=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Cd(Md[Md.rtcRExit],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"rtcPing",value:(m=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Cd(Md[Md.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return m.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(y=Tt(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Cd(Md[Md.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Dh));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(v=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Cd(Md[Md.rtcUData],n,t),e.next=6,this._channel.send(r,Sh);case 6:return i=e.sent,s=i.code,o=i.data,e.abrupt("return",{code:s,data:o?{users:o.users}:o});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setRTCUserInfo",value:(p=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Cd(Md[Md.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(g=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new Td(Md[Md.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"setRTCData",value:(d=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeSetRTCData(n,r,i,s,o),u=new Td(Md[Md.rtcSetData],a,t),e.next=6,this._channel.send(u);case 6:return c=e.sent,l=c.code,e.abrupt("return",l);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return d.apply(this,arguments)})},{key:"setRTCTotalRes",value:(f=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeUserSetRTCData(n,r,i,s),a=new Cd(Md[Md.userSetData],o,t),e.next=6,this._channel.send(a);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return f.apply(this,arguments)})},{key:"setRTCCDNUris",value:(h=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Cd(Md[Md.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return h.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:ro.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Cd(Md[Md.rtcQryData],i,e);return this._channel.send(s,xh)}},{key:"removeRTCData",value:(l=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeRemoveRTCData(n,r,i,s),a=new Td(Md[Md.rtcDelData],o,t),e.next=6,this._channel.send(a);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return l.apply(this,arguments)})},{key:"setRTCOutData",value:function(e,t,n,r){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCOutData",value:function(e,t){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCToken",value:(c=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Cd(Md[Md.rtcToken],i,t),e.abrupt("return",this._channel.send(s,Mh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return c.apply(this,arguments)})},{key:"setRTCState",value:(u=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Cd(Md[Md.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"getRTCUserInfo",value:(a=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Method not implemented.");case 1:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:ro.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Cd(Md[Md.rtcUList],t,e);return this._channel.send(n,Sh)}},{key:"joinLivingRoomAsAudience",value:(o=Tt(regeneratorRuntime.mark((function t(n){var r,i,s=this,o=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:e.RTCMode.LIVE,i=o.length>2?o[2]:void 0,t.next=4,this.__joinLivingRoomAsAudience(n,r,i);case 4:return this._audienceJoinRes=t.sent,t.abrupt("return",new Promise((function(e,t){s._audienceJoinResolve=e})));case 6:case"end":return t.stop()}}),t,this)}))),function(e){return o.apply(this,arguments)})},{key:"__joinLivingRoomAsAudience",value:(s=Tt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:e.RTCMode.LIVE,i=l.length>2?l[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),o=new Cd(Md[Md.viewerJoinR],s,n),t.next=8,this._channel.send(o,Mh);case 8:if(a=t.sent,u=a.code,c=a.data,u===ro.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return this._rtcKVManager.pullEntry(n,0),t.abrupt("return",{code:u,data:{token:c.rtcToken}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return s.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(i=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Cd(Md[Md.viewerExitR],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"rtcIdentityChange",value:(r=Tt(regeneratorRuntime.mark((function t(n,r,i){var s,o,a,u,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._channel){t.next=2;break}return t.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s=this._channel.codec.encodeIdentityChangeInfo(r,i),o=new Cd(Md[Md.rtcIdentityChange],s,n),t.next=6,this._channel.send(o,Sh);case 6:if(a=t.sent,u=a.code,c=a.data,u===ro.SUCCESS&&r===e.RTCIdentityChangeType.AnchorToViewer&&(this._rtcKVManager.reset(),this._rtcKVManager.pullEntry(n,0)),u===ro.SUCCESS){t.next=12;break}return t.abrupt("return",{code:u});case 12:return t.abrupt("return",{code:u,data:c});case 13:case"end":return t.stop()}}),t,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(n=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return Ks.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),o=new Cd(Md[Md.rtcPullKv],s,i),e.next=8,r.send(o,_f);case 8:if(a=e.sent,u=a.code,c=a.data,Ks.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==ro.SUCCESS){e.next=19;break}return l=c.kvEntries,this._audienceJoinRes&&(this._audienceJoinRes.data.kvEntries=l),this._audienceJoinResolve&&this._audienceJoinResolve(this._audienceJoinRes),this._audienceJoinResolve=null,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 19:return e.abrupt("return",{code:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getDeviceId",value:function(){return Ig(this.runtime)}},{key:"callExtra",value:function(e){return Promise.resolve({code:ro.EXTRA_METHOD_UNDEFINED})}},{key:"clearConversations",value:function(){throw new Error("Method not implemented.")}},{key:"setUserStatusListener",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"subscribeUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"getUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"addToBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"removeFromBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"getBlacklist",value:function(){throw new Error("Method not implemented.")}},{key:"getBlacklistStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"insertMessage",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"deleteMessages",value:function(e){throw new Error("Method not implemented.")}},{key:"deleteMessagesByTimestamp",value:function(e,t,n,r,i){throw new Error("Method not implemented.")}},{key:"clearMessages",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getMessage",value:function(e){throw new Error("Method not implemented.")}},{key:"setMessageContent",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"setMessageSearchField",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"searchConversationByContent",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"searchMessageByContent",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}},{key:"getUnreadMentionedMessages",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageSentStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageReceivedStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"getConversationNotificationStatus",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}}]),he}(jd),Og=function(){function e(t){Rt(this,e),this._context=t}return Ct(e,[{key:"getCoreVersion",value:function(){return this._context.coreVersion}},{key:"getAPIVersion",value:function(){return this._context.apiVersion}},{key:"getAppkey",value:function(){return this._context.appkey}},{key:"getCurrentId",value:function(){return this._context.getCurrentUserId()}},{key:"getConnectionStatus",value:function(){return this._context.getConnectionStatus()}},{key:"getDeviceId",value:function(){return this._context.getDeviceId()}},{key:"sendMessage",value:function(e,t,n){return this._context.sendMessage(e,t,n)}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._context.registerMessageType(e,t,n,r)}},{key:"getServerTime",value:function(){return this._context.getServerTime()}}]),e}(),kg=function(e){Nt(n,e);var t=Pt(n);function n(){return Rt(this,n),t.apply(this,arguments)}return Ct(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n){return this._context.joinRTCRoom(e,t,n)}},{key:"quitRTCRoom",value:function(e){return this._context.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._context.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._context.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._context.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._context.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._context.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._context.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._context.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._context.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._context.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._context.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._context.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._context.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._context.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._context.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._context.rtcIdentityChange(e,t,n)}}]),n}(Og),Ag=function(){function e(){Rt(this,e)}return Ct(e,null,[{key:"compress",value:function(e){for(var t=this,n={},r=0;r<e.length-1;r++){var i=e.charAt(r)+e.charAt(r+1);n.hasOwnProperty(i)?n[i].push(r):n[i]=[r]}for(var s=[],o=[],a=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);s.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);s.push(i)}s.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)o.push(e.charAt(u++));else if(c.length<4)o.push(e.substr(u,c.length)),u+=c.length;else{var l=t.numberEncode(u-c.offset),h=t.numberEncode(c.length);if(l.length+h.length>=c.length)o.push(e.substr(u,c.length)),u+=c.length;else{a();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}a();var d=t.numberEncode(e.length),g=String.fromCharCode(t.dataType.Tail|d.length);return s.push(g+d),s.join("")}},{key:"uncompress",value:function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),s=i&t.dataType.Mark,o=15&i,a=void 0;switch(s){case t.dataType.Compressed:var u=o>>2,c=3&o;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,u)),h=t.numberDecode(e.substr(n+=u,c));if((l=r.length-l)+h>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(l,h);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,o)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=o;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,o)),r+=e.substr(n+=o,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,o),n+=o;break;case t.dataType.Mark:if(o>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+o),n+=16+o;break;default:throw new Error("Data parsing error,at "+n+" header:"+s)}}while(n<e.length);return r}},{key:"indexOf",value:function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var s=t.length-n,o=0,a=i.length;o<a;o++){var u=i[o],c=n-u;if(!(c>this.max)){var l=Math.min(s,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,f=h;f<l&&t.charAt(u+f)===t.charAt(n+f);f++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r}},{key:"numberEncode",value:function(e){var t=this,n=[],r=0;do{r=e%t.scale,n.push(t.chars.charAt(r)),e=(e-r)/t.scale}while(e>0);return n.join("")}},{key:"numberDecode",value:function(e){for(var t=0,n=0,r=e.length-1;r>=0;r--){if(-1===(n=this.chars.indexOf(e.charAt(r))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t}}]),e}();Ag.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},Ag.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ag.scale=Ag.chars.length,Ag.max=238327;var Mg=1,xg=!1,Lg="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",Ug=function(){function e(t){Rt(this,e),this.info=t,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=t.logPolicy.url||this.logUrl,this.level=t.logPolicy.level||this.level,this.itv=t.logPolicy.itv||this.itv,this.times=t.logPolicy.times||this.times,this.deviceId=Ig(t.runtime),this.logSwitch=t.logSwitch;var n=ua(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(Hs.sessionId),this.startReport()}var t;return Ct(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&xg){var t=this.itv*Math.pow(2,Mg-1);Mg<this.times&&Mg++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=Hs.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=Ag.compress(t.map((function(e){return e.content})).join("")),r="".concat(Lg).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){Ks.__clearRealTimeLog(),Ks.debug("report real-time log success");var n=t.data;n&&(n=JSON.parse(n),e.itv=n.nextTime,e.level=n.level,e.logSwitch=n.logSwitch,Mg=1),e.startReport()})).catch((function(t){Ks.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.startTime,r=t.endTime,i=t.platform,s=t.logId,o=t.uri,a=fs.getInstance(),"web"===i.toLowerCase()&&a){e.next=4;break}return e.abrupt("return");case 4:if(!(n>r)){e.next=7;break}return Ks.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 7:return e.next=9,Ks.__insertLogIntoDatabase();case 9:return e.next=11,a.getRangeData(ls,"time",n,r);case 11:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=Ag.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&xg){var t=o||h.logUrl,n="".concat(Lg).concat(t,"?version=").concat(h.info.version,"&appkey=").concat(h.info.appkey,"&userId=").concat(h.info.userId,"&logId=").concat(s,"&deviceId=").concat(h.deviceId,"&deviceInfo=").concat(h.deviceInfo,"&platform=Web"),r=5e3*(l-1);l++,setTimeout((function(){xg&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Ks.debug("report full log success!")})).catch((function(t){e(),Ks.warn("report full log error -> "+t)}))}),r)}}();case 18:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){Mg=1,xg=!1}}],[{key:"init",value:function(t){return xg=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function Pg(e){return Object.assign({},e)}var Dg,Vg=function(){function e(t,n){var r;(Rt(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="4.4.9",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=so.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._options=Object.assign({},n),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length)&&(r=this._options.navigators).push.apply(r,Bt(sn));var i={status:this._connectionStatusListener.bind(this),message:this._messageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedLister.bind(this)};this._engine=aa()?new RCCppEngine(t,i,this._options):new Ng(t,i,this._options)}var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R,I,C,S,b,w,N,O,k,A,M,x,L,U,P,D,V,B;return Ct(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Ks.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new kg(this):new Og(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Ks.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&this._pluginContextQueue.push(n),r&&(this._pluginInstanseMap[e.tag]=r),r}},{key:"_handleRedirect",value:(B=Tt(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ks.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:e.sent.code!==ro.SUCCESS&&this._canRedirectConnect&&setTimeout((function(){t._handleRedirect()}),5e3);case 6:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"_connectionStatusListener",value:(V=Tt(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===so.REDIRECT&&(this._canRedirectConnect=!0,this._handleRedirect()),t!==so.BLOCKED&&t!==so.KICKED_OFFLINE_BY_OTHER_CLIENT&&t!==so.DISCONNECT_BY_SERVER||(this._canRedirectConnect=!1),this._connectionStatus=t,(null===(n=this._watcher.rtcInnerWatcher)||void 0===n?void 0:n.status)&&this._watcher.rtcInnerWatcher.status(t),this._pluginContextQueue.forEach((function(e){e.onconnectionstatechange&&e.onconnectionstatechange(t)})),this._watcher.connectionState&&this._watcher.connectionState(t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===Os.RTC_ROOM||Object.prototype.hasOwnProperty.call(Co,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Pg(e));else if("RC:TypSts"!==e.messageType||(this._addTypingInfo(Pg(e)),!this._watcher.typingState))if(e.messageType!==uo.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Pg(e))}catch(e){return Ks.error("plugin error =>",e),!1}}))||this._watcher.message&&this._watcher.message(Pg(e),t,n);else{var r,i=e.content,s=i.startTime,o=i.endTime,a=i.platform,u=i.logId,c=i.uri,l=i.packageName,h={startTime:parseInt(s),endTime:parseInt(o),platform:a,logId:u,uri:c,packageName:l};null===(r=Ug.getInstance())||void 0===r||r.reportFullLog(h)}}},{key:"_chatroomInfoListener",value:function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)}},{key:"_conversationInfoListener",value:function(e){this._watcher.conversationState&&this._watcher.conversationState(e)}},{key:"_expansionInfoListener",value:function(e){this._watcher.expansion&&this._watcher.expansion(e)}},{key:"_tagListener",value:function(){this._watcher.tag&&this._watcher.tag()}},{key:"_conversationTagListener",value:function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedLister",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_rtcDataChange",value:function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))}},{key:"assignWatcher",value:function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=Bs(r)||Vs(r)?r:void 0}}))}},{key:"_addTypingInfo",value:function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,s=e.channelId,o=i.typingContentType,a=s||"",u="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===o?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())}},{key:"_startCheckTypingInfo",value:function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var r=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(r),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))}},{key:"getConnectedTime",value:function(){return this._engine.getConnectedTime()}},{key:"getServerTime",value:function(){return this._engine.getServerTime()}},{key:"getDeviceId",value:function(){return this._engine.getDeviceId()}},{key:"getCurrentUserId",value:function(){return this._engine.getCurrentUserId()}},{key:"getConnectionStatus",value:function(){return this._connectionStatus}},{key:"connect",value:(D=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]&&l[1],this._connectionStatus!==so.CONNECTED){e.next=3;break}return e.abrupt("return",{code:ro.SUCCESS,userId:this._engine.currentUserId});case 3:if(this._connectionStatus!==so.CONNECTING){e.next=5;break}return e.abrupt("return",{code:ro.BIZ_ERROR_CONNECTING});case 5:if("string"==typeof t&&0!==t.length){e.next=7;break}return e.abrupt("return",{code:ro.RC_CONN_USER_OR_PASSWD_ERROR});case 7:return this._token=t,r=t.split("@"),i=Vt(r,2),s=i[1],o=s?s.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=12,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 12:if(a=e.sent){e.next=15;break}return e.abrupt("return",{code:ro.RC_NAVI_RESOURCE_ERROR});case 15:if(1!==(null==a?void 0:a.type)){e.next=17;break}return e.abrupt("return",{code:ro.PACKAGE_ENVIRONMENT_ERROR});case 17:return u=wt({engine:this.coreVersion,imlib:this.apiVersion},this._versionInfo),e.next=20,this._engine.connect(this._getTokenWithoutNavi(),a);case 20:if(c=e.sent,Ks.__insertLogIntoDatabase(),c!==oo.REDIRECT){e.next=27;break}return this._connectionStatus=so.REDIRECT,e.next=26,this.connect(t,!0);case 26:return e.abrupt("return",e.sent);case 27:return c===ro.SUCCESS&&(Ks.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),Ug.init({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Hs.init(this._engine.currentUserId),this._isInternalConnected=!0),c!==ro.SUCCESS||aa()||1===a.openUS&&this._pullUserSettings(),c!==ro.SUCCESS&&(this._connectionStatus=so.CONNECTION_CLOSED),e.abrupt("return",{code:c,userId:this._engine.currentUserId});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"_pullUserSettings",value:(P=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case 1:case"end":return e.stop()}}),e)}))),function(){return P.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=Ug.getInstance())||void 0===e||e.distroy(),Ks.__insertLogIntoDatabase(),Hs.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Ks.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(){return this._isInternalConnected?Promise.resolve({code:ro.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())}},{key:"_getTokenWithoutNavi",value:function(){return this._token.replace(/@.+$/,"@")}},{key:"getInfoFromCache",value:function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._engine.registerMessageType(e,t,n,r)}},{key:"sendMessage",value:function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===uo.READ_RECEIPT_RESPONSE)return Promise.resolve({code:ro.READ_RECEIPT_ERROR});var s=JSON.stringify(n.content);return Gn(s)>cn?Promise.resolve({code:ro.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(U=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channelId,r=t.conversationType,i=t.targetId,s=t.messageUId,o=t.keys,a=t.expansion,u=t.originExpansion,c=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:ro.MESSAGE_KV_NOT_SUPPORT});case 3:if(l=!1,h=!1,Vs(a))for(p in u=u||{},f=Object.keys(a).length,d=Object.assign(u,a),g=Object.keys(d).length,l=g>300||f>20,a)v=a[p],l=p.length>32||v.length>64,h=!/^[A-Za-z0-9_=+-]+$/.test(p);if(!l){e.next=8;break}return e.abrupt("return",{code:ro.EXPANSION_LIMIT_EXCEET});case 8:if(!h){e.next=10;break}return e.abrupt("return",{code:ro.BIZ_ERROR_INVALID_PARAMETER});case 10:return y={mid:s},a&&(y.put=a),o&&(y.del=o),c&&(y.removeAll=1),e.next=16,this._engine.sendMessage(r,i,{content:y,messageType:uo.EXPANSION_NOTIFY,channelId:n});case 16:return m=e.sent,_=m.code,e.abrupt("return",{code:_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(L=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:ro.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"});case 4:return e.abrupt("return",this._engine.sendReadReceiptMessage(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return L.apply(this,arguments)})},{key:"getMessageReader",value:(x=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:ro.READ_RECEIPT_ERROR});case 4:return e.abrupt("return",this._engine.getMessageReader(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return x.apply(this,arguments)})},{key:"_destroy",value:function(){var e;this._isInternalConnected=!1,this._watcher={message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){Ks.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=Ug.getInstance())||void 0===e||e.distroy(),Hs.reset()}},{key:"getHistoryMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";return this._engine.getHistoryMessage(e,t,n,r,i,s,o||"")}},{key:"getConversationList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.getConversationList(e,t,n,r,i)}},{key:"getConversation",value:function(e,t,n){return this._engine.getConversation(e,t,n)}},{key:"removeConversation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.removeConversation(e,t,n)}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationUnreadCount(e,t,n)}},{key:"getUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationUnreadCount(e,t,n)}},{key:"getTotalUnreadCount",value:function(e,t,n){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Os.PRIVATE,Os.GROUP,Os.SYSTEM,Os.PUBLIC_SERVICE],!!n)}},{key:"getFirstUnreadMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getFirstUnreadMessage(e,t,n)}},{key:"setConversationStatus",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(s)}},{key:"saveConversationMessageDraft",value:function(e,t,n){return this._engine.saveConversationMessageDraft(e,t,n)}},{key:"getConversationMessageDraft",value:function(e,t){return this._engine.getConversationMessageDraft(e,t)}},{key:"clearConversationMessageDraft",value:function(e,t){return this._engine.clearConversationMessageDraft(e,t)}},{key:"recallMessage",value:function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)}},{key:"deleteRemoteMessage",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessage(e,t,n,r)}},{key:"deleteRemoteMessageByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)}},{key:"joinChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinChatroom(e,t)}},{key:"joinExistChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinExistChatroom(e,t)}},{key:"quitChatroom",value:function(e){return this._engine.quitChatroom(e)}},{key:"getChatroomInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this._engine.getChatroomInfo(e,t,n)}},{key:"setChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return ea(n)&&ta(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return ea(n)&&ta(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return ea(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return ea(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"getChatroomEntry",value:function(e,t){return this._engine.getChatroomEntry(e,t)}},{key:"getAllChatroomEntries",value:function(e){return this._engine.getAllChatroomEntry(e)}},{key:"getChatRoomHistoryMessages",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this._engine.getChatroomHistoryMessages(e,r,t,n)}},{key:"getFileToken",value:(M=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",e.next=6,this._engine.getFileToken(t,n,r,i);case 6:if(c=e.sent,l=c.code,h=c.data,l!==ro.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:o,qiniu:a,ossConfig:u})));case 11:return e.abrupt("return",Promise.reject(l));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return M.apply(this,arguments)})},{key:"getFileUrl",value:(A=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=c.length>4&&void 0!==c[4]?c[4]:po.QINIU,null==i||!i.isBosRes){e.next=3;break}return e.abrupt("return",Promise.resolve(i));case 3:return e.next=5,this._engine.getFileUrl(t,s,n,r);case 5:if(o=e.sent,a=o.code,u=o.data,a!==ro.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(a));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"createTag",value:(k=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.createTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"removeTag",value:(O=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"updateTag",value:(N=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.updateTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"getTagList",value:(w=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagList());case 1:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"addTagForConversations",value:(b=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.length>1e3)){e.next=2;break}return e.abrupt("return",Promise.reject(ro.CONVER_OUT_LIMIT_ERROR));case 2:return e.abrupt("return",this._engine.addTagForConversations(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"removeTagForConversations",value:(S=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagForConversations(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"removeTagsForConversation",value:(C=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagsForConversation(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"getConversationListByTag",value:(I=Tt(regeneratorRuntime.mark((function e(t,n,r,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getConversationListByTag(t,n,r,i));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return I.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(R=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUnreadCountByTag(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(T=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setConversationStatusInTag(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return T.apply(this,arguments)})},{key:"getTagsForConversation",value:(E=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagsForConversation(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"callExtra",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,[e].concat(r))}},{key:"clearConversations",value:(_=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._engine.clearConversations(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Ks.error(e)}}))}},{key:"addToBlacklist",value:(m=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.addToBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"removeFromBlacklist",value:(y=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeFromBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"getBlacklist",value:(v=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklist());case 1:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getBlacklistStatus",value:(p=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklistStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"insertMessage",value:(g=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.insertMessage(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return g.apply(this,arguments)})},{key:"deleteMessages",value:(d=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.deleteMessages(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(f=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.length>4&&void 0!==o[4]?o[4]:"",e.abrupt("return",this._engine.deleteMessagesByTimestamp(t,n,r,i,s));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return f.apply(this,arguments)})},{key:"clearMessages",value:(h=Tt(regeneratorRuntime.mark((function e(t,n){var r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:"",e.abrupt("return",this._engine.clearMessages(t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"getMessage",value:(l=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getMessage(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setMessageContent",value:(c=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageContent(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return c.apply(this,arguments)})},{key:"setMessageSearchField",value:(u=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSearchField(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"setMessageSentStatus",value:(a=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSentStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(o=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageReceivedStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"setUserStatus",value:(s=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribeUserStatus",value:(i=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.subscribeUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserStatus",value:(r=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchConversationByContent",value:(n=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:[],r=s.length>2&&void 0!==s[2]?s[2]:"",i=s.length>3?s[3]:void 0,e.abrupt("return",this._engine.searchConversationByContent(t,n,r,i));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"searchMessageByContent",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,o,a));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,o){return t.apply(this,arguments)})},{key:"getUnreadMentionedMessages",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getUnreadMentionedMessages(e,t,n)}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.clearUnreadCountByTimestamp(e,t,n,r)}},{key:"getConversationNotificationStatus",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationNotificationStatus(e,t,n)}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,s)}},{key:"joinRTCRoom",value:function(e,t,n){return this._engine.joinRTCRoom(e,t,n)}},{key:"quitRTCRoom",value:function(e){return this._engine.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._engine.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._engine.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._engine.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._engine.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._engine.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._engine.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._engine.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._engine.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._engine.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._engine.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._engine.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)}}],[{key:"init",value:function(t,n){return Ks.setLogLevel(n.logLevel),Ks.setLogStdout(n.logStdout),(n.indexDBSwitch||Fs(n.indexDBSwitch))&&fs.init(),Ks.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Ks.error("Repeat initialize!"),this._context):(Ks.warn("RCEngine Commit:","23d6f4e445f77284cb9e4b70a6df4c90326928db"),this._context=new e(t,n),Ks.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(Dg=e.TagChangeType||(e.TagChangeType={}))[Dg.add=1]="add",Dg[Dg.update=2]="update",Dg[Dg.delete=3]="delete";e.AEngine=jd,e.ANavi=Wd,e.APIContext=Vg,e.AppStorage=pn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=Co,e.ChatroomEntryType=_o,e.CometChannel=Fd,e.ConnectResultCode=oo,e.ConnectionStatus=so,e.ConversationType=Os,e.DelayTimer=ha,e.ErrorCode=ro,e.EventEmitter=Xs,e.FileType=As,e.IM_COMET_PULLMSG_TIMEOUT=45e3,e.IM_PING_INTERVAL_TIME=15e3,e.IM_PING_MIN_TIMEOUT=2e3,e.IM_PING_TIMEOUT=15e3,e.IM_SIGNAL_TIMEOUT=un,e.Logger=Hs,e.MAX_MESSAGE_CONTENT_BYTES=cn,e.MINI_COMET_CONNECT_URIS=an,e.MINI_SOCKET_CONNECT_URIS=on,e.MentionedType=fo,e.MessageDirection=to,e.MessageType=uo,e.NAVI_CACHE_DURATION=nn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=lo,e.PING_REQ_TIMEOUT=5e3,e.PUBLIC_CLOUD_NAVI_URIS=sn,e.PluginContext=Og,e.RCAssertError=bo,e.RTCPluginContext=kg,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=hn,e.STATUS_MESSAGE=fn,e.STORAGE_ROOT_KEY=ln,e.UploadMethod=po,e.WEB_SOCKET_TIMEOUT=rn,e.WebSocketChannel=Vd,e.appendUrl=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},e.assert=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!wo(e,t,n,r))throw new bo("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.cloneByJSON=oa,e.forEach=na,e.formatConnectResponseCode=ca,e.getBrowser=ua,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case As.IMAGE:t="image/jpeg";break;case As.AUDIO:t="audio/amr";break;case As.VIDEO:t="video/3gpp";break;case As.SIGHT:t="video/mpeg4";break;case As.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=Zo,e.indexOf=ia,e.isArray=Us,e.isArrayBuffer=Ps,e.isBoolean=xs,e.isFunction=Bs,e.isHttpUrl=function(e){return Ms(e)&&/https?:\/\//.test(e)},e.isInObject=sa,e.isInclude=function(e,t){return-1!==ia(e,t)},e.isNull=js,e.isNumber=Ls,e.isObject=Vs,e.isString=Ms,e.isUndefined=Fs,e.isValidChrmEntryKey=ea,e.isValidChrmEntryValue=ta,e.isValidConversationType=function(e){return Ls(e)&&Object.prototype.hasOwnProperty.call(Os,e)},e.isValidFileType=function(e){return Ls(e)&&Object.prototype.hasOwnProperty.call(As,e)},e.map=ra,e.notEmptyArray=function(e){return Us(e)&&e.length>0},e.notEmptyObject=Ys,e.notEmptyString=Ds,e.pushConfigsToJSON=$o,e.pushJSONToConfigs=Xo,e.todo=function(e){return new vn(e)},e.usingCppEngine=aa,e.validate=wo,e.version="4.4.9",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RCEngine={})}(this,(function(e){"use strict";var t;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(t||(t={}));var n=t,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){var t={exports:{}};return e(t,t.exports),t.exports}var s=function(e){return e&&e.Math==Math&&e},o=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof r&&r)||function(){return this}()||Function("return this")(),a=function(e){try{return!!e()}catch(e){return!0}},u=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,h={f:l&&!c.call({1:2},1)?function(e){var t=l(this,e);return!!t&&t.enumerable}:c},f=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},d={}.toString,p=function(e){return d.call(e).slice(8,-1)},v="".split,y=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?v.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},_=function(e){return y(m(e))},E=function(e){return"object"==typeof e?null!==e:"function"==typeof e},T=function(e,t){if(!E(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!E(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},R=function(e){return Object(m(e))},I={}.hasOwnProperty,C=function(e,t){return I.call(R(e),t)},S=o.document,b=E(S)&&E(S.createElement),w=function(e){return b?S.createElement(e):{}},N=!u&&!a((function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a})),O=Object.getOwnPropertyDescriptor,k={f:u?O:function(e,t){if(e=_(e),t=T(t,!0),N)try{return O(e,t)}catch(e){}if(C(e,t))return f(!h.f.call(e,t),e[t])}},A=function(e){if(!E(e))throw TypeError(String(e)+" is not an object");return e},M=Object.defineProperty,x={f:u?M:function(e,t,n){if(A(e),t=T(t,!0),A(n),N)try{return M(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},L=u?function(e,t,n){return x.f(e,t,f(1,n))}:function(e,t,n){return e[t]=n,e},U=function(e,t){try{L(o,e,t)}catch(n){o[e]=t}return t},P="__core-js_shared__",D=o[P]||U(P,{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return V.call(e)});var B,F,j,Y=D.inspectSource,q=o.WeakMap,K="function"==typeof q&&/native code/.test(Y(q)),G=i((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),H=0,W=Math.random(),Q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++H+W).toString(36)},J=G("keys"),z=function(e){return J[e]||(J[e]=Q(e))},Z={},$="Object already initialized",X=o.WeakMap;if(K){var ee=D.state||(D.state=new X),te=ee.get,ne=ee.has,re=ee.set;B=function(e,t){if(ne.call(ee,e))throw new TypeError($);return t.facade=e,re.call(ee,e,t),t},F=function(e){return te.call(ee,e)||{}},j=function(e){return ne.call(ee,e)}}else{var ie=z("state");Z[ie]=!0,B=function(e,t){if(C(e,ie))throw new TypeError($);return t.facade=e,L(e,ie,t),t},F=function(e){return C(e,ie)?e[ie]:{}},j=function(e){return C(e,ie)}}var se={set:B,get:F,has:j,enforce:function(e){return j(e)?F(e):B(e,{})},getterFor:function(e){return function(t){var n;if(!E(t)||(n=F(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},oe=i((function(e){var t=se.get,n=se.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a,u=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||C(i,"name")||L(i,"name",t),(a=n(i)).source||(a.source=r.join("string"==typeof t?t:""))),e!==o?(u?!l&&e[t]&&(c=!0):delete e[t],c?e[t]=i:L(e,t,i)):c?e[t]=i:U(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||Y(this)}))})),ae=o,ue=function(e){return"function"==typeof e?e:void 0},ce=function(e,t){return arguments.length<2?ue(ae[e])||ue(o[e]):ae[e]&&ae[e][t]||o[e]&&o[e][t]},le=Math.ceil,he=Math.floor,fe=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)},de=Math.min,ge=function(e){return e>0?de(fe(e),9007199254740991):0},pe=Math.max,ve=Math.min,ye=function(e,t){var n=fe(e);return n<0?pe(n+t,0):ve(n,t)},me=function(e){return function(t,n,r){var i,s=_(t),o=ge(s.length),a=ye(r,o);if(e&&n!=n){for(;o>a;)if((i=s[a++])!=i)return!0}else for(;o>a;a++)if((e||a in s)&&s[a]===n)return e||a||0;return!e&&-1}},_e={includes:me(!0),indexOf:me(!1)},Ee=_e.indexOf,Te=function(e,t){var n,r=_(e),i=0,s=[];for(n in r)!C(Z,n)&&C(r,n)&&s.push(n);for(;t.length>i;)C(r,n=t[i++])&&(~Ee(s,n)||s.push(n));return s},Re=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ie=Re.concat("length","prototype"),Ce={f:Object.getOwnPropertyNames||function(e){return Te(e,Ie)}},Se={f:Object.getOwnPropertySymbols},be=ce("Reflect","ownKeys")||function(e){var t=Ce.f(A(e)),n=Se.f;return n?t.concat(n(e)):t},we=function(e,t){for(var n=be(t),r=x.f,i=k.f,s=0;s<n.length;s++){var o=n[s];C(e,o)||r(e,o,i(t,o))}},Ne=/#|\.prototype\./,Oe=function(e,t){var n=Ae[ke(e)];return n==xe||n!=Me&&("function"==typeof t?a(t):!!t)},ke=Oe.normalize=function(e){return String(e).replace(Ne,".").toLowerCase()},Ae=Oe.data={},Me=Oe.NATIVE="N",xe=Oe.POLYFILL="P",Le=Oe,Ue=k.f,Pe=function(e,t){var n,r,i,s,a,u=e.target,c=e.global,l=e.stat;if(n=c?o:l?o[u]||U(u,{}):(o[u]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=Ue(n,r))&&a.value:n[r],!Le(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;we(s,i)}(e.sham||i&&i.sham)&&L(s,"sham",!0),oe(n,r,s,e)}},De=function(){var e=A(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function Ve(e,t){return RegExp(e,t)}var Be={UNSUPPORTED_Y:a((function(){var e=Ve("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:a((function(){var e=Ve("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Fe=RegExp.prototype.exec,je=G("native-string-replace",String.prototype.replace),Ye=Fe,qe=function(){var e=/a/,t=/b*/g;return Fe.call(e,"a"),Fe.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ke=Be.UNSUPPORTED_Y||Be.BROKEN_CARET,Ge=void 0!==/()??/.exec("")[1];(qe||Ge||Ke)&&(Ye=function(e){var t,n,r,i,s=this,o=Ke&&s.sticky,a=De.call(s),u=s.source,c=0,l=e;return o&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(e).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==e[s.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,c++),n=new RegExp("^(?:"+u+")",a)),Ge&&(n=new RegExp("^"+u+"$(?!\\s)",a)),qe&&(t=s.lastIndex),r=Fe.call(o?n:s,l),o?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=s.lastIndex,s.lastIndex+=r[0].length):s.lastIndex=0:qe&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),Ge&&r&&r.length>1&&je.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var He=Ye;Pe({target:"RegExp",proto:!0,forced:/./.exec!==He},{exec:He});var We,Qe,Je="process"==p(o.process),ze=ce("navigator","userAgent")||"",Ze=o.process,$e=Ze&&Ze.versions,Xe=$e&&$e.v8;Xe?Qe=(We=Xe.split("."))[0]+We[1]:ze&&(!(We=ze.match(/Edge\/(\d+)/))||We[1]>=74)&&(We=ze.match(/Chrome\/(\d+)/))&&(Qe=We[1]);var et=Qe&&+Qe,tt=!!Object.getOwnPropertySymbols&&!a((function(){return!Symbol.sham&&(Je?38===et:et>37&&et<41)})),nt=tt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rt=G("wks"),it=o.Symbol,st=nt?it:it&&it.withoutSetter||Q,ot=function(e){return C(rt,e)&&(tt||"string"==typeof rt[e])||(tt&&C(it,e)?rt[e]=it[e]:rt[e]=st("Symbol."+e)),rt[e]},at=ot("species"),ut=!a((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),ct="$0"==="a".replace(/./,"$0"),lt=ot("replace"),ht=!!/./[lt]&&""===/./[lt]("a","$0"),ft=!a((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),dt=function(e,t,n,r){var i=ot(e),s=!a((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=s&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[at]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!o||"replace"===e&&(!ut||!ct||ht)||"split"===e&&!ft){var u=/./[i],c=n(i,""[e],(function(e,t,n,r,i){return t.exec===RegExp.prototype.exec?s&&!i?{done:!0,value:u.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:ct,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:ht}),l=c[0],h=c[1];oe(String.prototype,e,l),oe(RegExp.prototype,i,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}r&&L(RegExp.prototype[i],"sham",!0)},gt=function(e){return function(t,n){var r,i,s=String(m(t)),o=fe(n),a=s.length;return o<0||o>=a?e?"":void 0:(r=s.charCodeAt(o))<55296||r>56319||o+1===a||(i=s.charCodeAt(o+1))<56320||i>57343?e?s.charAt(o):r:e?s.slice(o,o+2):i-56320+(r-55296<<10)+65536}},pt={codeAt:gt(!1),charAt:gt(!0)},vt=pt.charAt,yt=function(e,t,n){return t+(n?vt(e,t).length:1)},mt=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return He.call(e,t)};function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Et(e,t,n,r,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function Tt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){Et(s,r,i,o,a,"next",e)}function a(e){Et(s,r,i,o,a,"throw",e)}o(void 0)}))}}function Rt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(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)}}function Ct(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&kt(e,t)}function Ot(e){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function kt(e,t){return(kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Mt(e,t,n){return(Mt=At()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&kt(i,n.prototype),i}).apply(null,arguments)}function xt(e){var t="function"==typeof Map?new Map:void 0;return(xt=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Mt(e,arguments,Ot(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),kt(r,e)})(e)}function Lt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ut(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Lt(e):t}function Pt(e){var t=At();return function(){var n,r=Ot(e);if(t){var i=Ot(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ut(this,n)}}function Dt(e,t,n){return(Dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ot(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw i}}return s}(e,t)||Ft(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e){return function(e){if(Array.isArray(e))return jt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e,t){if(e){if("string"==typeof e)return jt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jt(e,t):void 0}}function jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}dt("match",1,(function(e,t,n){return[function(t){var n=m(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=A(e),s=String(this);if(!i.global)return mt(i,s);var o=i.unicode;i.lastIndex=0;for(var a,u=[],c=0;null!==(a=mt(i,s));){var l=String(a[0]);u[c]=l,""===l&&(i.lastIndex=yt(s,ge(i.lastIndex),o)),c++}return 0===c?null:u}]}));var Yt=Array.isArray||function(e){return"Array"==p(e)},qt=function(e,t,n){var r=T(t);r in e?x.f(e,r,f(0,n)):e[r]=n},Kt=ot("species"),Gt=function(e,t){var n;return Yt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Yt(n.prototype)?E(n)&&null===(n=n[Kt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Ht=ot("species"),Wt=function(e){return et>=51||!a((function(){var t=[];return(t.constructor={})[Ht]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qt=ot("isConcatSpreadable"),Jt=9007199254740991,zt="Maximum allowed index exceeded",Zt=et>=51||!a((function(){var e=[];return e[Qt]=!1,e.concat()[0]!==e})),$t=Wt("concat"),Xt=function(e){if(!E(e))return!1;var t=e[Qt];return void 0!==t?!!t:Yt(e)};Pe({target:"Array",proto:!0,forced:!Zt||!$t},{concat:function(e){var t,n,r,i,s,o=R(this),a=Gt(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(Xt(s=-1===t?o:arguments[t])){if(u+(i=ge(s.length))>Jt)throw TypeError(zt);for(n=0;n<i;n++,u++)n in s&&qt(a,u,s[n])}else{if(u>=Jt)throw TypeError(zt);qt(a,u++,s)}return a.length=u,a}});var en,tn,nn=72e5,rn=5e3,sn=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],on=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],an=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],un=3e4,cn=131072,ln="RCV4-",hn={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"RC:FileMsg":{isCounted:!0,isPersited:!0},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1}},fn=["RC:TypSts"];e.CONNECTION_TYPE=void 0,(en=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",en.COMET="comet";var dn=function(e){return tn||(tn={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),tn},gn=function(){function e(t){Rt(this,e),this._caches={},t&&(this._caches=t)}return Ct(e,[{key:"set",value:function(e,t){this._caches[e]=t}},{key:"remove",value:function(e){var t=this.get(e);return delete this._caches[e],t}},{key:"get",value:function(e){return this._caches[e]}},{key:"getKeys",value:function(){var e=[];for(var t in this._caches)e.push(t);return e}}]),e}(),pn=function(){function e(t,n){Rt(this,e);var r=n?"".concat(ln).concat(n):ln;this._rootStorage=dn(t);var i=this._rootStorage.get(r)||{};this._cache=new gn(St({},r,i)),this._storageKey=r}return Ct(e,[{key:"_get",value:function(){var e=this._storageKey;return this._cache.get(e)||{}}},{key:"_set",value:function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)}},{key:"set",value:function(e,t){var n=this._get();n[e]=t,this._set(n)}},{key:"remove",value:function(e){var t=this._get();delete t[e],this._set(t)}},{key:"clear",value:function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)}},{key:"get",value:function(e){return this._get()[e]}},{key:"getKeys",value:function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t}},{key:"getValues",value:function(){return this._get()||{}}}]),e}(),vn=function(e){Nt(n,e);var t=Pt(n);function n(e){return Rt(this,n),t.call(this,"TODO => ".concat(e))}return n}(xt(Error)),yn=Wt("slice"),mn=ot("species"),_n=[].slice,En=Math.max;Pe({target:"Array",proto:!0,forced:!yn},{slice:function(e,t){var n,r,i,s=_(this),o=ge(s.length),a=ye(e,o),u=ye(void 0===t?o:t,o);if(Yt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!Yt(n.prototype)?E(n)&&null===(n=n[mn])&&(n=void 0):n=void 0,n===Array||void 0===n))return _n.call(s,a,u);for(r=new(void 0===n?Array:n)(En(u-a,0)),i=0;a<u;a++,i++)a in s&&qt(r,i,s[a]);return r.length=i,r}});var Tn=Math.floor,Rn="".replace,In=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Cn=/\$([$&'`]|\d{1,2})/g,Sn=function(e,t,n,r,i,s){var o=n+e.length,a=r.length,u=Cn;return void 0!==i&&(i=R(i),u=In),Rn.call(s,u,(function(s,u){var c;switch(u.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":c=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return s;if(l>a){var h=Tn(l/10);return 0===h?s:h<=a?void 0===r[h-1]?u.charAt(1):r[h-1]+u.charAt(1):s}c=r[l-1]}return void 0===c?"":c}))},bn=Math.max,wn=Math.min;dt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=m(this),s=null==n?void 0:n[e];return void 0!==s?s.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&s||"string"==typeof r&&-1===r.indexOf(o)){var a=n(t,e,this,r);if(a.done)return a.value}var u=A(e),c=String(this),l="function"==typeof r;l||(r=String(r));var h=u.global;if(h){var f=u.unicode;u.lastIndex=0}for(var d=[];;){var g=mt(u,c);if(null===g)break;if(d.push(g),!h)break;""===String(g[0])&&(u.lastIndex=yt(c,ge(u.lastIndex),f))}for(var p,v="",y=0,m=0;m<d.length;m++){g=d[m];for(var _=String(g[0]),E=bn(wn(fe(g.index),c.length),0),T=[],R=1;R<g.length;R++)T.push(void 0===(p=g[R])?p:String(p));var I=g.groups;if(l){var C=[_].concat(T,E,c);void 0!==I&&C.push(I);var S=String(r.apply(void 0,C))}else S=Sn(_,c,E,T,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var Nn=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},On=function(e,t,n){if(Nn(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},kn=[].push,An=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,o=7==e,a=5==e||s;return function(u,c,l,h){for(var f,d,g=R(u),p=y(g),v=On(c,l,3),m=ge(p.length),_=0,E=h||Gt,T=t?E(u,m):n||o?E(u,0):void 0;m>_;_++)if((a||_ in p)&&(d=v(f=p[_],_,g),e))if(t)T[_]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:kn.call(T,f)}else switch(e){case 4:return!1;case 7:kn.call(T,f)}return s?-1:r||i?i:T}},Mn={forEach:An(0),map:An(1),filter:An(2),some:An(3),every:An(4),find:An(5),findIndex:An(6),filterOut:An(7)},xn=Mn.filter,Ln=Wt("filter");Pe({target:"Array",proto:!0,forced:!Ln},{filter:function(e){return xn(this,e,arguments.length>1?arguments[1]:void 0)}});var Un=Mn.map,Pn=Wt("map");Pe({target:"Array",proto:!0,forced:!Pn},{map:function(e){return Un(this,e,arguments.length>1?arguments[1]:void 0)}});var Dn=Object.keys||function(e){return Te(e,Re)},Vn=a((function(){Dn(1)}));Pe({target:"Object",stat:!0,forced:Vn},{keys:function(e){return Dn(R(e))}});var Bn=function(e,t){var n=[][e];return!!n&&a((function(){n.call(null,t||function(){throw 1},1)}))},Fn=[].join,jn=y!=Object,Yn=Bn("join",",");Pe({target:"Array",proto:!0,forced:jn||!Yn},{join:function(e){return Fn.call(_(this),void 0===e?",":e)}});var qn=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},Kn=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8",r=0;if("utf-16"===n)for(var i=0,s=e.length;i<s;i++)r+=(t=e.charCodeAt(i))<=65535?2:4;else for(var o=0,a=e.length;o<a;o++)r+=(t=e.charCodeAt(o))<127?1:t<=2047?2:t<=65535?3:4;return r},Gn=function(e){return e.match(/\d+(\.\d+){2}/)[0]};i((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),o=new N(r||[]);return s._invoke=function(e,t,n){var r=h;return function(i,s){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw s;return k()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:f,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,o),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",d="executing",g="completed",p={};function v(){}function y(){}function m(){}var _={};_[s]=function(){return this};var E=Object.getPrototypeOf,T=E&&E(E(O([])));T&&T!==n&&r.call(T,s)&&(_=T);var R=m.prototype=v.prototype=Object.create(_);function I(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,s,o,a){var u=l(e[i],e,s);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,o,a)}),(function(e){n("throw",e,o,a)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,a)}))}a(u.arg)}var i;this._invoke=function(e,r){function s(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(s,s):s()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var s=i.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function O(e){if(e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=R.constructor=m,m.constructor=y,y.displayName=u(m,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,a,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},I(C.prototype),C.prototype[o]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var o=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(R),u(R,a,"Generator"),R[s]=function(){return this},R.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));var Hn=x.f,Wn=Function.prototype,Qn=Wn.toString,Jn=/^\s*function ([^ (]*)/,zn="name";u&&!(zn in Wn)&&Hn(Wn,zn,{configurable:!0,get:function(){try{return Qn.call(this).match(Jn)[1]}catch(e){return""}}});var Zn,$n=u?Object.defineProperties:function(e,t){A(e);for(var n,r=Dn(t),i=r.length,s=0;i>s;)x.f(e,n=r[s++],t[n]);return e},Xn=ce("document","documentElement"),er=z("IE_PROTO"),tr=function(){},nr=function(e){return"<script>"+e+"</"+"script>"},rr=function(){try{Zn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;rr=Zn?function(e){e.write(nr("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Zn):((t=w("iframe")).style.display="none",Xn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(nr("document.F=Object")),e.close(),e.F);for(var n=Re.length;n--;)delete rr.prototype[Re[n]];return rr()};Z[er]=!0;var ir=Object.create||function(e,t){var n;return null!==e?(tr.prototype=A(e),n=new tr,tr.prototype=null,n[er]=e):n=rr(),void 0===t?n:$n(n,t)},sr=ot("unscopables"),or=Array.prototype;null==or[sr]&&x.f(or,sr,{configurable:!0,value:ir(null)});var ar,ur,cr=function(e){or[sr][e]=!0},lr=_e.includes;Pe({target:"Array",proto:!0},{includes:function(e){return lr(this,e,arguments.length>1?arguments[1]:void 0)}}),cr("includes"),e.LogLevel=void 0,(ar=e.LogLevel||(e.LogLevel={}))[ar.LOG=0]="LOG",ar[ar.DEBUG=0]="DEBUG",ar[ar.INFO=1]="INFO",ar[ar.WARN=2]="WARN",ar[ar.ERROR=3]="ERROR",ar[ar.FATAL=4]="FATAL",ar[ar.NONE=1e3]="NONE",e.LogType=void 0,(ur=e.LogType||(e.LogType={})).IM="IM",ur.RTC="RTC";var hr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},fr=Mn.forEach,dr=Bn("forEach")?[].forEach:function(e){return fr(this,e,arguments.length>1?arguments[1]:void 0)};for(var gr in hr){var pr=o[gr],vr=pr&&pr.prototype;if(vr&&vr.forEach!==dr)try{L(vr,"forEach",dr)}catch(e){vr.forEach=dr}}var yr={};yr[ot("toStringTag")]="z";var mr="[object z]"===String(yr),_r=ot("toStringTag"),Er="Arguments"==p(function(){return arguments}()),Tr=mr?p:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),_r))?n:Er?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Rr=mr?{}.toString:function(){return"[object "+Tr(this)+"]"};mr||oe(Object.prototype,"toString",Rr,{unsafe:!0});var Ir=o.Promise,Cr=function(e,t,n){for(var r in t)oe(e,r,t[r],n);return e},Sr=x.f,br=ot("toStringTag"),wr=function(e,t,n){e&&!C(e=n?e:e.prototype,br)&&Sr(e,br,{configurable:!0,value:t})},Nr=ot("species"),Or=function(e){var t=ce(e),n=x.f;u&&t&&!t[Nr]&&n(t,Nr,{configurable:!0,get:function(){return this}})},kr=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Ar={},Mr=ot("iterator"),xr=Array.prototype,Lr=function(e){return void 0!==e&&(Ar.Array===e||xr[Mr]===e)},Ur=ot("iterator"),Pr=function(e){if(null!=e)return e[Ur]||e["@@iterator"]||Ar[Tr(e)]},Dr=function(e){var t=e.return;if(void 0!==t)return A(t.call(e)).value},Vr=function(e,t){this.stopped=e,this.result=t},Br=function(e,t,n){var r,i,s,o,a,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=On(t,l,1+h+d),p=function(e){return r&&Dr(r),new Vr(!0,e)},v=function(e){return h?(A(e),d?g(e[0],e[1],p):g(e[0],e[1])):d?g(e,p):g(e)};if(f)r=e;else{if("function"!=typeof(i=Pr(e)))throw TypeError("Target is not iterable");if(Lr(i)){for(s=0,o=ge(e.length);o>s;s++)if((a=v(e[s]))&&a instanceof Vr)return a;return new Vr(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{a=v(c.value)}catch(e){throw Dr(r),e}if("object"==typeof a&&a&&a instanceof Vr)return a}return new Vr(!1)},Fr=ot("iterator"),jr=!1;try{var Yr=0,qr={next:function(){return{done:!!Yr++}},return:function(){jr=!0}};qr[Fr]=function(){return this},Array.from(qr,(function(){throw 2}))}catch(e){}var Kr,Gr,Hr,Wr=function(e,t){if(!t&&!jr)return!1;var n=!1;try{var r={};r[Fr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Qr=ot("species"),Jr=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[Qr])?t:Nn(n)},zr=/(?:iphone|ipod|ipad).*applewebkit/i.test(ze),Zr=o.location,$r=o.setImmediate,Xr=o.clearImmediate,ei=o.process,ti=o.MessageChannel,ni=o.Dispatch,ri=0,ii={},si="onreadystatechange",oi=function(e){if(ii.hasOwnProperty(e)){var t=ii[e];delete ii[e],t()}},ai=function(e){return function(){oi(e)}},ui=function(e){oi(e.data)},ci=function(e){o.postMessage(e+"",Zr.protocol+"//"+Zr.host)};$r&&Xr||($r=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return ii[++ri]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Kr(ri),ri},Xr=function(e){delete ii[e]},Je?Kr=function(e){ei.nextTick(ai(e))}:ni&&ni.now?Kr=function(e){ni.now(ai(e))}:ti&&!zr?(Hr=(Gr=new ti).port2,Gr.port1.onmessage=ui,Kr=On(Hr.postMessage,Hr,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&Zr&&"file:"!==Zr.protocol&&!a(ci)?(Kr=ci,o.addEventListener("message",ui,!1)):Kr=si in w("script")?function(e){Xn.appendChild(w("script")).onreadystatechange=function(){Xn.removeChild(this),oi(e)}}:function(e){setTimeout(ai(e),0)});var li,hi,fi,di,gi,pi,vi,yi,mi={set:$r,clear:Xr},_i=/web0s(?!.*chrome)/i.test(ze),Ei=k.f,Ti=mi.set,Ri=o.MutationObserver||o.WebKitMutationObserver,Ii=o.document,Ci=o.process,Si=o.Promise,bi=Ei(o,"queueMicrotask"),wi=bi&&bi.value;wi||(li=function(){var e,t;for(Je&&(e=Ci.domain)&&e.exit();hi;){t=hi.fn,hi=hi.next;try{t()}catch(e){throw hi?di():fi=void 0,e}}fi=void 0,e&&e.enter()},zr||Je||_i||!Ri||!Ii?Si&&Si.resolve?(vi=Si.resolve(void 0),yi=vi.then,di=function(){yi.call(vi,li)}):di=Je?function(){Ci.nextTick(li)}:function(){Ti.call(o,li)}:(gi=!0,pi=Ii.createTextNode(""),new Ri(li).observe(pi,{characterData:!0}),di=function(){pi.data=gi=!gi}));var Ni,Oi,ki,Ai,Mi=wi||function(e){var t={fn:e,next:void 0};fi&&(fi.next=t),hi||(hi=t,di()),fi=t},xi=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=Nn(t),this.reject=Nn(n)},Li={f:function(e){return new xi(e)}},Ui=function(e,t){if(A(e),E(t)&&t.constructor===e)return t;var n=Li.f(e);return(0,n.resolve)(t),n.promise},Pi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Di=mi.set,Vi=ot("species"),Bi="Promise",Fi=se.get,ji=se.set,Yi=se.getterFor(Bi),qi=Ir,Ki=o.TypeError,Gi=o.document,Hi=o.process,Wi=ce("fetch"),Qi=Li.f,Ji=Qi,zi=!!(Gi&&Gi.createEvent&&o.dispatchEvent),Zi="function"==typeof PromiseRejectionEvent,$i="unhandledrejection",Xi=Le(Bi,(function(){if(!(Y(qi)!==String(qi))){if(66===et)return!0;if(!Je&&!Zi)return!0}if(et>=51&&/native code/.test(qi))return!1;var e=qi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Vi]=t,!(e.then((function(){}))instanceof t)})),es=Xi||!Wr((function(e){qi.all(e).catch((function(){}))})),ts=function(e){var t;return!(!E(e)||"function"!=typeof(t=e.then))&&t},ns=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Mi((function(){for(var r=e.value,i=1==e.state,s=0;n.length>s;){var o,a,u,c=n[s++],l=i?c.ok:c.fail,h=c.resolve,f=c.reject,d=c.domain;try{l?(i||(2===e.rejection&&os(e),e.rejection=1),!0===l?o=r:(d&&d.enter(),o=l(r),d&&(d.exit(),u=!0)),o===c.promise?f(Ki("Promise-chain cycle")):(a=ts(o))?a.call(o,h,f):h(o)):f(r)}catch(e){d&&!u&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&is(e)}))}},rs=function(e,t,n){var r,i;zi?((r=Gi.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),o.dispatchEvent(r)):r={promise:t,reason:n},!Zi&&(i=o["on"+e])?i(r):e===$i&&function(e,t){var n=o.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},is=function(e){Di.call(o,(function(){var t,n=e.facade,r=e.value;if(ss(e)&&(t=Pi((function(){Je?Hi.emit("unhandledRejection",r,n):rs($i,n,r)})),e.rejection=Je||ss(e)?2:1,t.error))throw t.value}))},ss=function(e){return 1!==e.rejection&&!e.parent},os=function(e){Di.call(o,(function(){var t=e.facade;Je?Hi.emit("rejectionHandled",t):rs("rejectionhandled",t,e.value)}))},as=function(e,t,n){return function(r){e(t,r,n)}},us=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,ns(e,!0))},cs=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Ki("Promise can't be resolved itself");var r=ts(t);r?Mi((function(){var n={done:!1};try{r.call(t,as(cs,n,e),as(us,n,e))}catch(t){us(n,t,e)}})):(e.value=t,e.state=1,ns(e,!1))}catch(t){us({done:!1},t,e)}}};Xi&&(qi=function(e){kr(this,qi,Bi),Nn(e),Ni.call(this);var t=Fi(this);try{e(as(cs,t),as(us,t))}catch(e){us(t,e)}},(Ni=function(e){ji(this,{type:Bi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Cr(qi.prototype,{then:function(e,t){var n=Yi(this),r=Qi(Jr(this,qi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Je?Hi.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&ns(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Oi=function(){var e=new Ni,t=Fi(e);this.promise=e,this.resolve=as(cs,t),this.reject=as(us,t)},Li.f=Qi=function(e){return e===qi||e===ki?new Oi(e):Ji(e)},"function"==typeof Ir&&(Ai=Ir.prototype.then,oe(Ir.prototype,"then",(function(e,t){var n=this;return new qi((function(e,t){Ai.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Wi&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Ui(qi,Wi.apply(o,arguments))}}))),Pe({global:!0,wrap:!0,forced:Xi},{Promise:qi}),wr(qi,Bi,!1),Or(Bi),ki=ce(Bi),Pe({target:Bi,stat:!0,forced:Xi},{reject:function(e){var t=Qi(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Bi,stat:!0,forced:Xi},{resolve:function(e){return Ui(this,e)}}),Pe({target:Bi,stat:!0,forced:es},{all:function(e){var t=this,n=Qi(t),r=n.resolve,i=n.reject,s=Pi((function(){var n=Nn(t.resolve),s=[],o=0,a=1;Br(e,(function(e){var u=o++,c=!1;s.push(void 0),a++,n.call(t,e).then((function(e){c||(c=!0,s[u]=e,--a||r(s))}),i)})),--a||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Qi(t),r=n.reject,i=Pi((function(){var i=Nn(t.resolve);Br(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var ls="RC_Logs";function hs(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(ls),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=wt({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,ls,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var fs=function(){function e(){Rt(this,e)}return Ct(e,[{key:"addList",value:function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),s=i.objectStore(t);n.forEach((function(e){null==s||s.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))}},{key:"getRangeData",value:function(t,n,r,i){return new Promise((function(s){if(e._db){var o=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=o.index(n),c=[],l=u.openCursor(a);l.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):s(c)},l.onerror=function(e){console.error(e),s([])}}else s([])}))}},{key:"getCount",value:function(t,n){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readonly").objectStore(t).count();r.onsuccess=function(){n(r.result)},r.onerror=function(e){console.error(e),n(0)}}else n(0)}))}},{key:"removeFirstData",value:function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),s=i.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var e=s.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))}}],[{key:"init",value:function(){if("undefined"!=typeof window&&window&&window.indexedDB){var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(e){console.warn("open indexDB request failed "+e.target.error)},t.onsuccess=function(t){e._db=t.target.result,e._instance=new e},t.onupgradeneeded=function(t){e._db=t.target.result,hs(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();fs._db=null;var ds=ot("match"),gs=function(e){var t;return E(e)&&(void 0!==(t=e[ds])?!!t:"RegExp"==p(e))},ps=Be.UNSUPPORTED_Y,vs=[].push,ys=Math.min,ms=4294967295;dt("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(m(this)),i=void 0===n?ms:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!gs(e))return t.call(r,e,i);for(var s,o,a,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=He.call(h,r))&&!((o=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&vs.apply(u,s.slice(1)),a=s[0].length,l=o,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!a&&h.test("")||u.push(""):u.push(r.slice(l)),u.length>i?u.slice(0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=m(this),s=null==t?void 0:t[e];return void 0!==s?s.call(t,i,n):r.call(String(i),t,n)},function(e,i){var s=n(r,e,this,i,r!==t);if(s.done)return s.value;var o=A(e),a=String(this),u=Jr(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(ps?"g":"y"),h=new u(ps?"^(?:"+o.source+")":o,l),f=void 0===i?ms:i>>>0;if(0===f)return[];if(0===a.length)return null===mt(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=ps?0:g;var v,y=mt(h,ps?a.slice(g):a);if(null===y||(v=ys(ge(h.lastIndex+(ps?g:0)),a.length))===d)g=yt(a,g,c);else{if(p.push(a.slice(d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(p.push(y[m]),p.length===f)return p;g=d=v}}return p.push(a.slice(d)),p}]}),ps);var _s="toString",Es=RegExp.prototype,Ts=Es.toString,Rs=a((function(){return"/a/b"!=Ts.call({source:"a",flags:"b"})})),Is=Ts.name!=_s;(Rs||Is)&&oe(RegExp.prototype,_s,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Es)?De.call(e):n)}),{unsafe:!0});var Cs,Ss=function(e,t){return e+Math.floor(Math.random()*(t-e))},bs=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},ws=function(){var e=bs();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var s=r%n;r=(r-s)/n,i.unshift(t[s])}while(r);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e};!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.RTC_ROOM=12]="RTC_ROOM"}(Cs||(Cs={}));var Ns,Os=Cs;!function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(Ns||(Ns={}));var ks,As=Ns,Ms=function(e){return"string"==typeof e},xs=function(e){return"boolean"==typeof e},Ls=function(e){return"number"==typeof e&&!isNaN(e)},Us=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ps=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Ds=function(e){return Ms(e)&&e.length>0},Vs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Bs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Fs=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},js=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ys=function(e){for(var t in e)return!0;return!1},qs=(St(ks={},e.LogLevel.DEBUG,console.debug.bind(console)),St(ks,e.LogLevel.INFO,console.info.bind(console)),St(ks,e.LogLevel.WARN,console.warn.bind(console)),St(ks,e.LogLevel.ERROR,console.error.bind(console)),St(ks,e.LogLevel.FATAL,console.log.bind(console)),ks),Ks=function(e){return Ms(e)||Ls(e)||Fs(e)||xs(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Gs=function(){function t(n,r,i){Rt(this,t),this.tag=n,this.type=r,this.initiator=i,this._outLevel=e.LogLevel.WARN,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}var n;return Ct(t,[{key:"_defaultStdout",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];qs[e].apply(qs,["".concat(t,":")].concat(r))}},{key:"__pushLocalLog",value:function(n,r,i){var s;s=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?e.LogType.RTC:e.LogType.IM;var o=Date.now();Kn(r)>=1e3&&(r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf-8";if(!e||!t)return"";var r="utf-8"===n?3:2,i=0,s=0,o="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return o;o+=e.charAt(s)}return e}(r,1e3));var a=JSON.stringify({message:r,userId:t.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(i)?i:"".concat(this.initiator||"L","-").concat(i,"-O"),c={sessionId:t.sessionId,time:o,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(a,'"\n'),userId:t.userId};t.databaseLogList.push(c),t.databaseLogList.length>=100&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=Tt(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Bt(t.databaseLogList),t.databaseLogList=[],!(r=fs.getInstance())){e.next=14;break}return e.next=6,r.addList(ls,n);case 6:return i=e.sent,e.next=9,r.getCount(ls,"time");case 9:return e.sent>1e5&&r.removeFirstData(ls,"time",2e3),e.abrupt("return",i);case 14:return e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"setLogLevel",value:function(t){this._outLevel="number"!=typeof t?e.LogLevel.WARN:t}},{key:"setLogStdout",value:function(e){this._logStdout=e}},{key:"log",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(this.__pushLocalLog(t,r.map(Ks).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),o="".concat(s," - ").concat(r.map(Ks).join(" "));this._logStdout?this._logStdout(t,o):this._stdout?this._stdout(t,o):this._defaultStdout.apply(this,[t,s].concat(r))}}},{key:"reportLog",value:function(e,n,r){this.__pushLocalLog(4-e,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'.concat(i,'"');var s={level:e,content:[t.sessionId,Date.now(),this.type,e,n,i].join()+"\n"};t.realTimeLogList.push(s),t.realTimeLogList.length>=600&&(t.realTimeLogList=t.realTimeLogList.slice(-500))}},{key:"set",value:function(e,t){this.warn("logger.set has being deprecated!")}},{key:"setStdout",value:function(e){this._stdout=e}},{key:"__clearRealTimeLog",value:function(){t.realTimeLogList=[]}}],[{key:"init",value:function(e){t.userId=e}},{key:"reset",value:function(){t.userId=""}}]),t}();Gs.databaseLogList=[],Gs.realTimeLogList=[],Gs.sessionId=ws(),Gs.userId="";var Hs=new Gs("RCLog"),Ws=Wt("splice"),Qs=Math.max,Js=Math.min,zs=9007199254740991,Zs="Maximum allowed length exceeded";Pe({target:"Array",proto:!0,forced:!Ws},{splice:function(e,t){var n,r,i,s,o,a,u=R(this),c=ge(u.length),l=ye(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=Js(Qs(fe(t),0),c-l)),c+n-r>zs)throw TypeError(Zs);for(i=Gt(u,r),s=0;s<r;s++)(o=l+s)in u&&qt(i,s,u[o]);if(i.length=r,n<r){for(s=l;s<c-r;s++)a=s+n,(o=s+r)in u?u[a]=u[o]:delete u[a];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)a=s+n-1,(o=s+r-1)in u?u[a]=u[o]:delete u[a];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var $s,Xs=function(){function e(){Rt(this,e),this._map={}}return Ct(e,[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var s=t.length-1;s>=0;s-=1){var o=t[s],a=o.target,u=o.once,c=o.listener;u&&t.splice(s,1);try{c.call.apply(c,[a].concat(r))}catch(e){Hs.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}]),e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}($s||($s={}));var eo,to=$s;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=34009]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS"}(eo||(eo={}));var no,ro=eo;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"}(no||(no={}));var io,so=no,oo={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13};!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange"}(io||(io={}));var ao,uo=io;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(ao||(ao={}));var co,lo=ao;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(co||(co={}));var ho,fo=co;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(ho||(ho={}));var go,po=ho;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(go||(go={}));var vo,yo=go;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(vo||(vo={}));var mo,_o,Eo,To=vo;e.RTCMode=void 0,(mo=e.RTCMode||(e.RTCMode={}))[mo.RTC=0]="RTC",mo[mo.LIVE=2]="LIVE",e.LiveType=void 0,(_o=e.LiveType||(e.LiveType={}))[_o.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",_o[_o.AUDIO=1]="AUDIO",e.LiveRole=void 0,(Eo=e.LiveRole||(e.LiveRole={}))[Eo.ANCHOR=1]="ANCHOR",Eo[Eo.AUDIENCE=2]="AUDIENCE";var Ro,Io,Co,So,bo={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};e.RTCApiType=void 0,(Ro=e.RTCApiType||(e.RTCApiType={}))[Ro.ROOM=1]="ROOM",Ro[Ro.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(Io=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[Io.AnchorToViewer=1]="AnchorToViewer",Io[Io.ViewerToAnchor=2]="ViewerToAnchor",e.AssertRules=void 0,(So=e.AssertRules||(e.AssertRules={}))[So.STRING=0]="STRING",So[So.ONLY_STRING=1]="ONLY_STRING",So[So.NUMBER=2]="NUMBER",So[So.BOOLEAN=3]="BOOLEAN",So[So.OBJECT=4]="OBJECT",So[So.ARRAY=5]="ARRAY",So[So.CALLBACK=6]="CALLBACK";var wo=(St(Co={},e.AssertRules.STRING,Ds),St(Co,e.AssertRules.ONLY_STRING,Ms),St(Co,e.AssertRules.NUMBER,Ls),St(Co,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),St(Co,e.AssertRules.OBJECT,Vs),St(Co,e.AssertRules.ARRAY,Us),St(Co,e.AssertRules.CALLBACK,(function(e){var t=!0;return Vs(e)||(t=!1),(e=e||{}).onSuccess&&!Bs(e.onSuccess)&&(t=!1),e.onError&&!Bs(e.onError)&&(t=!1),t})),Co),No=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(xt(Error)),Oo=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=wo[n]||n;var i=r&&!n(t)||!r&&!(Fs(t)||null===t||n(t));return i&&Hs.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},ko=[].slice,Ao=/MSIE .\./.test(ze),Mo=function(e){return function(t,n){var r=arguments.length>2,i=r?ko.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};Pe({global:!0,bind:!0,forced:Ao},{setTimeout:Mo(o.setTimeout),setInterval:Mo(o.setInterval)});var xo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return A(n),function(e){if(!E(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Lo=function(e,t,n){var r,i;return xo&&"function"==typeof(r=t.constructor)&&r!==n&&E(i=r.prototype)&&i!==n.prototype&&xo(e,i),e},Uo=x.f,Po=Ce.f,Do=se.enforce,Vo=ot("match"),Bo=o.RegExp,Fo=Bo.prototype,jo=/a/g,Yo=/a/g,qo=new Bo(jo)!==jo,Ko=Be.UNSUPPORTED_Y;if(u&&Le("RegExp",!qo||Ko||a((function(){return Yo[Vo]=!1,Bo(jo)!=jo||Bo(Yo)==Yo||"/a/i"!=Bo(jo,"i")})))){for(var Go=function(e,t){var n,r=this instanceof Go,i=gs(e),s=void 0===t;if(!r&&i&&e.constructor===Go&&s)return e;qo?i&&!s&&(e=e.source):e instanceof Go&&(s&&(t=De.call(e)),e=e.source),Ko&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Lo(qo?new Bo(e,t):Bo(e,t),r?this:Fo,Go);Ko&&n&&(Do(o).sticky=!0);return o},Ho=function(e){e in Go||Uo(Go,e,{configurable:!0,get:function(){return Bo[e]},set:function(t){Bo[e]=t}})},Wo=Po(Bo),Qo=0;Wo.length>Qo;)Ho(Wo[Qo++]);Fo.constructor=Go,Go.prototype=Fo,oe(o,"RegExp",Go)}Or("RegExp");var Jo,zo,Zo,$o=function(e){if(!Vs(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{"+t.length+"}$"),t),16)},Xo=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=bs(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),s=(new Date).getTime(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(o)},ea=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.threadId,r=e.apnsCollapseId,i=e.category,s=e.richMediaUri,o=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h={};h["thread-id"]=n||"",h["apns-collapse-id"]=r||"",h.category=i||"",h.richMediaUri=s||"";var f={};f.collapse_key=null==l?void 0:l.collapseKey,f.imageUrl=null==l?void 0:l.imageUrl;var d=null==l?void 0:l.priority;d&&!["high","normal"].includes(d)&&(d="normal"),f.priority=d;var g=[{HW:{channelId:a||""}},{MI:{channelId:o||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},ta=function(e,t){var n={},r={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:r};try{var i=JSON.parse(e);null==i||i.forEach((function(e){var t,i,s,o,a=Object.keys(e);if(0!==a.length){var u=a[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(s=e[u])||void 0===s?void 0:s.channelId);case"VIVO":return void(r.typeVivo=null===(o=e[u])||void 0===o?void 0:o.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){Hs.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},na=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},ra=function(e){var t=e.length;return t<=4096&&t>=1},ia=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Vs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Us(e)||Ms(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,s=e.length;i<s;i++)t(e[i],i)}()},sa=function(e,t){return ia(e,(function(n,r){e[r]=t(n,r)})),e},oa=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return ia(e,(function(e,r){t===e&&(n=r)})),n},aa=function(e,t){var n=[];return ia(e,(function(e){n.push(e)})),-1!==oa(n,t)},ua=function(e){return JSON.parse(JSON.stringify(e))},ca=function(){return"undefined"!=typeof RCCppEngine},la=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var s in i)if(i.hasOwnProperty(s)){var o=r.match(i[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},ha=function(e){switch(e){case oo.SERVER_UNAVAILABLE:return ro.SERVER_UNAVAILABLE;case oo.TOKEN_INCORRECT:return ro.RC_CONN_USER_OR_PASSWD_ERROR;case oo.REDIRECT:return ro.RC_CONN_REDIRECTED;case oo.APP_BLOCK_OR_DELETE:return ro.RC_CONN_APP_BLOCKED_OR_DELETED;case oo.BLOCK:return ro.RC_CONN_USER_BLOCKED;case oo.TOKEN_EXPIRE:return ro.RC_CONN_USER_OR_PASSWD_ERROR;case oo.HOSTNAME_ERROR:return ro.HOSTNAME_ERROR;case oo.HASOHTERSAMECLIENTONLINE:return ro.HAS_OHTER_SAME_CLIENT_ON_LINE;default:return ro.RC_NET_UNAVAILABLE}},fa=function(e){var t={},n=JSON.parse(e);return ia(n,(function(e,n){t[n]=e.v})),t},da={_delayTime:0,setTime:function(e){var t=(new Date).getTime();da._delayTime=t-e},getTime:function(){var e=da._delayTime;return(new Date).getTime()-e}},ga=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},pa=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),va=z("IE_PROTO"),ya=Object.prototype,ma=pa?Object.getPrototypeOf:function(e){return e=R(e),C(e,va)?e[va]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ya:null},_a=ot("iterator"),Ea=!1;[].keys&&("next"in(Zo=[].keys())?(zo=ma(ma(Zo)))!==Object.prototype&&(Jo=zo):Ea=!0),(null==Jo||a((function(){var e={};return Jo[_a].call(e)!==e})))&&(Jo={}),C(Jo,_a)||L(Jo,_a,(function(){return this}));var Ta={IteratorPrototype:Jo,BUGGY_SAFARI_ITERATORS:Ea},Ra=Ta.IteratorPrototype,Ia=function(){return this},Ca=Ta.IteratorPrototype,Sa=Ta.BUGGY_SAFARI_ITERATORS,ba=ot("iterator"),wa="keys",Na="values",Oa="entries",ka=function(){return this},Aa=function(e,t,n,r,i,s,o){!function(e,t,n){var r=t+" Iterator";e.prototype=ir(Ra,{next:f(1,n)}),wr(e,r,!1),Ar[r]=Ia}(n,t,r);var a,u,c,l=function(e){if(e===i&&v)return v;if(!Sa&&e in g)return g[e];switch(e){case wa:case Na:case Oa:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",d=!1,g=e.prototype,p=g[ba]||g["@@iterator"]||i&&g[i],v=!Sa&&p||l(i),y="Array"==t&&g.entries||p;if(y&&(a=ma(y.call(new e)),Ca!==Object.prototype&&a.next&&(ma(a)!==Ca&&(xo?xo(a,Ca):"function"!=typeof a[ba]&&L(a,ba,ka)),wr(a,h,!0))),i==Na&&p&&p.name!==Na&&(d=!0,v=function(){return p.call(this)}),g[ba]!==v&&L(g,ba,v),Ar[t]=v,i)if(u={values:l(Na),keys:s?v:l(wa),entries:l(Oa)},o)for(c in u)(Sa||d||!(c in g))&&oe(g,c,u[c]);else Pe({target:t,proto:!0,forced:Sa||d},u);return u},Ma=pt.charAt,xa="String Iterator",La=se.set,Ua=se.getterFor(xa);Aa(String,"String",(function(e){La(this,{type:xa,string:String(e),index:0})}),(function(){var e,t=Ua(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Ma(n,r),t.index+=e.length,{value:e,done:!1})}));var Pa="Array Iterator",Da=se.set,Va=se.getterFor(Pa),Ba=Aa(Array,"Array",(function(e,t){Da(this,{type:Pa,target:_(e),index:0,kind:t})}),(function(){var e=Va(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");Ar.Arguments=Ar.Array,cr("keys"),cr("values"),cr("entries");var Fa=ot("iterator"),ja=ot("toStringTag"),Ya=Ba.values;for(var qa in hr){var Ka=o[qa],Ga=Ka&&Ka.prototype;if(Ga){if(Ga[Fa]!==Ya)try{L(Ga,Fa,Ya)}catch(e){Ga[Fa]=Ya}if(Ga[ja]||L(Ga,ja,qa),hr[qa])for(var Ha in Ba)if(Ga[Ha]!==Ba[Ha])try{L(Ga,Ha,Ba[Ha])}catch(e){Ga[Ha]=Ba[Ha]}}}var Wa="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Qa=function(e){if(void 0===e)return 0;var t=fe(e),n=ge(t);if(t!==n)throw RangeError("Wrong length or index");return n},Ja=Math.abs,za=Math.pow,Za=Math.floor,$a=Math.log,Xa=Math.LN2,eu=function(e,t,n){var r,i,s,o=new Array(n),a=8*n-t-1,u=(1<<a)-1,c=u>>1,l=23===t?za(2,-24)-za(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=Ja(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Za($a(e)/Xa),e*(s=za(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*za(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*za(2,t),r+=c):(i=e*za(2,c-1)*za(2,t),r=0));t>=8;o[f++]=255&i,i/=256,t-=8);for(r=r<<t|i,a+=t;a>0;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*h,o},tu=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,o=s>>1,a=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;a>0;l=256*l+e[u],u--,a-=8);for(n=l&(1<<-a)-1,l>>=-a,a+=t;a>0;n=256*n+e[u],u--,a-=8);if(0===l)l=1-o;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=za(2,t),l-=o}return(c?-1:1)*n*za(2,l-t)},nu=function(e){for(var t=R(this),n=ge(t.length),r=arguments.length,i=ye(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,o=void 0===s?n:ye(s,n);o>i;)t[i++]=e;return t},ru=Ce.f,iu=x.f,su=se.get,ou=se.set,au="ArrayBuffer",uu="DataView",cu="Wrong index",lu=o.ArrayBuffer,hu=lu,fu=o.DataView,du=fu&&fu.prototype,gu=Object.prototype,pu=o.RangeError,vu=eu,yu=tu,mu=function(e){return[255&e]},_u=function(e){return[255&e,e>>8&255]},Eu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Tu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Ru=function(e){return vu(e,23,4)},Iu=function(e){return vu(e,52,8)},Cu=function(e,t){iu(e.prototype,t,{get:function(){return su(this)[t]}})},Su=function(e,t,n,r){var i=Qa(n),s=su(e);if(i+t>s.byteLength)throw pu(cu);var o=su(s.buffer).bytes,a=i+s.byteOffset,u=o.slice(a,a+t);return r?u:u.reverse()},bu=function(e,t,n,r,i,s){var o=Qa(n),a=su(e);if(o+t>a.byteLength)throw pu(cu);for(var u=su(a.buffer).bytes,c=o+a.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Wa){if(!a((function(){lu(1)}))||!a((function(){new lu(-1)}))||a((function(){return new lu,new lu(1.5),new lu(NaN),lu.name!=au}))){for(var wu,Nu=(hu=function(e){return kr(this,hu),new lu(Qa(e))}).prototype=lu.prototype,Ou=ru(lu),ku=0;Ou.length>ku;)(wu=Ou[ku++])in hu||L(hu,wu,lu[wu]);Nu.constructor=hu}xo&&ma(du)!==gu&&xo(du,gu);var Au=new fu(new hu(2)),Mu=du.setInt8;Au.setInt8(0,2147483648),Au.setInt8(1,2147483649),!Au.getInt8(0)&&Au.getInt8(1)||Cr(du,{setInt8:function(e,t){Mu.call(this,e,t<<24>>24)},setUint8:function(e,t){Mu.call(this,e,t<<24>>24)}},{unsafe:!0})}else hu=function(e){kr(this,hu,au);var t=Qa(e);ou(this,{bytes:nu.call(new Array(t),0),byteLength:t}),u||(this.byteLength=t)},fu=function(e,t,n){kr(this,fu,uu),kr(e,hu,uu);var r=su(e).byteLength,i=fe(t);if(i<0||i>r)throw pu("Wrong offset");if(i+(n=void 0===n?r-i:ge(n))>r)throw pu("Wrong length");ou(this,{buffer:e,byteLength:n,byteOffset:i}),u||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},u&&(Cu(hu,"byteLength"),Cu(fu,"buffer"),Cu(fu,"byteLength"),Cu(fu,"byteOffset")),Cr(fu.prototype,{getInt8:function(e){return Su(this,1,e)[0]<<24>>24},getUint8:function(e){return Su(this,1,e)[0]},getInt16:function(e){var t=Su(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Su(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Tu(Su(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Tu(Su(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return yu(Su(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return yu(Su(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){bu(this,1,e,mu,t)},setUint8:function(e,t){bu(this,1,e,mu,t)},setInt16:function(e,t){bu(this,2,e,_u,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){bu(this,2,e,_u,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){bu(this,4,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){bu(this,4,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){bu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){bu(this,8,e,Iu,t,arguments.length>2?arguments[2]:void 0)}});wr(hu,au),wr(fu,uu);var xu={ArrayBuffer:hu,DataView:fu},Lu=xu.ArrayBuffer,Uu=xu.DataView,Pu=Lu.prototype.slice,Du=a((function(){return!new Lu(2).slice(1,void 0).byteLength}));Pe({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Du},{slice:function(e,t){if(void 0!==Pu&&void 0===t)return Pu.call(A(this),e);for(var n=A(this).byteLength,r=ye(e,n),i=ye(void 0===t?n:t,n),s=new(Jr(this,Lu))(ge(i-r)),o=new Uu(this),a=new Uu(s),u=0;r<i;)a.setUint8(u++,o.getUint8(r++));return s}});var Vu,Bu=x.f,Fu=o.Int8Array,ju=Fu&&Fu.prototype,Yu=o.Uint8ClampedArray,qu=Yu&&Yu.prototype,Ku=Fu&&ma(Fu),Gu=ju&&ma(ju),Hu=Object.prototype,Wu=Hu.isPrototypeOf,Qu=ot("toStringTag"),Ju=Q("TYPED_ARRAY_TAG"),zu=Wa&&!!xo&&"Opera"!==Tr(o.opera),Zu=!1,$u={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Xu={BigInt64Array:8,BigUint64Array:8},ec=function(e){if(!E(e))return!1;var t=Tr(e);return C($u,t)||C(Xu,t)};for(Vu in $u)o[Vu]||(zu=!1);if((!zu||"function"!=typeof Ku||Ku===Function.prototype)&&(Ku=function(){throw TypeError("Incorrect invocation")},zu))for(Vu in $u)o[Vu]&&xo(o[Vu],Ku);if((!zu||!Gu||Gu===Hu)&&(Gu=Ku.prototype,zu))for(Vu in $u)o[Vu]&&xo(o[Vu].prototype,Gu);if(zu&&ma(qu)!==Gu&&xo(qu,Gu),u&&!C(Gu,Qu))for(Vu in Zu=!0,Bu(Gu,Qu,{get:function(){return E(this)?this[Ju]:void 0}}),$u)o[Vu]&&L(o[Vu],Ju,Vu);var tc={NATIVE_ARRAY_BUFFER_VIEWS:zu,TYPED_ARRAY_TAG:Zu&&Ju,aTypedArray:function(e){if(ec(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(xo){if(Wu.call(Ku,e))return e}else for(var t in $u)if(C($u,Vu)){var n=o[t];if(n&&(e===n||Wu.call(n,e)))return e}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n){if(u){if(n)for(var r in $u){var i=o[r];i&&C(i.prototype,e)&&delete i.prototype[e]}Gu[e]&&!n||oe(Gu,e,n?t:zu&&ju[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(u){if(xo){if(n)for(r in $u)(i=o[r])&&C(i,e)&&delete i[e];if(Ku[e]&&!n)return;try{return oe(Ku,e,n?t:zu&&Fu[e]||t)}catch(e){}}for(r in $u)!(i=o[r])||i[e]&&!n||oe(i,e,t)}},isView:function(e){if(!E(e))return!1;var t=Tr(e);return"DataView"===t||C($u,t)||C(Xu,t)},isTypedArray:ec,TypedArray:Ku,TypedArrayPrototype:Gu},nc=tc.NATIVE_ARRAY_BUFFER_VIEWS,rc=o.ArrayBuffer,ic=o.Int8Array,sc=!nc||!a((function(){ic(1)}))||!a((function(){new ic(-1)}))||!Wr((function(e){new ic,new ic(null),new ic(1.5),new ic(e)}),!0)||a((function(){return 1!==new ic(new rc(2),1,void 0).length})),oc=function(e,t){var n=function(e){var t=fe(e);if(t<0)throw RangeError("The argument can't be less than 0");return t}(e);if(n%t)throw RangeError("Wrong offset");return n},ac=tc.aTypedArrayConstructor,uc=function(e){var t,n,r,i,s,o,a=R(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Pr(a);if(null!=h&&!Lr(h))for(o=(s=h.call(a)).next,a=[];!(i=o.call(s)).done;)a.push(i.value);for(l&&u>2&&(c=On(c,arguments[2],2)),n=ge(a.length),r=new(ac(this))(n),t=0;n>t;t++)r[t]=l?c(a[t],t):a[t];return r},cc=i((function(e){var t=Ce.f,n=Mn.forEach,r=se.get,i=se.set,s=x.f,a=k.f,c=Math.round,l=o.RangeError,h=xu.ArrayBuffer,d=xu.DataView,g=tc.NATIVE_ARRAY_BUFFER_VIEWS,p=tc.TYPED_ARRAY_TAG,v=tc.TypedArray,y=tc.TypedArrayPrototype,m=tc.aTypedArrayConstructor,_=tc.isTypedArray,R="BYTES_PER_ELEMENT",I="Wrong length",S=function(e,t){for(var n=0,r=t.length,i=new(m(e))(r);r>n;)i[n]=t[n++];return i},b=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},w=function(e){var t;return e instanceof h||"ArrayBuffer"==(t=Tr(e))||"SharedArrayBuffer"==t},N=function(e,t){return _(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},O=function(e,t){return N(e,t=T(t,!0))?f(2,e[t]):a(e,t)},A=function(e,t,n){return!(N(e,t=T(t,!0))&&E(n)&&C(n,"value"))||C(n,"get")||C(n,"set")||n.configurable||C(n,"writable")&&!n.writable||C(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};u?(g||(k.f=O,x.f=A,b(y,"buffer"),b(y,"byteOffset"),b(y,"byteLength"),b(y,"length")),Pe({target:"Object",stat:!0,forced:!g},{getOwnPropertyDescriptor:O,defineProperty:A}),e.exports=function(e,a,u){var f=e.match(/\d+$/)[0]/8,m=e+(u?"Clamped":"")+"Array",T="get"+e,C="set"+e,b=o[m],N=b,O=N&&N.prototype,k={},A=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[T](t*f+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);u&&(n=(n=c(n))<0?0:n>255?255:255&n),i.view[C](t*f+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};g?sc&&(N=a((function(e,t,n,r){return kr(e,N,m),Lo(E(t)?w(t)?void 0!==r?new b(t,oc(n,f),r):void 0!==n?new b(t,oc(n,f)):new b(t):_(t)?S(N,t):uc.call(N,t):new b(Qa(t)),e,N)})),xo&&xo(N,v),n(t(b),(function(e){e in N||L(N,e,b[e])})),N.prototype=O):(N=a((function(e,t,n,r){kr(e,N,m);var s,o,a,u=0,c=0;if(E(t)){if(!w(t))return _(t)?S(N,t):uc.call(N,t);s=t,c=oc(n,f);var g=t.byteLength;if(void 0===r){if(g%f)throw l(I);if((o=g-c)<0)throw l(I)}else if((o=ge(r)*f)+c>g)throw l(I);a=o/f}else a=Qa(t),s=new h(o=a*f);for(i(e,{buffer:s,byteOffset:c,byteLength:o,length:a,view:new d(s)});u<a;)A(e,u++)})),xo&&xo(N,v),O=N.prototype=ir(y)),O.constructor!==N&&L(O,"constructor",N),p&&L(O,p,m),k[m]=N,Pe({global:!0,forced:N!=b,sham:!g},k),R in N||L(N,R,f),R in O||L(O,R,f),Or(m)}):e.exports=function(){}}));cc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var lc=Math.min,hc=[].copyWithin||function(e,t){var n=R(this),r=ge(n.length),i=ye(e,r),s=ye(t,r),o=arguments.length>2?arguments[2]:void 0,a=lc((void 0===o?r:ye(o,r))-s,r-i),u=1;for(s<i&&i<s+a&&(u=-1,s+=a-1,i+=a-1);a-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},fc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("copyWithin",(function(e,t){return hc.call(fc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var dc=Mn.every,gc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("every",(function(e){return dc(gc(this),e,arguments.length>1?arguments[1]:void 0)}));var pc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("fill",(function(e){return nu.apply(pc(this),arguments)}));var vc=tc.aTypedArrayConstructor,yc=function(e,t){for(var n=Jr(e,e.constructor),r=0,i=t.length,s=new(vc(n))(i);i>r;)s[r]=t[r++];return s},mc=Mn.filter,_c=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("filter",(function(e){var t=mc(_c(this),e,arguments.length>1?arguments[1]:void 0);return yc(this,t)}));var Ec=Mn.find,Tc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("find",(function(e){return Ec(Tc(this),e,arguments.length>1?arguments[1]:void 0)}));var Rc=Mn.findIndex,Ic=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("findIndex",(function(e){return Rc(Ic(this),e,arguments.length>1?arguments[1]:void 0)}));var Cc=Mn.forEach,Sc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("forEach",(function(e){Cc(Sc(this),e,arguments.length>1?arguments[1]:void 0)}));var bc=_e.includes,wc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("includes",(function(e){return bc(wc(this),e,arguments.length>1?arguments[1]:void 0)}));var Nc=_e.indexOf,Oc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("indexOf",(function(e){return Nc(Oc(this),e,arguments.length>1?arguments[1]:void 0)}));var kc=ot("iterator"),Ac=o.Uint8Array,Mc=Ba.values,xc=Ba.keys,Lc=Ba.entries,Uc=tc.aTypedArray,Pc=tc.exportTypedArrayMethod,Dc=Ac&&Ac.prototype[kc],Vc=!!Dc&&("values"==Dc.name||null==Dc.name),Bc=function(){return Mc.call(Uc(this))};Pc("entries",(function(){return Lc.call(Uc(this))})),Pc("keys",(function(){return xc.call(Uc(this))})),Pc("values",Bc,!Vc),Pc(kc,Bc,!Vc);var Fc=tc.aTypedArray,jc=[].join;(0,tc.exportTypedArrayMethod)("join",(function(e){return jc.apply(Fc(this),arguments)}));var Yc=Math.min,qc=[].lastIndexOf,Kc=!!qc&&1/[1].lastIndexOf(1,-0)<0,Gc=Bn("lastIndexOf"),Hc=Kc||!Gc?function(e){if(Kc)return qc.apply(this,arguments)||0;var t=_(this),n=ge(t.length),r=n-1;for(arguments.length>1&&(r=Yc(r,fe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:qc,Wc=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("lastIndexOf",(function(e){return Hc.apply(Wc(this),arguments)}));var Qc=Mn.map,Jc=tc.aTypedArray,zc=tc.aTypedArrayConstructor;(0,tc.exportTypedArrayMethod)("map",(function(e){return Qc(Jc(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(zc(Jr(e,e.constructor)))(t)}))}));var Zc=function(e){return function(t,n,r,i){Nn(n);var s=R(t),o=y(s),a=ge(s.length),u=e?a-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:a<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:a>u;u+=c)u in o&&(i=n(i,o[u],u,s));return i}},$c={left:Zc(!1),right:Zc(!0)},Xc=$c.left,el=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("reduce",(function(e){return Xc(el(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var tl=$c.right,nl=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("reduceRight",(function(e){return tl(nl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var rl=tc.aTypedArray,il=tc.exportTypedArrayMethod,sl=Math.floor;il("reverse",(function(){for(var e,t=this,n=rl(t).length,r=sl(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var ol=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("set",(function(e){ol(this);var t=oc(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=R(e),i=ge(r.length),s=0;if(i+t>n)throw RangeError("Wrong length");for(;s<i;)this[t+s]=r[s++]}),a((function(){new Int8Array(1).set({})})));var al=tc.aTypedArray,ul=tc.aTypedArrayConstructor,cl=[].slice;(0,tc.exportTypedArrayMethod)("slice",(function(e,t){for(var n=cl.call(al(this),e,t),r=Jr(this,this.constructor),i=0,s=n.length,o=new(ul(r))(s);s>i;)o[i]=n[i++];return o}),a((function(){new Int8Array(1).slice()})));var ll=Mn.some,hl=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("some",(function(e){return ll(hl(this),e,arguments.length>1?arguments[1]:void 0)}));var fl=tc.aTypedArray,dl=[].sort;(0,tc.exportTypedArrayMethod)("sort",(function(e){return dl.call(fl(this),e)}));var gl=tc.aTypedArray;(0,tc.exportTypedArrayMethod)("subarray",(function(e,t){var n=gl(this),r=n.length,i=ye(e,r);return new(Jr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ge((void 0===t?r:ye(t,r))-i))}));var pl=o.Int8Array,vl=tc.aTypedArray,yl=tc.exportTypedArrayMethod,ml=[].toLocaleString,_l=[].slice,El=!!pl&&a((function(){ml.call(new pl(1))}));yl("toLocaleString",(function(){return ml.apply(El?_l.call(vl(this)):vl(this),arguments)}),a((function(){return[1,2].toLocaleString()!=new pl([1,2]).toLocaleString()}))||!a((function(){pl.prototype.toLocaleString.call([1,2])})));var Tl=tc.exportTypedArrayMethod,Rl=o.Uint8Array,Il=Rl&&Rl.prototype||{},Cl=[].toString,Sl=[].join;a((function(){Cl.call({})}))&&(Cl=function(){return Sl.call(this)});var bl=Il.toString!=Cl;Tl("toString",Cl,bl);var wl=Object.assign,Nl=Object.defineProperty,Ol=!wl||a((function(){if(u&&1!==wl({b:1},wl(Nl({},"a",{enumerable:!0,get:function(){Nl(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=wl({},e)[n]||Dn(wl({},t)).join("")!=r}))?function(e,t){for(var n=R(e),r=arguments.length,i=1,s=Se.f,o=h.f;r>i;)for(var a,c=y(arguments[i++]),l=s?Dn(c).concat(s(c)):Dn(c),f=l.length,d=0;f>d;)a=l[d++],u&&!o.call(c,a)||(n[a]=c[a]);return n}:wl;Pe({target:"Object",stat:!0,forced:Object.assign!==Ol},{assign:Ol});var kl,Al,Ml,xl,Ll="[\t\n\v\f\r \u2028\u2029\ufeff]",Ul=RegExp("^"+Ll+Ll+"*"),Pl=RegExp(Ll+Ll+"*$"),Dl=function(e){return function(t){var n=String(m(t));return 1&e&&(n=n.replace(Ul,"")),2&e&&(n=n.replace(Pl,"")),n}},Vl={start:Dl(1),end:Dl(2),trim:Dl(3)},Bl=Ce.f,Fl=k.f,jl=x.f,Yl=Vl.trim,ql="Number",Kl=o.Number,Gl=Kl.prototype,Hl=p(ir(Gl))==ql,Wl=function(e){var t,n,r,i,s,o,a,u,c=T(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=Yl(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(o=(s=c.slice(2)).length,a=0;a<o;a++)if((u=s.charCodeAt(a))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(Le(ql,!Kl(" 0o1")||!Kl("0b1")||Kl("+0x1"))){for(var Ql,Jl=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof Jl&&(Hl?a((function(){Gl.valueOf.call(n)})):p(n)!=ql)?Lo(new Kl(Wl(t)),n,Jl):Wl(t)},zl=u?Bl(Kl):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),Zl=0;zl.length>Zl;Zl++)C(Kl,Ql=zl[Zl])&&!C(Jl,Ql)&&jl(Jl,Ql,Fl(Kl,Ql));Jl.prototype=Gl,Gl.constructor=Jl,oe(o,ql,Jl)}!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(kl||(kl={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Al||(Al={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(Ml||(Ml={})),function(e){e.PUB="pub",e.QUERY="qry"}(xl||(xl={}));var $l,Xl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:kl.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Rt(this,e),this._retain=!1,this.qos=kl.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var s=t>0;t&&s&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=n,this.qos=r,this._dup=i)}return Ct(e,[{key:"encode",value:function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0}}]),e}(),eh=function(){function e(){Rt(this,e)}return Ct(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ms(e))for(var i=0,s=e.length;i<s;i++){var o=e.charCodeAt(i);o>=0&&o<=127?(r+=1,n.push(o)):o>=128&&o<=2047?(r+=2,n.push(192|31&o>>6),n.push(128|63&o)):o>=2048&&o<=65535&&(r+=3,n.push(224|15&o>>12),n.push(128|63&o>>6),n.push(128|63&o))}for(var a=0,u=n.length;a<u;a++)n[a]>255&&(n[a]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)}},{key:"readUTF",value:function(e){for(var t,n,r=[],i=-1,s=e,o="";++i<s.length;){var a=Number(s[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&a)&&(a=(a^=192)<<6|128^s[++i])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(o+=String.fromCharCode.apply(null,r),r.length=0)}return o}}]),e}(),th=function(){function e(t){Rt(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return Ct(e,[{key:"check",value:function(){return this._position>=this._pool.length}},{key:"readInt",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)}},{key:"readLong",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r}return parseInt(t,16)}},{key:"readByte",value:function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e}},{key:"readUTF",value:function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return eh.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),nh=function(){function e(){Rt(this,e),this._pool=[],this._position=0,this._writen=0}return Ct(e,[{key:"write",value:function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e}},{key:"writeArr",value:function(e){return this._pool=this._pool.concat(e),e}},{key:"writeUTF",value:function(e){var t=eh.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),rh="UpStreamMessage",ih="PushExtra",sh="DownStreamMessage",oh="DownStreamMessages",ah="SessionsAttQryInput",uh="SessionsAttOutput",ch="SyncRequestMsg",lh="ChrmPullMsg",hh="NotifyMsg",fh="HistoryMsgInput",dh="HistoryMsgOuput",gh="RelationQryInput",ph="RelationsOutput",vh="DeleteSessionsInput",yh="SessionInfo",mh="DeleteSessionsOutput",_h="RelationsInput",Eh="DeleteMsgInput",Th="CleanHisMsgInput",Rh="SessionMsgReadInput",Ih="ChrmInput",Ch="ChrmOutput",Sh="QueryChatRoomInfoInput",bh="QueryChatRoomInfoOutput",wh="RtcInput",Nh="RtcUserListOutput",Oh="SetUserStatusInput",kh="RtcSetDataInput",Ah="RtcUserSetDataInput",Mh="RtcDataInput",xh="RtcSetOutDataInput",Lh="MCFollowInput",Uh="RtcTokenOutput",Ph="RtcQryOutput",Dh="RtcQryUserOutDataInput",Vh="RtcUserOutDataOutput",Bh="RtcQueryListInput",Fh="RtcRoomInfoOutput",jh="RtcValueInfo",Yh="RtcKeyDeleteInput",qh="GetQNupTokenInput",Kh="GetQNupTokenOutput",Gh="GetQNdownloadUrlInput",Hh="GetDownloadUrlInput",Wh="GetQNdownloadUrlOutput",Qh="GetDownloadUrlOutput",Jh="SetChrmKV",zh="SetChrmKVS",Zh="DeleteChrmKVS",$h="ChrmKVOutput",Xh="ChrmKVSOutput",ef="ChrmKVSOutputEntity",tf="QueryChrmKV",nf="SetUserSettingInput",rf="SetUserSettingOutput",sf="PullUserSettingInput",of="PullUserSettingOutput",af="UserSettingNotification",uf="SessionReq",cf="SessionStates",lf="SessionState",hf="SessionStateItem",ff="SessionStateModifyReq",df="SessionStateModifyResp",gf="GrpReadReceiptMsg",pf="GrpReadReceiptQryReq",vf="GrpReadReceiptQryResp",yf="GrpMsgReadUser",mf="SessionTagAddInput",_f="SessionTagItem",Ef="SessionTagDelInput",Tf="SessionDisTagReq",Rf="ReportSDKInput",If="ReportSDKOutput",Cf="RtcNotifyMsg",Sf="RtcPullKV",bf="RtcKVOutput",wf=(St($l={},rh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt"]),St($l,oh,["list","syncTime","finished"]),St($l,sh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt"]),St($l,ih,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),St($l,ah,["nothing"]),St($l,uh,["inboxTime","sendboxTime","totalUnreadCount"]),St($l,ch,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),St($l,lh,["syncTime","count"]),St($l,hh,["type","time","chrmId"]),St($l,fh,["targetId","time","count","order"]),St($l,dh,["list","syncTime","hasMsg"]),St($l,gh,["type","count","startTime","order"]),St($l,ph,["info"]),St($l,vh,["sessions"]),St($l,yh,["type","channelId"]),St($l,mh,["nothing"]),St($l,_h,["type","msg","count","offset","startTime","endTime"]),St($l,Eh,["type","conversationId","msgs"]),St($l,Th,["targetId","dataTime","conversationType"]),St($l,Rh,["type","msgTime","channelId"]),St($l,Ih,["nothing"]),St($l,Ch,["nothing","sessionId","joinTime"]),St($l,Sh,["count","order"]),St($l,bh,["userTotalNums","userInfos"]),St($l,qh,["type","key","httpMethod","queryString"]),St($l,Gh,["type","key","fileName"]),St($l,Hh,["type","key","fileName"]),St($l,Kh,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),St($l,Wh,["downloadUrl"]),St($l,Qh,["downloadUrl"]),St($l,Jh,["entry","bNotify","notification","type"]),St($l,zh,["entry","bNotify","notification","type"]),St($l,Zh,["entry","bNotify","notification","type"]),St($l,$h,["entries","bFullUpdate","syncTime"]),St($l,Xh,["timestamp","errorKeys"]),St($l,ef,["key","errorCode"]),St($l,tf,["timestamp"]),St($l,nf,["version","value"]),St($l,rf,["version","reserve"]),St($l,sf,["version","reserve"]),St($l,of,["items","version"]),St($l,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),St($l,uf,["time"]),St($l,cf,["version","state"]),St($l,lf,["type","channelId","time","stateItem"]),St($l,hf,["sessionStateType","value","tags"]),St($l,ff,["version","state"]),St($l,df,["version"]),St($l,gf,["msgId","busChannel"]),St($l,pf,["msgId","busChannel"]),St($l,vf,["totalMemberNum","list"]),St($l,yf,["readTime","userId"]),St($l,mf,["version","tags"]),St($l,_f,["tagId","name","createdTime","isTop"]),St($l,Ef,["version","tags"]),St($l,Tf,["tagId"]),St($l,af,["version","reserve"]),St($l,Rf,["sdkInfo"]),St($l,If,["nothing"]),St($l,wh,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType"]),St($l,Nh,["users","token","sessionId","roomInfo"]),St($l,Oh,["status"]),St($l,kh,["interior","target","key","value","objectName","content"]),St($l,Ah,["valueInfo","objectName","content"]),St($l,Mh,["interior","target","key","objectName","content"]),St($l,xh,["target","valueInfo","objectName","content"]),St($l,Lh,["state"]),St($l,Uh,["rtcToken"]),St($l,Ph,["outInfo"]),St($l,Dh,["userId"]),St($l,Vh,["user"]),St($l,Bh,["order"]),St($l,Fh,["roomId","roomData","userCount","list"]),St($l,jh,["key","value"]),St($l,Yh,["key"]),St($l,Cf,["type","time","roomId"]),St($l,Sf,["timestamp","roomId"]),St($l,bf,["entries","bFullUpdate","syncTime"]),$l),Nf={},Of=function(e){var t=wf[e];Nf[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(qn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Nf[e].decode=function(e){var t={};Ms(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(qn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var kf in wf)Of(kf);Nf.getModule=function(e){return Nf[e]()},cc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Af="\npackage Modules;\nmessage probuf {\n message ".concat(Oh,"\n {\n optional int32 status=1;\n }\n\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message ").concat(hh," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(ch," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n }\n message ").concat(rh," {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n }\n message ").concat(ih," {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message ").concat(oh," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(sh," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(As.IMAGE,";\n audio = ").concat(As.AUDIO,";\n video = ").concat(As.VIDEO,";\n file = ").concat(As.FILE,";\n }\n message ").concat(qh," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Gh," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Hh," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Kh," {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n }\n message ").concat(Wh," {\n required string downloadUrl = 1;\n }\n message ").concat(Qh," {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message ").concat(Ih," {\n required int32 nothing = 1;\n }\n message ").concat(Ch," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(lh," {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message ").concat(gh,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(_h,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional int32 offset = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(ph,"\n {\n repeated RelationInfo info = 1;\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string channelId = 6;\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(Th,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(Sh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(bh,"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message ").concat(Lh,"\n {\n required string state = 1;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message ").concat(fh,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n }\n\n message ").concat(dh,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Bh,"{\n optional int32 order=1;\n }\n\n message ").concat(Yh,"{\n repeated string key=1;\n }\n\n message ").concat(jh,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(jh," userData=2; //用户资源信息\n }\n\n message ").concat(Nh,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(jh," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(wh,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Ph,"{\n repeated ").concat(jh," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(Mh,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(kh,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(Ah," {\n repeated ").concat(jh," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(jh," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Uh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(xh,"{\n required targetType target=1;\n repeated ").concat(jh," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Dh,"{\n repeated string userId = 1;\n }\n message ").concat(Vh,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(ah,"{\n required int32 nothing = 1;\n }\n message ").concat(uh,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Rh,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(vh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(yh,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n }\n message ").concat(mh,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Eh,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(Jh," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(zh," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Zh," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat($h," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(Xh," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(ef,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(tf," {\n required int64 timestamp = 1;\n }\n message ").concat(nf," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(rf," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(sf," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(of," {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message ").concat(uf," {\n required int64 time = 1;\n }\n message ").concat(cf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(lf," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n }\n message ").concat(hf," {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message ").concat(ff," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(df," {\n required int64 version=1;\n }\n message ").concat(gf," {\n repeated string msgId=1; //已读消息ID\n optional string busChannel = 2; // 该消息所属会话的业务标识\n }\n message ").concat(pf," {\n repeated string msgId=1; //已读消息ID\n optional string busChannel = 2; // 该消息所属会话的业务标识\n }\n message ").concat(vf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(yf," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(mf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(_f," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Ef," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Tf," {\n repeated string tagId=1;\n }\n message ").concat(af," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Rf,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(If,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Cf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Sf,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(bf,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n}\n"),Mf=/"/g;Pe({target:"String",proto:!0,forced:function(e){return a((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("sub")},{sub:function(){return e="sub",t="",n="",r=String(m(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+String(n).replace(Mf,""")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var xf="ArrayBuffer",Lf=xu.ArrayBuffer,Uf=o.ArrayBuffer;Pe({global:!0,forced:Uf!==Lf},{ArrayBuffer:Lf}),Or(xf),Pe({target:"Array",proto:!0},{fill:nu}),cr("fill");var Pf,Df,Vf,Bf,Ff,jf=(Pf=Af,function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||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 e={};return e.IS_NODE=!("object"!==("undefined"==typeof process?"undefined":_t(process))||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),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=0|i*r,!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 1/0*n;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){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var s,o,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,i,s;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();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;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(s=this.source.substring(this.index,this.index=i))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,(o=(s=function(e){this.tn=new u(e),this.proto3=!1}).prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},o._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)},o._parseOption=function(e,n){var r,i=this.tn.next(),s=!1;if("("===i&&(s=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,s&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},o._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)}},o._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},o._parseServiceRPC=function(e){var n,r,i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},o._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())&&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},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,r,i){var s,o,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(s={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.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(s.type=i,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._parseMessageOneOf=function(e){var n,r,i,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(r=s,i=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var r,i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),r={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},o._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},o._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),s=7&r,o=r>>>3;switch(s){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(o,n);break;case t.WIRE_TYPES.ENDGROUP:if(o===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+s)}return!0}var s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T={},R=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=R.prototype;return I.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},I.toString=function(e){return(e?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},T.T=R,(o=(s=function(e,t,n,r,i){R.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(R.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.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)},o.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},o.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,s=0;if(""===r[s]){for(;null!==i.parent;)i=i.parent;s++}do{do{if(!(i instanceof T.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof T.T&&(!t||n instanceof T.Namespace))){i=null;break}i=n,s++}while(s<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},o.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof T.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof s&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},o.buildOpt=function(){var e,t,n,r,i={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],r=this.options[s[e]],i[n]=r;return i},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},T.Namespace=s,u=(a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)}).prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){var i,s,o,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(_t(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(_t(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(_t(n),"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),o=0;o<i.length;o++){if(i[o].name==n)return i[o].id;if(i[o].id==n)return i[o].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),(n>4294967295||n<0)&&a(_t(n),"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===_t(n)||a(_t(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in s={},n)n.hasOwnProperty(o)&&(s[o]=n[o]);n=s}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.calculateLength=function(e,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?n.calculateVarint64(r):n.calculateVarint32(r);case t.TYPES.uint32:return n.calculateVarint32(r);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return n.calculateVarint64(r);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=n.calculateUTF8Bytes(r),n.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return n.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),n.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},u.encodeValue=function(e,r,i){var s,o;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");s=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=s;break;case t.TYPES.message:o=(new n).LE(),this.resolvedType.encode(r,o),i.writeVarint32(o.offset),i.append(o.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},u.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,s;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(s=e.readVarint32(),e.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+s,e.offset+=s,i;case t.TYPES.message:return s=e.readVarint32(),this.resolvedType.decode(e,s);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},T.Element=a,(l=(c=function(e,t,n,r,i,o){s.call(this,e,t,n,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(s.prototype)).build=function(r){var i,s,o,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,s,o){var a,u,c,l,h,f,d;if(null===e||"object"!==_t(e))return o&&o instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(o.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return s?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,s,o)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=i(l.value[1],r,s,e.valueElem.resolvedType);return u}for(d in h=e.$type,f=void 0,e)e.hasOwnProperty(d)&&(u[d]=h&&(f=h.getChild(d))?i(e[d],r,s,f.resolvedType):i(e[d],r,s));return u}var s,o,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function e(i){var s,o,c,l;for(t.Builder.Message.call(this),s=0,o=u.length;o>s;++s)this[u[s].name]=null;for(s=0,o=a.length;o>s;++s)this[(c=a[s]).name]=c.repeated?[]:c.map?new t.Map(c):null,!c.required&&"proto3"!==r.syntax||null===c.defaultValue||(this[c.name]=c.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!==_t(i)||!("function"!=typeof i.encode||i instanceof e)||Array.isArray(i)||i instanceof t.Map||n.isByteBuffer(i)||i instanceof ArrayBuffer||t.Long&&i instanceof t.Long)for(s=0,o=arguments.length;o>s;++s)void 0!==(l=arguments[s])&&this.$set(a[s].name,l);else this.$set(i)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,n,i){var s=r._fieldsByName[e];if(!i){if(!s)throw Error(this+"#"+e+" is undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+e+" is not a repeated field");n=s.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},l.$add=l.add,l.set=function(e,n,i){var s,o,a;if(e&&"object"===_t(e)){for(s in i=n,e)e.hasOwnProperty(s)&&void 0!==(n=e[s])&&this.$set(s,n,i);return this}if(o=r._fieldsByName[e],i)this[e]=n;else{if(!o)throw Error(this+"#"+e+" is not a field: undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));this[o.name]=n=o.verifyValue(n)}return o&&o.oneof&&(a=this[o.oneof.name],null!==n?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===e&&(this[o.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,s=0;s<a.length;s++)(o=a[s])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===r.getChild("set"+s)&&(l["set"+s]=n),null===r.getChild("set_"+t)&&(l["set_"+t]=n),null===r.getChild("get"+s)&&(l["get"+s]=i),null===r.getChild("get_"+t)&&(l["get_"+t]=i)}(o);return l.encode=function(t,n){var i,s;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),s=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(s)}catch(e){throw t.LE(s),e}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return r.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,s;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return s=r.decode(e.LE()),e.LE(i),s}catch(t){throw e.LE(i),t}},c.decodeDelimited=function(e,t){var i,s,o;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(i=e.offset,s=e.readVarint32(),e.remaining()<s)return e.offset=i,null;try{return o=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(l,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof p||s instanceof c||s instanceof m){if(i.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");i[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,s,o,a,u=null;for(s=0,o=this._fields.length;o>s;++s)i=e[(r=this._fields[s]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,s=this._fields.length;s>i;++i){if(n=e[(t=this._fields[i]).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},l.decode=function(e,n,r){var s,o,a,u,c,l,h,f,d,g,p,v;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(s=e.readVarint32())>>>3,(o=7&s)===t.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])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,e)):u.map?(f=u.decode(o,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(o,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(o){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(g=0,p=this._fields.length;p>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(v=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,v;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},T.Message=c,(f=(h=function(e,n,r,i,s,o,a,u,l,h){R.call(this,e,n,o),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=a,this.options=u||{},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 c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(R.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},f.verifyValue=function(e,n){var r,i,s;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===e)return this.required&&r(_t(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(_t(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),s=[],i=0;i<e.length;i++)s.push(this.element.verifyValue(e[i]));return s}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(_t(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(_t(e),"no array expected"),this.element.verifyValue(e))},f.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},f.encode=function(e,r,i){var s,o,a,u,c;if(null===this.type||"object"!==_t(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),o=r.offset,s=0;s<e.length;s++)this.element.encodeValue(this.id,e[s],r);a=r.offset-o,(u=n.calculateVarint32(a))>1&&(c=r.slice(o,r.offset),o+=u-1,r.offset=o,r.append(c)),r.writeVarint32(a,o-u)}else for(s=0;s<e.length;s++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[s],r);else this.map?e.forEach((function(e,i){var s=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(s),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)}),this):this.hasWirePresence(e,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,r))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},f.calculate=function(e,r){var i,s,o;if(e=this.verifyValue(e),null===this.type||"object"!==_t(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),o=0,s=0;s<e.length;s++)o+=this.element.calculateLength(this.id,e[s]);i+=n.calculateVarint32(o),i+=o}else for(s=0;s<e.length;s++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[s]);else this.map?e.forEach((function(e,r){var s=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=n.calculateVarint32(s),i+=s}),this):this.hasWirePresence(e,r)&&(i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},f.decode=function(e,n,r){var i,s,o,u,c,l,h;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(s=n.readVarint32(),s=n.offset+s,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.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());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1==(h=l>>>3))u=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,h)}return[u,i]}return this.element.decode(n,e,this.id)},T.Message.Field=h,(d=function(e,t,n,r,i,s,o){h.call(this,e,t,n,null,r,i,s,o),this.extension}).prototype=Object.create(h.prototype),T.Message.ExtensionField=d,g=function(e,t,n){R.call(this,e,t,n),this.fields=[]},T.Message.OneOf=g,(p=function(e,t,n,r,i){s.call(this,e,t,n,r,i),this.className="Enum",this.object=null}).getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(p.prototype=Object.create(s.prototype)).build=function(e){var n,r,i,s;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,s=(r=this.getChildren(p.Value)).length;s>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},T.Enum=p,(v=function(e,t,n,r){R.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(R.prototype),T.Enum.Value=v,(y=function(e,t,n,r){R.call(this,e,t,n),this.field=r}).prototype=Object.create(R.prototype),T.Extension=y,((m=function(e,t,n,r){s.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(s.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var r,i=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)}},s=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){s[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(n.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!==_t(r))throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(n,r){if(!n){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 "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),i}(t,this)},T.Service=m,((_=function(e,t,n,r){R.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(R.prototype)).buildOpt=o.buildOpt,T.Service.Method=_,(E=function(e,t,n,r,i,s,o,a){_.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}).prototype=Object.create(_.prototype),T.Service.RPCMethod=E,T}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},s=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!==_t(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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 n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},s.create=function(t){var r,s,o,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(s=t.shift(),i.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.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"!==_t(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 n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){r.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(i.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(i.isService(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!i.isExtend(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.fields.forEach((function(t){var r,i,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(r=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var i,s,o,a,u,c,l,h,f="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"===_t(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(f="\\"),s=i+f+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"===_t(n)?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(f="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),f="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+f+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;if(null==this.ptr||"object"===_t(this.ptr.type))return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.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(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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: "+_t(this.ptr)+": "+this.ptr);return this.reset()},s.build=function(e){var t,n,r;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(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},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(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){var r,i,s,o;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(r=Object.keys(n),i=0;i<r.length;i++)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(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).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));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,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"===_t(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)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===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"===_t(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"===_t(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)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Pf,i.loadProto(r,void 0,"").build("Modules").probuf}(function(e){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("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.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,c=u>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,g=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(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?f/u:f*Math.pow(2,1-h))*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+d]=255&a,d+=g,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[n+d]=255&o,d+=g,o/=256,c-=8);e[n+d-g]|=128*p}var s,o,a,u,c,l=function e(t,n,r){if(void 0===t&&(t=e.DEFAULT_CAPACITY),void 0===n&&(n=e.DEFAULT_ENDIAN),void 0===r&&(r=e.DEFAULT_NOASSERT),!r){if((t|=0)<0)throw RangeError("Illegal capacity");n=!!n,r=!!r}this.buffer=0===t?o:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=n,this.noAssert=r};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(i+=s);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),o=0;a>o;)(s=(u=e[o++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,o;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==_t(e))throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=s.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(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 l(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");for((i=new l(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},s.writeBitSet=function(e,t){var n,r,i,s,o,a,u=void 0===t;if(u&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,s=(i=e.length)>>3,o=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(i>o){for(a=0,n=0;i>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},s.readBitSet=function(e){var t,n,r,i,s,o,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;i--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(r>s)for(a=0,t=this.readByte(e++);r>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},s.writeBytes=s.append,s.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},s.writeByte=s.writeInt8,s.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},s.readByte=s.readInt8,s.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},s.writeUInt8=s.writeUint8,s.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},s.readUInt8=s.readUint8,s.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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),r&&(this.offset+=2),this},s.writeShort=s.writeInt16,s.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},s.readShort=s.readInt16,s.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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),r&&(this.offset+=2),this},s.writeUInt16=s.writeUint16,s.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},s.readUInt16=s.readUint16,s.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},s.writeInt=s.writeInt32,s.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},s.readInt=s.readInt32,s.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},s.writeUInt32=s.writeUint32,s.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,s=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.readInt64=function(t){var n,r,i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),s&&(this.offset+=8),i},s.readLong=s.readInt64,s.writeUint64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,s=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.readUint64=function(t){var n,r,i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),s&&(this.offset+=8),i},s.readUInt64=s.readUint64),s.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},s.writeFloat=s.writeFloat32,s.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},s.readFloat=s.readFloat32,s.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},s.writeDouble=s.writeFloat64,s.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},s.readDouble=s.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},s.writeVarint32=function(e,t){var n,r,i,s=void 0===t;if(s&&(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)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,s?(this.offset=t,this):r},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.readVarint32=function(e){var t,n,r,i,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,s?(this.offset=e,r):{value:r,length:n}},s.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===_t(t)?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.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:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},s.writeVarint64=function(t,n){var r,i,s,o,a,u=void 0===n;if(u&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&o>>>7;case 9:this.view[n+8]=9!==r?128|o:127&o;case 8:this.view[n+7]=8!==r?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==r?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==r?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==r?128|s:127&s;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return u?(this.offset+=r,this):r},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,r,i,s,o,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,i=0,s=0,o=0,r=127&(o=this.view[t++]),128&o&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(i=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),s.writeCString=function(e,n){var r,i,s,o=void 0===n;if(o&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):i},s.readCString=function(e){var t,r,i,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,c.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),s?(this.offset=e,r()):{string:r(),length:e-t}},s.writeIString=function(e,n){var r,i,s,o=void 0===n;if(o&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return o?(this.offset=n,this):n-i},s.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",s.writeUTF8String=function(e,n){var r,i,s,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-i},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateString=l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},s.readUTF8String=function(e,t,r){var i,s,o,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.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)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(o=0,a=r,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(u=r+e,c.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),s=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,s()):{string:s(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var r,i,s,o,a=void 0===n;if(a&&(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)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(s=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-s},s.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},s.append=function(e,t,n){var r,i,s;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.clone=function(e){var t=new l(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},s.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===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 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=o,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).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)},s.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===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 l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(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},s.copyTo=function(e,t,n,r){var i,s,o;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===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);return 0==(o=r-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===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(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var r,i,s,o,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=o,this.view=a,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},s.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===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||Array.prototype.reverse.call(this.view.subarray(e,t)),this},s.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},s.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===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},s.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?o:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},s.toArrayBuffer=s.toBuffer,s.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),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)}},u=function(){var e,t,n={},r=[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],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,s,o;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(o=i[r])&&n(r),t(s<<2>>>0|(48&o)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(o=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},s.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);s.view[r++]=n}return s.limit=i,s},s.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",o="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<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},l.fromDebug=function(e,t,n){for(var r,i,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,f=!1,d=!1,g=!1;s>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||f||d){g=!0;break}h=f=d=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||f){g=!0;break}h=f=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}o.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");o.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===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);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,s,o,a;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(i=e.length,s=new l(0|i/2,t),o=0,a=0;i>o;o+=2){if(r=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=r}return s.limit=a,s},c=function(){var e={MAX_CODEPOINT:1114111,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(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},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)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)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)},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):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},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]}};return e}(),s.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===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{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},l}(Df=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,s;return t?(s=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&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:g;if(t){if(e<0)return p;if(e>=h)return E}else{if(-f>=e)return T;if(e+1>=f)return _}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function s(e,t,n){var i,o,a,u,l,h,f;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return s(e.substring(1),t,n).neg();for(o=r(c(n,8)),a=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(f=r(c(n,l)),a=a.mul(f).add(r(h))):a=(a=a.mul(o)).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)}var a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=o,f=(h=(l=4294967296)*l)/2,d=n(16777216),g=n(0),e.ZERO=g,p=n(0,!0),e.UZERO=p,v=n(1),e.ONE=v,y=n(1,!0),e.UONE=y,m=n(-1),e.NEG_ONE=m,_=i(-1,2147483647,!1),e.MAX_VALUE=_,E=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=E,T=i(0,-2147483648,!1),e.MIN_VALUE=T,(R=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},R.toString=function(e){var t,n,i,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(s=r(c(e,6),this.unsigned),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(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},R.isZero=function(){return 0===this.high&&0===this.low},R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.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},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.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},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){var n,r,s,a,u,c,l,h,f,d,g;return t(e)||(e=o(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,f=0,d=0,g=0,d+=(g+=a+(65535&e.low))>>>16,f+=(d+=s+l)>>>16,h+=(f+=r+c)>>>16,h+=n+u,i((d&=65535)<<16|(g&=65535),(h&=65535)<<16|(f&=65535),this.unsigned)},R.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,s,a,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(T)?e.isOdd()?T:g:e.eq(T)?this.isOdd()?T:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(d)&&e.lt(d)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=0,v=0,y=0,m=0,y+=(m+=u*(f=65535&e.low))>>>16,v+=(y+=a*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=a*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+a*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},R.mul=R.multiply,R.divide=function(e){var n,i,s,a,u,l,h;if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return y;s=p}else{if(this.eq(T))return e.eq(v)||e.eq(m)?T:e.eq(T)?v:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:m:(i=this.sub(e.mul(n)),s=n.add(i.div(e)));if(e.eq(T))return this.unsigned?p:g;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=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=v),s=s.add(l),i=i.sub(h)}return s},R.div=R.divide,R.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.not=function(){return i(~this.low,~this.high,this.unsigned)},R.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},R.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)},R.shl=R.shiftLeft,R.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)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},R.shru=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,255&t>>>8,255&t>>>16,255&t>>>24,255&e,255&e>>>8,255&e>>>16,255&e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[255&e>>>24,255&e>>>16,255&e>>>8,255&e,255&t>>>24,255&t>>>16,255&t>>>8,255&t]},e}()),Df));jf.getModule=function(e){var t=new jf[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Ps(e)?[].slice.call(new Int8Array(e)):e},t};var Yf="pgMsgP",qf="chatMsg",Kf="pcMsgP",Gf={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Hf="delMsg",Wf="joinChrm",Qf="joinChrmR",Jf="exitChrm",zf="setKV",Zf="delKV",$f="setKVS",Xf="delKVS",ed="qryRelationR",td="delRelation",nd="setSeAtt",rd={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},id="qryPMsg",sd="qryGMsg",od="qryCHMsg",ad="qryCMsg",ud="qrySMsg",cd=(St(Vf={},"ppMsgP",Os.PRIVATE),St(Vf,Yf,Os.GROUP),St(Vf,qf,Os.CHATROOM),St(Vf,Kf,Os.CUSTOMER_SERVICE),Vf),ld=(St(Bf={},Os.PRIVATE,id),St(Bf,Os.GROUP,sd),St(Bf,Os.CHATROOM,od),St(Bf,Os.CUSTOMER_SERVICE,ad),St(Bf,Os.SYSTEM,ud),Bf),hd=(St(Ff={},Os.PRIVATE,rd.PRIVATE),St(Ff,Os.GROUP,rd.GROUP),St(Ff,Os.CUSTOMER_SERVICE,rd.CUSTOMER_SERVICE),St(Ff,Os.SYSTEM,rd.SYSTEM),Ff),fd="1",dd="0",gd=1,pd=2,vd=3,yd=function(){function t(e){Rt(this,t),this._codec="websocket"===e?jf:Nf,this._connectType=e}return Ct(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,o=(St(r={},oh,i._formatSyncMessages),St(r,sh,i._formatReceivedMessage),St(r,rh,i._formatSentMessage),St(r,dh,i._formatHistoryMessages),St(r,ph,i._formatConversationList),St(r,bh,i._formatChatRoomInfos),St(r,Nh,i._formatRTCUserList),St(r,Ph,i._formatRTCData),St(r,$h,i._formatChatRoomKVList),St(r,of,i._formatUserSetting),St(r,cf,i._formatConversationStatus),St(r,vf,i._formatGrpReadReceiptQryResp),St(r,rf,i._formatSetUserSettingOutput),St(r,af,i._formatUserSettingNotification),St(r,bf,i._formatRTCRoomKVList),St(r,Uh,i._formatRTCAuidenceJoinRoomData),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Vs(s)&&(s=function(e){for(var t in e)Vs(e[t])&&(e[t]=$o(e[t]));return e}(s)),Bs(o)&&(s=o.call(this,s,n))}catch(n){Hs.error("PB parse error\n",n,e,t)}return s}},{key:"_readBytes",value:function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Ps(n)?new Uint8Array(n):n;return eh.readUTF(i.subarray(t,r))}catch(e){Hs.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Hs.info("formatBytes error\n",e)}return t||e}},{key:"_formatSyncMessages",value:function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,s=e.finished;return(Fs(s)||null===s)&&(e.finished=!0),e.syncTime=$o(i),e.list=sa(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){var r=t=t||{},i=r.currentUserId,s=r.connectedTime,o=e.content,a=e.fromUserId,u=e.type,c=e.groupId,l=e.status,h=e.dataTime,f=e.classname,d=e.msgId,g=e.extraContent,p=e.pushContent,v=e.pushExt,y=e.configFlag,m=(e.direction||to.RECEIVE)===to.SEND,_=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(l),E=_.isPersited,T=_.isCounted,R=_.isMentioned,I=_.disableNotification,C=_.receivedStatus,S=_.canIncludeExpansion,b=[Os.GROUP,Os.CHATROOM,Os.RTC_ROOM].indexOf(u)>-1?c:a,w=m?i:a,N=$o(h),O=N<s,k=u===Os.CHATROOM,A=this._formatBytes(o),M={};v&&(M=ta(v.pushConfigs,v.pushId));var x,L=wt(wt({},M),{},{pushTitle:null==v?void 0:v.title,pushContent:p,pushData:p,disablePushTitle:!!y&&Boolean(4&y),forceShowDetailContent:!!y&&Boolean(8&y),templateId:null==v?void 0:v.templateId}),U=m?to.SEND:to.RECEIVE;return k&&a===i&&(U=to.SEND),g&&(x={},x=fa(g)),{conversationType:u,targetId:b,senderUserId:w,messageType:f,messageUId:d,isPersited:E,isCounted:T,isMentioned:R,sentTime:N,isOffLineMessage:O,messageDirection:U,receivedTime:da.getTime(),disableNotification:I,receivedStatus:C,canIncludeExpansion:S,content:A,expansion:x,configFlag:y,pushConfig:L}}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,i=e.classname,s=e.sessionId,o=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=t.signal,f=t.currentUserId,d=h.date,g=h.topic,p=h.targetId,v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(s),y=v.isPersited,m=v.isCounted,_=v.disableNotification,E=v.canIncludeExpansion,T=cd[g]||Os.PRIVATE,R=aa(Gf,g),I=this._formatBytes(r),C=p;i===uo.RECALL&&(T=I.conversationType||T,C=I.targetId||p),a&&(n={},n=fa(a));var S={};u&&(S=ta(u.pushConfigs,u.pushId));var b=wt(wt({},S),{},{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:T,targetId:C,messageType:i,messageUId:o,isPersited:y,isCounted:m,isStatusMessage:R,senderUserId:f,content:this._formatBytes(r),sentTime:1e3*d,receivedTime:da.getTime(),messageDirection:to.SEND,isOffLineMessage:!1,disableNotification:_,canIncludeExpansion:E,expansion:n,pushConfig:b}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,o=r.targetId,a=$o(e.syncTime),u=[];return ia(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=sa(r,(function(e){var r=e.msg,s=e.userId,o=e.type,a=e.unreadCount,u=e.channelId,c=n._formatReceivedMessage(r,t);c.targetId=s;var l={targetId:s,conversationType:o,unreadMessageCount:a,latestMessage:c,channelId:u||""};return i(l)||l})))||[]}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:sa(n,(function(e){var t=e.id,n=e.time;return{id:t,time:$o(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=sa(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,o=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?yo.DELETE:yo.UPDATE}}(r);return{key:t,value:n,isAutoDelete:o.isAutoDelete,isOverwrite:o.isOverwrite,type:o.type,userId:s,timestamp:$o(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return ia(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=$o(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=$o(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return ia(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,o=lo.CLOSE,a=!1,u=[];ia(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case gd:o=n===fd?lo.OPEN:lo.CLOSE;break;case pd:a=n===fd;break;case vd:u=r}})),n.push({type:t,targetId:r,notificationStatus:o,isTop:a,updatedTime:$o(i),tags:u})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i={};return ia(t,(function(e){var t=e.userId,n=e.userData,r={};ia(n,(function(e){var t=e.key,n=e.value;r[t]=n})),i[t]=r})),{users:i,token:n,sessionId:r}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return ia(t,(function(e){n[e.key]=e.value})),n}},{key:"_formatRTCRoomInfo",value:function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return ia(r,(function(e){i[e.key]=e.value})),i}},{key:"_formatGrpReadReceiptQryResp",value:function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=$o(e.readTime)})),{totalMemberCount:t,list:n}}},{key:"_formatUserSettingNotification",value:function(e){return e}},{key:"_formatRTCRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:$o(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(ah);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=e.type,i=t.messageType,s=t.isMentioned,o=t.mentionedType,a=t.mentionedUserIdList,u=t.content,c=t.pushContent,l=t.directionalUserIdList,h=t.isFilerWhiteBlacklist,f=t.isVoipPush,d=t.canIncludeExpansion,g=t.expansion,p=t.pushConfig,v=r===Os.GROUP,y=this._codec.getModule(rh),m=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),_=p||{},E=_.pushTitle,T=_.pushData,R=_.iOSConfig,I=_.androidConfig,C=_.templateId,S=_.disablePushTitle,b=_.forceShowDetailContent,w=0;if(y.setSessionId(m),v&&s&&u&&(u.mentionedInfo={userIdList:a,type:o||fo.ALL}),c&&y.setPushText(c),T&&y.setAppData(T),l&&y.setUserId(l),w|=f?1:0,w|=h?2:0,w|=S?4:0,w|=b?8:0,y.setConfigFlag(w),y.setClassname(i),y.setContent(JSON.stringify(u)),d&&g){var N={};ia(g,(function(e,t){N[t]={v:e}})),y.setExtraContent(JSON.stringify(N))}if(p){var O=this._codec.getModule(ih);if(E&&O.setTitle(E),R&&I){var k=ea(R,I);O.setPushConfigs(k)}(null==I?void 0:I.notificationId)&&O.setPushId(null==I?void 0:I.notificationId),O.setTemplateId(C||""),y.setPushExt(n?O.getArrayData():O)}return y}},{key:"encodeUpMsg",value:function(e,t){return this._getUpMsgModule(e,t).getArrayData()}},{key:"encodeSyncMsg",value:function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(ch);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()}},{key:"encodeChrmSyncMsg",value:function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(lh);return n.setCount(t),n.setSyncTime(e),n.getArrayData()}},{key:"encodeGetHistoryMsg",value:function(e,t){var n=t.count,r=t.order,i=t.timestamp,s=this._codec.getModule(fh);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(gh);return i.setType(1),i.setCount(n),i.setStartTime(r),i.getArrayData()}},{key:"encodeOldConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.type,i=t.startTime,s=t.order;n=n||0,i=i||0,s=s||0;var o=this._codec.getModule(gh);return o.setType(r),o.setCount(n),o.setStartTime(i),o.setOrder(s),o.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(vh),r=[];return ia(e,(function(e){var n=e.type,i=e.targetId,s=t._codec.getModule(yh);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n){var r=this._codec.getModule(Eh),i=[];return ia(n,(function(e){i.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(i),r.getArrayData()}},{key:"encodeClearMessages",value:function(e,t){var n=this._codec.getModule(Th);return t=t||(new Date).getTime(),n.setDataTime(t),n.setTargetId(e),n.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.type,r=e.targetId,i=t.timestamp,s=this._codec.getModule(Rh);return i=i||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(i),s.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(Ih);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Sh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(qh);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()}},{key:"encodeGetFileUrl",value:function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()}},{key:"encodeModifyChatRoomKV",value:function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(Jh),s=t.key,o=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type||yo.UPDATE,l=ga(t,c),h={key:s,value:o||"",uid:n};if(Fs(l)||(h.status=l),i.setEntry(h),u){var f={type:Os.CHATROOM,targetId:e},d={key:s,value:o,extra:a,type:c},g=this._getUpMsgModule(f,{messageType:uo.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(Os.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(zh),i=t.entries;t.notificationExtra;var s=t.type||yo.UPDATE,o=ga(t,s),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};Fs(o)||(t.status=o),a.push(t)})),r.setEntry(a),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(tf);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(sf);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(uf);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(ff),i=da.getTime(),s=[];return ia(e,(function(e){var r=t._codec.getModule(lf),o=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,l=[];r.setType(o),r.setChannelId(a),r.setTime(i);var h=u===lo.OPEN,f={};Fs(u)||(f[gd]=h),Fs(c)||(f[pd]=c),ia(f,(function(e,r){if(!Fs(e)){var i=t._codec.getModule(hf);e=e?fd:dd,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;l.push(s)}})),r.setStateItem(l);var d=n?r.getArrayData():r;s.push(d)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(gf);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeCreateTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(mf),s=[];return e.forEach((function(e){var t=n._codec.getModule(_f);t.setTagId(e.tagId),t.setName(e.tagName),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeMessageReader",value:function(e,t){var n=this._codec.getModule(gf);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeRemoveTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Ef),s=[];return e.forEach((function(e){var t=n._codec.getModule(_f);t.setTagId(e),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeDisConversationTag",value:function(e){var t=this._codec.getModule(Tf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(ff),s=[];return t.forEach((function(t){var i=n._codec.getModule(lf),o=n._codec.getModule(hf),a=[];e.forEach((function(e){var t=n._codec.getModule(_f);t.setTagId(e.tagId),Fs(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),o.setSessionStateType(vd),o.setValue(JSON.stringify(a)),o.setTags(a),i.setType(t.type),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?o.getArrayData():o]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(da.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(Rf);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t){var n=this._codec.getModule(wh);return e=e||0,n.setRoomType(e),Fs(t)||n.setBroadcastType(t),n.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(Oh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(kh);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var o=i.content;o&&(Vs(o)&&(o=JSON.stringify(o)),s.setContent(o))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,o=this._codec.getModule(Ah);o.setObjectName(n);var a=this._codec.getModule(jh);a.setKey(e.name),a.setValue(e.content),s?o.setContent([a.getArrayData()]):o.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(jh);n.setKey(e);var o="uris"===e?t:r;n.setValue(o),s?u.push(n.getArrayData()):u.push(n)})),o.setValueInfo(u),o.getArrayData()}},{key:"encodeGetRTCData",value:function(e,t,n){var r=this._codec.getModule(Mh);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()}},{key:"encodeRemoveRTCData",value:function(e,t,n,r){var i=this._codec.getModule(Mh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},o=s.name,a=s.content;return!Fs(o)&&i.setObjectName(o),Fs(a)||(Vs(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(xh);r.setTarget(t),Us(e)||(e=[e]),ia(e,(function(t,n){t.key=t.key?t.key.toString():t.key,t.value=t.value?t.value.toString():t.value,e[n]=t})),r.setValueInfo(e);var i=n=n||{},s=i.name,o=i.content;return!Fs(s)&&r.setObjectName(s),Fs(o)||(Vs(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Dh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(Lh);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Bh);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(jh);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Yh);return t.setKey(e),t.getArrayData()}},{key:"encodeIdentityChangeInfo",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._codec.getModule(wh);return i.setRoomType(e.RTCMode.LIVE),n&&i.setBroadcastType(n),i.setIdentityChangeType(t),i.setNeedSysChatroom(r),i.getArrayData()}},{key:"encodePullRTCRoomKV",value:function(e,t){var n=this._codec.getModule(Sf);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}}]),t}(),md=function e(t,n){Rt(this,e),this._watcher=n,this.codec=new yd(t)},_d=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Ed=function(){function e(t){Rt(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return _d(e,t)}},{key:"read",value:function(e,t){this.readMessage(e,t)}},{key:"readMessage",value:function(e,t){return{stream:e,length:t}}}]),e}(),Td=function(){function e(t){Rt(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Xl(t,!1,kl.AT_MOST_ONCE,!1)}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return _d(e,t)}},{key:"write",value:function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)}},{key:"setHeaderQos",value:function(e){this._header.qos=e}},{key:"getHeaderFlag",value:function(){return this._header.encode()}},{key:"getLengthSize",value:function(){return this.lengthSize}},{key:"getBufferData",value:function(){var e=new nh;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Rd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ml.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){if(e.readByte(),this.status=+e.readByte(),t>n.MESSAGE_LENGTH){this.userId=e.readUTF();var r=e.readUTF();Hs.debug("server sessionId -> "+r),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(Ed);Rd.MESSAGE_LENGTH=2;var Id=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ml.DISCONNECT,e.status=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(Ed);Id.MESSAGE_LENGTH=2;var Cd,Sd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.call(this,Al.PING_REQ))._name=Ml.PING_REQ,e}return Ct(n,[{key:"writeMessage",value:function(e){}}]),n}(Td),bd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,e))._name=Ml.PING_RESP,r}return n}(Ed),wd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}}}]),n}(Ed),Nd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(Td),Od=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ml.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=xl.PUB,e}return Ct(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(wd),kd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Rt(this,n),(s=t.call(this,Al.PUBLISH))._name=Ml.PUBLISH,s.syncMsg=!1,s.identifier=xl.PUB,s.topic=e,s.data=Ms(r)?eh.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Nd),Ad=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ml.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=xl.PUB,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}]),n}(wd),Md=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,Al.PUB_ACK))._name=Ml.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return Ct(n,[{key:"writeMessage",value:function(e){Dt(Ot(n.prototype),"writeMessage",this).call(this,e)}}]),n}(Nd),xd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Rt(this,n),(s=t.call(this,Al.QUERY)).name=Ml.QUERY,s.identifier=xl.QUERY,s.topic=e,s.data=Ms(r)?eh.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Nd),Ld=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Rt(this,n),(r=t.call(this,Al.QUERY_CONFIRM))._name=Ml.QUERY_CON,r.messageId=e,r}return n}(Nd),Ud=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Rt(this,n),(e=t.apply(this,arguments))._name=Ml.QUERY_ACK,e.status=0,e.identifier=xl.QUERY,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}]),n}(wd),Pd=function(e){var t,n=e.type;switch(n){case Al.CONN_ACK:t=new Rd(e);break;case Al.PUBLISH:(t=new Od(e)).syncMsg=e.syncMsg;break;case Al.PUB_ACK:t=new Ad(e);break;case Al.QUERY_ACK:t=new Ud(e);break;case Al.SUB_ACK:case Al.UNSUB_ACK:case Al.PING_RESP:t=new bd(e);break;case Al.DISCONNECT:t=new Id(e);break;default:t=new Ed(e),Hs.error("No support for deserializing "+n+" messages")}return t},Dd=function(e){var t=new Uint8Array(e),n=new th(t),r=n.readByte(),i=new Xl(r),s=Pd(i);return s.read(n,t.length-1),s},Vd=function(e){var t=e.headerCode,n=new Xl(t),r=Pd(n);for(var i in e)r[i]=e[i];return r};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.addSeTag=72]="addSeTag",e[e.delSeTag=73]="delSeTag",e[e.addTag=74]="addTag",e[e.delTag=75]="delTag",e[e.disTag=76]="disTag",e[e.reportsdk=77]="reportsdk"}(Cd||(Cd={}));var Bd,Fd,jd=Cd,Yd=(Bd=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=Tt(regeneratorRuntime.mark((function e(t){var i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Date.now(),s="".concat(n,"://").concat(t,"/ping?r=").concat(Ss(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:5e3});case 4:return o=e.sent,e.abrupt("return",{status:o.status,host:t,cost:Date.now()-i});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return(i=(i=e.sent).filter((function(e){return 200===e.status}))).length>1&&(i=i.sort((function(e,t){return e.cost-t.cost}))),e.abrupt("return",i.map((function(e){return e.host})));case 6:case"end":return e.stop()}}),e)}))),function(e,t,n){return Bd.apply(this,arguments)}),qd=function(e,t,n,r,i,s,o){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"")},Kd=function(e){return[jd.ppMsgS,jd.pgMsgS,jd.chatMsgS].map((function(e){return jd[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(Fd||(Fd={}));var Gd,Hd=function(e,t){Hs.debug("websocket send -> messageId: ".concat(e.messageId));var n=e.getBufferData();t.send(n.buffer)},Wd=function(e){Nt(o,e);var t,n,r,i,s=Pt(o);function o(e,t){var n;return Rt(this,o),(n=s.call(this,"websocket",t))._runtime=e,n._socket=null,n._messageIds={},n._syncMessageIds={},n._failedCount=0,n.ALLOW_FAILED_TIMES=2,n._timer=null,n._idCount=0,n._generateMessageId=function(){return n._idCount>=65535&&(n._idCount=0),++n._idCount},n}return Ct(o,[{key:"connect",value:(i=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Gn(s),this._watcher.status(so.CONNECTING),Hs.debug("ping -> protocol: ".concat(i,", hosts: ").concat(JSON.stringify(r))),e.next=5,Yd(r,i,this._runtime);case 5:if(o=e.sent,Hs.debug("valid hosts -> ".concat(o.join(","))),0!==o.length){e.next=10;break}return Hs.error("No valid websocket server hosts!"),e.abrupt("return",ro.RC_SOCKET_NOT_CREATED);case 10:a=i.replace("http","ws"),c=regeneratorRuntime.mark((function e(r,i){var c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=qd(a,o[r],t,n,d._runtime,s),Hs.debug("conenct start -> ".concat(c)),d.sendConnectTime=Date.now(),l=d._runtime.createWebSocket(c),h=function(e){d._timer&&(clearTimeout(d._timer),d._timer=null),d._socket===l&&(d._socket=null,d._watcher.status(e))},e.next=7,new Promise((function(e){l.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=Dd(t);if(n instanceof bd&&d._pingResolve)return d._pingResolve(ro.SUCCESS),void(d._pingResolve=void 0);if(n instanceof Rd)return Hs.debug("recv connect ack -> ".concat(n.status)),n.status!==oo.ACCEPTED?(Hs.warn("connect failed: ".concat(n.status)),void e(n.status)):(Hs.info("connect success -> ".concat(c)),d.connectedTime=n.timestamp,d.userId=n.userId||"",void e(ro.SUCCESS));if(n instanceof Id){var r=n.status;switch(Hs.warn("recv disconnect signal -> status: ".concat(r)),r){case Fd.BLOCK:d._watcher.status(so.BLOCKED);break;case Fd.OTHER_DEVICE_LOGIN:d._watcher.status(so.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Fd.REDIRECT_NEW:case Fd.REDIRECT:d._watcher.status(so.REDIRECT);break;default:d._watcher.status(so.DISCONNECT_BY_SERVER)}}else d._onReceiveSignal(n)}else Hs.error("Socket received invalid data:",t)})),l.onClose((function(t,n){Hs.warn("websocket closed! code:",t,"reason:",n),h(so.CONNECTION_CLOSED),e(t)})),l.onError((function(t){Hs.error("websocket error!",null==t?void 0:t.stack),h(so.WEBSOCKET_ERROR),e(ro.NETWORK_ERROR)})),l.onOpen((function(){return Hs.debug("websocket open =>",c)})),setTimeout((function(){e(ro.TIMEOUT)}),rn)}));case 7:if((u=e.sent)!==oo.REDIRECT){e.next=10;break}return e.abrupt("return",{v:u});case 10:if(u!==ro.SUCCESS){e.next=16;break}return d._socket=l,d._checkAlive(),e.abrupt("return",{v:u});case 16:Hs.warn("connect result -> code: ".concat(u,", url: ").concat(c)),u=ha(u);case 18:l.close();case 19:case"end":return e.stop()}}),e)})),l=0,h=o.length;case 13:if(!(l<h)){e.next=21;break}return e.delegateYield(c(l,h),"t0",15);case 15:if("object"!==_t(f=e.t0)){e.next=18;break}return e.abrupt("return",f.v);case 18:l+=1,e.next=13;break;case 21:return e.abrupt("return",void 0!==u?u:ro.RC_NET_UNAVAILABLE);case 22:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=Tt(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._socket){e.next=2;break}return e.abrupt("return");case 2:return Hs.debug("send ping ->"),this.sendOnly(new Sd),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(ro.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===ro.SUCCESS){e.next=12;break}return this._failedCount+=1,Hs.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Hs.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close()):this._checkAlive(),e.abrupt("return");case 12:Hs.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3);case 15:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_onReceiveSignal",value:(n=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==kl.AT_MOST_ONCE&&(t instanceof Od&&!t.syncMsg&&(Hs.debug("send pubAck -> ".concat(n)),this.sendOnly(new Md(n))),t instanceof Ud&&(Hs.debug("send queryCon -> ".concat(n)),this.sendOnly(new Ld(n)))),n>0&&(Hs.debug("recv ack -> messageId: ".concat(n)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Od)){e.next=16;break}if(s=t.syncMsg,(o=t.topic)!==jd[jd.userSetData]){e.next=8;break}return e.abrupt("return");case 8:if(s&&!Kd(o)){e.next=11;break}return this._watcher.signal(t),e.abrupt("return");case 11:return e.next=13,new Promise((function(e){u._syncMessageIds[n]=e}));case 13:a=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,a);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&Hd(e,this._socket)}},{key:"send",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=c.length>3&&void 0!==c[3]?c[3]:un,!this._socket){e.next=16;break}return s=this._generateMessageId(),t.messageId=s,Hd(t,this._socket),e.next=7,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){u._messageIds[s]&&delete u._messageIds[s],e()}),i)}));case 7:if(o=e.sent){e.next=11;break}return Hs.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:ro.TIMEOUT});case 11:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=15;break}return Hs.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(o.status)),e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 15:return e.abrupt("return",{code:ro.SUCCESS,data:a});case 16:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 17:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"close",value:function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(so.DISCONNECTED))}}]),o}(md);e.HttpMethod=void 0,(Gd=e.HttpMethod||(e.HttpMethod={})).GET="GET",Gd.POST="POST";var Qd=function(e){if(Vs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},Jd=function(t){Nt(a,t);var n,r,i,s,o=Pt(a);function a(e,t){var n;return Rt(this,a),(n=o.call(this,"comet",t))._runtime=e,n._messageIds={},n._syncMessageIds={},n._idCount=0,n._generateMessageId=function(){return++n._idCount},n._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),n}return Ct(a,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ms(e.data)?JSON.parse(e.data):e.data;return n?!Us(n)||(ia(n,function(){var e=Tt(regeneratorRuntime.mark((function e(n){var r,i,s,o,a,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=n.sessionid)&&(t._sessionid=r),i=Vd(n),s=i.messageId,o=i._header,a=i.status,i.identifier,u=o&&o.qos!==kl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Od&&!i.syncMsg&&(l=new Md(s),t.sendOnly(l)),i instanceof Ud&&(h=new Ld(s),t.sendOnly(h))),!(i instanceof Id)){e.next=20;break}e.t0=a,e.next=e.t0===Fd.OTHER_DEVICE_LOGIN?11:e.t0===Fd.BLOCK?13:e.t0===Fd.REDIRECT_NEW||e.t0===Fd.REDIRECT?15:17;break;case 11:return t._watcher.status(so.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(so.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(so.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(so.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Od)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!Kd(d)){e.next=25;break}return t._watcher.signal(i),e.abrupt("return",!1);case 25:return e.next=27,new Promise((function(e){t._syncMessageIds[s]=e}));case 27:g=e.sent,delete t._syncMessageIds[s],t._watcher.signal(i,g);case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!0):(Hs.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(s=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),r="".concat(t,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(n,"&pid=").concat(this._pid),e.next=4,this._runtime.httpReq({url:r,body:{pid:this._pid},timeout:45e3});case 4:i=e.sent,s=this.handleCometRes(i),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(so.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"connect",value:(i=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Gn(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(so.CONNECTING),e.next=6,Yd(r,i,this._runtime);case 6:if(0!==(o=e.sent).length){e.next=10;break}return Hs.error("No valid comet server hosts!"),e.abrupt("return",ro.RC_SOCKET_NOT_CREATED);case 10:a=function(e){return 200!==e.status&&202!==e.status?(Hs.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(Qd(e.data)?Vs(e.data)?e.data:JSON.parse(e.data):(Hs.error("received data is not a validJson",e.data),!1))},c=0,l=o.length;case 12:if(!(c<l)){e.next=36;break}return h=qd(i,o[c],t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),e.next=17,this._runtime.httpReq({url:h,body:{pid:this._pid},timeout:rn});case 17:if(f=e.sent,d=a(f),this._domain=o[c],!d||d.status!==oo.REDIRECT){e.next=22;break}return e.abrupt("return",d.status);case 22:if(!d||0!==d.status){e.next=31;break}return this._watcher.status(so.CONNECTED),this._sessionid=d.sessionid,this._startPullSignal(i),this.userId=d.userId,this.connectedTime=d.timestamp,e.abrupt("return",d.status);case 31:Hs.warn("connect result -> code: ".concat(null==d?void 0:d.status,", url: ").concat(h)),u=ha(null==d?void 0:d.status);case 33:c+=1,e.next=12;break;case 36:return e.abrupt("return",void 0!==u?u:ro.RC_NET_UNAVAILABLE);case 37:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=Tt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._domain,i=this._sessionid,s=this._pid,o=n.messageId,a=n.topic,u=n.targetId,n.identifier,c=n.getHeaderFlag(),l=a?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(a,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(s),t.next=7,this._runtime.httpReq({url:l,method:e.HttpMethod.POST,body:n.getCometData()});case 7:h=t.sent,this.handleCometRes(h);case 9:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"sendOnly",value:function(e){this.sendCometData(e)}},{key:"send",value:(n=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=c.length>3&&void 0!==c[3]?c[3]:un,s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),e.next=6,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){delete u._messageIds[s],e()}),i)}));case 6:if(o=e.sent){e.next=9;break}return e.abrupt("return",{code:ro.TIMEOUT});case 9:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=12;break}return e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 12:return e.abrupt("return",{code:ro.SUCCESS,data:a});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:function(){this._isDisconnected=!0,this._watcher.status(so.DISCONNECTED)}}]),a}(md),zd=function e(t,n,r){Rt(this,e),this.runtime=t,this._watcher=n,this._options=r,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()},Zd=Mn.find,$d="find",Xd=!0;$d in[]&&Array(1).find((function(){Xd=!1})),Pe({target:"Array",proto:!0,forced:Xd},{find:function(e){return Zd(this,e,arguments.length>1?arguments[1]:void 0)}}),cr($d);var eg=function(e){return["navi",e].join("_")},tg=function(e,t,n){var r,i,s=eg(e);try{var o=n.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn}))),0===i.length?n.removeItem(s):n.setItem(s,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null},ng=function(){function e(t,n){Rt(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Gn(this._options.apiVersion)}var t;return Ct(e,[{key:"getInfo",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=tg(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return o=this._options.navigators.slice(),n.length&&n.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),e.next=9,this._reqNavi(o,this._appkey,t,i);case 9:if(!(s=e.sent)){e.next=14;break}return this._naviInfo=s,this.setNaviInfo2Cache(t,s),e.abrupt("return",s);case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"setNaviInfo2Cache",value:function(e,t){this._naviInfo=t,function(e,t,n,r){var i,s=eg(e);try{var o=r.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(s,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)}},{key:"getInfoFromCache",value:function(e){return this._naviInfo}},{key:"_clear",value:function(e){!function(e,t,n){var r,i=eg(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var o=Date.now();r.length>0&&(r=r.filter((function(e){return o-e.timestamp<nn&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),rg=Mn.findIndex,ig="findIndex",sg=!0;ig in[]&&Array(1).findIndex((function(){sg=!1})),Pe({target:"Array",proto:!0,forced:sg},{findIndex:function(e){return rg(this,e,arguments.length>1?arguments[1]:void 0)}}),cr(ig);var og=function(e){if(gs(e))throw TypeError("The method doesn't accept regular expressions");return e},ag=ot("match");Pe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[ag]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(m(this)).indexOf(og(e),arguments.length>1?arguments[1]:void 0)}});var ug="outbox",cg="inbox",lg=function(e,t,n){return[e,t,n].join("_")},hg=function(){function e(t,n){Rt(this,e),this._runtime=t,this._appkey=n,this._inboxTime=0,this._outboxTime=0}return Ct(e,[{key:"setInboxTime",value:function(e,t){if(!(this._inboxTime>e)){this._inboxTime=e;var n=lg(cg,this._appkey,t);this._runtime.localStorage.setItem(n,e.toString())}}},{key:"getInboxTime",value:function(e){if(0===this._inboxTime){var t=lg(cg,this._appkey,e);this._inboxTime=parseInt(this._runtime.localStorage.getItem(t))||0}return this._inboxTime}},{key:"setOutboxTime",value:function(e,t){if(!(this._outboxTime>=e)){this._outboxTime=e;var n=lg(ug,this._appkey,t);this._runtime.localStorage.setItem(n,e.toString())}}},{key:"getOutboxTime",value:function(e){if(0===this._outboxTime){var t=lg(ug,this._appkey,e);this._outboxTime=parseInt(this._runtime.localStorage.getItem(t))||0}return this._outboxTime}}]),e}(),fg={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},dg=function(){function e(t,n){Rt(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return Ct(e,[{key:"_add",value:function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e}},{key:"_remove",value:function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)}},{key:"_setEntry",value:function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,s=e.userId,o=this._getSetUserId(n),a=r===yo.DELETE,u=o===s,c=!this._isExisted(n),l=a?this._remove:this._add;(t||i||u||c)&&l.call(this,e)}},{key:"getValue",value:function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value}},{key:"getAllValue",value:function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e}},{key:"_getSetUserId",value:function(e){return(this._kvCaches[e]||{}).userId}},{key:"_isExisted",value:function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r}},{key:"setEntries",value:function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)})),Hs.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),gg=function(){function e(t){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.chrmId,r=t.timestamp,!((i=fg.get(n))>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullChatroomEntry(n,i);case 11:s=e.sent,o=s.code,a=s.data,this._isPulling=!1,o===ro.SUCCESS?(fg.set(n,a.syncTime||0),this._startPull()):this._startPull();case 16:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(e){fg.clear(e);var t=this._storeCaches[e];t&&t.clear()}},{key:"pullEntry",value:function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()}},{key:"setLocal",value:function(e,t,n){var r=this._storeCaches[e];Ys(r)||(r=new dg(e,n)),r.setEntries(t),this._storeCaches[e]=r}},{key:"getValue",value:function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null}},{key:"getAll",value:function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n}}]),e}(),pg=function(){function e(t,n,r,i){Rt(this,e),this._runtime=t,this._appkey=n,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return Ct(e,[{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))}},{key:"get",value:function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){Hs.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],Ys(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()}},{key:"clear",value:function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)}}]),e}(),vg="converStatusChanged",yg=function(){function e(t,n,r){Rt(this,e),this._eventEmitter=new Xs,this._pullQueue=[],this._isPulling=!1,this._storage=dn(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return Ct(e,[{key:"_set",value:function(e){var t=this;if(!Fs(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(vg,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullConversationStatus(t);case 6:n=e.sent,r=n.code,i=n.data,r===ro.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull();case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pull",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"watch",value:function(e){this._eventEmitter.on(vg,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(vg,(function(e){}))}}]),e}(),mg={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}}},_g={};for(var Eg in mg){var Tg=mg[Eg].keyName;_g[Tg]=Eg}var Rg,Ig=function(){function e(t,n,r){Rt(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new pn(t,i)}return Ct(e,[{key:"_getStoreKey",value:function(e,t){return"".concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value:function(e){var t=(e=e||"").split("_");return t.length>=2?{conversationType:t[0],targetId:e.match(/_.*/g)[0].substring(1)}:{conversationType:Os.PRIVATE,targetId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,o=e.isMentioned,a=e.content,u=e.senderUserId,c=this._getStoreKey(r,i),l=this.storage.get(c)||{},h=_g.mentionedInfo,f=_g.hasMentioned,d=l[h]||{},g=d.userIdList||[],p=a.mentionedInfo;if(p){if(o&&r===Os.GROUP)(p.userIdList||[]).forEach((function(e){e===n._currentUserId&&g.indexOf(u)<0&&g.push(u)})),p.type===fo.ALL&&g.indexOf(u)<0&&g.push(u);if(s===uo.RECALL&&r===Os.GROUP){var v=g.indexOf(u);v>=0&&g.splice(v,1)}p={userIdList:g,type:(null===(t=p)||void 0===t?void 0:t.type)||d.type},0!==g.length?(l[h]=p,l[f]=!0):(delete l[h],delete l[f]),Ys(l)?this.storage.set(c,l):this.storage.remove(c)}}},{key:"set",value:function(e,t,n){var r=this._getStoreKey(e,t),i=this.storage.get(r)||{};for(var s in n){var o=_g[s],a=n[s];if(!Fs(o)&&!Fs(a)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(a===mg[o].defaultVal||"tags"===s&&!Ys(a))delete i[o];else if("tags"===s){var u=a;for(var c in u)u[c].isTop||delete u[c].isTop;i[o]=a}else i[o]=a;i.c||(delete i.t,delete i.hm,delete i.m)}}Ys(i)?this.storage.set(r,i):this.storage.remove(r)}},{key:"get",value:function(e,t){var n=this._getStoreKey(e,t),r=this.storage.get(n)||{},i={};for(var s in mg){var o=mg[s],a=o.keyName,u=o.defaultVal;i[a]=r[s]||ua(u)}return i}},{key:"getValue",value:function(e){var t=this.storage.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId},o=t[r];for(var a in o){var u=mg[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||ua(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this.storage.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,s=r.targetId,o={},a=e[n];for(var u in a){var c=mg[u],l=c.keyName,h=c.defaultVal;o[l]=a[u]||ua(h)}for(var f in o.tags){Fs(t[f])&&(t[f]=[]);var d=Object.assign({},o,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}}]),e}(),Cg=[Os.PRIVATE,Os.GROUP,Os.SYSTEM,Os.PUBLIC_SERVICE],Sg="conversationChanged",bg=function(){function e(t,n,r,i){var s=this;Rt(this,e),this._updatedConversations={},this._eventEmitter=new Xs,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new Ig(t.runtime,n,r),this._statusManager=new yg(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(Sg,(function(e){i(e)}))}return Ct(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=o===to.SEND&&a===this._loginUserId,c=r===uo.RECALL,l=Vs(n),h=!1,f=t.lastUnreadTime||0,d=t.unreadMessageCount||0;if(f>i||u)return{hasChanged:h,localConversation:t};(s&&(t.unreadMessageCount=d+1,t.lastUnreadTime=i,h=!0),c&&l)&&(f>=n.sentTime&&d&&(t.unreadMessageCount=d-1,h=!0));return{hasChanged:h,localConversation:t}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned);to.SEND;var i=Vs(n),s=!1;return r&&i&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0),{hasChanged:s,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(Vs(e)){var t=e.conversationType,n=e.targetId,r="".concat(t,"_").concat(n),i=this._store.get(t,n)||{};this._updatedConversations[r]=Object.assign(i,e)}}},{key:"addStatus",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,s=e.notificationStatus,o=e.isTop,a=e.tags,u={},c={};Fs(s)||(c.notificationStatus={time:i,val:s}),Fs(o)||(c.isTop={time:i,val:o}),Fs(a)||(c.tags={time:i,val:a},null==a||a.forEach((function(e){u[e.tagId]={isTop:e.isTop}}))),this._store.set(n,r,{notificationStatus:s,isTop:o,tags:u}),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:c}),t&&this._notifyConversationChanged()}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);this._eventEmitter.emit(Sg,e),this._updatedConversations={}}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId;if(Cg.indexOf(r)>=0){var o=!1,a=this._store.get(r,s);if([this._calcUnreadCount,this._calcMentionedInfo].forEach((function(t){var r=t.call(n,e,a),i=r.hasChanged,s=r.localConversation;o=o||i,a=ua(s)})),o&&this._store.set(r,s,a),this._store.updateMentionedData(e),i){var u=this._store.get(r,s);u.updatedItems={latestMessage:{time:e.sentTime,val:e},unreadMessageCount:{time:e.sentTime,val:a.unreadMessageCount}},u.latestMessage=e;var c=Object.assign(u,{conversationType:r,targetId:s});this._setUpdatedConversation(c)}t&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){return this._store.get(e,t)}},{key:"getAllUnreadCount",value:function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,s=e.notificationStatus,o=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(o))&&(i+=Number(r)):i+=Number(r))})),i}},{key:"getUnreadCountByTag",value:function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus;(t||1!==i)&&(n=n||0,r+=Number(n))})),r}},{key:"getUnreadCount",value:function(e,t){return this._store.get(e,t).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t){var n=this._store.get(e,t),r=n.unreadMessageCount,i=n.hasMentioned;(r||i)&&(n.unreadMessageCount=0,n.hasMentioned=!1),this._store.set(e,t,n);var s=Object.assign(n,{conversationType:e,targetId:t});this._setUpdatedConversation(s),this._notifyConversationChanged()}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t);this._draftMap[r]=n}},{key:"getDraft",value:function(e,t){var n="".concat(e,"_").concat(t);return this._draftMap[n]}},{key:"clearDraft",value:function(e,t){var n="".concat(e,"_").concat(t);delete this._draftMap[n]}},{key:"addTagStatus",value:function(e,t,n){var r=this._store.get(e,t).tags;r=Object.assign(r,n),this._store.set(e,t,{tags:r})}},{key:"deleteTagStatus",value:function(e,t,n){var r=this._store.get(e,t).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r})}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}}]),e}(),wg=function(){function e(t,n,r,i){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=dn(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return Ct(e,[{key:"_updateTag",value:function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()}},{key:"addTag",value:function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)}},{key:"deleteTag",value:function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)}},{key:"getTagsInfo",value:function(){return this._storage.get(this._storageTagKey)||{}}},{key:"getTags",value:function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))}},{key:"getTagById",value:function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null}},{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullUserSettings(t);case 6:n=e.sent,r=n.code,i=n.data,r!==ro.SUCCESS||Fs(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,o=i.version,a=s.Tag,Fs(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,o),this._isPulling=!1,this._startPull());case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullUserSettings",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"getVersion",value:function(){return this._storage.get(this._storagePullTimeKey)||0}}]),e}(),Ng=function(e){Nt(i,e);var t,n,r=Pt(i);function i(e,t){var n;return Rt(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return Ct(i,[{key:"_formatJSONPUrl",value:function(e,t,n,r){var i=this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())}},{key:"getInfo",value:(n=Tt(regeneratorRuntime.mark((function e(t,n,r){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?on.join(","):an.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):o||"",n=[]),e.abrupt("return",Dt(Ot(i.prototype),"getInfo",this).call(this,t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"_reqNavi",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,o=t.length;case 2:if(!(s<o)){e.next=27;break}return a=this._formatJSONPUrl(t[s],r,n,i),Hs.debug("req navi => ".concat(a)),e.next=7,this._runtime.httpReq({url:a,timeout:1e4});case 7:if(200===(u=e.sent).status){e.next=12;break}return 403===u.status&&Hs.error("request navi error: "+ro.RC_CONN_USER_OR_PASSWD_ERROR),401===u.status&&Hs.error("request navi error: "+ro.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",24);case 12:return e.prev=12,c=u.data.replace("".concat(i,"("),"").replace(/\);?$/,""),l=JSON.parse(c),h=/^https/.test(a)?"https":"http",l.protocol=h,this._runtime.useNavi||(l.server="",l.backupServer=this._miniConnectUrl,l.logSwitch=0),e.abrupt("return",l);case 21:e.prev=21,e.t0=e.catch(12),Hs.error("parse navi err =>",e.t0);case 24:s+=1,e.next=2;break;case 27:if(this._runtime.useNavi){e.next=30;break}return f={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl},e.abrupt("return",f);case 30:return e.abrupt("return",null);case 31:case"end":return e.stop()}}),e,this,[[12,21]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(ng),Og=function(){function e(t){Rt(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.roomId,r=t.timestamp,!((i=this._pullTime)>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullRTCRoomEntry(n,i);case 11:s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS?(this._isPulling=!1,this._pullTime=a.syncTime||0,this._startPull()):this._startPull();case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullEntry",value:function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()}},{key:"reset",value:function(){this._pullTime=0,this._isPulling=!1}}]),e}(),kg=function(e,t){return["send_msg",e,t].join("_")},Ag=function(){function e(t,n){Rt(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return Ct(e,[{key:"init",value:function(e){this._userId=e;var t=kg(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}},{key:"_getLocalInfo",value:function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}},{key:"setMessage",value:function(e,t){this._sendMessageMap[e]=t;var n=kg(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))}},{key:"getSendMessageMap",value:function(){return this._sendMessageMap}},{key:"removeByUID",value:function(e){delete this._sendMessageMap[e]}},{key:"removeByTimestamp",value:function(e){var t=kg(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))}}]),e}(),Mg=function(e){var t="RCDeviceId",n=dn(e),r="",i=n.get(t);return i?r=i:(r=ws(),n.set(t,r)),r};St(Rg={},Os.PRIVATE,jd.qryPMsg),St(Rg,Os.GROUP,jd.qryGMsg),St(Rg,Os.CHATROOM,jd.qryCHMsg),St(Rg,Os.CUSTOMER_SERVICE,jd.qryCMsg),St(Rg,Os.SYSTEM,jd.qrySMsg);var xg=[jd[jd.recallMsg],jd[jd.ppMsgS],jd[jd.pgMsgS],jd[jd.ppMsgP],jd[jd.pgMsgP],jd[jd.chatMsg],jd[jd.pcMsgP],jd[jd.prMsgS]],Lg=function(e){var t;return(t={},St(t,Os.PRIVATE,jd.ppMsgP),St(t,Os.GROUP,jd.pgMsgP),St(t,Os.CHATROOM,jd.chatMsg),St(t,Os.CUSTOMER_SERVICE,jd.pcMsgP),St(t,Os.RTC_ROOM,jd.prMsgS),t)[e]},Ug=function(e,t,r,i,s,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:to.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig}},Pg=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},Dg=function(t){Nt(ge,t);var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R,I,C,S,b,w,N,O,k,A,M,x,L,U,P,D,V,B,F,j,Y,q,K,G,H,W,Q,J,z,Z,$,X,ee,te,ne,re,ie,se,oe,ae,ue,ce,le,he,fe,de=Pt(ge);function ge(e,t,n){var r;return Rt(this,ge),(r=de.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._letterbox=new hg(e,n.appkey),r._sendMessageStore=new Ag(e,n.appkey),r._chrmEntryHandler=new gg(Lt(r)),r}return Ct(ge,[{key:"_createNavi",value:function(){return new Ng(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(fe=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],this._naviInfo=n,n.server?r.push(n.server):Hs.warn("navi.server is invalid"),(i=n.backupServer)&&i.split(",").forEach((function(e){r.indexOf(e)<0&&r.push(e)})),0!==r.length){e.next=8;break}return Hs.error("navi invaild.",r),e.abrupt("return",ro.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){a._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),e.next=11,s.connect(this._appkey,t,r,n.protocol,this._apiVer);case 11:return(o=e.sent)===ro.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(so.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new bg(this,this._appkey,this.currentUserId,this._watcher.conversation),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new wg(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rtcKVManager=new Og(this),this._joinedChrmManager=new pg(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval()):s.close(),e.abrupt("return",o);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Hs.warn("connection status changed:",e),e!==so.CONNECTING)if(e!==so.CONNECTED){if(this._channel&&e!==so.DISCONNECTED)return e===so.BLOCKED||e===so.KICKED_OFFLINE_BY_OTHER_CLIENT||e===so.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==so.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,r)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)}},{key:"_try2Reconnect",value:(he=Tt(regeneratorRuntime.mark((function e(t,n,r){var i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._channel.connect(this._appkey,t,n,r,this._apiVer);case 4:if(e.sent!==ro.SUCCESS){e.next=12;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(so.CONNECTED),this._rejoinChrm(),Hs.__insertLogIntoDatabase(),e.abrupt("return");case 12:this._watcher.status(so.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){i._reconnectTimer=-1,i._try2Reconnect(t,n,r)}),5e3);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"_signalHandler",value:function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=jd[r];if(i)switch(i){case jd.s_ntf:Hs.debug("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case jd.s_msg:this._receiveMsg(e);break;case jd.s_cmd:this._receiveStateNotify(e);break;case jd.s_us:this._receiveSettingNotify(e);break;case jd.rtc_ntf:this._receiveRtcKv(e)}else Hs.error("unknown topic:",r)}}},{key:"_receiveStateNotify",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,hh),r=n.time,i=n.type,s=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(s,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(s),this._watcher.chatroom({chatroomDestroyed:e.targetId})}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,af)).version;this._userSettingManager.pullUserSettings(n)}},{key:"_receiveRtcKv",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Cf),r=n.time,i=n.type,s=n.roomId;switch(i){case 1:this._rtcKVManager.pullEntry(s,r)}}},{key:"_receiveMessageExpansion",value:function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})}},{key:"_receiveSyncMsg",value:function(e,t){var n;if(xg.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,rh,{currentUserId:this.currentUserId,signal:e});(r=this._handleMsgProperties(r)).sentTime=t.timestamp,r.messageUId=t.messageUId,this._pullingMsg?this._pullQueue.push(t.timestamp):(this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==uo.EXPANSION_NOTIFY?(r.messageType===uo.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId),this._watcher.batchMessage([r]),this._conversationManager.setConversationCacheByMessage(r,!0)):this._receiveMessageExpansion(r))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,hh),n=t.type,r=t.chrmId,i=t.time;if(Hs.debug("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", time: ").concat(i)),2===n){var s=this._chrmsQueue[r];if(!s)return;s.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}}},{key:"_startSyncInterval",value:function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()}},{key:"_stopSyncInterval",value:function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)}},{key:"_syncMsg",value:(le=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._pullingMsg){e.next=2;break}return e.abrupt("return");case 2:if(this._channel){e.next=5;break}return this._pullingMsg=!1,e.abrupt("return");case 5:return this._pullingMsg=!0,n=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),Hs.debug("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new xd(jd[jd.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,oh,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(o=e.sent,a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),a===ro.SUCCESS&&u){e.next=21;break}return Hs.warn("pullMsg failed -> code:",a,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Hs.debug("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===to.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==uo.EXPANSION_NOTIFY){if(e.messageType===uo.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId)}var t=p._handleMsgProperties(e);p._conversationManager.setConversationCacheByMessage(t,!0),d.push(t)}else p._receiveMessageExpansion(e)})),this._watcher.batchMessage(d),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,g=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(t=this._pullQueue).push.apply(t,Bt(g)),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!l||g.length>0)&&this._syncMsg();case 36:case"end":return e.stop()}}),e,this)}))),function(){return le.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg){var t=this._channel.codec.decodeByPBName(e.data,sh,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});(t=this._handleMsgProperties(t)).isStatusMessage||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==uo.EXPANSION_NOTIFY?t.messageType===uo.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._watcher.batchMessage([t]),this._conversationManager.setConversationCacheByMessage(t,!0)):this._receiveMessageExpansion(t)}}},{key:"_handleMsgProperties",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.messageType,i=e.isCounted,s=e.isPersited,o=e.isStatusMessage,a=r in hn,u=r in this._customMessageType;return t=a?hn[r]:u?this._customMessageType[r]:{isCounted:!js(i)&&i,isPersited:!js(s)&&s},Object.assign(e,{isCounted:t.isCounted,isPersited:t.isPersited,isStatusMessage:fn.includes(r)}),n&&(e.isStatusMessage=o),e}},{key:"getHistoryMessage",value:(ce=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this.currentUserId,a=this._channel,u=ld[t]||id,c=1===i&&0===r,!a){e.next=14;break}return l=a.codec.encodeGetHistoryMsg(n,{timestamp:r,count:c?2:i,order:s}),e.next=7,a.send(new xd(u,l,o),dh,{currentUserId:o,connectedTime:a.connectedTime,conversation:{targetId:n}});case 7:if(h=e.sent,(f=h.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",{code:f});case 11:return d=h.data,c&&2===d.list.length&&(d.hasMore=!0,0===s?d.list.shift():d.list.pop()),e.abrupt("return",{code:f,data:{list:d.list,hasMore:d.hasMore}});case 14:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return ce.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Hs.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new xd(jd[jd.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==ro.SUCCESS&&Hs.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(ue=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,!(s=this._channel)){e.next=11;break}return o=s.codec.encodeDeleteMessages(t,n,r),a=new xd(Hf,o,i),e.next=6,s.send(a);case 6:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=10;break}return e.abrupt("return",c);case 10:return e.abrupt("return",c);case 11:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(ae=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,!(s=this._channel)){e.next=12;break}return o=s.codec.encodeClearMessages(n,r),a=new xd(hd[t],o,i),e.next=7,s.send(a);case 7:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",c);case 12:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ae.apply(this,arguments)})},{key:"getConversationList",value:(oe=Tt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,u,c,l,h,f=this,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=d.length>0&&void 0!==d[0]?d[0]:300,n=d.length>1?d[1]:void 0,r=d.length>2?d[2]:void 0,i=d.length>3?d[3]:void 0,s=this.currentUserId,o=this._channel,n=n||Os.PRIVATE,!o){e.next=17;break}return a=o.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new xd(ed,a,s),e.next=12,o.send(u,ph,{currentUserId:s,connectedTime:o.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=f._conversationManager.get(t,n);return Object.assign(e,r),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===ro.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:h});case 17:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return oe.apply(this,arguments)})},{key:"removeConversation",value:(se=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._channel)){e.next=12;break}return i=r.codec.encodeOldConversationList({type:t}),s=new xd(td,i,n),e.next=6,r.send(s);case 6:if(o=e.sent,Hs.info("RemoveConversation =>",o),(a=o.code)===ro.SUCCESS){e.next=11;break}return e.abrupt("return",a);case 11:return e.abrupt("return",a);case 12:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return se.apply(this,arguments)})},{key:"getConversation",value:(ie=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._conversationManager.get(t,n)){e.next=3;break}return e.abrupt("return",{code:ro.CONVER_GET_ERROR});case 3:return e.next=5,this.getHistoryMessage(t,n,0,1,0);case 5:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:ro.CONVER_GET_ERROR});case 10:return u=(null==a?void 0:a.list[0])||null,c={conversationType:t,targetId:n,channelId:r,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||lo.CLOSE,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0},e.abrupt("return",{code:ro.SUCCESS,data:c});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ie.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:ro.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t){var n=this._conversationManager.getUnreadCount(e,t);return Promise.resolve({code:ro.SUCCESS,data:n})}},{key:"clearConversationUnreadCount",value:function(e,t){return this._conversationManager.clearUnreadCount(e,t),Promise.resolve(ro.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n){return this._conversationManager.setDraft(e,t,n),Promise.resolve(ro.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t){var n=this._conversationManager.getDraft(e,t);return Promise.resolve({code:ro.SUCCESS,data:n})}},{key:"clearConversationMessageDraft",value:function(e,t){return this._conversationManager.clearDraft(e,t),Promise.resolve(ro.SUCCESS)}},{key:"pullConversationStatus",value:(re=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=11;break}return i=n.codec.encodeGetConversationStatus(t),s=new xd(jd[jd.pullSeAtts],i,r),e.next=6,n.send(s,cf);case 6:if(o=e.sent,a=o.code,u=o.data,a===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return e.abrupt("return",{code:a,data:u});case 11:return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 12:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(ne=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=13;break}return i=r.codec.encodeSetConversationStatus(t),s=new xd(nd,i,n),e.next=6,r.send(s,df);case 6:if(o=e.sent,a=o.code,u=o.data,a!==ro.SUCCESS){e.next=12;break}return c=u,t.forEach((function(e){l._conversationManager.addStatus(wt(wt({},e),{},{updatedTime:c.version}),!0)})),e.abrupt("return",a);case 12:return e.abrupt("return",a);case 13:return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"_joinChrm",value:(te=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),o=new xd(r?Qf:Wf,s,t),e.next=8,i.send(o,Ch);case 8:return a=e.sent,u=a.code,c=a.data,l=c.joinTime,u===ro.SUCCESS&&(this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,n,l),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,n)),e.abrupt("return",u);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return te.apply(this,arguments)})},{key:"_rejoinChrm",value:(ee=Tt(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this._joinedChrmManager.get(),e.t0=regeneratorRuntime.keys(t);case 2:if((e.t1=e.t0()).done){e.next=10;break}return n=e.t1.value,e.next=6,this._joinChrm(n,t[n]||10,!0);case 6:(r=e.sent)===ro.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:n,count:t[n]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:n,errorCode:r}}),e.next=2;break;case 10:case"end":return e.stop()}}),e,this)}))),function(){return ee.apply(this,arguments)})},{key:"_pullChrmMsg",value:(X=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.length>1&&void 0!==v[1]?v[1]:10,r=v.length>2&&void 0!==v[2]?v[2]:0,this._channel){e.next=4;break}return e.abrupt("return");case 4:if(i=this._chrmsQueue[t],s=i.pulling,o=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,a=this._channel.codec.encodeChrmSyncMsg(o,n),u=new xd(jd[jd.chrmPull],a,t),e.next=13,this._channel.send(u,oh,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===ro.SUCCESS&&h){e.next=20;break}return Hs.warn("pull chatroom msg failed, code:",l,", data:",h),e.abrupt("return");case 20:f=h.list,d=h.syncTime,g=h.finished,i.timestamp=r?Math.max(d,r):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],f.forEach((function(e){e.sentTime<o||p.push(e)})),this._watcher.batchMessage(p),(!g||i.queue.length>0)&&this._pullChrmMsg(t);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return X.apply(this,arguments)})},{key:"joinChatroom",value:($=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!1));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"joinExistChatroom",value:(Z=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!0));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return Z.apply(this,arguments)})},{key:"quitChatroom",value:(z=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new xd(Jf,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(o=s.code)===ro.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"getChatroomInfo",value:(J=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),o=new xd(jd[jd.queryChrmI],s,t),e.next=7,i.send(o,bh);case 7:if(a=e.sent,u=a.code,c=a.data,u===ro.SUCCESS){e.next=11;break}return e.abrupt("return",{code:u});case 11:return e.abrupt("return",{code:u,data:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return J.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(Q=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),a=new xd(od,o,t),e.next=7,s.send(a,dh,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return e.abrupt("return",{code:c,data:{list:l.list,hasMore:l.hasMore}});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Q.apply(this,arguments)})},{key:"_modifyChatroomKV",value:(W=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),o=n.type===yo.UPDATE?zf:Zf,a=new xd(o,s,t),e.next=8,r.send(a);case 8:if(u=e.sent,(c=u.code)!==ro.SUCCESS){e.next=13;break}return this._chrmEntryHandler.setLocal(t,{kvEntries:[n],syncTime:(new Date).getTime()},i),e.abrupt("return",c);case 13:return e.abrupt("return",c);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return W.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(H=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),o=n.type===yo.UPDATE?$f:Xf,a=new xd(o,s,t),e.next=8,r.send(a,Xh);case 8:return u=e.sent,c=u.code,-1!==[ro.SUCCESS,ro.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(l=[],delete(h=Object.assign({},n)).entries,n.entries.forEach((function(e){l.push(Object.assign({},e,h))})),c===ro.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=u.data,Hs.warn("设置失败的属性:",f.errorKeys),f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),Hs.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(t,{kvEntries:l,syncTime:(new Date).getTime()},i)),e.abrupt("return",c);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"setChatroomEntry",value:(G=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"setChatroomEntries",value:(K=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(q=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.UPDATE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"removeChatroomEntry",value:(Y=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"removeChatroomEntries",value:(j=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(F=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=yo.DELETE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return F.apply(this,arguments)})},{key:"getChatroomEntry",value:(B=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._chrmEntryHandler.getValue(t,n))){e.next=5;break}return e.abrupt("return",Promise.resolve({code:ro.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:ro.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),o=new xd(jd[jd.pullKV],s,t),e.next=12,i.send(o,$h);case 12:if(a=e.sent,!((u=a.data||{})&&u.kvEntries&&u.kvEntries.length)){e.next=18;break}if(void 0===(c=u.kvEntries.find((function(e){return e.key===n})))){e.next=18;break}return e.abrupt("return",Promise.resolve({code:ro.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:ro.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return B.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(V=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._chrmEntryHandler.getAll(t))||!Object.keys(n).length){e.next=5;break}return e.abrupt("return",Promise.resolve({code:ro.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:ro.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),o=new xd(jd[jd.pullKV],s,t),e.next=13,r.send(o,$h);case 13:return a=e.sent,(u=a.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:ro.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"pullChatroomEntry",value:(D=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),o=new xd(jd[jd.pullKV],s,t),e.next=7,r.send(o,$h);case 7:if(a=e.sent,u=a.code,c=a.data,u!==ro.SUCCESS){e.next=17;break}return Hs.debug("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(t,c,i),Hs.debug("Save into cache success!"),l=c.kvEntries,h=[],l.length>0&&(l.forEach((function(e){var n=e.key,r=e.value,i=e.type,s=e.timestamp;h.push({key:n,value:r,type:i,timestamp:s,chatroomId:t})})),this._watcher.chatroom({updatedEntries:h})),e.abrupt("return",{code:u,data:c});case 17:return e.abrupt("return",{code:u});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"sendMessage",value:(P=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(r=Pg(r,this.currentUserId),r=this._handleMsgProperties(r,!0),s=!![Os.PRIVATE,Os.GROUP].includes(t)&&r.isStatusMessage,o=s?(p=t,v=void 0,(v={},St(v,Os.PRIVATE,jd.ppMsgS),St(v,Os.GROUP,jd.pgMsgS),v)[p]):Lg(t)||jd.ppMsgP,s&&(r.isPersited=!1,r.isCounted=!1),r.pushContent=(null===(i=r.pushConfig)||void 0===i?void 0:i.pushContent)||r.pushContent||"",a=this._channel.codec.encodeUpMsg({type:t,targetId:n},r),(u=new kd(jd[o],a,n)).setHeaderQos(kl.AT_LEAST_ONCE),!s){e.next=14;break}return this._channel.sendOnly(u),e.abrupt("return",{code:ro.SUCCESS,data:Ug(t,n,wt({},r),"",0,this.currentUserId)});case 14:return c=Date.now()-this._localConnectedTime+this._connectedTime,l=Ug(t,n,wt({},r),"",c,this.currentUserId),e.next=18,this._channel.send(u);case 18:if(h=e.sent,f=h.code,d=h.data,f===ro.SUCCESS){e.next=23;break}return e.abrupt("return",{code:f,data:l});case 23:return g=d,this._sendMessageStore.setMessage(g.messageUId,g.timestamp),l.sentTime=g.timestamp,l.messageUId=g.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),e.abrupt("return",{code:ro.SUCCESS,data:l});case 29:case"end":return e.stop()}var p,v}),e,this)}))),function(e,t,n){return P.apply(this,arguments)})},{key:"recallMsg",value:(U=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return a=s.user,u={content:{conversationType:t,targetId:n,messageUId:r,sentTime:i,user:a},messageType:"RC:RcCmd",disableNotification:null==s?void 0:s.disableNotification,pushConfig:null==s?void 0:s.pushConfig,pushContent:(null===(o=s.pushConfig)||void 0===o?void 0:o.pushContent)||s.pushContent||""},c=jd[jd.recallMsg],l=this._channel.codec.encodeUpMsg({type:t,targetId:n},u),(h=new kd(c,l,this.currentUserId)).setHeaderQos(kl.AT_LEAST_ONCE),e.next=10,this._channel.send(h);case 10:if(f=e.sent,d=f.code,g=f.data,d===ro.SUCCESS){e.next=15;break}return e.abrupt("return",{code:d});case 15:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),e.abrupt("return",{code:ro.SUCCESS,data:Ug(t,n,wt({},u),p.messageUId,p.timestamp,this.currentUserId)});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return U.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(L=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new xd(jd[jd.rrMsg],i,t),e.next=6,this._channel.send(s);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return L.apply(this,arguments)})},{key:"getMessageReader",value:(x=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new xd(jd[jd.rrList],i,t),e.next=6,this._channel.send(s,vf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return x.apply(this,arguments)})},{key:"pullUserSettings",value:(M=Tt(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new xd(jd[jd.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,of));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"getFileToken",value:(A=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":Xo(t,n),o=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),a=new xd(jd[jd.qnTkn],o,this.currentUserId),e.next=7,this._channel.send(a,Kh);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==ro.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c,data:l});case 13:return e.abrupt("return",{code:c});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"getFileUrl",value:(k=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s="",o="",a="",n===po.QINIU?(o=Gh,a=Wh):(o=Hh,a=Qh),s=n===po.QINIU?jd[jd.qnUrl]:n===po.AWS?jd[jd.s3Url]:n===po.STC?jd[jd.stcUrl]:jd[jd.aliUrl],u=this._channel.codec.encodeGetFileUrl(o,t,r,i),c=new xd(s,u,this.currentUserId),e.next=11,this._channel.send(c,a);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==ro.SUCCESS){e.next=17;break}return e.abrupt("return",{code:h,data:d});case 17:return e.abrupt("return",{code:h});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return k.apply(this,arguments)})},{key:"disconnect",value:function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._stopSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"createTag",value:(O=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new xd(jd[jd.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,rf);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([wt(wt({},t),{},{createdTime:u})],u),e.abrupt("return",{code:ro.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"removeTag",value:(N=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new xd(jd[jd.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,rf);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:ro.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"updateTag",value:(w=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new xd(jd[jd.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,rf);case 7:if(s=e.sent,o=s.code,a=s.data,o===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:ro.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"getTagList",value:(b=Tt(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._userSettingManager.getTags(),n=this._conversationManager.getConversationListForTag(),t.forEach((function(e){e.conversationCount=n[e.tagId]?n[e.tagId].length:0})),e.abrupt("return",{code:ro.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"addTagForConversations",value:(S=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:ro.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new xd(jd[jd.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(o=s.code)===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return(a={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.type,e.targetId,a)})),e.abrupt("return",{code:ro.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"removeTagForConversations",value:(C=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new xd(jd[jd.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(o=s.code)===ro.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return n.forEach((function(e){a._conversationManager.deleteTagStatus(e.type,e.targetId,[t])})),e.abrupt("return",{code:ro.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"removeTagsForConversation",value:(I=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=t.type,i=t.targetId,s=n.map((function(e){return{tagId:e}})),o=this._channel.codec.encodeUpdateConversationTag(s,[t]),a=new xd(jd[jd.delTag],o,this.currentUserId),e.next=8,this._channel.send(a);case 8:if(u=e.sent,(c=u.code)===ro.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return this._conversationManager.deleteTagStatus(r,i,n),e.abrupt("return",{code:ro.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"getConversationListByTag",value:(R=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,s=this._channel){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeOldConversationList({count:r,type:Os.PRIVATE,startTime:n}),a=new xd(ed,o,i),e.next=7,s.send(a,ph,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,l),Hs.info("GetConversationListByTag",h),c===ro.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c});case 13:return e.abrupt("return",{code:c,data:h});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return R.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],i=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=n._conversationManager.get(s,o),u=a.hasMentioned,c=a.mentionedInfo,l=a.lastUnreadTime,h=a.notificationStatus,f=a.isTop,d=a.tags,g=a.unreadMessageCount,p=d&&d[e];if(p){var v=wt(wt({},t),{},{hasMentioned:u,mentionedInfo:c,lastUnreadTime:l,notificationStatus:h,isTop:f,unreadMessageCount:g});p.isTop?r.push(wt(wt({},v),{},{isTopInTag:!0})):i.push(wt(wt({},v),{},{isTopInTag:!1}))}})),[].concat(Bt(r.sort(s)),Bt(i.sort(s)))}},{key:"getUnreadCountByTag",value:(T=Tt(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:ro.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(E=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.type,o=r.isTop,a=[{tagId:t,isTop:o}],(u=this._conversationManager.get(s,i)).tags&&Object.hasOwnProperty.call(u.tags,t)){e.next=8;break}return e.abrupt("return",{code:ro.NO_TAG_IN_CONVER});case 8:return c=this._channel.codec.encodeUpdateConversationTag(a,[n]),l=new xd(jd[jd.addTag],c,this.currentUserId),e.next=12,this._channel.send(l);case 12:if(h=e.sent,(f=h.code)===ro.SUCCESS){e.next=16;break}return e.abrupt("return",{code:f});case 16:return(d={})[t]={},o&&(d[t].isTop=!0),this._conversationManager.addTagStatus(s,i,d),e.abrupt("return",{code:ro.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return E.apply(this,arguments)})},{key:"getTagsForConversation",value:(_=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.type,t.targetId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(s in n.tags)i.push({tagId:s,tagName:null===(o=r[s])||void 0===o?void 0:o.tagName});return e.abrupt("return",{code:ro.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"joinRTCRoom",value:(m=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new xd(jd[jd.rtcRJoin_data],i,t),e.abrupt("return",this._channel.send(s,Nh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return m.apply(this,arguments)})},{key:"quitRTCRoom",value:(y=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new xd(jd[jd.rtcRExit],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"rtcPing",value:(v=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new xd(jd[jd.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return v.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(p=Tt(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new xd(jd[jd.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Fh));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(g=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new xd(jd[jd.rtcUData],n,t),e.next=6,this._channel.send(r,Nh);case 6:return i=e.sent,s=i.code,o=i.data,e.abrupt("return",{code:s,data:o?{users:o.users}:o});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"setRTCUserInfo",value:(d=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new xd(jd[jd.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(f=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new kd(jd[jd.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"setRTCData",value:(h=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeSetRTCData(n,r,i,s,o),u=new kd(jd[jd.rtcSetData],a,t),e.next=6,this._channel.send(u);case 6:return c=e.sent,l=c.code,e.abrupt("return",l);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return h.apply(this,arguments)})},{key:"setRTCTotalRes",value:(l=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeUserSetRTCData(n,r,i,s),a=new xd(jd[jd.userSetData],o,t),e.next=6,this._channel.send(a);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return l.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:ro.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new xd(jd[jd.rtcQryData],i,e);return this._channel.send(s,Ph)}},{key:"removeRTCData",value:(c=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeRemoveRTCData(n,r,i,s),a=new kd(jd[jd.rtcDelData],o,t),e.next=6,this._channel.send(a);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return c.apply(this,arguments)})},{key:"setRTCOutData",value:function(e,t,n,r){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCOutData",value:function(e,t){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCToken",value:(u=Tt(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new xd(jd[jd.rtcToken],i,t),e.abrupt("return",this._channel.send(s,Uh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"setRTCState",value:(a=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new xd(jd[jd.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getRTCUserInfo",value:(o=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Method not implemented.");case 1:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:ro.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new xd(jd[jd.rtcUList],t,e);return this._channel.send(n,Nh)}},{key:"joinLivingRoomAsAudience",value:(s=Tt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:e.RTCMode.LIVE,i=l.length>2?l[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),o=new xd(jd[jd.viewerJoinR],s,n),t.next=8,this._channel.send(o,Uh);case 8:if(a=t.sent,u=a.code,c=a.data,u===ro.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return this._rtcKVManager.pullEntry(n,0),t.abrupt("return",{code:u,data:{token:c.rtcToken}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return s.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(i=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",ro.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new xd(jd[jd.viewerExitR],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"rtcIdentityChange",value:(r=Tt(regeneratorRuntime.mark((function t(n,r,i){var s,o,a,u,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._channel){t.next=2;break}return t.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 2:return s=this._channel.codec.encodeIdentityChangeInfo(r,i),o=new xd(jd[jd.rtcIdentityChange],s,n),t.next=6,this._channel.send(o,Nh);case 6:if(a=t.sent,u=a.code,c=a.data,u===ro.SUCCESS&&r===e.RTCIdentityChangeType.AnchorToViewer&&(this._rtcKVManager.reset(),this._rtcKVManager.pullEntry(n,0)),u===ro.SUCCESS){t.next=12;break}return t.abrupt("return",{code:u});case 12:return t.abrupt("return",{code:u,data:c});case 13:case"end":return t.stop()}}),t,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(n=Tt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:ro.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullRTCRoomKV(t,0),o=new xd(jd[jd.rtcPullKv],s,i),e.next=7,r.send(o,bf);case 7:if(a=e.sent,u=a.code,c=a.data,u!==ro.SUCCESS){e.next=14;break}return l=c.kvEntries,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 14:return e.abrupt("return",{code:u});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getDeviceId",value:function(){return Mg(this.runtime)}},{key:"callExtra",value:function(e){return Promise.resolve({code:ro.EXTRA_METHOD_UNDEFINED})}},{key:"clearConversations",value:function(){throw new Error("Method not implemented.")}},{key:"setUserStatusListener",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"subscribeUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"getUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"addToBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"removeFromBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"getBlacklist",value:function(){throw new Error("Method not implemented.")}},{key:"getBlacklistStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"insertMessage",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"deleteMessages",value:function(e){throw new Error("Method not implemented.")}},{key:"deleteMessagesByTimestamp",value:function(e,t,n,r,i){throw new Error("Method not implemented.")}},{key:"clearMessages",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getMessage",value:function(e){throw new Error("Method not implemented.")}},{key:"setMessageContent",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"setMessageSearchField",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"searchConversationByContent",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"searchMessageByContent",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}},{key:"getUnreadMentionedMessages",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageSentStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageReceivedStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"getConversationNotificationStatus",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}}]),ge}(zd),Vg=function(){function e(t){Rt(this,e),this._context=t}return Ct(e,[{key:"getCoreVersion",value:function(){return this._context.coreVersion}},{key:"getAPIVersion",value:function(){return this._context.apiVersion}},{key:"getAppkey",value:function(){return this._context.appkey}},{key:"getCurrentId",value:function(){return this._context.getCurrentUserId()}},{key:"getConnectionStatus",value:function(){return this._context.getConnectionStatus()}},{key:"getDeviceId",value:function(){return this._context.getDeviceId()}},{key:"sendMessage",value:function(e,t,n){return this._context.sendMessage(e,t,n)}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._context.registerMessageType(e,t,n,r)}},{key:"getServerTime",value:function(){return this._context.getServerTime()}}]),e}(),Bg=function(e){Nt(n,e);var t=Pt(n);function n(){return Rt(this,n),t.apply(this,arguments)}return Ct(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n){return this._context.joinRTCRoom(e,t,n)}},{key:"quitRTCRoom",value:function(e){return this._context.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._context.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._context.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._context.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._context.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._context.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._context.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._context.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)}},{key:"getRTCData",value:function(e,t,n,r){return this._context.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._context.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._context.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._context.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._context.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._context.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._context.rtcIdentityChange(e,t,n)}}]),n}(Vg),Fg=function(){function e(){Rt(this,e)}return Ct(e,null,[{key:"compress",value:function(e){for(var t=this,n={},r=0;r<e.length-1;r++){var i=e.charAt(r)+e.charAt(r+1);n.hasOwnProperty(i)?n[i].push(r):n[i]=[r]}for(var s=[],o=[],a=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);s.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);s.push(i)}s.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)o.push(e.charAt(u++));else if(c.length<4)o.push(e.substr(u,c.length)),u+=c.length;else{var l=t.numberEncode(u-c.offset),h=t.numberEncode(c.length);if(l.length+h.length>=c.length)o.push(e.substr(u,c.length)),u+=c.length;else{a();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}a();var d=t.numberEncode(e.length),g=String.fromCharCode(t.dataType.Tail|d.length);return s.push(g+d),s.join("")}},{key:"uncompress",value:function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),s=i&t.dataType.Mark,o=15&i,a=void 0;switch(s){case t.dataType.Compressed:var u=o>>2,c=3&o;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,u)),h=t.numberDecode(e.substr(n+=u,c));if((l=r.length-l)+h>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(l,h);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,o)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=o;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,o)),r+=e.substr(n+=o,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,o),n+=o;break;case t.dataType.Mark:if(o>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+o),n+=16+o;break;default:throw new Error("Data parsing error,at "+n+" header:"+s)}}while(n<e.length);return r}},{key:"indexOf",value:function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var s=t.length-n,o=0,a=i.length;o<a;o++){var u=i[o],c=n-u;if(!(c>this.max)){var l=Math.min(s,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,f=h;f<l&&t.charAt(u+f)===t.charAt(n+f);f++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r}},{key:"numberEncode",value:function(e){var t=this,n=[],r=0;do{r=e%t.scale,n.push(t.chars.charAt(r)),e=(e-r)/t.scale}while(e>0);return n.join("")}},{key:"numberDecode",value:function(e){for(var t=0,n=0,r=e.length-1;r>=0;r--){if(-1===(n=this.chars.indexOf(e.charAt(r))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t}}]),e}();Fg.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},Fg.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Fg.scale=Fg.chars.length,Fg.max=238327;var jg=1,Yg=!1,qg="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",Kg=function(){function e(t){Rt(this,e),this.info=t,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=t.logPolicy.url||this.logUrl,this.level=t.logPolicy.level||this.level,this.itv=t.logPolicy.itv||this.itv,this.times=t.logPolicy.times||this.times,this.deviceId=Mg(t.runtime),this.logSwitch=t.logSwitch;var n=la(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(Gs.sessionId),this.startReport()}var t;return Ct(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&Yg){var t=this.itv*Math.pow(2,jg-1);jg<this.times&&jg++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=Gs.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=Fg.compress(t.map((function(e){return e.content})).join("")),r="".concat(qg).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){Hs.__clearRealTimeLog(),Hs.debug("report real-time log success");var n=t.data;n&&(n=JSON.parse(n),e.itv=n.nextTime,e.level=n.level,e.logSwitch=n.logSwitch,jg=1),e.startReport()})).catch((function(t){Hs.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.startTime,r=t.endTime,i=t.platform,s=t.logId,o=t.uri,a=fs.getInstance(),"web"===i.toLowerCase()&&a){e.next=4;break}return e.abrupt("return");case 4:if(!(n>r)){e.next=7;break}return Hs.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 7:return e.next=9,Hs.__insertLogIntoDatabase();case 9:return e.next=11,a.getRangeData(ls,"time",n,r);case 11:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=Fg.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&Yg){var t=o||h.logUrl,n="".concat(qg).concat(t,"?version=").concat(h.info.version,"&appkey=").concat(h.info.appkey,"&userId=").concat(h.info.userId,"&logId=").concat(s,"&deviceId=").concat(h.deviceId,"&deviceInfo=").concat(h.deviceInfo,"&platform=Web"),r=5e3*(l-1);l++,setTimeout((function(){Yg&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Hs.debug("report full log success!")})).catch((function(t){e(),Hs.warn("report full log error -> "+t)}))}),r)}}();case 18:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){jg=1,Yg=!1}}],[{key:"init",value:function(t){return Yg=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function Gg(e){return Object.assign({},e)}var Hg,Wg=function(){function e(t,n){var r;(Rt(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.0.0-alpha.3",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=so.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._options=Object.assign({},n),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length)&&(r=this._options.navigators).push.apply(r,Bt(sn));var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedLister.bind(this)};this._engine=ca()?new RCCppEngine(t,i,this._options):new Dg(t,i,this._options)}var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R,I,C,S,b,w,N,O,k,A,M,x,L,U,P,D,V,B;return Ct(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Hs.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new Bg(this):new Vg(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Hs.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&this._pluginContextQueue.push(n),r&&(this._pluginInstanseMap[e.tag]=r),r}},{key:"_handleRedirect",value:(B=Tt(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Hs.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:e.sent.code!==ro.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){t._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"_connectionStatusListener",value:(V=Tt(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===so.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):t===so.BLOCKED||t===so.KICKED_OFFLINE_BY_OTHER_CLIENT||t===so.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):t===so.CONNECTING?this._handleConnecting():t===so.CONNECTED?this._handleConnected():t===so.DISCONNECTED?this._handleDisconnect():this._handleSuspend(),this._connectionStatus=t,(null===(n=this._watcher.rtcInnerWatcher)||void 0===n?void 0:n.status)&&this._watcher.rtcInnerWatcher.status(t),this._pluginContextQueue.forEach((function(e){e.onconnectionstatechange&&e.onconnectionstatechange(t)})),this._watcher.connectionState&&this._watcher.connectionState(t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"_handleConnecting",value:function(){this._watcher.onConnecting&&this._watcher.onConnecting()}},{key:"_handleConnected",value:function(){this._watcher.onConnected&&this._watcher.onConnected()}},{key:"_handleDisconnect",value:function(){this._watcher.onDisconnect&&this._watcher.onDisconnect()}},{key:"_handleSuspend",value:function(){this._watcher.onSuspend&&this._watcher.onSuspend()}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===Os.RTC_ROOM||Object.prototype.hasOwnProperty.call(bo,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Gg(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if("RC:TypSts"!==e.messageType||(this._addTypingInfo(Gg(e)),!this._watcher.typingState))if(e.messageType!==uo.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Gg(e))}catch(e){return Hs.error("plugin error =>",e),!1}})))if("RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return this._watcher.message&&this._watcher.message(Gg(e),t,n),e;this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({type:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.messageUId,St({},e.senderUserId,e.sentTime))}else this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({type:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.messageUId);else this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({type:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.messageUId,e.sentTime)}else{var r,i=e.content,s=i.startTime,o=i.endTime,a=i.platform,u=i.logId,c=i.uri,l=i.packageName,h={startTime:parseInt(s),endTime:parseInt(o),platform:a,logId:u,uri:c,packageName:l};null===(r=Kg.getInstance())||void 0===r||r.reportFullLog(h)}}else if("function"==typeof this._watcher.chatroomState){var f={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){f[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:f,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:St({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?To.QUIT:To.JOIN),chatroomId:e.targetId}})}},{key:"_batchMessageReceiver",value:function(e,t,n){var r=this,i=[];e.forEach((function(e){var s=r._messageReceiver(e,t,n);s&&i.push(s)})),i.length&&this._watcher.batchMessage&&this._watcher.batchMessage(i)}},{key:"_chatroomInfoListener",value:function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)}},{key:"_conversationInfoListener",value:function(e){this._watcher.conversationState&&this._watcher.conversationState(e)}},{key:"_expansionInfoListener",value:function(e){this._watcher.expansion&&this._watcher.expansion(e)}},{key:"_tagListener",value:function(){this._watcher.tag&&this._watcher.tag()}},{key:"_conversationTagListener",value:function(e,t,n){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged(e,t,n)}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedLister",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_rtcDataChange",value:function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))}},{key:"assignWatcher",value:function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=Bs(r)||Vs(r)?r:void 0}}))}},{key:"resetWatcher",value:function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))}},{key:"_addTypingInfo",value:function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,s=e.channelId,o=i.typingContentType,a=s||"",u="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===o?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())}},{key:"_startCheckTypingInfo",value:function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var r=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(r),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))}},{key:"getConnectedTime",value:function(){return this._engine.getConnectedTime()}},{key:"getServerTime",value:function(){return this._engine.getServerTime()}},{key:"getDeviceId",value:function(){return this._engine.getDeviceId()}},{key:"getCurrentUserId",value:function(){return this._engine.currentUserId}},{key:"getConnectionStatus",value:function(){return this._connectionStatus}},{key:"token",get:function(){return this._token}},{key:"connect",value:(D=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]&&l[1],this._connectionStatus!==so.CONNECTED){e.next=3;break}return e.abrupt("return",{code:ro.SUCCESS,userId:this._engine.currentUserId});case 3:if(this._connectionStatus!==so.CONNECTING){e.next=5;break}return e.abrupt("return",{code:ro.BIZ_ERROR_CONNECTING});case 5:if("string"==typeof t&&0!==t.length){e.next=7;break}return e.abrupt("return",{code:ro.RC_CONN_USER_OR_PASSWD_ERROR});case 7:return this._token=t,r=t.split("@"),i=Vt(r,2),s=i[1],o=s?s.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=12,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 12:if(a=e.sent){e.next=15;break}return e.abrupt("return",{code:ro.RC_NAVI_RESOURCE_ERROR});case 15:if(1!==(null==a?void 0:a.type)){e.next=17;break}return e.abrupt("return",{code:ro.PACKAGE_ENVIRONMENT_ERROR});case 17:return u=wt({engine:this.coreVersion,imlib:this.apiVersion},this._versionInfo),e.next=20,this._engine.connect(this._getTokenWithoutNavi(),a);case 20:if(c=e.sent,Hs.__insertLogIntoDatabase(),c!==oo.REDIRECT){e.next=27;break}return this._connectionStatus=so.REDIRECT,e.next=26,this.connect(t,!0);case 26:return e.abrupt("return",e.sent);case 27:return c===ro.SUCCESS&&(Hs.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),Kg.init({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Gs.init(this._engine.currentUserId),this._isInternalConnected=!0),c!==ro.SUCCESS||ca()||1===a.openUS&&this._pullUserSettings(),c!==ro.SUCCESS&&(this._connectionStatus=so.CONNECTION_CLOSED),e.abrupt("return",{code:c,userId:this._engine.currentUserId});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"_pullUserSettings",value:(P=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case 1:case"end":return e.stop()}}),e)}))),function(){return P.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=Kg.getInstance())||void 0===e||e.distroy(),Hs.__insertLogIntoDatabase(),Gs.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Hs.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(){return this._isInternalConnected?Promise.resolve({code:ro.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())}},{key:"_getTokenWithoutNavi",value:function(){return this._token.replace(/@.+$/,"@")}},{key:"getInfoFromCache",value:function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._engine.registerMessageType(e,t,n,r)}},{key:"sendMessage",value:function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===uo.READ_RECEIPT_RESPONSE)return Promise.resolve({code:ro.READ_RECEIPT_ERROR});if(e===Os.SYSTEM)return Promise.resolve({code:ro.BIZ_ERROR_INVALID_PARAMETER});var s=JSON.stringify(n.content);return Kn(s)>cn?Promise.resolve({code:ro.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(U=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channelId,r=t.conversationType,i=t.targetId,s=t.messageUId,o=t.keys,a=t.expansion,u=t.originExpansion,c=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:ro.MESSAGE_KV_NOT_SUPPORT});case 3:if(l=!1,h=!1,Vs(a))for(p in u=u||{},f=Object.keys(a).length,d=Object.assign(u,a),g=Object.keys(d).length,l=g>300||f>20,a)v=a[p],l=p.length>32||v.length>64,h=!/^[A-Za-z0-9_=+-]+$/.test(p);if(!l){e.next=8;break}return e.abrupt("return",{code:ro.EXPANSION_LIMIT_EXCEET});case 8:if(!h){e.next=10;break}return e.abrupt("return",{code:ro.BIZ_ERROR_INVALID_PARAMETER});case 10:return y={mid:s},a&&(y.put=a),o&&(y.del=o),c&&(y.removeAll=1),e.next=16,this._engine.sendMessage(r,i,{content:y,messageType:uo.EXPANSION_NOTIFY,channelId:n});case 16:return m=e.sent,_=m.code,e.abrupt("return",{code:_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(L=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:ro.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"});case 4:return e.abrupt("return",this._engine.sendReadReceiptMessage(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return L.apply(this,arguments)})},{key:"getMessageReader",value:(x=Tt(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:ro.READ_RECEIPT_ERROR});case 4:return e.abrupt("return",this._engine.getMessageReader(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return x.apply(this,arguments)})},{key:"_destroy",value:function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){Hs.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=Kg.getInstance())||void 0===e||e.distroy(),Gs.reset()}},{key:"getHistoryMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";return this._engine.getHistoryMessage(e,t,n,r,i,s,o||"")}},{key:"getConversationList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.getConversationList(e,t,n,r,i)}},{key:"getConversation",value:function(e,t,n){return this._engine.getConversation(e,t,n)}},{key:"removeConversation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.removeConversation(e,t,n)}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationUnreadCount(e,t,n)}},{key:"getUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationUnreadCount(e,t,n)}},{key:"getTotalUnreadCount",value:function(e,t,n){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Os.PRIVATE,Os.GROUP,Os.SYSTEM,Os.PUBLIC_SERVICE],!!n)}},{key:"getFirstUnreadMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getFirstUnreadMessage(e,t,n)}},{key:"setConversationStatus",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(s)}},{key:"saveConversationMessageDraft",value:function(e,t,n){return this._engine.saveConversationMessageDraft(e,t,n)}},{key:"getConversationMessageDraft",value:function(e,t){return this._engine.getConversationMessageDraft(e,t)}},{key:"clearConversationMessageDraft",value:function(e,t){return this._engine.clearConversationMessageDraft(e,t)}},{key:"recallMessage",value:function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)}},{key:"deleteRemoteMessage",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessage(e,t,n,r)}},{key:"deleteRemoteMessageByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)}},{key:"joinChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinChatroom(e,t)}},{key:"joinExistChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinExistChatroom(e,t)}},{key:"quitChatroom",value:function(e){return this._engine.quitChatroom(e)}},{key:"getChatroomInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this._engine.getChatroomInfo(e,t,n)}},{key:"setChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return na(n)&&ra(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"setChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,s=r.value;if(!na(i)||!ra(s))return Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return na(n)&&ra(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return na(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!na(r))return Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return na(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(ro.BIZ_ERROR_INVALID_PARAMETER)}},{key:"getChatroomEntry",value:function(e,t){return this._engine.getChatroomEntry(e,t)}},{key:"getAllChatroomEntries",value:function(e){return this._engine.getAllChatroomEntry(e)}},{key:"getChatRoomHistoryMessages",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this._engine.getChatroomHistoryMessages(e,r,t,n)}},{key:"getFileToken",value:(M=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",e.next=6,this._engine.getFileToken(t,n,r,i);case 6:if(c=e.sent,l=c.code,h=c.data,l!==ro.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:o,qiniu:a,ossConfig:u})));case 11:return e.abrupt("return",Promise.reject(l));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return M.apply(this,arguments)})},{key:"getFileUrl",value:(A=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=c.length>4&&void 0!==c[4]?c[4]:po.QINIU,null==i||!i.isBosRes){e.next=3;break}return e.abrupt("return",Promise.resolve(i));case 3:return e.next=5,this._engine.getFileUrl(t,s,n,r);case 5:if(o=e.sent,a=o.code,u=o.data,a!==ro.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(a));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"createTag",value:(k=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.createTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"removeTag",value:(O=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"updateTag",value:(N=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.updateTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"getTagList",value:(w=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagList());case 1:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"addTagForConversations",value:(b=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.length>1e3)){e.next=2;break}return e.abrupt("return",Promise.reject(ro.CONVER_OUT_LIMIT_ERROR));case 2:return e.abrupt("return",this._engine.addTagForConversations(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"removeTagForConversations",value:(S=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagForConversations(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"removeTagsForConversation",value:(C=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagsForConversation(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"getConversationListByTag",value:(I=Tt(regeneratorRuntime.mark((function e(t,n,r,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getConversationListByTag(t,n,r,i));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return I.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(R=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUnreadCountByTag(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(T=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setConversationStatusInTag(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return T.apply(this,arguments)})},{key:"getTagsForConversation",value:(E=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagsForConversation(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"callExtra",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,[e].concat(r))}},{key:"clearConversations",value:(_=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._engine.clearConversations(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Hs.error(e)}}))}},{key:"addToBlacklist",value:(m=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.addToBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"removeFromBlacklist",value:(y=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeFromBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"getBlacklist",value:(v=Tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklist());case 1:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"getBlacklistStatus",value:(p=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklistStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"insertMessage",value:(g=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.insertMessage(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return g.apply(this,arguments)})},{key:"deleteMessages",value:(d=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.deleteMessages(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(f=Tt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.length>4&&void 0!==o[4]?o[4]:"",e.abrupt("return",this._engine.deleteMessagesByTimestamp(t,n,r,i,s));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return f.apply(this,arguments)})},{key:"clearMessages",value:(h=Tt(regeneratorRuntime.mark((function e(t,n){var r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:"",e.abrupt("return",this._engine.clearMessages(t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"getMessage",value:(l=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getMessage(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setMessageContent",value:(c=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageContent(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return c.apply(this,arguments)})},{key:"setMessageSearchField",value:(u=Tt(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSearchField(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"setMessageSentStatus",value:(a=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSentStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(o=Tt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageReceivedStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"setUserStatus",value:(s=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribeUserStatus",value:(i=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.subscribeUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserStatus",value:(r=Tt(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchConversationByContent",value:(n=Tt(regeneratorRuntime.mark((function e(t){var n,r,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:[],r=s.length>2&&void 0!==s[2]?s[2]:"",i=s.length>3?s[3]:void 0,e.abrupt("return",this._engine.searchConversationByContent(t,n,r,i));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"searchMessageByContent",value:(t=Tt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,o,a));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,o){return t.apply(this,arguments)})},{key:"getUnreadMentionedMessages",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getUnreadMentionedMessages(e,t,n)}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.clearUnreadCountByTimestamp(e,t,n,r)}},{key:"getConversationNotificationStatus",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationNotificationStatus(e,t,n)}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,s)}},{key:"joinRTCRoom",value:function(e,t,n){return this._engine.joinRTCRoom(e,t,n)}},{key:"quitRTCRoom",value:function(e){return this._engine.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._engine.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._engine.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._engine.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._engine.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._engine.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._engine.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.setRTCTotalRes(e,t,n,r,i)}},{key:"getRTCData",value:function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._engine.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._engine.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._engine.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._engine.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._engine.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)}}],[{key:"init",value:function(t,n){return Hs.setLogLevel(n.logLevel),Hs.setLogStdout(n.logStdout),(n.indexDBSwitch||Fs(n.indexDBSwitch))&&fs.init(),Hs.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Hs.error("Repeat initialize!"),this._context):(Hs.warn("RCEngine Commit:","3e5a7cf4e97602af42b8933af7de690b0db08c21"),this._context=new e(t,n),Hs.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(Hg=e.TagChangeType||(e.TagChangeType={}))[Hg.add=1]="add",Hg[Hg.update=2]="update",Hg[Hg.delete=3]="delete";e.AEngine=zd,e.ANavi=ng,e.APIContext=Wg,e.AppStorage=pn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=bo,e.ChatroomEntryType=yo,e.ChatroomMemberChangeType=To,e.CometChannel=Jd,e.ConnectResultCode=oo,e.ConnectionStatus=so,e.ConversationType=Os,e.DelayTimer=da,e.ErrorCode=ro,e.EventEmitter=Xs,e.FileType=As,e.IM_COMET_PULLMSG_TIMEOUT=45e3,e.IM_PING_INTERVAL_TIME=15e3,e.IM_PING_MIN_TIMEOUT=2e3,e.IM_PING_TIMEOUT=15e3,e.IM_SIGNAL_TIMEOUT=un,e.Logger=Gs,e.MAX_MESSAGE_CONTENT_BYTES=cn,e.MINI_COMET_CONNECT_URIS=an,e.MINI_SOCKET_CONNECT_URIS=on,e.MentionedType=fo,e.MessageDirection=to,e.MessageType=uo,e.NAVI_CACHE_DURATION=nn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=lo,e.PING_REQ_TIMEOUT=5e3,e.PUBLIC_CLOUD_NAVI_URIS=sn,e.PluginContext=Vg,e.RCAssertError=No,e.RTCPluginContext=Bg,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=hn,e.STATUS_MESSAGE=fn,e.STORAGE_ROOT_KEY=ln,e.UploadMethod=po,e.WEB_SOCKET_TIMEOUT=rn,e.WebSocketChannel=Wd,e.appendUrl=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},e.assert=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!Oo(e,t,n,r))throw new No("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.cloneByJSON=ua,e.forEach=ia,e.formatConnectResponseCode=ha,e.getBrowser=la,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case As.IMAGE:t="image/jpeg";break;case As.AUDIO:t="audio/amr";break;case As.VIDEO:t="video/3gpp";break;case As.SIGHT:t="video/mpeg4";break;case As.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=Xo,e.indexOf=oa,e.isArray=Us,e.isArrayBuffer=Ps,e.isBoolean=xs,e.isFunction=Bs,e.isHttpUrl=function(e){return Ms(e)&&/https?:\/\//.test(e)},e.isInObject=aa,e.isInclude=function(e,t){return-1!==oa(e,t)},e.isNull=js,e.isNumber=Ls,e.isObject=Vs,e.isString=Ms,e.isUndefined=Fs,e.isValidChrmEntryKey=na,e.isValidChrmEntryValue=ra,e.isValidConversationType=function(e){return Ls(e)&&Object.prototype.hasOwnProperty.call(Os,e)},e.isValidFileType=function(e){return Ls(e)&&Object.prototype.hasOwnProperty.call(As,e)},e.map=sa,e.notEmptyArray=function(e){return Us(e)&&e.length>0},e.notEmptyObject=Ys,e.notEmptyString=Ds,e.pushConfigsToJSON=ea,e.pushJSONToConfigs=ta,e.todo=function(e){return new vn(e)},e.usingCppEngine=ca,e.validate=Oo,e.version="5.0.0-alpha.3",Object.defineProperty(e,"__esModule",{value:!0})}));
|