@rongcloud/engine 5.1.2 → 5.2.0

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.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},R=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")},T=function(e){return Object(m(e))},I={}.hasOwnProperty,C=function(e,t){return I.call(T(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=R(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,L={f:u?M:function(e,t,n){if(A(e),t=R(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}},U=u?function(e,t,n){return L.f(e,t,f(1,n))}:function(e,t,n){return e[t]=n,e},x=function(e,t){try{U(o,e,t)}catch(n){o[e]=t}return t},P="__core-js_shared__",D=o[P]||x(P,{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return V.call(e)});var B,F,K,j=D.inspectSource,q=o.WeakMap,Y="function"==typeof q&&/native code/.test(j(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)"})})),G=0,W=Math.random(),Q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++G+W).toString(36)},J=H("keys"),z=function(e){return J[e]||(J[e]=Q(e))},Z={},X="Object already initialized",$=o.WeakMap;if(Y){var ee=D.state||(D.state=new $),te=ee.get,ne=ee.has,re=ee.set;B=function(e,t){if(ne.call(ee,e))throw new TypeError(X);return t.facade=e,re.call(ee,e,t),t},F=function(e){return te.call(ee,e)||{}},K=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(X);return t.facade=e,U(e,ie,t),t},F=function(e){return C(e,ie)?e[ie]:{}},K=function(e){return C(e,ie)}}var se={set:B,get:F,has:K,enforce:function(e){return K(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")||U(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:U(e,t,i)):c?e[t]=i:x(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||j(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,Re=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},Te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ie=Te.concat("length","prototype"),Ce={f:Object.getOwnPropertyNames||function(e){return Re(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=L.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==Le||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",Le=Oe.POLYFILL="P",Ue=Oe,xe=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]||x(u,{}):(o[u]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=xe(n,r))&&a.value:n[r],!Ue(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;we(s,i)}(e.sham||i&&i.sham)&&U(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,Ke=H("native-string-replace",String.prototype.replace),je=Fe,qe=function(){var e=/a/,t=/b*/g;return Fe.call(e,"a"),Fe.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ye=Be.UNSUPPORTED_Y||Be.BROKEN_CARET,He=void 0!==/()??/.exec("")[1];(qe||He||Ye)&&(je=function(e){var t,n,r,i,s=this,o=Ye&&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&&Ke.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var Ge=je;Pe({target:"RegExp",proto:!0,forced:/./.exec!==Ge},{exec:Ge});var We,Qe,Je="process"==p(o.process),ze=ce("navigator","userAgent")||"",Ze=o.process,Xe=Ze&&Ze.versions,$e=Xe&&Xe.v8;$e?Qe=(We=$e.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&&U(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 Ge.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 Rt(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 Tt(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 Lt(e){var t="function"==typeof Map?new Map:void 0;return(Lt=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 Ut(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Ut(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 xt(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 Kt(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 Kt(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)?Kt(e,t):void 0}}function Kt(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 jt=Array.isArray||function(e){return"Array"==p(e)},qt=function(e,t,n){var r=R(t);r in e?L.f(e,r,f(0,n)):e[r]=n},Yt=ot("species"),Ht=function(e,t){var n;return jt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!jt(n.prototype)?E(n)&&null===(n=n[Yt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Gt=ot("species"),Wt=function(e){return et>=51||!a((function(){var t=[];return(t.constructor={})[Gt]=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})),Xt=Wt("concat"),$t=function(e){if(!E(e))return!1;var t=e[Qt];return void 0!==t?!!t:jt(e)};Pe({target:"Array",proto:!0,forced:!Zt||!Xt},{concat:function(e){var t,n,r,i,s,o=T(this),a=Ht(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if($t(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=5e3,on=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],an=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],un=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],cn=3e4,ln=131072,hn="RCV4-",fn={"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},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},dn=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(en=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",en.COMET="comet";var gn=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},pn=function(){function e(t){Tt(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}(),vn=function(){function e(t,n){Tt(this,e);var r=n?"".concat(hn).concat(n):hn;this._rootStorage=gn(t);var i=this._rootStorage.get(r)||{};this._cache=new pn(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}(),yn=function(e){Nt(n,e);var t=Pt(n);function n(e){return Tt(this,n),t.call(this,"TODO => ".concat(e))}return n}(Lt(Error)),mn=Wt("slice"),_n=ot("species"),En=[].slice,Rn=Math.max;Pe({target:"Array",proto:!0,forced:!mn},{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(jt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!jt(n.prototype)?E(n)&&null===(n=n[_n])&&(n=void 0):n=void 0,n===Array||void 0===n))return En.call(s,a,u);for(r=new(void 0===n?Array:n)(Rn(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,In="".replace,Cn=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Sn=/\$([$&'`]|\d{1,2})/g,bn=function(e,t,n,r,i,s){var o=n+e.length,a=r.length,u=Sn;return void 0!==i&&(i=T(i),u=Cn),In.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}))},wn=Math.max,Nn=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=wn(Nn(fe(g.index),c.length),0),R=[],T=1;T<g.length;T++)R.push(void 0===(p=g[T])?p:String(p));var I=g.groups;if(l){var C=[_].concat(R,E,c);void 0!==I&&C.push(I);var S=String(r.apply(void 0,C))}else S=bn(_,c,E,R,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var On=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},kn=function(e,t,n){if(On(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)}},An=[].push,Mn=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=T(u),p=y(g),v=kn(c,l,3),m=ge(p.length),_=0,E=h||Ht,R=t?E(u,m):n||o?E(u,0):void 0;m>_;_++)if((a||_ in p)&&(d=v(f=p[_],_,g),e))if(t)R[_]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:An.call(R,f)}else switch(e){case 4:return!1;case 7:An.call(R,f)}return s?-1:r||i?i:R}},Ln={forEach:Mn(0),map:Mn(1),filter:Mn(2),some:Mn(3),every:Mn(4),find:Mn(5),findIndex:Mn(6),filterOut:Mn(7)},Un=Ln.filter,xn=Wt("filter");Pe({target:"Array",proto:!0,forced:!xn},{filter:function(e){return Un(this,e,arguments.length>1?arguments[1]:void 0)}});var Pn=Ln.map,Dn=Wt("map");Pe({target:"Array",proto:!0,forced:!Dn},{map:function(e){return Pn(this,e,arguments.length>1?arguments[1]:void 0)}});var Vn=Object.keys||function(e){return Re(e,Te)},Bn=a((function(){Vn(1)}));Pe({target:"Object",stat:!0,forced:Bn},{keys:function(e){return Vn(T(e))}});var Fn=function(e,t){var n=[][e];return!!n&&a((function(){n.call(null,t||function(){throw 1},1)}))},Kn=[].join,jn=y!=Object,qn=Fn("join",",");Pe({target:"Array",proto:!0,forced:jn||!qn},{join:function(e){return Kn.call(_(this),void 0===e?",":e)}});var Yn=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()}))},Hn=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,R=E&&E(E(O([])));R&&R!==n&&r.call(R,s)&&(_=R);var T=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=T.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(T),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(T),u(T,a,"Generator"),T[s]=function(){return this},T.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 Wn=L.f,Qn=Function.prototype,Jn=Qn.toString,zn=/^\s*function ([^ (]*)/,Zn="name";u&&!(Zn in Qn)&&Wn(Qn,Zn,{configurable:!0,get:function(){try{return Jn.call(this).match(zn)[1]}catch(e){return""}}});var Xn,$n=u?Object.defineProperties:function(e,t){A(e);for(var n,r=Vn(t),i=r.length,s=0;i>s;)L.f(e,n=r[s++],t[n]);return e},er=ce("document","documentElement"),tr=z("IE_PROTO"),nr=function(){},rr=function(e){return"<script>"+e+"</"+"script>"},ir=function(){try{Xn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;ir=Xn?function(e){e.write(rr("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Xn):((t=w("iframe")).style.display="none",er.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(rr("document.F=Object")),e.close(),e.F);for(var n=Te.length;n--;)delete ir.prototype[Te[n]];return ir()};Z[tr]=!0;var sr=Object.create||function(e,t){var n;return null!==e?(nr.prototype=A(e),n=new nr,nr.prototype=null,n[tr]=e):n=ir(),void 0===t?n:$n(n,t)},or=ot("unscopables"),ar=Array.prototype;null==ar[or]&&L.f(ar,or,{configurable:!0,value:sr(null)});var ur,cr,lr=function(e){ar[or][e]=!0},hr=_e.includes;Pe({target:"Array",proto:!0},{includes:function(e){return hr(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("includes"),e.LogLevel=void 0,(ur=e.LogLevel||(e.LogLevel={}))[ur.LOG=0]="LOG",ur[ur.DEBUG=0]="DEBUG",ur[ur.INFO=1]="INFO",ur[ur.WARN=2]="WARN",ur[ur.ERROR=3]="ERROR",ur[ur.FATAL=4]="FATAL",ur[ur.NONE=1e3]="NONE",e.LogType=void 0,(cr=e.LogType||(e.LogType={})).IM="IM",cr.RTC="RTC";var fr={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},dr=Ln.forEach,gr=Fn("forEach")?[].forEach:function(e){return dr(this,e,arguments.length>1?arguments[1]:void 0)};for(var pr in fr){var vr=o[pr],yr=vr&&vr.prototype;if(yr&&yr.forEach!==gr)try{U(yr,"forEach",gr)}catch(e){yr.forEach=gr}}var mr={};mr[ot("toStringTag")]="z";var _r="[object z]"===String(mr),Er=ot("toStringTag"),Rr="Arguments"==p(function(){return arguments}()),Tr=_r?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),Er))?n:Rr?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Ir=_r?{}.toString:function(){return"[object "+Tr(this)+"]"};_r||oe(Object.prototype,"toString",Ir,{unsafe:!0});var Cr=o.Promise,Sr=function(e,t,n){for(var r in t)oe(e,r,t[r],n);return e},br=L.f,wr=ot("toStringTag"),Nr=function(e,t,n){e&&!C(e=n?e:e.prototype,wr)&&br(e,wr,{configurable:!0,value:t})},Or=ot("species"),kr=function(e){var t=ce(e),n=L.f;u&&t&&!t[Or]&&n(t,Or,{configurable:!0,get:function(){return this}})},Ar=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Mr={},Lr=ot("iterator"),Ur=Array.prototype,xr=function(e){return void 0!==e&&(Mr.Array===e||Ur[Lr]===e)},Pr=ot("iterator"),Dr=function(e){if(null!=e)return e[Pr]||e["@@iterator"]||Mr[Tr(e)]},Vr=function(e){var t=e.return;if(void 0!==t)return A(t.call(e)).value},Br=function(e,t){this.stopped=e,this.result=t},Fr=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=kn(t,l,1+h+d),p=function(e){return r&&Vr(r),new Br(!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=Dr(e)))throw TypeError("Target is not iterable");if(xr(i)){for(s=0,o=ge(e.length);o>s;s++)if((a=v(e[s]))&&a instanceof Br)return a;return new Br(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{a=v(c.value)}catch(e){throw Vr(r),e}if("object"==typeof a&&a&&a instanceof Br)return a}return new Br(!1)},Kr=ot("iterator"),jr=!1;try{var qr=0,Yr={next:function(){return{done:!!qr++}},return:function(){jr=!0}};Yr[Kr]=function(){return this},Array.from(Yr,(function(){throw 2}))}catch(e){}var Hr,Gr,Wr,Qr=function(e,t){if(!t&&!jr)return!1;var n=!1;try{var r={};r[Kr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Jr=ot("species"),zr=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[Jr])?t:On(n)},Zr=/(?:iphone|ipod|ipad).*applewebkit/i.test(ze),Xr=o.location,$r=o.setImmediate,ei=o.clearImmediate,ti=o.process,ni=o.MessageChannel,ri=o.Dispatch,ii=0,si={},oi="onreadystatechange",ai=function(e){if(si.hasOwnProperty(e)){var t=si[e];delete si[e],t()}},ui=function(e){return function(){ai(e)}},ci=function(e){ai(e.data)},li=function(e){o.postMessage(e+"",Xr.protocol+"//"+Xr.host)};$r&&ei||($r=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return si[++ii]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Hr(ii),ii},ei=function(e){delete si[e]},Je?Hr=function(e){ti.nextTick(ui(e))}:ri&&ri.now?Hr=function(e){ri.now(ui(e))}:ni&&!Zr?(Wr=(Gr=new ni).port2,Gr.port1.onmessage=ci,Hr=kn(Wr.postMessage,Wr,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&Xr&&"file:"!==Xr.protocol&&!a(li)?(Hr=li,o.addEventListener("message",ci,!1)):Hr=oi in w("script")?function(e){er.appendChild(w("script")).onreadystatechange=function(){er.removeChild(this),ai(e)}}:function(e){setTimeout(ui(e),0)});var hi,fi,di,gi,pi,vi,yi,mi,_i={set:$r,clear:ei},Ei=/web0s(?!.*chrome)/i.test(ze),Ri=k.f,Ti=_i.set,Ii=o.MutationObserver||o.WebKitMutationObserver,Ci=o.document,Si=o.process,bi=o.Promise,wi=Ri(o,"queueMicrotask"),Ni=wi&&wi.value;Ni||(hi=function(){var e,t;for(Je&&(e=Si.domain)&&e.exit();fi;){t=fi.fn,fi=fi.next;try{t()}catch(e){throw fi?gi():di=void 0,e}}di=void 0,e&&e.enter()},Zr||Je||Ei||!Ii||!Ci?bi&&bi.resolve?(yi=bi.resolve(void 0),mi=yi.then,gi=function(){mi.call(yi,hi)}):gi=Je?function(){Si.nextTick(hi)}:function(){Ti.call(o,hi)}:(pi=!0,vi=Ci.createTextNode(""),new Ii(hi).observe(vi,{characterData:!0}),gi=function(){vi.data=pi=!pi}));var Oi,ki,Ai,Mi,Li=Ni||function(e){var t={fn:e,next:void 0};di&&(di.next=t),fi||(fi=t,gi()),di=t},Ui=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=On(t),this.reject=On(n)},xi={f:function(e){return new Ui(e)}},Pi=function(e,t){if(A(e),E(t)&&t.constructor===e)return t;var n=xi.f(e);return(0,n.resolve)(t),n.promise},Di=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Vi=_i.set,Bi=ot("species"),Fi="Promise",Ki=se.get,ji=se.set,qi=se.getterFor(Fi),Yi=Cr,Hi=o.TypeError,Gi=o.document,Wi=o.process,Qi=ce("fetch"),Ji=xi.f,zi=Ji,Zi=!!(Gi&&Gi.createEvent&&o.dispatchEvent),Xi="function"==typeof PromiseRejectionEvent,$i="unhandledrejection",es=Ue(Fi,(function(){if(!(j(Yi)!==String(Yi))){if(66===et)return!0;if(!Je&&!Xi)return!0}if(et>=51&&/native code/.test(Yi))return!1;var e=Yi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Bi]=t,!(e.then((function(){}))instanceof t)})),ts=es||!Qr((function(e){Yi.all(e).catch((function(){}))})),ns=function(e){var t;return!(!E(e)||"function"!=typeof(t=e.then))&&t},rs=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Li((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&&as(e),e.rejection=1),!0===l?o=r:(d&&d.enter(),o=l(r),d&&(d.exit(),u=!0)),o===c.promise?f(Hi("Promise-chain cycle")):(a=ns(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&&ss(e)}))}},is=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},!Xi&&(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)},ss=function(e){Vi.call(o,(function(){var t,n=e.facade,r=e.value;if(os(e)&&(t=Di((function(){Je?Wi.emit("unhandledRejection",r,n):is($i,n,r)})),e.rejection=Je||os(e)?2:1,t.error))throw t.value}))},os=function(e){return 1!==e.rejection&&!e.parent},as=function(e){Vi.call(o,(function(){var t=e.facade;Je?Wi.emit("rejectionHandled",t):is("rejectionhandled",t,e.value)}))},us=function(e,t,n){return function(r){e(t,r,n)}},cs=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,rs(e,!0))},ls=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Hi("Promise can't be resolved itself");var r=ns(t);r?Li((function(){var n={done:!1};try{r.call(t,us(ls,n,e),us(cs,n,e))}catch(t){cs(n,t,e)}})):(e.value=t,e.state=1,rs(e,!1))}catch(t){cs({done:!1},t,e)}}};es&&(Yi=function(e){Ar(this,Yi,Fi),On(e),Oi.call(this);var t=Ki(this);try{e(us(ls,t),us(cs,t))}catch(e){cs(t,e)}},(Oi=function(e){ji(this,{type:Fi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Sr(Yi.prototype,{then:function(e,t){var n=qi(this),r=Ji(zr(this,Yi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Je?Wi.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&rs(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),ki=function(){var e=new Oi,t=Ki(e);this.promise=e,this.resolve=us(ls,t),this.reject=us(cs,t)},xi.f=Ji=function(e){return e===Yi||e===Ai?new ki(e):zi(e)},"function"==typeof Cr&&(Mi=Cr.prototype.then,oe(Cr.prototype,"then",(function(e,t){var n=this;return new Yi((function(e,t){Mi.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Qi&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Pi(Yi,Qi.apply(o,arguments))}}))),Pe({global:!0,wrap:!0,forced:es},{Promise:Yi}),Nr(Yi,Fi,!1),kr(Fi),Ai=ce(Fi),Pe({target:Fi,stat:!0,forced:es},{reject:function(e){var t=Ji(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Fi,stat:!0,forced:es},{resolve:function(e){return Pi(this,e)}}),Pe({target:Fi,stat:!0,forced:ts},{all:function(e){var t=this,n=Ji(t),r=n.resolve,i=n.reject,s=Di((function(){var n=On(t.resolve),s=[],o=0,a=1;Fr(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=Ji(t),r=n.reject,i=Di((function(){var i=On(t.resolve);Fr(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var hs="RC_Logs";function fs(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(hs),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,hs,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var ds=function(){function e(){Tt(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._db&&(e._db.onclose=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has unexpectedly closed."),t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening error."),t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening aborted."),t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e._db=t.target.result,fs(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();ds._db=null;var gs=ot("match"),ps=function(e){var t;return E(e)&&(void 0!==(t=e[gs])?!!t:"RegExp"==p(e))},vs=Be.UNSUPPORTED_Y,ys=[].push,ms=Math.min,_s=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?_s:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!ps(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=Ge.call(h,r))&&!((o=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&ys.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=zr(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(vs?"g":"y"),h=new u(vs?"^(?:"+o.source+")":o,l),f=void 0===i?_s: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=vs?0:g;var v,y=mt(h,vs?a.slice(g):a);if(null===y||(v=ms(ge(h.lastIndex+(vs?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}]}),vs);var Es="toString",Rs=RegExp.prototype,Ts=Rs.toString,Is=a((function(){return"/a/b"!=Ts.call({source:"a",flags:"b"})})),Cs=Ts.name!=Es;(Is||Cs)&&oe(RegExp.prototype,Es,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Rs)?De.call(e):n)}),{unsafe:!0});var Ss,bs=function(e,t){return e+Math.floor(Math.random()*(t-e))},ws=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)}))},Ns=function(){var e=ws();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"}(Ss||(Ss={}));var Os,ks=Ss;!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"}(Os||(Os={}));var As,Ms=Os,Ls=function(e){return"string"==typeof e},Us=function(e){return"boolean"==typeof e},xs=function(e){return"number"==typeof e&&!isNaN(e)},Ps=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ds=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Vs=function(e){return Ls(e)&&e.length>0},Bs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Fs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Ks=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},js=function(e){return"[object Null]"===Object.prototype.toString.call(e)},qs=function(e){for(var t in e)return!0;return!1},Ys={};console&&(St(As={},e.LogLevel.DEBUG,console.debug.bind(console)),St(As,e.LogLevel.INFO,console.info.bind(console)),St(As,e.LogLevel.WARN,console.warn.bind(console)),St(As,e.LogLevel.ERROR,console.error.bind(console)),St(As,e.LogLevel.FATAL,console.log.bind(console)),Ys=As);var Hs=function(e){return Ls(e)||xs(e)||Ks(e)||Us(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){Tt(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){if(Ys[e]){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];(n=Ys)[e].apply(n,["".concat(t,":")].concat(i))}}},{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();Hn(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||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=Rt(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=ds.getInstance())){e.next=14;break}return e.next=6,r.addList(hs,n);case 6:return i=e.sent,e.next=9,r.getCount(hs,"time");case 9:return e.sent>1e5&&r.removeFirstData(hs,"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(t>e.LogLevel.DEBUG&&this.__pushLocalLog(t,r.map(Hs).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(Hs).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=Ns(),Gs.userId="";var Ws=new Gs("RCLog"),Qs=Wt("splice"),Js=Math.max,zs=Math.min,Zs=9007199254740991,Xs="Maximum allowed length exceeded";Pe({target:"Array",proto:!0,forced:!Qs},{splice:function(e,t){var n,r,i,s,o,a,u=T(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=zs(Js(fe(t),0),c-l)),c+n-r>Zs)throw TypeError(Xs);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,eo=function(){function e(){Tt(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){Ws.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 to,no=$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.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",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_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",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=35021]="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",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(to||(to={}));var ro,io=to;!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"}(ro||(ro={}));var so,oo=ro,ao={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,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};!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",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(so||(so={}));var uo,co=so;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(uo||(uo={}));var lo,ho=uo;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(lo||(lo={}));var fo,go=lo;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(fo||(fo={}));var po,vo=fo;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(po||(po={}));var yo,mo=po;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(yo||(yo={}));var _o,Eo=yo;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_o||(_o={}));var Ro,To,Io,Co=_o;e.RTCMode=void 0,(Ro=e.RTCMode||(e.RTCMode={}))[Ro.RTC=0]="RTC",Ro[Ro.LIVE=2]="LIVE",e.LiveType=void 0,(To=e.LiveType||(e.LiveType={}))[To.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",To[To.AUDIO=1]="AUDIO",e.LiveRole=void 0,(Io=e.LiveRole||(e.LiveRole={}))[Io.ANCHOR=1]="ANCHOR",Io[Io.AUDIENCE=2]="AUDIENCE";var So,bo,wo,No={"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,(So=e.RTCApiType||(e.RTCApiType={}))[So.ROOM=1]="ROOM",So[So.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(bo=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[bo.AnchorToViewer=1]="AnchorToViewer",bo[bo.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(wo=e.RTCJoinType||(e.RTCJoinType={}))[wo.KICK=0]="KICK",wo[wo.REFUSE=1]="REFUSE",wo[wo.COEXIST=2]="COEXIST";var Oo=function(e){var t=String(m(this)),n="",r=fe(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},ko=Math.ceil,Ao=function(e){return function(t,n,r){var i,s,o=String(m(t)),a=o.length,u=void 0===r?" ":String(r),c=ge(n);return c<=a||""==u?o:((s=Oo.call(u,ko((i=c-a)/u.length))).length>i&&(s=s.slice(0,i)),e?o+s:s+o)}},Mo={start:Ao(!1),end:Ao(!0)},Lo=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ze),Uo=Mo.start;Pe({target:"String",proto:!0,forced:Lo},{padStart:function(e){return Uo(this,e,arguments.length>1?arguments[1]:void 0)}});var xo,Po,Do={engine:"5.1.2"},Vo=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"add",value:function(e,t){Do[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Ws.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Do.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Do}}]),e}();e.AssertRules=void 0,(Po=e.AssertRules||(e.AssertRules={}))[Po.STRING=0]="STRING",Po[Po.ONLY_STRING=1]="ONLY_STRING",Po[Po.NUMBER=2]="NUMBER",Po[Po.BOOLEAN=3]="BOOLEAN",Po[Po.OBJECT=4]="OBJECT",Po[Po.ARRAY=5]="ARRAY",Po[Po.CALLBACK=6]="CALLBACK",Po[Po.CHANNEL_ID=7]="CHANNEL_ID";var Bo=(St(xo={},e.AssertRules.STRING,Vs),St(xo,e.AssertRules.ONLY_STRING,Ls),St(xo,e.AssertRules.NUMBER,xs),St(xo,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),St(xo,e.AssertRules.OBJECT,Bs),St(xo,e.AssertRules.ARRAY,Ps),St(xo,e.AssertRules.CALLBACK,(function(e){var t=!0;return Bs(e)||(t=!1),(e=e||{}).onSuccess&&!Fs(e.onSuccess)&&(t=!1),e.onError&&!Fs(e.onError)&&(t=!1),t})),St(xo,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ls(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),xo),Fo=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(Lt(Error)),Ko=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=Bo[n]||n;var i=r&&!n(t)||!r&&!(Ks(t)||null===t||n(t));return i&&Ws.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},jo=[].slice,qo=/MSIE .\./.test(ze),Yo=function(e){return function(t,n){var r=arguments.length>2,i=r?jo.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:qo},{setTimeout:Yo(o.setTimeout),setInterval:Yo(o.setInterval)});var Ho=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),Go=function(e,t,n){var r,i;return Ho&&"function"==typeof(r=t.constructor)&&r!==n&&E(i=r.prototype)&&i!==n.prototype&&Ho(e,i),e},Wo=L.f,Qo=Ce.f,Jo=se.enforce,zo=ot("match"),Zo=o.RegExp,Xo=Zo.prototype,$o=/a/g,ea=/a/g,ta=new Zo($o)!==$o,na=Be.UNSUPPORTED_Y;if(u&&Ue("RegExp",!ta||na||a((function(){return ea[zo]=!1,Zo($o)!=$o||Zo(ea)==ea||"/a/i"!=Zo($o,"i")})))){for(var ra=function(e,t){var n,r=this instanceof ra,i=ps(e),s=void 0===t;if(!r&&i&&e.constructor===ra&&s)return e;ta?i&&!s&&(e=e.source):e instanceof ra&&(s&&(t=De.call(e)),e=e.source),na&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Go(ta?new Zo(e,t):Zo(e,t),r?this:Xo,ra);na&&n&&(Jo(o).sticky=!0);return o},ia=function(e){e in ra||Wo(ra,e,{configurable:!0,get:function(){return Zo[e]},set:function(t){Zo[e]=t}})},sa=Qo(Zo),oa=0;sa.length>oa;)ia(sa[oa++]);Xo.constructor=ra,ra.prototype=Xo,oe(o,"RegExp",ra)}kr("RegExp");var aa,ua,ca,la=function(e){if(!Bs(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)},ha=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=ws(),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)},fa=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)},da=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){Ws.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},ga=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},pa=function(e){var t=e.length;return t<=4096&&t>=1},va=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Bs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Ps(e)||Ls(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)}()},ya=function(e,t){return va(e,(function(n,r){e[r]=t(n,r)})),e},ma=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return va(e,(function(e,r){t===e&&(n=r)})),n},_a=function(e,t){var n=[];return va(e,(function(e){n.push(e)})),-1!==ma(n,t)},Ea=function(e){return JSON.parse(JSON.stringify(e))},Ra=function(){return"undefined"!=typeof RCCppEngine},Ta=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"}},Ia=function(e){switch(e){case ao.SERVER_UNAVAILABLE:return io.SERVER_UNAVAILABLE;case ao.TOKEN_INCORRECT:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.REDIRECT:return io.RC_CONN_REDIRECTED;case ao.APP_BLOCK_OR_DELETE:return io.RC_CONN_APP_BLOCKED_OR_DELETED;case ao.BLOCK:return io.RC_CONN_USER_BLOCKED;case ao.TOKEN_EXPIRE:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.HOSTNAME_ERROR:return io.HOSTNAME_ERROR;case ao.HASOHTERSAMECLIENTONLINE:return io.HAS_OHTER_SAME_CLIENT_ON_LINE;case ao.APP_AUTH_NOT_PASS:return io.RC_APP_AUTH_NOT_PASS;case ao.OTP_USED:return io.RC_OTP_USED;case ao.PLATFORM_ERROR:return io.RC_PLATFORM_ERROR;default:return io.RC_NET_UNAVAILABLE}},Ca=function(e){var t={},n=JSON.parse(e);return va(n,(function(e,n){t[n]=e.v})),t},Sa={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Sa._delayTime=t-e},getTime:function(){var e=Sa._delayTime;return(new Date).getTime()-e}},ba=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},wa=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Na=z("IE_PROTO"),Oa=Object.prototype,ka=wa?Object.getPrototypeOf:function(e){return e=T(e),C(e,Na)?e[Na]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Oa:null},Aa=ot("iterator"),Ma=!1;[].keys&&("next"in(ca=[].keys())?(ua=ka(ka(ca)))!==Object.prototype&&(aa=ua):Ma=!0),(null==aa||a((function(){var e={};return aa[Aa].call(e)!==e})))&&(aa={}),C(aa,Aa)||U(aa,Aa,(function(){return this}));var La={IteratorPrototype:aa,BUGGY_SAFARI_ITERATORS:Ma},Ua=La.IteratorPrototype,xa=function(){return this},Pa=La.IteratorPrototype,Da=La.BUGGY_SAFARI_ITERATORS,Va=ot("iterator"),Ba="keys",Fa="values",Ka="entries",ja=function(){return this},qa=function(e,t,n,r,i,s,o){!function(e,t,n){var r=t+" Iterator";e.prototype=sr(Ua,{next:f(1,n)}),Nr(e,r,!1),Mr[r]=xa}(n,t,r);var a,u,c,l=function(e){if(e===i&&v)return v;if(!Da&&e in g)return g[e];switch(e){case Ba:case Fa:case Ka:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",d=!1,g=e.prototype,p=g[Va]||g["@@iterator"]||i&&g[i],v=!Da&&p||l(i),y="Array"==t&&g.entries||p;if(y&&(a=ka(y.call(new e)),Pa!==Object.prototype&&a.next&&(ka(a)!==Pa&&(Ho?Ho(a,Pa):"function"!=typeof a[Va]&&U(a,Va,ja)),Nr(a,h,!0))),i==Fa&&p&&p.name!==Fa&&(d=!0,v=function(){return p.call(this)}),g[Va]!==v&&U(g,Va,v),Mr[t]=v,i)if(u={values:l(Fa),keys:s?v:l(Ba),entries:l(Ka)},o)for(c in u)(Da||d||!(c in g))&&oe(g,c,u[c]);else Pe({target:t,proto:!0,forced:Da||d},u);return u},Ya="Array Iterator",Ha=se.set,Ga=se.getterFor(Ya),Wa=qa(Array,"Array",(function(e,t){Ha(this,{type:Ya,target:_(e),index:0,kind:t})}),(function(){var e=Ga(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");Mr.Arguments=Mr.Array,lr("keys"),lr("values"),lr("entries");var Qa="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Ja=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},za=Math.abs,Za=Math.pow,Xa=Math.floor,$a=Math.log,eu=Math.LN2,tu=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=za(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Xa($a(e)/eu),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},nu=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)},ru=function(e){for(var t=T(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},iu=Ce.f,su=L.f,ou=se.get,au=se.set,uu="ArrayBuffer",cu="DataView",lu="Wrong index",hu=o.ArrayBuffer,fu=hu,du=o.DataView,gu=du&&du.prototype,pu=Object.prototype,vu=o.RangeError,yu=tu,mu=nu,_u=function(e){return[255&e]},Eu=function(e){return[255&e,e>>8&255]},Ru=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]},Iu=function(e){return yu(e,23,4)},Cu=function(e){return yu(e,52,8)},Su=function(e,t){su(e.prototype,t,{get:function(){return ou(this)[t]}})},bu=function(e,t,n,r){var i=Ja(n),s=ou(e);if(i+t>s.byteLength)throw vu(lu);var o=ou(s.buffer).bytes,a=i+s.byteOffset,u=o.slice(a,a+t);return r?u:u.reverse()},wu=function(e,t,n,r,i,s){var o=Ja(n),a=ou(e);if(o+t>a.byteLength)throw vu(lu);for(var u=ou(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(Qa){if(!a((function(){hu(1)}))||!a((function(){new hu(-1)}))||a((function(){return new hu,new hu(1.5),new hu(NaN),hu.name!=uu}))){for(var Nu,Ou=(fu=function(e){return Ar(this,fu),new hu(Ja(e))}).prototype=hu.prototype,ku=iu(hu),Au=0;ku.length>Au;)(Nu=ku[Au++])in fu||U(fu,Nu,hu[Nu]);Ou.constructor=fu}Ho&&ka(gu)!==pu&&Ho(gu,pu);var Mu=new du(new fu(2)),Lu=gu.setInt8;Mu.setInt8(0,2147483648),Mu.setInt8(1,2147483649),!Mu.getInt8(0)&&Mu.getInt8(1)||Sr(gu,{setInt8:function(e,t){Lu.call(this,e,t<<24>>24)},setUint8:function(e,t){Lu.call(this,e,t<<24>>24)}},{unsafe:!0})}else fu=function(e){Ar(this,fu,uu);var t=Ja(e);au(this,{bytes:ru.call(new Array(t),0),byteLength:t}),u||(this.byteLength=t)},du=function(e,t,n){Ar(this,du,cu),Ar(e,fu,cu);var r=ou(e).byteLength,i=fe(t);if(i<0||i>r)throw vu("Wrong offset");if(i+(n=void 0===n?r-i:ge(n))>r)throw vu("Wrong length");au(this,{buffer:e,byteLength:n,byteOffset:i}),u||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},u&&(Su(fu,"byteLength"),Su(du,"buffer"),Su(du,"byteLength"),Su(du,"byteOffset")),Sr(du.prototype,{getInt8:function(e){return bu(this,1,e)[0]<<24>>24},getUint8:function(e){return bu(this,1,e)[0]},getInt16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return mu(bu(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return mu(bu(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){wu(this,1,e,_u,t)},setUint8:function(e,t){wu(this,1,e,_u,t)},setInt16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){wu(this,4,e,Iu,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){wu(this,8,e,Cu,t,arguments.length>2?arguments[2]:void 0)}});Nr(fu,uu),Nr(du,cu);var Uu={ArrayBuffer:fu,DataView:du},xu=Uu.ArrayBuffer,Pu=Uu.DataView,Du=xu.prototype.slice,Vu=a((function(){return!new xu(2).slice(1,void 0).byteLength}));Pe({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Vu},{slice:function(e,t){if(void 0!==Du&&void 0===t)return Du.call(A(this),e);for(var n=A(this).byteLength,r=ye(e,n),i=ye(void 0===t?n:t,n),s=new(zr(this,xu))(ge(i-r)),o=new Pu(this),a=new Pu(s),u=0;r<i;)a.setUint8(u++,o.getUint8(r++));return s}});var Bu,Fu=L.f,Ku=o.Int8Array,ju=Ku&&Ku.prototype,qu=o.Uint8ClampedArray,Yu=qu&&qu.prototype,Hu=Ku&&ka(Ku),Gu=ju&&ka(ju),Wu=Object.prototype,Qu=Wu.isPrototypeOf,Ju=ot("toStringTag"),zu=Q("TYPED_ARRAY_TAG"),Zu=Qa&&!!Ho&&"Opera"!==Tr(o.opera),Xu=!1,$u={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ec={BigInt64Array:8,BigUint64Array:8},tc=function(e){if(!E(e))return!1;var t=Tr(e);return C($u,t)||C(ec,t)};for(Bu in $u)o[Bu]||(Zu=!1);if((!Zu||"function"!=typeof Hu||Hu===Function.prototype)&&(Hu=function(){throw TypeError("Incorrect invocation")},Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu],Hu);if((!Zu||!Gu||Gu===Wu)&&(Gu=Hu.prototype,Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu].prototype,Gu);if(Zu&&ka(Yu)!==Gu&&Ho(Yu,Gu),u&&!C(Gu,Ju))for(Bu in Xu=!0,Fu(Gu,Ju,{get:function(){return E(this)?this[zu]:void 0}}),$u)o[Bu]&&U(o[Bu],zu,Bu);var nc={NATIVE_ARRAY_BUFFER_VIEWS:Zu,TYPED_ARRAY_TAG:Xu&&zu,aTypedArray:function(e){if(tc(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Ho){if(Qu.call(Hu,e))return e}else for(var t in $u)if(C($u,Bu)){var n=o[t];if(n&&(e===n||Qu.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(Ho){if(n)for(r in $u)(i=o[r])&&C(i,e)&&delete i[e];if(Hu[e]&&!n)return;try{return oe(Hu,e,n?t:Zu&&Ku[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(ec,t)},isTypedArray:tc,TypedArray:Hu,TypedArrayPrototype:Gu},rc=nc.NATIVE_ARRAY_BUFFER_VIEWS,ic=o.ArrayBuffer,sc=o.Int8Array,oc=!rc||!a((function(){sc(1)}))||!a((function(){new sc(-1)}))||!Qr((function(e){new sc,new sc(null),new sc(1.5),new sc(e)}),!0)||a((function(){return 1!==new sc(new ic(2),1,void 0).length})),ac=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},uc=nc.aTypedArrayConstructor,cc=function(e){var t,n,r,i,s,o,a=T(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Dr(a);if(null!=h&&!xr(h))for(o=(s=h.call(a)).next,a=[];!(i=o.call(s)).done;)a.push(i.value);for(l&&u>2&&(c=kn(c,arguments[2],2)),n=ge(a.length),r=new(uc(this))(n),t=0;n>t;t++)r[t]=l?c(a[t],t):a[t];return r},lc=i((function(e){var t=Ce.f,n=Ln.forEach,r=se.get,i=se.set,s=L.f,a=k.f,c=Math.round,l=o.RangeError,h=Uu.ArrayBuffer,d=Uu.DataView,g=nc.NATIVE_ARRAY_BUFFER_VIEWS,p=nc.TYPED_ARRAY_TAG,v=nc.TypedArray,y=nc.TypedArrayPrototype,m=nc.aTypedArrayConstructor,_=nc.isTypedArray,T="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=R(t,!0))?f(2,e[t]):a(e,t)},A=function(e,t,n){return!(N(e,t=R(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,L.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",R="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[R](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?oc&&(N=a((function(e,t,n,r){return Ar(e,N,m),Go(E(t)?w(t)?void 0!==r?new b(t,ac(n,f),r):void 0!==n?new b(t,ac(n,f)):new b(t):_(t)?S(N,t):cc.call(N,t):new b(Ja(t)),e,N)})),Ho&&Ho(N,v),n(t(b),(function(e){e in N||U(N,e,b[e])})),N.prototype=O):(N=a((function(e,t,n,r){Ar(e,N,m);var s,o,a,u=0,c=0;if(E(t)){if(!w(t))return _(t)?S(N,t):cc.call(N,t);s=t,c=ac(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=Ja(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++)})),Ho&&Ho(N,v),O=N.prototype=sr(y)),O.constructor!==N&&U(O,"constructor",N),p&&U(O,p,m),k[m]=N,Pe({global:!0,forced:N!=b,sham:!g},k),T in N||U(N,T,f),T in O||U(O,T,f),kr(m)}):e.exports=function(){}}));lc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var hc=Math.min,fc=[].copyWithin||function(e,t){var n=T(this),r=ge(n.length),i=ye(e,r),s=ye(t,r),o=arguments.length>2?arguments[2]:void 0,a=hc((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},dc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("copyWithin",(function(e,t){return fc.call(dc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var gc=Ln.every,pc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("every",(function(e){return gc(pc(this),e,arguments.length>1?arguments[1]:void 0)}));var vc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("fill",(function(e){return ru.apply(vc(this),arguments)}));var yc=nc.aTypedArrayConstructor,mc=function(e,t){for(var n=zr(e,e.constructor),r=0,i=t.length,s=new(yc(n))(i);i>r;)s[r]=t[r++];return s},_c=Ln.filter,Ec=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("filter",(function(e){var t=_c(Ec(this),e,arguments.length>1?arguments[1]:void 0);return mc(this,t)}));var Rc=Ln.find,Tc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("find",(function(e){return Rc(Tc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ic=Ln.findIndex,Cc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("findIndex",(function(e){return Ic(Cc(this),e,arguments.length>1?arguments[1]:void 0)}));var Sc=Ln.forEach,bc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("forEach",(function(e){Sc(bc(this),e,arguments.length>1?arguments[1]:void 0)}));var wc=_e.includes,Nc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("includes",(function(e){return wc(Nc(this),e,arguments.length>1?arguments[1]:void 0)}));var Oc=_e.indexOf,kc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("indexOf",(function(e){return Oc(kc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ac=ot("iterator"),Mc=o.Uint8Array,Lc=Wa.values,Uc=Wa.keys,xc=Wa.entries,Pc=nc.aTypedArray,Dc=nc.exportTypedArrayMethod,Vc=Mc&&Mc.prototype[Ac],Bc=!!Vc&&("values"==Vc.name||null==Vc.name),Fc=function(){return Lc.call(Pc(this))};Dc("entries",(function(){return xc.call(Pc(this))})),Dc("keys",(function(){return Uc.call(Pc(this))})),Dc("values",Fc,!Bc),Dc(Ac,Fc,!Bc);var Kc=nc.aTypedArray,jc=[].join;(0,nc.exportTypedArrayMethod)("join",(function(e){return jc.apply(Kc(this),arguments)}));var qc=Math.min,Yc=[].lastIndexOf,Hc=!!Yc&&1/[1].lastIndexOf(1,-0)<0,Gc=Fn("lastIndexOf"),Wc=Hc||!Gc?function(e){if(Hc)return Yc.apply(this,arguments)||0;var t=_(this),n=ge(t.length),r=n-1;for(arguments.length>1&&(r=qc(r,fe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Yc,Qc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("lastIndexOf",(function(e){return Wc.apply(Qc(this),arguments)}));var Jc=Ln.map,zc=nc.aTypedArray,Zc=nc.aTypedArrayConstructor;(0,nc.exportTypedArrayMethod)("map",(function(e){return Jc(zc(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Zc(zr(e,e.constructor)))(t)}))}));var Xc=function(e){return function(t,n,r,i){On(n);var s=T(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:Xc(!1),right:Xc(!0)},el=$c.left,tl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduce",(function(e){return el(tl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var nl=$c.right,rl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduceRight",(function(e){return nl(rl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var il=nc.aTypedArray,sl=nc.exportTypedArrayMethod,ol=Math.floor;sl("reverse",(function(){for(var e,t=this,n=il(t).length,r=ol(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var al=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("set",(function(e){al(this);var t=ac(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=T(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 ul=nc.aTypedArray,cl=nc.aTypedArrayConstructor,ll=[].slice;(0,nc.exportTypedArrayMethod)("slice",(function(e,t){for(var n=ll.call(ul(this),e,t),r=zr(this,this.constructor),i=0,s=n.length,o=new(cl(r))(s);s>i;)o[i]=n[i++];return o}),a((function(){new Int8Array(1).slice()})));var hl=Ln.some,fl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("some",(function(e){return hl(fl(this),e,arguments.length>1?arguments[1]:void 0)}));var dl=nc.aTypedArray,gl=[].sort;(0,nc.exportTypedArrayMethod)("sort",(function(e){return gl.call(dl(this),e)}));var pl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("subarray",(function(e,t){var n=pl(this),r=n.length,i=ye(e,r);return new(zr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ge((void 0===t?r:ye(t,r))-i))}));var vl=o.Int8Array,yl=nc.aTypedArray,ml=nc.exportTypedArrayMethod,_l=[].toLocaleString,El=[].slice,Rl=!!vl&&a((function(){_l.call(new vl(1))}));ml("toLocaleString",(function(){return _l.apply(Rl?El.call(yl(this)):yl(this),arguments)}),a((function(){return[1,2].toLocaleString()!=new vl([1,2]).toLocaleString()}))||!a((function(){vl.prototype.toLocaleString.call([1,2])})));var Tl=nc.exportTypedArrayMethod,Il=o.Uint8Array,Cl=Il&&Il.prototype||{},Sl=[].toString,bl=[].join;a((function(){Sl.call({})}))&&(Sl=function(){return bl.call(this)});var wl=Cl.toString!=Sl;Tl("toString",Sl,wl);var Nl=ot("iterator"),Ol=ot("toStringTag"),kl=Wa.values;for(var Al in fr){var Ml=o[Al],Ll=Ml&&Ml.prototype;if(Ll){if(Ll[Nl]!==kl)try{U(Ll,Nl,kl)}catch(e){Ll[Nl]=kl}if(Ll[Ol]||U(Ll,Ol,Al),fr[Al])for(var Ul in Wa)if(Ll[Ul]!==Wa[Ul])try{U(Ll,Ul,Wa[Ul])}catch(e){Ll[Ul]=Wa[Ul]}}}var xl=Object.assign,Pl=Object.defineProperty,Dl=!xl||a((function(){if(u&&1!==xl({b:1},xl(Pl({},"a",{enumerable:!0,get:function(){Pl(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!=xl({},e)[n]||Vn(xl({},t)).join("")!=r}))?function(e,t){for(var n=T(e),r=arguments.length,i=1,s=Se.f,o=h.f;r>i;)for(var a,c=y(arguments[i++]),l=s?Vn(c).concat(s(c)):Vn(c),f=l.length,d=0;f>d;)a=l[d++],u&&!o.call(c,a)||(n[a]=c[a]);return n}:xl;Pe({target:"Object",stat:!0,forced:Object.assign!==Dl},{assign:Dl});var Vl,Bl,Fl,Kl,jl,ql="[\t\n\v\f\r                 \u2028\u2029\ufeff]",Yl=RegExp("^"+ql+ql+"*"),Hl=RegExp(ql+ql+"*$"),Gl=function(e){return function(t){var n=String(m(t));return 1&e&&(n=n.replace(Yl,"")),2&e&&(n=n.replace(Hl,"")),n}},Wl={start:Gl(1),end:Gl(2),trim:Gl(3)},Ql=Ce.f,Jl=k.f,zl=L.f,Zl=Wl.trim,Xl="Number",$l=o.Number,eh=$l.prototype,th=p(sr(eh))==Xl,nh=function(e){var t,n,r,i,s,o,a,u,c=R(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=Zl(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(Ue(Xl,!$l(" 0o1")||!$l("0b1")||$l("+0x1"))){for(var rh,ih=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof ih&&(th?a((function(){eh.valueOf.call(n)})):p(n)!=Xl)?Go(new $l(nh(t)),n,ih):nh(t)},sh=u?Ql($l):"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(","),oh=0;sh.length>oh;oh++)C($l,rh=sh[oh])&&!C(ih,rh)&&zl(ih,rh,Jl($l,rh));ih.prototype=eh,eh.constructor=ih,oe(o,Xl,ih)}!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"}(Vl||(Vl={})),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"}(Bl||(Bl={})),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"}(Fl||(Fl={})),function(e){e.PUB="pub",e.QUERY="qry"}(Kl||(Kl={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(jl||(jl={}));var ah,uh=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]:Vl.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tt(this,e),this._retain=!1,this.qos=Vl.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}(),ch=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ls(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}(),lh=function(){function e(t){Tt(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:"read2Byte",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)}},{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 ch.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),hh=function(){function e(){Tt(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=ch.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),fh="UpStreamMessage",dh="PushExtra",gh="DownStreamMessage",ph="DownStreamMessages",vh="SessionsAttQryInput",yh="SessionsAttOutput",mh="SyncRequestMsg",_h="ChrmPullMsg",Eh="NotifyMsg",Rh="HistoryMsgInput",Th="HistoryMsgOuput",Ih="RelationQryInput",Ch="RelationsOutput",Sh="DeleteSessionsInput",bh="SessionInfo",wh="DeleteSessionsOutput",Nh="RelationsInput",Oh="DeleteMsgInput",kh="CleanHisMsgInput",Ah="SessionMsgReadInput",Mh="ChrmInput",Lh="ChrmOutput",Uh="QueryChatRoomInfoInput",xh="QueryChatRoomInfoOutput",Ph="RtcInput",Dh="RtcUserListOutput",Vh="SetUserStatusInput",Bh="RtcSetDataInput",Fh="RtcUserSetDataInput",Kh="RtcDataInput",jh="RtcSetOutDataInput",qh="MCFollowInput",Yh="RtcTokenOutput",Hh="RtcQryOutput",Gh="RtcQryUserOutDataInput",Wh="RtcUserOutDataOutput",Qh="RtcQueryListInput",Jh="RtcRoomInfoOutput",zh="RtcValueInfo",Zh="RtcKeyDeleteInput",Xh="GetQNupTokenInput",$h="GetQNupTokenOutput",ef="GetQNdownloadUrlInput",tf="GetDownloadUrlInput",nf="GetQNdownloadUrlOutput",rf="GetDownloadUrlOutput",sf="SetChrmKV",of="SetChrmKVS",af="DeleteChrmKVS",uf="ChrmKVOutput",cf="ChrmKVSOutput",lf="ChrmKVSOutputEntity",hf="QueryChrmKV",ff="SetUserSettingInput",df="SetUserSettingOutput",gf="PullUserSettingInput",pf="PullUserSettingOutput",vf="UserSettingNotification",yf="SessionReq",mf="SessionStates",_f="SessionState",Ef="SessionStateItem",Rf="SessionStateModifyReq",Tf="SessionStateModifyResp",If="GrpReadReceiptMsg",Cf="GrpReadReceiptQryReq",Sf="GrpReadReceiptQryResp",bf="GrpMsgReadUser",wf="SessionTagAddInput",Nf="SessionTagItem",Of="SessionTagDelInput",kf="SessionDisTagReq",Af="ReportSDKInput",Mf="ReportSDKOutput",Lf="RtcNotifyMsg",Uf="RtcPullKV",xf="RtcKVOutput",Pf="RtcQueryUserJoinedInput",Df="RtcQueryUserJoinedOutput",Vf="RtcViewerJoinedOutput",Bf="RtcInviteInput",Ff="RtcCancelInviteInput",Kf="RtcInviteAnswerInput",jf="RtcEndInviteInput",qf=(St(ah={},fh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),St(ah,ph,["list","syncTime","finished"]),St(ah,gh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),St(ah,dh,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),St(ah,vh,["nothing"]),St(ah,yh,["inboxTime","sendboxTime","totalUnreadCount"]),St(ah,mh,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),St(ah,_h,["syncTime","count"]),St(ah,Eh,["type","time","chrmId"]),St(ah,Rh,["targetId","time","count","order","busChannel"]),St(ah,Th,["list","syncTime","hasMsg"]),St(ah,Ih,["type","count","startTime","order"]),St(ah,Ch,["info"]),St(ah,Sh,["sessions"]),St(ah,bh,["type","channelId","busChannel"]),St(ah,wh,["nothing"]),St(ah,Nh,["type","msg","count","busChannel","startTime","endTime"]),St(ah,Oh,["type","conversationId","msgs","busChannel"]),St(ah,kh,["targetId","dataTime","conversationType","busChannel"]),St(ah,Ah,["type","msgTime","channelId"]),St(ah,Mh,["nothing"]),St(ah,Lh,["nothing","sessionId","joinTime"]),St(ah,Uh,["count","order"]),St(ah,xh,["userTotalNums","userInfos"]),St(ah,Xh,["type","key","httpMethod","queryString"]),St(ah,ef,["type","key","fileName"]),St(ah,tf,["type","key","fileName"]),St(ah,$h,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),St(ah,nf,["downloadUrl"]),St(ah,rf,["downloadUrl"]),St(ah,sf,["entry","bNotify","notification","type"]),St(ah,of,["entry","bNotify","notification","type"]),St(ah,af,["entry","bNotify","notification","type"]),St(ah,uf,["entries","bFullUpdate","syncTime"]),St(ah,cf,["timestamp","errorKeys"]),St(ah,lf,["key","errorCode"]),St(ah,hf,["timestamp"]),St(ah,ff,["version","value"]),St(ah,df,["version","reserve"]),St(ah,gf,["version","reserve"]),St(ah,pf,["items","version"]),St(ah,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),St(ah,yf,["time"]),St(ah,mf,["version","state"]),St(ah,_f,["type","channelId","time","stateItem","busChannel"]),St(ah,Ef,["sessionStateType","value","tags"]),St(ah,Rf,["version","state"]),St(ah,Tf,["version"]),St(ah,If,["msgId","busChannel"]),St(ah,Cf,["msgId","busChannel"]),St(ah,Sf,["totalMemberNum","list"]),St(ah,bf,["readTime","userId"]),St(ah,wf,["version","tags"]),St(ah,Nf,["tagId","name","createdTime","isTop"]),St(ah,Of,["version","tags"]),St(ah,kf,["tagId"]),St(ah,vf,["version","reserve"]),St(ah,Af,["sdkInfo"]),St(ah,Mf,["nothing"]),St(ah,Ph,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),St(ah,Dh,["users","token","sessionId","roomInfo"]),St(ah,Vh,["status"]),St(ah,Bh,["interior","target","key","value","objectName","content"]),St(ah,Fh,["valueInfo","objectName","content"]),St(ah,Kh,["interior","target","key","objectName","content"]),St(ah,jh,["target","valueInfo","objectName","content"]),St(ah,qh,["state"]),St(ah,Yh,["rtcToken"]),St(ah,Hh,["outInfo"]),St(ah,Gh,["userId"]),St(ah,Wh,["user"]),St(ah,Qh,["order"]),St(ah,Jh,["roomId","roomData","userCount","list"]),St(ah,zh,["key","value"]),St(ah,Zh,["key"]),St(ah,Lf,["type","time","roomId"]),St(ah,Uf,["timestamp","roomId"]),St(ah,xf,["entries","bFullUpdate","syncTime"]),St(ah,Pf,["userId"]),St(ah,Df,["info"]),St(ah,Bf,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,Ff,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,Kf,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),St(ah,jf,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),ah),Yf={},Hf=function(e){var t=qf[e];Yf[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(Yn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Yf[e].decode=function(e){var t={};Ls(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(Yn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Gf in qf)Hf(Gf);Yf.getModule=function(e){return Yf[e]()},lc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Wf="\npackage Modules;\nmessage probuf {\n message ".concat(Vh,"\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(Eh," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(mh," {\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(fh," {\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 optional string busChannel = 13; // 该消息所属会话的业务标识\n }\n message ").concat(dh," {\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(ph," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(gh," {\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 optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\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(Ms.IMAGE,";\n audio = ").concat(Ms.AUDIO,";\n video = ").concat(Ms.VIDEO,";\n file = ").concat(Ms.FILE,";\n }\n message ").concat(Xh," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(ef," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(tf," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat($h," {\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(nf," {\n required string downloadUrl = 1;\n }\n message ").concat(rf," {\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(Mh," {\n required int32 nothing = 1;\n }\n message ").concat(Lh," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(_h," {\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(Ih,"\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(Nh,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Ch,"\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 busChannel = 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(kh,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\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(Uh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(xh,"\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(qh,"\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(Rh,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message ").concat(Th,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Qh,"{\n optional int32 order=1;\n }\n\n message ").concat(Zh,"{\n repeated string key=1;\n }\n\n message ").concat(zh,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(zh," userData=2; //用户资源信息\n }\n\n message ").concat(Dh,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(zh," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ph,"{\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 optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(zh," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(zh," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Hh,"{\n repeated ").concat(zh," 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(Kh,"{\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(Bh,"{\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(Fh," {\n repeated ").concat(zh," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(zh," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Yh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(jh,"{\n required targetType target=1;\n repeated ").concat(zh," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Gh,"{\n repeated string userId = 1;\n }\n message ").concat(Wh,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(vh,"{\n required int32 nothing = 1;\n }\n message ").concat(yh,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Ah,"\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(Sh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(bh,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(wh,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Oh,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\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(sf," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(of," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(af," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(uf," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(cf," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(lf,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(hf," {\n required int64 timestamp = 1;\n }\n message ").concat(ff," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(df," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(gf," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(pf," {\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(yf," {\n required int64 time = 1;\n }\n message ").concat(mf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(_f," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message ").concat(Ef," {\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(Rf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Tf," {\n required int64 version=1;\n }\n message ").concat(If," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Cf," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Sf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(bf," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(wf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Nf," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Of," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(kf," {\n repeated string tagId=1;\n }\n message ").concat(vf," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Af,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Mf,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Lf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Uf,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(xf,"\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 message ").concat(Pf,"\n {\n required string userId = 1;\n }\n message ").concat(Df,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(Vf,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Bf,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(Ff,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(Kf,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(jf,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n"),Qf=/"/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(Qf,"&quot;")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Jf="ArrayBuffer",zf=Uu.ArrayBuffer,Zf=o.ArrayBuffer;Pe({global:!0,forced:Zf!==zf},{ArrayBuffer:zf}),kr(Jf),Pe({target:"Array",proto:!0},{fill:ru}),lr("fill");var Xf,$f,ed,td,nd,rd=(Xf=Wf,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,R={},T=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=T.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")},R.T=T,(o=(s=function(e,t,n,r,i){T.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(T.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 R.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof R.T&&(!t||n instanceof R.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 R.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},R.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()},R.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},R.Message=c,(f=(h=function(e,n,r,i,s,o,a,u,l,h){T.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(T.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)},R.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),R.Message.ExtensionField=d,g=function(e,t,n){T.call(this,e,t,n),this.fields=[]},R.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},R.Enum=p,(v=function(e,t,n,r){T.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(T.prototype),R.Enum.Value=v,(y=function(e,t,n,r){T.call(this,e,t,n),this.field=r}).prototype=Object.create(T.prototype),R.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)},R.Service=m,((_=function(e,t,n,r){T.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(T.prototype)).buildOpt=o.buildOpt,R.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),R.Service.RPCMethod=E,R}(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=Xf,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}($f=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 R;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,R,T;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,R=i(0,-2147483648,!1),e.MIN_VALUE=R,(T=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},T.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(R)?(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}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?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},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.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},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.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},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(v)},T.neg=T.negate,T.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)},T.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},T.sub=T.subtract,T.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(R)?e.isOdd()?R:g:e.eq(R)?this.isOdd()?R: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)))},T.mul=T.multiply,T.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(R))return e.eq(v)||e.eq(m)?R:e.eq(R)?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(R))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},T.div=T.divide,T.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return i(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},T.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)},T.shl=T.shiftLeft,T.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)},T.shr=T.shiftRight,T.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))},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.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]},T.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}()),$f));rd.getModule=function(e){var t=new rd[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Ds(e)?[].slice.call(new Int8Array(e)):e},t};var id="pgMsgP",sd="chatMsg",od="pcMsgP",ad={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ud="delMsg",cd="joinChrm",ld="joinChrmR",hd="exitChrm",fd="setKV",dd="delKV",gd="setKVS",pd="delKVS",vd="qryRelationR",yd="delRelation",md="setSeAtt",_d={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Ed="qryPMsg",Rd="qryGMsg",Td="qryCHMsg",Id="qryCMsg",Cd="qrySMsg",Sd=(St(ed={},"ppMsgP",ks.PRIVATE),St(ed,id,ks.GROUP),St(ed,sd,ks.CHATROOM),St(ed,od,ks.CUSTOMER_SERVICE),ed),bd=(St(td={},ks.PRIVATE,Ed),St(td,ks.GROUP,Rd),St(td,ks.CHATROOM,Td),St(td,ks.CUSTOMER_SERVICE,Id),St(td,ks.SYSTEM,Cd),td),wd=(St(nd={},ks.PRIVATE,_d.PRIVATE),St(nd,ks.GROUP,_d.GROUP),St(nd,ks.CUSTOMER_SERVICE,_d.CUSTOMER_SERVICE),St(nd,ks.SYSTEM,_d.SYSTEM),nd),Nd="1",Od="0",kd=1,Ad=2,Md=3,Ld=function(){function t(e){Tt(this,t),this._codec="websocket"===e?rd:Yf,this._connectType=e}return Ct(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,o=(St(r={},ph,i._formatSyncMessages),St(r,gh,i._formatReceivedMessage),St(r,fh,i._formatSentMessage),St(r,Th,i._formatHistoryMessages),St(r,Ch,i._formatConversationList),St(r,xh,i._formatChatRoomInfos),St(r,Dh,i._formatRTCUserList),St(r,Hh,i._formatRTCData),St(r,uf,i._formatChatRoomKVList),St(r,pf,i._formatUserSetting),St(r,mf,i._formatConversationStatus),St(r,Sf,i._formatGrpReadReceiptQryResp),St(r,df,i._formatSetUserSettingOutput),St(r,vf,i._formatUserSettingNotification),St(r,xf,i._formatRTCRoomKVList),St(r,Yh,i._formatRTCAuidenceJoinRoomData),St(r,Df,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Bs(s)&&(s=function(e){for(var t in e)Bs(e[t])&&(e[t]=la(e[t]));return e}(s)),Fs(o)&&(s=o.call(this,s,n))}catch(n){Ws.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=Ds(n)?new Uint8Array(n):n;return ch.readUTF(i.subarray(t,r))}catch(e){Ws.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Ws.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(Ks(s)||null===s)&&(e.finished=!0),e.syncTime=la(i),e.list=ya(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||no.RECEIVE)===no.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,R=_.isCounted,T=_.isMentioned,I=_.disableNotification,C=_.receivedStatus,S=_.canIncludeExpansion,b=[ks.GROUP,ks.CHATROOM,ks.RTC_ROOM].indexOf(u)>-1?c:a,w=m?i:a,N=la(h),O=N<s,k=u===ks.CHATROOM,A=this._formatBytes(o),M={};if(v&&(M=da(v.pushConfigs,v.pushId)),A.user){var L=A.user,U=L.portrait,x=L.portraitUri,P=U||x;P&&(A.user.portrait=A.user.portraitUri=P)}var D,V=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}),B=m?no.SEND:no.RECEIVE;return k&&a===i&&(B=no.SEND),g&&(D={},D=Ca(g)),{conversationType:u,targetId:b,senderUserId:w,messageType:f,messageUId:d,isPersited:E,isCounted:R,isMentioned:T,sentTime:N,isOffLineMessage:O,messageDirection:B,receivedTime:Sa.getTime(),disableNotification:I,receivedStatus:C,canIncludeExpansion:S,content:A,expansion:D,configFlag:y,pushConfig:V,channelId:e.busChannel||""}}},{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,R=Sd[g]||ks.PRIVATE,T=_a(ad,g),I=this._formatBytes(r),C=p;i===co.RECALL&&(R=I.conversationType||R,C=I.targetId||p),a&&(n={},n=Ca(a));var S={};u&&(S=da(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:R,targetId:C,messageType:i,messageUId:o,isPersited:y,isCounted:m,isStatusMessage:T,senderUserId:f,content:this._formatBytes(r),sentTime:1e3*d,receivedTime:Sa.getTime(),messageDirection:no.SEND,isOffLineMessage:!1,disableNotification:_,canIncludeExpansion:E,expansion:n,pushConfig:b,channelId:e.busChannel||""}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,o=r.targetId,a=la(e.syncTime),u=[];return va(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=ya(r,(function(e){var r=e.msg,s=e.userId,o=e.type,a=e.unreadCount,u=e.busChannel,c=null;r&&((c=n._formatReceivedMessage(r,t)).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:ya(n,(function(e){var t=e.id,n=e.time;return{id:t,time:la(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=ya(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?mo.DELETE:mo.UPDATE}}(r);return{key:t,value:n,isAutoDelete:o.isAutoDelete,isOverwrite:o.isOverwrite,type:o.type,userId:s,timestamp:la(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return va(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=la(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=la(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return va(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,o=e.busChannel,a=ho.CLOSE,u=!1,c=[];va(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case kd:a=n===Nd?ho.OPEN:ho.CLOSE;break;case Ad:u=n===Nd;break;case Md:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,isTop:u,updatedTime:la(i),tags:c,channelId:o||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,o={};return va(t,(function(e){var t=e.userId,n=e.userData,r={};va(n,(function(e){var t=e.key,n=e.value;r[t]=n})),o[t]=r})),{users:o,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return va(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 va(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=la(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:la(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"_formatRTCJoinedUserInfo",value:function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:la(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(vh);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=(e.conversationType,t.messageType),i=t.isMentioned,s=t.mentionedType,o=t.mentionedUserIdList,a=t.content,u=t.pushContent,c=t.pushData,l=t.directionalUserIdList,h=t.isFilerWhiteBlacklist,f=t.isVoipPush,d=t.canIncludeExpansion,g=t.expansion,p=t.pushConfig,v=t.channelId;ks.GROUP;var y,m,_,E=this._codec.getModule(fh),R=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),T=p||{},I=T.pushTitle,C=T.pushContent,S=T.pushData,b=T.iOSConfig,w=T.androidConfig,N=T.templateId,O=T.disablePushTitle,k=T.forceShowDetailContent,A=0;(E.setSessionId(R),i&&a)&&(a.mentionedInfo={userIdList:(null===(y=a.mentionedInfo)||void 0===y?void 0:y.userIdList)||o||[],type:(null===(m=a.mentionedInfo)||void 0===m?void 0:m.type)||s||go.ALL,mentionedContent:(null===(_=a.mentionedInfo)||void 0===_?void 0:_.mentionedContent)||""});var M=C||u||"",L=S||c||"";if(M&&E.setPushText(M),L&&E.setAppData(L),l&&E.setUserId(l),A|=f?1:0,A|=h?2:0,A|=O?4:0,A|=k?8:0,E.setConfigFlag(A),E.setClassname(r),a.user&&a.user.portraitUri&&(a.user.portrait=a.user.portraitUri),E.setContent(JSON.stringify(a)),d&&g){var U={};va(g,(function(e,t){U[t]={v:e}})),E.setExtraContent(JSON.stringify(U))}if(p){var x=this._codec.getModule(dh);if(I&&x.setTitle(I),b&&w){var P=fa(b,w);x.setPushConfigs(P)}(null==w?void 0:w.notificationId)&&x.setPushId(null==w?void 0:w.notificationId),x.setTemplateId(N||""),E.setPushExt(n?x.getArrayData():x)}return Ks(v)||E.setBusChannel(v),E}},{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(mh);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(_h);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=t.channelId,o=this._codec.getModule(Rh);return o.setTargetId(e),o.setTime(i),o.setCount(n),o.setOrder(r),o.setBusChannel(s||""),o.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Ih);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(Ih);return o.setType(r),o.setCount(n),o.setStartTime(i),o.setOrder(s),o.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(Nh);return i.setType(n),i.setBusChannel(r),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(Sh),r=[];return va(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(bh);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n,r){var i=this._codec.getModule(Oh),s=[];return va(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(s),i.setBusChannel(r),i.getArrayData()}},{key:"encodeClearMessages",value:function(e,t,n){var r=this._codec.getModule(kh);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=t.timestamp,s=this._codec.getModule(Ah);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(Mh);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Uh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(Xh);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(sf),s=t.key,o=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type||mo.UPDATE,l=ba(t,c),h={key:s,value:o||"",uid:n};if(Ks(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:ks.CHATROOM,targetId:e},d={key:s,value:o,extra:a,type:c},g=this._getUpMsgModule(f,{messageType:co.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(ks.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(of),i=t.entries,s=t.type||mo.UPDATE,o=ba(t,s),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};Ks(o)||(t.status=o),a.push(t)})),r.setEntry(a),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(hf);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(gf);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(yf);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Rf),i=Sa.getTime(),s=[];return va(e,(function(e){var r=t._codec.getModule(_f),o=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(o),r.setChannelId(a),r.setTime(i),r.setBusChannel(l);var f=u===ho.OPEN,d={};Ks(u)||(d[kd]=f),Ks(c)||(d[Ad]=c),va(d,(function(e,r){if(!Ks(e)){var i=t._codec.getModule(Ef);e=e?Nd:Od,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;h.push(s)}})),r.setStateItem(h);var g=n?r.getArrayData():r;s.push(g)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(If);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(wf),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(If);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(Of),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(kf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Rf),s=[];return t.forEach((function(t){var i=n._codec.getModule(_f),o=n._codec.getModule(Ef),a=[];e.forEach((function(e){var t=n._codec.getModule(Nf);t.setTagId(e.tagId),Ks(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),o.setSessionStateType(Md),o.setValue(JSON.stringify(a)),o.setTags(a),i.setType(t.conversationType),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(Sa.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(Af);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n,r,i){var s=this,o="comet"===this._connectType,a=this._codec.getModule(Ph);if(e=e||0,a.setRoomType(e),Ks(t)||a.setBroadcastType(t),Ks(n)||a.setJoinType(n),r){var u=[],c=this._codec.getModule(zh);for(var l in r)c.setKey(l),c.setValue(r[l]),o?u.push(c.getArrayData()):u.push(c);a.setInnerDatas(u)}if(i){var h=[];Object.keys(i).forEach((function(e){var t=s._codec.getModule(zh);t.setKey(e),t.setValue(i[e]),o?h.push(t.getArrayData()):h.push(t)})),a.setOuterDatas(h)}return a.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(Vh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(Bh);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&&(Bs(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(Fh);o.setObjectName(n);var a=this._codec.getModule(zh);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(zh);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(Fh);n.setObjectName(e);var r=this._codec.getModule(zh);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(Kh);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(Kh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},o=s.name,a=s.content;return!Ks(o)&&i.setObjectName(o),Ks(a)||(Bs(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(jh);r.setTarget(t),Ps(e)||(e=[e]),va(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!Ks(s)&&r.setObjectName(s),Ks(o)||(Bs(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Gh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(qh);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Qh);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(zh);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Zh);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(Ph);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(Uf);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(Pf);return t.setUserId(e),t.getArrayData()}},{key:"encodeRequestRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,s=e.inviteInfo,o=this._codec.getModule(Bf);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setTimeoutTime(i),o.setInviteInfo(s),o.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(Ff);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setInviteInfo(i),s.getArrayData()}},{key:"encodeResponseRoomPK",value:function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,s=e.key,o=e.value,a=e.agree?1:0,u=this._codec.getModule(Kf);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(o),u.setAnswerCode(a),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(jf);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),Ud=function e(t,n){Tt(this,e),this._watcher=n,this.codec=new Ld(t)},xd=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Pd=function(){function e(t){Tt(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 xd(e,t)}},{key:"read",value:function(e,t,n){this.readMessage(e,t,n)}},{key:"readMessage",value:function(e,t,n){return{stream:e,length:t}}}]),e}(),Dd=function(){function e(t){Tt(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new uh(t,!1,Vl.AT_MOST_ONCE,!1)}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return xd(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 hh;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Vd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return Ct(n,[{key:"readMessage",value:function(e,t,r){if(e.readByte(),this.status=+e.readByte(),t<=n.MESSAGE_LENGTH)return{stream:e,length:t};if(r===jl.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&e.readUTF(),4&i&&(this.timestamp=e.readLong()),8&i&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var s=e.readUTF();Ws.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(Pd);Vd.MESSAGE_LENGTH=2;var Bd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.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}(Pd);Bd.MESSAGE_LENGTH=2;var Fd,Kd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.call(this,Bl.PING_REQ))._name=Fl.PING_REQ,e}return Ct(n,[{key:"writeMessage",value:function(e){}}]),n}(Dd),jd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e))._name=Fl.PING_RESP,r}return n}(Pd),qd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(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}(Pd),Yd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(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}(Dd),Hd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.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}(qd),Gd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.PUBLISH))._name=Fl.PUBLISH,s.syncMsg=!1,s.identifier=Kl.PUB,s.topic=e,s.data=Ls(r)?ch.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}(Yd),Wd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.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}(qd),Qd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.PUB_ACK))._name=Fl.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}(Yd),Jd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.QUERY)).name=Fl.QUERY,s.identifier=Kl.QUERY,s.topic=e,s.data=Ls(r)?ch.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}(Yd),zd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.QUERY_CONFIRM))._name=Fl.QUERY_CON,r.messageId=e,r}return n}(Yd),Zd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.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}(qd),Xd=function(e){var t,n=e.type;switch(n){case Bl.CONN_ACK:t=new Vd(e);break;case Bl.PUBLISH:(t=new Hd(e)).syncMsg=e.syncMsg;break;case Bl.PUB_ACK:t=new Wd(e);break;case Bl.QUERY_ACK:t=new Zd(e);break;case Bl.SUB_ACK:case Bl.UNSUB_ACK:case Bl.PING_RESP:t=new jd(e);break;case Bl.DISCONNECT:t=new Bd(e);break;default:t=new Pd(e),Ws.error("No support for deserializing "+n+" messages")}return t},$d=function(e,t){var n=new Uint8Array(e),r=new lh(n),i=r.readByte(),s=new uh(i),o=Xd(s);return o.read(r,n.length-1,t),o},eg=function(e){var t=e.headerCode,n=new uh(t),r=Xd(n);for(var i in e)r[i]=e[i];return r},tg=pt.charAt,ng="String Iterator",rg=se.set,ig=se.getterFor(ng);qa(String,"String",(function(e){rg(this,{type:ng,string:String(e),index:0})}),(function(){var e,t=ig(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=tg(n,r),t.index+=e.length,{value:e,done:!1})})),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.rtcQueryJoined=72]="rtcQueryJoined",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.rtcInvite=79]="rtcInvite",e[e.rtcCancelInvite=80]="rtcCancelInvite",e[e.rtcInviteAnswer=81]="rtcInviteAnswer",e[e.rtcEndInvite=82]="rtcEndInvite"}(Fd||(Fd={}));var sg=Fd;Rt(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=Rt(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(bs(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:rn});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)})));var og,ag,ug=(og=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=0,t.forEach(function(){var e=Rt(regeneratorRuntime.mark((function e(o){var a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a="".concat(n,"://").concat(o,"/ping?r=").concat(bs(1e3,9999)),Ws.debug("start ping",a),e.next=4,r.httpReq({url:a,timeout:rn});case 4:u=e.sent,Ws.debug("end ping",s,a,u.status),s++,i({finished:s===t.length,code:u.status,host:o});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return og.apply(this,arguments)}),cg=function(e,t,n,r,i,s,o,a){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:"").concat(a?"&protocolVer="+a:"")},lg=function(e){return[sg.ppMsgS,sg.pgMsgS,sg.chatMsgS].map((function(e){return sg[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"}(ag||(ag={}));var hg,fg=function(e,t){Ws.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)},dg=function(e){Nt(a,e);var t,n,r,i,s,o=Pt(a);function a(e,t){var n;return Tt(this,a),(n=o.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(a,[{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var u=[],c=0,l=!1,h=!1,f=function(){var r=Rt(regeneratorRuntime.mark((function r(){var c;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==u.length&&!l){r.next=2;break}return r.abrupt("return");case 2:return l=!0,r.next=5,a._connect(t,n,u.shift(),i,s,o);case 5:if((c=r.sent)!==io.SUCCESS){r.next=11;break}a._checkAlive(),e(c),r.next=20;break;case 11:if(c!==ao.REDIRECT){r.next=15;break}e(c),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(Ia(c)),r.abrupt("return");case 18:l=!1,f();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();s=Gn(s),a._watcher.status(oo.CONNECTING),ug(r,i,a._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,f()),r&&0===c&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.replace("http","ws"),u=cg(a,r,t,n,this._runtime,s,"",o),Ws.debug("conenct start -> ".concat(u)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(u),l=function(e){f._timer&&(clearTimeout(f._timer),f._timer=null),f._socket===c&&(f._socket=null,f._watcher.status(e))},e.next=8,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=$d(t,o);if(n instanceof jd&&f._pingResolve)return f._pingResolve(io.SUCCESS),void(f._pingResolve=void 0);if(n instanceof Vd)return Ws.debug("recv connect ack -> ".concat(n.status)),n.status!==ao.ACCEPTED?(Ws.warn("connect failed: ".concat(n.status)),void e(n.status)):(Ws.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(io.SUCCESS));if(n instanceof Bd){var r=n.status;switch(Ws.warn("recv disconnect signal -> status: ".concat(r)),r){case ag.BLOCK_NEW:case ag.BLOCK:f._watcher.status(oo.BLOCKED);break;case ag.OTHER_DEVICE_LOGIN:f._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case ag.REDIRECT_NEW:case ag.REDIRECT:f._watcher.status(oo.REDIRECT);break;default:f._watcher.status(oo.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else Ws.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Ws.warn("websocket closed! code:",t,"reason:",n),l(oo.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(io.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in Ws.error("websocket error!",null==t?void 0:t.stack),l(oo.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(io.RC_NET_CHANNEL_INVALID)}e(io.NETWORK_ERROR)})),c.onOpen((function(){return Ws.debug("websocket open =>",u)})),setTimeout((function(){e(io.TIMEOUT)}),sn)}));case 8:return(h=e.sent)===io.SUCCESS?this._socket=c:(Ws.warn("connect result -> code: ".concat(h,", url: ").concat(u)),c.close()),e.abrupt("return",h);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s,o){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=Rt(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 Ws.debug("send ping ->"),this.sendOnly(new Kd),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(io.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===io.SUCCESS){e.next=12;break}return this._failedCount+=1,Ws.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Ws.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(oo.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:Ws.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=Rt(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!==Vl.AT_MOST_ONCE&&(t instanceof Hd&&!t.syncMsg&&(Ws.info("send pubAck -> ".concat(n," ").concat(t.topic)),this.sendOnly(new Qd(n))),t instanceof Zd&&(Ws.info("send queryCon -> ".concat(n," ").concat(t.topic)),this.sendOnly(new zd(n)))),n>0&&(t instanceof Wd||t instanceof Zd)&&(Ws.info("recv ack -> messageId: ".concat(n," ").concat(t.topic)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Hd)){e.next=17;break}if(s=t.syncMsg,o=t.topic,Ws.info("recv PublishReader -> messageId: ".concat(n," ").concat(o)),o!==sg[sg.userSetData]){e.next=9;break}return e.abrupt("return");case 9:if(s&&!lg(o)){e.next=12;break}return this._watcher.signal(t),e.abrupt("return");case 12:return e.next=14,new Promise((function(e){u._syncMessageIds[n]=e}));case 14:a=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,a);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&((e instanceof Gd||e instanceof Jd)&&(e.messageId=this._generateMessageId()),fg(e,this._socket))}},{key:"send",value:(t=Rt(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]:cn,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,fg(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 Ws.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:io.TIMEOUT});case 11:if(o instanceof Zd||o instanceof Wd){e.next=13;break}return e.abrupt("return",{code:o});case 13:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=17;break}return Ws.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 17:return e.abrupt("return",{code:io.SUCCESS,data:a});case 18:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 19: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(oo.DISCONNECTED))}}]),a}(Ud);e.HttpMethod=void 0,(hg=e.HttpMethod||(e.HttpMethod={})).GET="GET",hg.POST="POST";var gg=function(e){if(Bs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},pg=function(t){Nt(u,t);var n,r,i,s,o,a=Pt(u);function u(e,t){var n;return Tt(this,u),(n=a.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(u,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ls(e.data)?JSON.parse(e.data):e.data;return n?!Ps(n)||(va(n,function(){var e=Rt(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=eg(n),s=i.messageId,o=i._header,a=i.status,i.identifier,u=o&&o.qos!==Vl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Hd&&!i.syncMsg&&(l=new Qd(s),t.sendOnly(l)),i instanceof Zd&&(h=new zd(s),t.sendOnly(h))),!(i instanceof Bd)){e.next=20;break}e.t0=a,e.next=e.t0===ag.OTHER_DEVICE_LOGIN?11:e.t0===ag.BLOCK||e.t0===ag.BLOCK_NEW?13:e.t0===ag.REDIRECT_NEW||e.t0===ag.REDIRECT?15:17;break;case 11:return t._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(oo.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(oo.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(oo.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Hd)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!lg(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):(Ws.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(o=Rt(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,"&timestrap=").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(oo.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h=this;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(oo.CONNECTING),a=[],u=0,c=!1,l=!1,e.abrupt("return",new Promise((function(e){var o,f=(o=Rt(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==a.length&&!c){r.next=2;break}return r.abrupt("return");case 2:return c=!0,r.next=5,h._connect(t,n,a.shift(),i,s);case 5:if((o=r.sent)!==io.SUCCESS){r.next=11;break}h._startPullSignal(i),e(o),r.next=20;break;case 11:if(o!==ao.REDIRECT){r.next=15;break}e(o),r.next=20;break;case 15:if(!l||0!==a.length){r.next=18;break}return e(Ia(o)),r.abrupt("return");case 18:c=!1,f();case 20:case"end":return r.stop()}}),r)}))),function(){return o.apply(this,arguments)});h._watcher.status(oo.CONNECTING),ug(r,i,h._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;l=r,200===n&&(a.push(i),u++,f()),r&&0===u&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(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:return o=function(e){return 200!==e.status&&202!==e.status?(Ws.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(gg(e.data)?Bs(e.data)?e.data:JSON.parse(e.data):(Ws.error("received data is not a validJson",e.data),!1))},a=cg(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),Ws.debug("conenct start -> ".concat(a)),e.next=6,this._runtime.httpReq({url:a,body:{pid:this._pid},timeout:sn});case 6:return u=e.sent,c=o(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Ws.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(a)),e.abrupt("return",null==c?void 0:c.status);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=Rt(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=Rt(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]:cn,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:io.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:io.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(oo.DISCONNECTED)}}]),u}(Ud),vg=function e(t,n,r){Tt(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()},yg=Ln.find,mg="find",_g=!0;mg in[]&&Array(1).find((function(){_g=!1})),Pe({target:"Array",proto:!0,forced:_g},{find:function(e){return yg(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(mg);var Eg=function(e){return["navi",e].join("_")},Rg=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},Tg=function(){function e(t,n){Tt(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=Rt(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=Rg(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}(),Ig=Ln.findIndex,Cg="findIndex",Sg=!0;Cg in[]&&Array(1).findIndex((function(){Sg=!1})),Pe({target:"Array",proto:!0,forced:Sg},{findIndex:function(e){return Ig(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(Cg);var bg=function(e){if(ps(e))throw TypeError("The method doesn't accept regular expressions");return e},wg=ot("match");Pe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[wg]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(m(this)).indexOf(bg(e),arguments.length>1?arguments[1]:void 0)}});var Ng="outbox",Og="inbox",kg=function(e,t,n){return[e,t,n].join("_")},Ag=function(){function e(t,n){Tt(this,e),this._runtime=t,this._appkey=n,this._users={}}return Ct(e,[{key:"_getMemData",value:function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})}},{key:"setInboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=kg(Og,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getInboxTime",value:function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=kg(Og,this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime}},{key:"setOutboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=kg(Ng,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getOutboxTime",value:function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=kg(Ng,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),Mg={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Lg=function(){function e(t,n){Tt(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===mo.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)})),Ws.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),Ug=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(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=Mg.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===io.SUCCESS?(Mg.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){Mg.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];qs(r)||(r=new Lg(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}(),xg=function(){function e(t,n,r,i){Tt(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){Ws.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],qs(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}(),Pg="converStatusChanged",Dg=function(){function e(t,n,r){Tt(this,e),this._eventEmitter=new eo,this._pullQueue=[],this._isPulling=!1,this._storage=gn(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(!Ks(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(Pg,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=Rt(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===io.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(Pg,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(Pg,(function(e){}))}}]),e}(),Vg={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:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},Bg={};for(var Fg in Vg){var Kg=Vg[Fg].keyName;Bg[Kg]=Fg}var jg,qg=function(){function e(t,n,r){Tt(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new vn(t,i),this._localStore=new vn(t,"CONVER-".concat(n,"-").concat(r))}return Ct(e,[{key:"_getStoreKey",value:function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value:function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:ks.PRIVATE,targetId:"",channelId:""}}},{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=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=Bg.mentionedInfo,d=Bg.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=a.mentionedInfo;if(v){if(o&&r===ks.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===go.ALL&&p.indexOf(u)<0&&p.push(u);if(s===co.RECALL&&r===ks.GROUP){var y=p.indexOf(u);y>=0&&p.splice(y,1)}v={userIdList:p,type:(null===(t=v)||void 0===t?void 0:t.type)||g.type},0!==p.length?(h[f]=v,h[d]=!0):(delete h[f],delete h[d]),qs(h)?this._localStore.set(l,h):this._localStore.remove(l)}}},{key:"set",value:function(e,t,n,r){var i=this._getStoreKey(e,t,r),s=this._localStore.get(i)||{};for(var o in n){var a=Bg[o],u=n[o];if(!Ks(a)&&!Ks(u)&&"hasMentioned"!==o&&"MentionedInfo"!==o){if(u===Vg[a].defaultVal||"tags"===o&&!qs(u))delete s[a];else if("tags"===o){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[a]=u}else s[a]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}qs(s)?this._localStore.set(i,s):this._localStore.remove(i)}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},s={};for(var o in Vg){var a=Vg[o],u=a.keyName,c=a.defaultVal;s[u]=i[o]||Ea(c)}return s}},{key:"getValue",value:function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},o=t[r];for(var a in o){var u=Vg[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||Ea(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this._localStore.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=Vg[u],l=c.keyName,h=c.defaultVal;o[l]=a[u]||Ea(h)}for(var f in o.tags){Ks(t[f])&&(t[f]=[]);var d=Object.assign({},o,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}},{key:"adaptOldStore",value:function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}}catch(e){Ws.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),Yg=[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.PUBLIC_SERVICE,ks.APP_PUBLIC_SERVICE],Hg="conversationChanged",Gg="conTagStatusChanged",Wg=function(){function e(t,n,r,i,s){var o=this;Tt(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new eo,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new qg(t.runtime,n,r),this._statusManager=new Dg(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Hg,(function(e){i(e)})),this._eventEmitter.on(Gg,(function(){s()}))}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===no.SEND&&a===this._loginUserId,c=r===co.RECALL,l=Bs(n),h=!1,f={},d=t.lastUnreadTime||0,g=t.unreadMessageCount||0;if(d>i||u)return{hasChanged:h,localConversation:t,updateItems:f};(s&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,h=!0),c&&l)&&(d>=n.sentTime&&g&&(t.unreadMessageCount=g-1,h=!0));return h&&(f.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:f}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;no.SEND;var s=Bs(n),o=!1,a={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,o=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:o,localConversation:t,updateItems:a}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===no.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,o=s.type,a=s.userIdList;if(o===go.ALL||(a||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(Bs(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),s=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(s,e)}}},{key:"_setConTagStatusChanged",value:function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var s in i)if(!n[s]||i[s].isTop!==n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}},{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=e.channelId,c={},l={};Ks(s)||(l.notificationStatus={time:i,val:s}),Ks(o)||(l.isTop={time:i,val:o}),Ks(a)||(l.tags={time:i,val:a},null==a||a.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:o,tags:c},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged()}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(Hg,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Gg),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId,o=e.channelId;if(Yg.indexOf(r)>=0){var a=!1,u=this._store.get(r,s,o),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,s=r.localConversation,o=r.updateItems;a=a||i,c=wt(wt({},c),o),u=Ea(s)})),a&&this._store.set(r,s,u,o),this._store.updateMentionedData(e),i){var l=this._store.get(r,s,o);l.updatedItems=wt({latestMessage:{time:e.sentTime,val:e}},c),l.latestMessage=e;var h=Object.assign(l,{conversationType:r,targetId:s,channelId:o});this._setUpdatedConversation(h)}(a||i)&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._store.get(e,t,n)}},{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,n){return this._store.get(e,t,n).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=this._store.get(e,t,n),s=i.unreadMessageCount,o=i.hasMentioned,a={};if(s&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),o&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(u),this._notifyConversationChanged()}}},{key:"clearAllUnreadCount",value:function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,e._store.set(t.conversationType,t.targetId,t,t.channelId))}))}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n}},{key:"getDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]}},{key:"clearDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]}},{key:"addTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;s=Object.assign(s,n),this._store.set(e,t,{tags:s},r)}},{key:"deleteTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;n.forEach((function(e){delete s[e]})),this._store.set(e,t,{tags:s},r)}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}},{key:"getBlockConversationList",value:function(){return this._store.getValue().filter((function(e){return e.notificationStatus===ho.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"getTopConversationList",value:function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"adaptOldStore",value:function(){this._store.adaptOldStore()}},{key:"getUnreadMentionedCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=this.get(t,n,e);return r.unreadMentionedCount||0}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t}},{key:"getAllConversationState",value:function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))}}]),e}(),Qg=function(){function e(t,n,r,i){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=gn(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=Rt(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!==io.SUCCESS||Ks(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,o=i.version,a=s.Tag,Ks(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}(),Jg=function(e){Nt(i,e);var t,n,r=Pt(i);function i(e,t){var n;return Tt(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=Rt(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?an.join(","):un.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=Rt(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:i="getServerEndpoint",s=0,o=t.length;case 2:if(!(s<o)){e.next=28;break}return a=this._formatJSONPUrl(t[s],r,n,i),Ws.debug("req navi => ".concat(a)),e.next=7,this._runtime.httpReq({url:a,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?Ws.error("request navi error: "+io.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&Ws.error("request navi error: "+io.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",25);case 11:return e.prev=11,c=u.data.match(/{[\d\D]+}/),0===(l=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),h=JSON.parse(l),f=/^https/.test(a)?"https":"http",h.protocol=f,this._runtime.useNavi||(h.server="",h.backupServer=this._miniConnectUrl,h.logSwitch=0),e.abrupt("return",h);case 22:e.prev=22,e.t0=e.catch(11),Ws.error("parse navi err =>",e.t0);case 25:s+=1,e.next=2;break;case 28:if(this._runtime.useNavi){e.next=31;break}return d={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",d);case 31:return e.abrupt("return",null);case 32:case"end":return e.stop()}}),e,this,[[11,22]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(Tg),zg=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(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===io.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}(),Zg=function(e,t){return["send_msg",e,t].join("_")},Xg=function(){function e(t,n){Tt(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=Zg(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=Zg(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=Zg(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}(),$g=function(e){var t="RCDeviceId",n=gn(e),r="",i=n.get(t);return i?r=i:(r=Ns(),n.set(t,r)),r};St(jg={},ks.PRIVATE,sg.qryPMsg),St(jg,ks.GROUP,sg.qryGMsg),St(jg,ks.CHATROOM,sg.qryCHMsg),St(jg,ks.CUSTOMER_SERVICE,sg.qryCMsg),St(jg,ks.SYSTEM,sg.qrySMsg);var ep=[sg[sg.recallMsg],sg[sg.ppMsgS],sg[sg.pgMsgS],sg[sg.ppMsgP],sg[sg.pgMsgP],sg[sg.chatMsg],sg[sg.pcMsgP],sg[sg.prMsgS]],tp=function(e){var t;return(t={},St(t,ks.PRIVATE,sg.ppMsgP),St(t,ks.GROUP,sg.pgMsgP),St(t,ks.CHATROOM,sg.chatMsg),St(t,ks.CUSTOMER_SERVICE,sg.pcMsgP),St(t,ks.RTC_ROOM,sg.prMsgS),t)[e]},np=function(e,t,r,i,s,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:no.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,channelId:r.channelId}},rp=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},ip=function(t){Nt(Ee,t);var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B,F,K,j,q,Y,H,G,W,Q,J,z,Z,X,$,ee,te,ne,re,ie,se,oe,ae,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e=Pt(Ee);function Ee(e,t,n){var r;return Tt(this,Ee),(r=_e.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 Ag(e,n.appkey),r._sendMessageStore=new Xg(e,n.appkey),r._chrmEntryHandler=new Ug(Ut(r)),r}return Ct(Ee,[{key:"_createNavi",value:function(){return new Jg(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(me=Rt(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(r=[],this._naviInfo=n,n.server?r.push(n.server):Ws.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 Ws.error("navi invaild.",r),e.abrupt("return",io.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){u._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=jl.V3,1===n.openAnti&&(o=jl.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,o);case 13:return(a=e.sent)===io.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(oo.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new Wg(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Qg(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new zg(this),this._joinedChrmManager=new xg(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval()):s.close(),e.abrupt("return",a);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Ws.warn("connection status changed:",e),e!==oo.CONNECTING)if(e!==oo.CONNECTED){if(this._channel&&e!==oo.DISCONNECTED)return e===oo.BLOCKED||e===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||e===oo.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==oo.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:(ye=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s=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 i=jl.V3,1===this._naviInfo.openAnti&&(i=jl.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==io.SUCCESS){e.next=14;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(oo.CONNECTED),this._rejoinChrm(),Ws.__insertLogIntoDatabase(),e.abrupt("return");case 14:this._watcher.status(oo.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ye.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=sg[r];if(i)switch(i){case sg.s_ntf:Ws.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case sg.s_msg:this._receiveMsg(e);break;case sg.s_cmd:this._receiveStateNotify(e);break;case sg.s_us:this._receiveSettingNotify(e);break;case sg.rtc_ntf:this._receiveRtcKv(e)}else Ws.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,Eh),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,vf)).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,Lf),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(ep.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,fh,{currentUserId:this.currentUserId,signal:e});r=this._handleMsgProperties(r),t&&(r.sentTime=t.timestamp,r.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||r.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==co.EXPANSION_NOTIFY?(r.messageType===co.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId,r.channelId),this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Eh),n=t.type,r=t.chrmId,i=t.time;if(Ws.info("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:(ve=Rt(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),Ws.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Jd(sg[sg.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(o=e.sent,a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),a===io.SUCCESS&&u&&!Ks(u.finished)&&!Ks(u.list)&&!Ks(u.syncTime)){e.next=21;break}return Ws.warn("pullMsg failed -> code:",a,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Ws.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===no.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==co.EXPANSION_NOTIFY){if(e.messageType===co.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}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 ve.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,gh,{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!==co.EXPANSION_NOTIFY?t.messageType===co.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([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 fn,u=r in this._customMessageType;if(t=a?wt(wt({},fn[r]),{},{isStatusMessage:dn.includes(r)}):u?this._customMessageType[r]:{isCounted:!js(i)&&i,isPersited:!js(s)&&s,isStatusMessage:!1},Object.assign(e,t),n&&!Ks(o)&&(e.isStatusMessage=o),!n){var c=e.content.user;if(c){var l=c.portrait,h=c.portraitUri,f=l||h;f&&(c.portrait=c.portraitUri=f)}}return e}},{key:"getHistoryMessage",value:(pe=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=p.length>5&&void 0!==p[5]?p[5]:"",a=this.currentUserId,u=this._channel,c=bd[t]||Ed,l=1===i&&0===r,!u){e.next=15;break}return h=u.codec.encodeGetHistoryMsg(n,{timestamp:r,count:l?2:i,order:s,channelId:o}),e.next=8,u.send(new Jd(c,h,a),Th,{currentUserId:a,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:d});case 12:return g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===s?g.list.shift():g.list.pop()),e.abrupt("return",{code:d,data:{list:g.list,hasMore:g.hasMore}});case 15:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return pe.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Ws.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Jd(sg[sg.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==io.SUCCESS&&Ws.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(ge=Rt(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.currentUserId,!(o=this._channel)){e.next=11;break}return a=o.codec.encodeDeleteMessages(t,n,r,i),u=new Jd(ud,a,s),e.next=6,o.send(u);case 6:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return ge.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(de=Rt(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.currentUserId,!(o=this._channel)){e.next=12;break}return a=o.codec.encodeClearMessages(n,r,i),u=new Jd(wd[t],a,s),e.next=7,o.send(u);case 7:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return de.apply(this,arguments)})},{key:"getConversationList",value:(fe=Rt(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||ks.PRIVATE,!o){e.next=17;break}return a=o.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Jd(vd,a,s),e.next=12,o.send(u,Ch,{currentUserId:s,connectedTime:o.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=f._conversationManager.get(t,n,r);return Object.assign(e,i),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===io.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:io.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return fe.apply(this,arguments)})},{key:"removeConversation",value:(he=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=this._channel)){e.next=12;break}return s=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:r,targetId:n}),o=new Jd(yd,s,n),e.next=6,i.send(o);case 6:if(a=e.sent,Ws.info("RemoveConversation =>",a),(u=a.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"getConversation",value:(le=Rt(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,r)){e.next=3;break}return e.abrupt("return",{code:io.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===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:io.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||ho.CLOSE,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},e.abrupt("return",{code:io.SUCCESS,data:c});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return le.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(io.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(io.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(io.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(io.SUCCESS)}},{key:"pullConversationStatus",value:(ce=Rt(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 Jd(sg[sg.pullSeAtts],i,r),e.next=6,n.send(s,mf);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.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:io.RC_NET_CHANNEL_INVALID});case 12:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(ue=Rt(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 Jd(md,i,n),e.next=6,r.send(s,Tf);case 6:if(o=e.sent,a=o.code,u=o.data,a!==io.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",io.RC_NET_CHANNEL_INVALID);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"_joinChrm",value:(ae=Rt(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",io.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),o=new Jd(r?ld:cd,s,t),e.next=8,i.send(o,Lh);case 8:return a=e.sent,u=a.code,c=a.data,u===io.SUCCESS&&(l=c.joinTime,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 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ae.apply(this,arguments)})},{key:"_rejoinChrm",value:(oe=Rt(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)===io.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 oe.apply(this,arguments)})},{key:"_pullChrmMsg",value:(se=Rt(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 Jd(sg[sg.chrmPull],a,t),e.next=13,this._channel.send(u,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===io.SUCCESS&&h){e.next=20;break}return Ws.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 se.apply(this,arguments)})},{key:"joinChatroom",value:(ie=Rt(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 ie.apply(this,arguments)})},{key:"joinExistChatroom",value:(re=Rt(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 re.apply(this,arguments)})},{key:"quitChatroom",value:(ne=Rt(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",io.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Jd(hd,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(o=s.code)===io.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 ne.apply(this,arguments)})},{key:"getChatroomInfo",value:(te=Rt(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:io.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),o=new Jd(sg[sg.queryChrmI],s,t),e.next=7,i.send(o,xh);case 7:if(a=e.sent,u=a.code,c=a.data,u===io.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 te.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(ee=Rt(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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),a=new Jd(Td,o,t),e.next=7,s.send(a,Th,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===io.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 ee.apply(this,arguments)})},{key:"_modifyChatroomKV",value:($=Rt(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",io.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),o=n.type===mo.UPDATE?fd:dd,a=new Jd(o,s,t),e.next=8,r.send(a);case 8:if(u=e.sent,(c=u.code)!==io.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 $.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(X=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,u,c,l,h,f,d;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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),o=n.type===mo.UPDATE?gd:pd,a=new Jd(o,s,t),e.next=8,r.send(a,cf);case 8:return u=e.sent,c=u.code,-1!==[io.SUCCESS,io.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(f=Object.assign({},n)).entries,n.entries.forEach((function(e){h.push(Object.assign({},e,f))})),c===io.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,Ws.warn("设置失败的属性:",d.errorKeys),l=d.errorKeys,d&&Array.isArray(d.errorKeys)&&d.errorKeys.forEach((function(e){var t=h.findIndex((function(t){return e.key===t.key}));-1!==t&&h.splice(t,1)}))),Ws.warn("设置成功的属性:",h),this._chrmEntryHandler.setLocal(t,{kvEntries:h,syncTime:(new Date).getTime()},i)),e.abrupt("return",{code:c,data:l});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"setChatroomEntry",value:(Z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Z.apply(this,arguments)})},{key:"setChatroomEntries",value:(z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 z.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(J=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 J.apply(this,arguments)})},{key:"removeChatroomEntry",value:(Q=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Q.apply(this,arguments)})},{key:"removeChatroomEntries",value:(W=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 W.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(G=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 G.apply(this,arguments)})},{key:"getChatroomEntry",value:(H=Rt(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:io.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=12,i.send(o,uf);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:io.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:io.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(Y=Rt(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:io.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=13,r.send(o,uf);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:io.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"pullChatroomEntry",value:(q=Rt(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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),o=new Jd(sg[sg.pullKV],s,t),e.next=7,r.send(o,uf);case 7:if(a=e.sent,u=a.code,c=a.data,u!==io.SUCCESS){e.next=17;break}return Ws.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(t,c,i),Ws.info("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 q.apply(this,arguments)})},{key:"sendMessage",value:(j=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:if(r=rp(r,this.currentUserId),r=this._handleMsgProperties(r,!0),i=!![ks.PRIVATE,ks.GROUP].includes(t)&&r.isStatusMessage,s=i?(g=t,p=void 0,(p={},St(p,ks.PRIVATE,sg.ppMsgS),St(p,ks.GROUP,sg.pgMsgS),p)[g]):tp(t)||sg.ppMsgP,i&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(a=new Gd(sg[s],o,n)).setHeaderQos(Vl.AT_LEAST_ONCE),!i){e.next=13;break}return this._channel.sendOnly(a),e.abrupt("return",{code:io.SUCCESS,data:np(t,n,wt({},r),"",0,this.currentUserId)});case 13:return u=Date.now()-this._localConnectedTime+this._connectedTime,c=np(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===io.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:io.SUCCESS,data:c});case 28:case"end":return e.stop()}var g,p}),e,this)}))),function(e,t,n){return j.apply(this,arguments)})},{key:"recallMsg",value:(K=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p,v;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:io.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||"",channelId:s.channelId},c=sg[sg.recallMsg],l=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},u),(h=new Gd(c,l,this.currentUserId)).setHeaderQos(Vl.AT_LEAST_ONCE),e.next=10,this._channel.send(h);case 10:if(f=e.sent,d=f.code,g=f.data,d===io.SUCCESS){e.next=15;break}return e.abrupt("return",{code:d});case 15:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),v=np(t,n,wt(wt({},u),{},{isPersited:!0}),p.messageUId,p.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),e.abrupt("return",{code:io.SUCCESS,data:v});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return K.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(F=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Jd(sg[sg.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 F.apply(this,arguments)})},{key:"getMessageReader",value:(B=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Jd(sg[sg.rrList],i,t),e.next=6,this._channel.send(s,Sf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return B.apply(this,arguments)})},{key:"pullUserSettings",value:(V=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Jd(sg[sg.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,pf));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"getFileToken",value:(D=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":ha(t,n),o=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),a=new Jd(sg[sg.qnTkn],o,this.currentUserId),e.next=7,this._channel.send(a,$h);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==io.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 D.apply(this,arguments)})},{key:"getFileUrl",value:(P=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return s="",o="",a="",n===vo.QINIU?(o=ef,a=nf):(o=tf,a=rf),s=n===vo.QINIU?sg[sg.qnUrl]:n===vo.AWS?sg[sg.s3Url]:n===vo.STC?sg[sg.stcUrl]:sg[sg.aliUrl],u=this._channel.codec.encodeGetFileUrl(o,t,r,i),c=new Jd(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!==io.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 P.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._pullQueue.length=0,this._stopSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(x=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.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:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"removeTag",value:(U=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Jd(sg[sg.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.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:io.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"updateTag",value:(L=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.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:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"getTagList",value:(M=Rt(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:io.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"addTagForConversations",value:(A=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:io.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return(a={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,a,e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"removeTagForConversations",value:(k=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return n.forEach((function(e){a._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"removeTagsForConversation",value:(O=Rt(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(this._channel){e.next=2;break}return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,o=n.map((function(e){return{tagId:e}})),a=this._channel.codec.encodeUpdateConversationTag(o,[t]),u=new Jd(sg[sg.delTag],a,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:l});case 12:return this._conversationManager.deleteTagStatus(r,i,n,s),e.abrupt("return",{code:io.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"getConversationListByTag",value:(N=Rt(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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeOldConversationList({count:r,type:ks.PRIVATE,startTime:n}),a=new Jd(vd,o,i),e.next=7,s.send(a,Ch,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,l),Ws.info("GetConversationListByTag",h),c===io.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 N.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=t.channelId,u=n._conversationManager.get(s,o,a),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,f=u.notificationStatus,d=u.isTop,g=u.tags,p=u.unreadMessageCount,v=g&&g[e];if(v){var y=wt(wt({},t),{},{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:f,isTop:d,unreadMessageCount:p});v.isTop?r.push(wt(wt({},y),{},{isTopInTag:!0})):i.push(wt(wt({},y),{},{isTopInTag:!1}))}})),[].concat(Bt(r.sort(s)),Bt(i.sort(s)))}},{key:"getUnreadCountByTag",value:(w=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:io.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(b=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,o=n.channelId,a=r.isTop,u=[{tagId:t,isTop:a}],(c=this._conversationManager.get(s,i,o)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:io.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new Jd(sg[sg.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===io.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},a&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,o),e.abrupt("return",{code:io.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return b.apply(this,arguments)})},{key:"getTagsForConversation",value:(S=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),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:io.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:io.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getAllConversationState",value:function(){return Promise.resolve({code:io.SUCCESS,data:this._conversationManager.getAllConversationState()})}},{key:"joinRTCRoom",value:(C=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var 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:io.RC_NET_CHANNEL_INVALID});case 2:return a=this._channel.codec.encodeJoinRTCRoom(n,r,i,s,o),u=new Jd(sg[sg.rtcRJoin_data],a,t),e.abrupt("return",this._channel.send(u,Dh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return C.apply(this,arguments)})},{key:"quitRTCRoom",value:(I=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 I.apply(this,arguments)})},{key:"rtcPing",value:(T=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.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 T.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(R=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Jh));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(E=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcUData],n,t),e.next=6,this._channel.send(r,Dh);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 E.apply(this,arguments)})},{key:"setRTCUserInfo",value:(_=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Jd(sg[sg.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 _.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(m=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new Gd(sg[sg.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 m.apply(this,arguments)})},{key:"setRTCData",value:(y=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeSetRTCData(n,r,i,s,o),u=new Gd(sg[sg.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 y.apply(this,arguments)})},{key:"setRTCTotalRes",value:(v=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeUserSetRTCData(n,r,i,s),a=new Jd(sg[sg.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 v.apply(this,arguments)})},{key:"setRTCCDNUris",value:(p=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Jd(sg[sg.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 p.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Jd(sg[sg.rtcQryData],i,e);return this._channel.send(s,Hh)}},{key:"removeRTCData",value:(g=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeRemoveRTCData(n,r,i,s),a=new Gd(sg[sg.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 g.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:(d=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.rtcToken],i,t),e.abrupt("return",this._channel.send(s,Yh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"setRTCState",value:(f=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Jd(sg[sg.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 f.apply(this,arguments)})},{key:"getRTCUserInfo",value:(h=Rt(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 h.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Jd(sg[sg.rtcUList],t,e);return this._channel.send(n,Dh)}},{key:"joinLivingRoomAsAudience",value:(l=Rt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,u,c,l,h,f=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=f.length>1&&void 0!==f[1]?f[1]:e.RTCMode.LIVE,i=f.length>2?f[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),o=new Jd(sg[sg.viewerJoinR],s,n),t.next=8,this._channel.send(o,Vf);case 8:if(a=t.sent,u=a.code,c=a.data,u===io.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return l=c.rtcToken,h=c.entries,t.abrupt("return",{code:u,data:{token:l,kvEntries:h}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return l.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(c=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 c.apply(this,arguments)})},{key:"rtcIdentityChange",value:(u=Rt(regeneratorRuntime.mark((function e(t,n,r){var 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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new Jd(sg[sg.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,Dh);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.SUCCESS){e.next=11;break}return e.abrupt("return",{code:a});case 11:return e.abrupt("return",{code:a,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(a=Rt(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:io.RC_NET_CHANNEL_INVALID});case 3:return Ws.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),o=new Jd(sg[sg.rtcPullKv],s,i),e.next=8,r.send(o,xf);case 8:if(a=e.sent,u=a.code,c=a.data,Ws.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==io.SUCCESS){e.next=16;break}return l=c.kvEntries,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 16:return e.abrupt("return",{code:u});case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(o=Rt(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=3;break}return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new Jd(sg[sg.rtcQueryJoined],i,r),e.next=7,n.send(s,Df);case 7:if(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a,data:u});case 12:return e.abrupt("return",{code:a});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getDeviceId",value:function(){return $g(this.runtime)}},{key:"requestRoomPK",value:(s=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new Jd(sg[sg.rtcInvite],n,t.roomId),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 s.apply(this,arguments)})},{key:"cancelRoomPK",value:(i=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new Jd(sg[sg.rtcCancelInvite],n,t.roomId),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:"responseRoomPK",value:(r=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new Jd(sg[sg.rtcInviteAnswer],n,t.roomId),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 r.apply(this,arguments)})},{key:"endRoomPK",value:(n=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new Jd(sg[sg.rtcEndInvite],n,t.roomId),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 n.apply(this,arguments)})},{key:"callExtra",value:function(e){return Promise.resolve({code:io.EXTRA_METHOD_UNDEFINED})}},{key:"getConversationListWithAllChannel",value:function(){throw new Error("Method not implemented.")}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){throw new Error("Method not implemented.")}},{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){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:io.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:io.CONVER_GET_ERROR})}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),Ee}(vg),sp=function(){function e(t){Tt(this,e),this._context=t}return Ct(e,[{key:"__getContext",value:function(){return this._context}},{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{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()}},{key:"getRTCJoinedUserInfo",value:function(e){return this._context.getRTCJoinedUserInfo(e)}}]),e}(),op=function(e){Nt(n,e);var t=Pt(n);function n(){return Tt(this,n),t.apply(this,arguments)}return Ct(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._context.joinRTCRoom(e,t,n,r,i,s)}},{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)}},{key:"requestRoomPK",value:function(e){return this._context.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._context.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._context.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._context.endRoomPK(e)}}]),n}(sp),ap=function(){function e(){Tt(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}();ap.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},ap.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ap.scale=ap.chars.length,ap.max=238327;var up=1,cp=!1,lp="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",hp=function(){function e(t){Tt(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=$g(t.runtime),this.logSwitch=t.logSwitch;var n=Ta(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&&cp){var t=this.itv*Math.pow(2,up-1);up<this.times&&up++,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=ap.compress(t.map((function(e){return e.content})).join("")),r="".concat(lp).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){Ws.__clearRealTimeLog(),Ws.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,up=1),e.startReport()})).catch((function(t){Ws.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=Rt(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=ds.getInstance(),Ws.debug("received report log msg, ".concat(i.toLowerCase()),a),"web"===i.toLowerCase()&&a){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return Ws.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 8:return e.next=10,Ws.__insertLogIntoDatabase();case 10:return e.next=12,a.getRangeData(hs,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=ap.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&cp){var t=o||h.logUrl,n="".concat(lp).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(){cp&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Ws.debug("report full log success!")})).catch((function(t){e(),Ws.warn("report full log error -> "+t)}))}),r)}}();case 19:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){up=1,cp=!1}}],[{key:"init",value:function(t){return cp=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function fp(e){return Object.assign({},e)}var dp,gp=function(){function e(t,n){var r;(Tt(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.2",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=oo.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,typingState:void 0,messageBlocked:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,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(on));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._pullFinishedListener.bind(this)};this._engine=Ra()?new RCCppEngine(t,i,this._options):new ip(t,i,this._options)}var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B;return Ct(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Ws.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new op(this):new sp(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Ws.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=Rt(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ws.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:t=e.sent,(n=t.code)!==io.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(n),setTimeout((function(){r._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"_connectionStatusListener",value:(V=Rt(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===oo.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(t),this._handleRedirect()):t===oo.BLOCKED||t===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||t===oo.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(t)):t===oo.CONNECTING?this._handleConnecting():t===oo.CONNECTED?this._handleConnected():t===oo.DISCONNECTED?this._handleDisconnect(t):t===oo.NETWORK_UNAVAILABLE&&this._handleSuspend(t),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(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)}},{key:"_handleSuspend",value:function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===ks.RTC_ROOM||Object.prototype.hasOwnProperty.call(No,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(fp(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==co.TYPING_STATUS||(this._addTypingInfo(fp(e)),!this._watcher.typingState))if(e.messageType!==co.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==co.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(fp(e))}catch(e){return Ws.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(fp(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var r,i=null===(r=e.content)||void 0===r?void 0:r.receiptMessageDic;i&&Array.isArray(i[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[this._engine.currentUserId])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var s,o=e.content,a=o.startTime,u=o.endTime,c=o.platform,l=o.logId,h=o.uri,f=o.packageName,d={startTime:parseInt(a),endTime:parseInt(u),platform:c,logId:l,uri:h,packageName:f};null===(s=hp.getInstance())||void 0===s||s.reportFullLog(d)}}else if("function"==typeof this._watcher.chatroomState){var g={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){g[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:g,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:St({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Eo.QUIT:Eo.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(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedListener",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_MessageBlockedListener",value:function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)}},{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]=Fs(r)||Bs(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=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],r=h.length>2?h[2]:void 0,this._connectionStatus!==oo.CONNECTED){e.next=4;break}return e.abrupt("return",{code:io.SUCCESS,userId:this._engine.currentUserId});case 4:if(this._connectionStatus!==oo.CONNECTING){e.next=6;break}return e.abrupt("return",{code:io.BIZ_ERROR_CONNECTING});case 6:if("string"==typeof t&&0!==t.length){e.next=8;break}return e.abrupt("return",{code:io.RC_CONN_USER_OR_PASSWD_ERROR});case 8:return this._token=t,i=t.split("@"),s=Vt(i,2),o=s[1],a=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=13,this._engine.navi.getInfo(this._getTokenWithoutNavi(),a,n,this._options.checkCA);case 13:if(u=e.sent){e.next=16;break}return e.abrupt("return",{code:io.RC_NAVI_RESOURCE_ERROR});case 16:if(1!==(null==u?void 0:u.type)){e.next=18;break}return e.abrupt("return",{code:io.PACKAGE_ENVIRONMENT_ERROR});case 18:return c=Vo.getInfo(),e.next=21,this._engine.connect(this._getTokenWithoutNavi(),u,r);case 21:if(l=e.sent,Ws.__insertLogIntoDatabase(),l!==ao.REDIRECT){e.next=28;break}return this._connectionStatus=oo.REDIRECT,e.next=27,this.connect(t,!0);case 27:return e.abrupt("return",e.sent);case 28:return l===io.SUCCESS&&(Ws.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==u?void 0:u.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),hp.init({runtime:this._runtime,logSwitch:(null==u?void 0:u.logSwitch)||0,logPolicy:JSON.parse((null==u?void 0:u.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Gs.init(this._engine.currentUserId),this._isInternalConnected=!0),l!==io.SUCCESS||Ra()||1===u.openUS&&this._pullUserSettings(),l!==io.SUCCESS&&(this._connectionStatus=oo.CONNECTION_CLOSED),e.abrupt("return",{code:l,userId:this._engine.currentUserId});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"_pullUserSettings",value:(P=Rt(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,this._typingInfo={},null===(e=hp.getInstance())||void 0===e||e.distroy(),Ws.__insertLogIntoDatabase(),Gs.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Ws.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(e){return this._isInternalConnected?Promise.resolve({code:io.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)}},{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]:[],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._engine.registerMessageType(e,t,n,r,i)}},{key:"sendMessage",value:function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===co.READ_RECEIPT_RESPONSE)return Promise.resolve({code:io.READ_RECEIPT_ERROR});var s=JSON.stringify(n.content);return Hn(s)>ln?Promise.resolve({code:io.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(x=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y;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.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:io.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=!1,h=!1,!Bs(a)){e.next=19;break}f=Object.keys(a).length,c=f>20,e.t0=regeneratorRuntime.keys(a);case 10:if((e.t1=e.t0()).done){e.next=19;break}if(d=e.t1.value,g=a[d],l=Ls(d)&&!/^[A-Za-z0-9_=+-]+$/.test(d),!(h=d.length>32||g.length>4096)&&!l){e.next=17;break}return e.abrupt("break",19);case 17:e.next=10;break;case 19:if(!c&&!h){e.next=21;break}return e.abrupt("return",{code:io.EXPANSION_LIMIT_EXCEET});case 21:if(!l){e.next=23;break}return e.abrupt("return",{code:io.BIZ_ERROR_INVALID_PARAMETER});case 23:return p={mid:s},a&&(p.put=a),o&&(p.del=o),u&&(p.removeAll=1),e.next=29,this._engine.sendMessage(r,i,{content:p,messageType:co.EXPANSION_NOTIFY,channelId:n});case 29:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(U=Rt(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:io.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 U.apply(this,arguments)})},{key:"getMessageReader",value:(L=Rt(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:io.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 L.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){Ws.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=hp.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:"clearAllUnreadCount",value:function(){return this._engine.clearAllUnreadCount()}},{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:[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.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){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.saveConversationMessageDraft(e,t,n,r)}},{key:"getConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationMessageDraft(e,t,n)}},{key:"clearConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationMessageDraft(e,t,n)}},{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 ga(n)&&pa(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(io.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(!ga(i)||!pa(s))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return ga(n)&&pa(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(io.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(io.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(!ga(r))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(io.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=Rt(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!==io.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=Rt(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]:vo.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!==io.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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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(io.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=Rt(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=Rt(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=Rt(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:(T=Rt(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 T.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(R=Rt(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 R.apply(this,arguments)})},{key:"getTagsForConversation",value:(E=Rt(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:"getBlockConversationList",value:function(){return this._engine.getBlockConversationList()}},{key:"getTopConversationList",value:function(){return this._engine.getTopConversationList()}},{key:"getUnreadMentionedCount",value:function(e){return this._engine.getUnreadMentionedCount(e)}},{key:"getAllUnreadMentionedCount",value:function(){return this._engine.getAllUnreadMentionedCount()}},{key:"getAllConversationState",value:function(){return this._engine.getAllConversationState()}},{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:(_=Rt(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){Ws.error(e)}}))}},{key:"addToBlacklist",value:(m=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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=Rt(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:"getConversationListWithAllChannel",value:function(){return this._engine.getConversationListWithAllChannel()}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._engine.joinRTCRoom(e,t,n,r,i,s)}},{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:"getRTCJoinedUserInfo",value:function(e){return this._engine.getRTCJoinedUserInfo(e)}},{key:"requestRoomPK",value:function(e){return this._engine.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._engine.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._engine.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._engine.endRoomPK(e)}}],[{key:"init",value:function(t,n){return Ws.setLogLevel(n.logLevel),Ws.setLogStdout(n.logStdout),(n.indexDBSwitch||Ks(n.indexDBSwitch))&&ds.init(),Ws.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Ws.error("Repeat initialize!"),this._context):(Ws.warn("RCEngine Commit:","efd1b7f44d2517ab9a2fab003c298184d1f06fca"),this._context=new e(t,n),Ws.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(dp=e.TagChangeType||(e.TagChangeType={}))[dp.add=1]="add",dp[dp.update=2]="update",dp[dp.delete=3]="delete";e.AEngine=vg,e.ANavi=Tg,e.APIContext=gp,e.AppStorage=vn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=No,e.ChatroomEntryType=mo,e.ChatroomMemberChangeType=Eo,e.CometChannel=pg,e.ConnectResultCode=ao,e.ConnectionStatus=oo,e.ConversationType=ks,e.DelayTimer=Sa,e.ErrorCode=io,e.EventEmitter=eo,e.FileType=Ms,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=cn,e.Logger=Gs,e.MAX_MESSAGE_CONTENT_BYTES=ln,e.MINI_COMET_CONNECT_URIS=un,e.MINI_SOCKET_CONNECT_URIS=an,e.MentionedType=go,e.MessageBlockType=Co,e.MessageDirection=no,e.MessageType=co,e.NAVI_CACHE_DURATION=nn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=ho,e.PING_REQ_TIMEOUT=rn,e.PUBLIC_CLOUD_NAVI_URIS=on,e.PluginContext=sp,e.RCAssertError=Fo,e.RTCPluginContext=op,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=fn,e.STATUS_MESSAGE=dn,e.STORAGE_ROOT_KEY=hn,e.UploadMethod=vo,e.VersionManage=Vo,e.WEB_SOCKET_TIMEOUT=sn,e.WebSocketChannel=dg,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(!Ko(e,t,n,r))throw new Fo("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.cloneByJSON=Ea,e.forEach=va,e.formatConnectResponseCode=Ia,e.getBrowser=Ta,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case Ms.IMAGE:t="image/jpeg";break;case Ms.AUDIO:t="audio/amr";break;case Ms.VIDEO:t="video/3gpp";break;case Ms.SIGHT:t="video/mpeg4";break;case Ms.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=ha,e.indexOf=ma,e.isArray=Ps,e.isArrayBuffer=Ds,e.isBoolean=Us,e.isFunction=Fs,e.isHttpUrl=function(e){return Ls(e)&&/https?:\/\//.test(e)},e.isInObject=_a,e.isInclude=function(e,t){return-1!==ma(e,t)},e.isNull=js,e.isNumber=xs,e.isObject=Bs,e.isString=Ls,e.isUndefined=Ks,e.isValidChrmEntryKey=ga,e.isValidChrmEntryValue=pa,e.isValidConversationType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(ks,e)},e.isValidFileType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(Ms,e)},e.map=ya,e.notEmptyArray=function(e){return Ps(e)&&e.length>0},e.notEmptyObject=qs,e.notEmptyString=Vs,e.pushConfigsToJSON=fa,e.pushJSONToConfigs=da,e.todo=function(e){return new yn(e)},e.usingCppEngine=Ra,e.validate=Ko,e.version="5.1.2",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;function r(e){return(r="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 i(e,t,n,r,i,s,a){try{var o=e[s](a),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var a=e.apply(t,n);function o(e){i(a,r,s,o,u,"next",e)}function u(e){i(a,r,s,o,u,"throw",e)}o(void 0)}))}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 u(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(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&&p(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){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 y(e,t,n){return(y=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i}).apply(null,arguments)}function m(e){var t="function"==typeof Map?new Map:void 0;return(m=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 y(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)})(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_(e):t}function T(e){var t=v();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return E(this,n)}}function R(e,t,n){return(R="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=d(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 I(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=[],a=!0,o=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(o)throw i}}return s}(e,t)||S(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 C(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||S(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 S(e,t){if(e){if("string"==typeof e)return b(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)?b(e,t):void 0}}function b(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}function w(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=S(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function N(e){var t={exports:{}};return e(t,t.exports),t.exports}var k=function(e){return e&&e.Math==Math&&e},M=k("object"==typeof globalThis&&globalThis)||k("object"==typeof window&&window)||k("object"==typeof self&&self)||k("object"==typeof O&&O)||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]})),L={}.propertyIsEnumerable,x=Object.getOwnPropertyDescriptor,P={f:x&&!L.call({1:2},1)?function(e){var t=x(this,e);return!!t&&t.enumerable}:L},D=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},V={}.toString,B=function(e){return V.call(e).slice(8,-1)},G="".split,F=A((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G.call(e,""):Object(e)}:Object,q=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},j=function(e){return F(q(e))},K=function(e){return"object"==typeof e?null!==e:"function"==typeof e},H=function(e,t){if(!K(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!K(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!K(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!K(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},Y=function(e){return Object(q(e))},Q={}.hasOwnProperty,W=function(e,t){return Q.call(Y(e),t)},J=M.document,z=K(J)&&K(J.createElement),Z=function(e){return z?J.createElement(e):{}},X=!U&&!A((function(){return 7!=Object.defineProperty(Z("div"),"a",{get:function(){return 7}}).a})),$=Object.getOwnPropertyDescriptor,ee={f:U?$:function(e,t){if(e=j(e),t=H(t,!0),X)try{return $(e,t)}catch(e){}if(W(e,t))return D(!P.f.call(e,t),e[t])}},te=function(e){if(!K(e))throw TypeError(String(e)+" is not an object");return e},ne=Object.defineProperty,re={f:U?ne:function(e,t,n){if(te(e),t=H(t,!0),te(n),X)try{return ne(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}},ie=U?function(e,t,n){return re.f(e,t,D(1,n))}:function(e,t,n){return e[t]=n,e},se=function(e,t){try{ie(M,e,t)}catch(n){M[e]=t}return t},ae="__core-js_shared__",oe=M[ae]||se(ae,{}),ue=Function.toString;"function"!=typeof oe.inspectSource&&(oe.inspectSource=function(e){return ue.call(e)});var ce,le,he,fe=oe.inspectSource,de=M.WeakMap,ge="function"==typeof de&&/native code/.test(fe(de)),pe=N((function(e){(e.exports=function(e,t){return oe[e]||(oe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),ve=0,ye=Math.random(),me=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++ve+ye).toString(36)},_e=pe("keys"),Ee=function(e){return _e[e]||(_e[e]=me(e))},Te={},Re="Object already initialized",Ie=M.WeakMap;if(ge){var Ce=oe.state||(oe.state=new Ie),Se=Ce.get,be=Ce.has,we=Ce.set;ce=function(e,t){if(be.call(Ce,e))throw new TypeError(Re);return t.facade=e,we.call(Ce,e,t),t},le=function(e){return Se.call(Ce,e)||{}},he=function(e){return be.call(Ce,e)}}else{var Oe=Ee("state");Te[Oe]=!0,ce=function(e,t){if(W(e,Oe))throw new TypeError(Re);return t.facade=e,ie(e,Oe,t),t},le=function(e){return W(e,Oe)?e[Oe]:{}},he=function(e){return W(e,Oe)}}var Ne={set:ce,get:le,has:he,enforce:function(e){return he(e)?le(e):ce(e,{})},getterFor:function(e){return function(t){var n;if(!K(t)||(n=le(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},ke=N((function(e){var t=Ne.get,n=Ne.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a,o=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,c=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||W(i,"name")||ie(i,"name",t),(a=n(i)).source||(a.source=r.join("string"==typeof t?t:""))),e!==M?(o?!c&&e[t]&&(u=!0):delete e[t],u?e[t]=i:ie(e,t,i)):u?e[t]=i:se(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||fe(this)}))})),Me=M,Ae=function(e){return"function"==typeof e?e:void 0},Ue=function(e,t){return arguments.length<2?Ae(Me[e])||Ae(M[e]):Me[e]&&Me[e][t]||M[e]&&M[e][t]},Le=Math.ceil,xe=Math.floor,Pe=function(e){return isNaN(e=+e)?0:(e>0?xe:Le)(e)},De=Math.min,Ve=function(e){return e>0?De(Pe(e),9007199254740991):0},Be=Math.max,Ge=Math.min,Fe=function(e,t){var n=Pe(e);return n<0?Be(n+t,0):Ge(n,t)},qe=function(e){return function(t,n,r){var i,s=j(t),a=Ve(s.length),o=Fe(r,a);if(e&&n!=n){for(;a>o;)if((i=s[o++])!=i)return!0}else for(;a>o;o++)if((e||o in s)&&s[o]===n)return e||o||0;return!e&&-1}},je={includes:qe(!0),indexOf:qe(!1)},Ke=je.indexOf,He=function(e,t){var n,r=j(e),i=0,s=[];for(n in r)!W(Te,n)&&W(r,n)&&s.push(n);for(;t.length>i;)W(r,n=t[i++])&&(~Ke(s,n)||s.push(n));return s},Ye=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qe=Ye.concat("length","prototype"),We={f:Object.getOwnPropertyNames||function(e){return He(e,Qe)}},Je={f:Object.getOwnPropertySymbols},ze=Ue("Reflect","ownKeys")||function(e){var t=We.f(te(e)),n=Je.f;return n?t.concat(n(e)):t},Ze=function(e,t){for(var n=ze(t),r=re.f,i=ee.f,s=0;s<n.length;s++){var a=n[s];W(e,a)||r(e,a,i(t,a))}},Xe=/#|\.prototype\./,$e=function(e,t){var n=tt[et(e)];return n==rt||n!=nt&&("function"==typeof t?A(t):!!t)},et=$e.normalize=function(e){return String(e).replace(Xe,".").toLowerCase()},tt=$e.data={},nt=$e.NATIVE="N",rt=$e.POLYFILL="P",it=$e,st=ee.f,at=function(e,t){var n,r,i,s,a,o=e.target,u=e.global,c=e.stat;if(n=u?M:c?M[o]||se(o,{}):(M[o]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=st(n,r))&&a.value:n[r],!it(u?r:o+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;Ze(s,i)}(e.sham||i&&i.sham)&&ie(s,"sham",!0),ke(n,r,s,e)}},ot=function(){var e=te(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 ut(e,t){return RegExp(e,t)}var ct={UNSUPPORTED_Y:A((function(){var e=ut("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:A((function(){var e=ut("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},lt=RegExp.prototype.exec,ht=pe("native-string-replace",String.prototype.replace),ft=lt,dt=function(){var e=/a/,t=/b*/g;return lt.call(e,"a"),lt.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),gt=ct.UNSUPPORTED_Y||ct.BROKEN_CARET,pt=void 0!==/()??/.exec("")[1];(dt||pt||gt)&&(ft=function(e){var t,n,r,i,s=this,a=gt&&s.sticky,o=ot.call(s),u=s.source,c=0,l=e;return a&&(-1===(o=o.replace("y","")).indexOf("g")&&(o+="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+")",o)),pt&&(n=new RegExp("^"+u+"$(?!\\s)",o)),dt&&(t=s.lastIndex),r=lt.call(a?n:s,l),a?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:dt&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),pt&&r&&r.length>1&&ht.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var vt=ft;at({target:"RegExp",proto:!0,forced:/./.exec!==vt},{exec:vt});var yt,mt,_t="process"==B(M.process),Et=Ue("navigator","userAgent")||"",Tt=M.process,Rt=Tt&&Tt.versions,It=Rt&&Rt.v8;It?mt=(yt=It.split("."))[0]+yt[1]:Et&&(!(yt=Et.match(/Edge\/(\d+)/))||yt[1]>=74)&&(yt=Et.match(/Chrome\/(\d+)/))&&(mt=yt[1]);var Ct=mt&&+mt,St=!!Object.getOwnPropertySymbols&&!A((function(){return!Symbol.sham&&(_t?38===Ct:Ct>37&&Ct<41)})),bt=St&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,wt=pe("wks"),Ot=M.Symbol,Nt=bt?Ot:Ot&&Ot.withoutSetter||me,kt=function(e){return W(wt,e)&&(St||"string"==typeof wt[e])||(St&&W(Ot,e)?wt[e]=Ot[e]:wt[e]=Nt("Symbol."+e)),wt[e]},Mt=kt("species"),At=!A((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),Ut="$0"==="a".replace(/./,"$0"),Lt=kt("replace"),xt=!!/./[Lt]&&""===/./[Lt]("a","$0"),Pt=!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=kt(e),s=!A((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=s&&!A((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Mt]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!a||"replace"===e&&(!At||!Ut||xt)||"split"===e&&!Pt){var o=/./[i],u=n(i,""[e],(function(e,t,n,r,i){return t.exec===RegExp.prototype.exec?s&&!i?{done:!0,value:o.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:Ut,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:xt}),c=u[0],l=u[1];ke(String.prototype,e,c),ke(RegExp.prototype,i,2==t?function(e,t){return l.call(e,this,t)}:function(e){return l.call(e,this)})}r&&ie(RegExp.prototype[i],"sham",!0)},Vt=function(e){return function(t,n){var r,i,s=String(q(t)),a=Pe(n),o=s.length;return a<0||a>=o?e?"":void 0:(r=s.charCodeAt(a))<55296||r>56319||a+1===o||(i=s.charCodeAt(a+1))<56320||i>57343?e?s.charAt(a):r:e?s.slice(a,a+2):i-56320+(r-55296<<10)+65536}},Bt={codeAt:Vt(!1),charAt:Vt(!0)},Gt=Bt.charAt,Ft=function(e,t,n){return t+(n?Gt(e,t).length:1)},qt=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"!==B(e))throw TypeError("RegExp#exec called on incompatible receiver");return vt.call(e,t)};Dt("match",1,(function(e,t,n){return[function(t){var n=q(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=te(e),s=String(this);if(!i.global)return qt(i,s);var a=i.unicode;i.lastIndex=0;for(var o,u=[],c=0;null!==(o=qt(i,s));){var l=String(o[0]);u[c]=l,""===l&&(i.lastIndex=Ft(s,Ve(i.lastIndex),a)),c++}return 0===c?null:u}]}));var jt=Array.isArray||function(e){return"Array"==B(e)},Kt=function(e,t,n){var r=H(t);r in e?re.f(e,r,D(0,n)):e[r]=n},Ht=kt("species"),Yt=function(e,t){var n;return jt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!jt(n.prototype)?K(n)&&null===(n=n[Ht])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Qt=kt("species"),Wt=function(e){return Ct>=51||!A((function(){var t=[];return(t.constructor={})[Qt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Jt=kt("isConcatSpreadable"),zt=9007199254740991,Zt="Maximum allowed index exceeded",Xt=Ct>=51||!A((function(){var e=[];return e[Jt]=!1,e.concat()[0]!==e})),$t=Wt("concat"),en=function(e){if(!K(e))return!1;var t=e[Jt];return void 0!==t?!!t:jt(e)};at({target:"Array",proto:!0,forced:!Xt||!$t},{concat:function(e){var t,n,r,i,s,a=Y(this),o=Yt(a,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(en(s=-1===t?a:arguments[t])){if(u+(i=Ve(s.length))>zt)throw TypeError(Zt);for(n=0;n<i;n++,u++)n in s&&Kt(o,u,s[n])}else{if(u>=zt)throw TypeError(Zt);Kt(o,u++,s)}return o.length=u,o}});var tn,nn,rn=72e5,sn=5e3,an=5e3,on=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],un=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],cn=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],ln=3e4,hn=131072,fn="RCV4-",dn={"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},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},gn=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(tn=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",tn.COMET="comet";var pn=function(e){return nn||(nn={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}}),nn},vn=function(){function e(t){a(this,e),this._caches={},t&&(this._caches=t)}return u(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}(),yn=function(){function e(t,n){a(this,e);var r=n?"".concat(fn).concat(n):fn;this._rootStorage=pn(t);var i=this._rootStorage.get(r)||{};this._cache=new vn(c({},r,i)),this._storageKey=r}return u(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}(),mn=function(e){f(n,e);var t=T(n);function n(e){return a(this,n),t.call(this,"TODO => ".concat(e))}return n}(m(Error)),_n=Wt("slice"),En=kt("species"),Tn=[].slice,Rn=Math.max;at({target:"Array",proto:!0,forced:!_n},{slice:function(e,t){var n,r,i,s=j(this),a=Ve(s.length),o=Fe(e,a),u=Fe(void 0===t?a:t,a);if(jt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!jt(n.prototype)?K(n)&&null===(n=n[En])&&(n=void 0):n=void 0,n===Array||void 0===n))return Tn.call(s,o,u);for(r=new(void 0===n?Array:n)(Rn(u-o,0)),i=0;o<u;o++,i++)o in s&&Kt(r,i,s[o]);return r.length=i,r}});var In=Math.floor,Cn="".replace,Sn=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,bn=/\$([$&'`]|\d{1,2})/g,wn=function(e,t,n,r,i,s){var a=n+e.length,o=r.length,u=bn;return void 0!==i&&(i=Y(i),u=Sn),Cn.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(a);case"<":c=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return s;if(l>o){var h=In(l/10);return 0===h?s:h<=o?void 0===r[h-1]?u.charAt(1):r[h-1]+u.charAt(1):s}c=r[l-1]}return void 0===c?"":c}))},On=Math.max,Nn=Math.min;Dt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=r.REPLACE_KEEPS_$0,a=i?"$":"$0";return[function(n,r){var i=q(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(a)){var o=n(t,e,this,r);if(o.done)return o.value}var u=te(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=qt(u,c);if(null===g)break;if(d.push(g),!h)break;""===String(g[0])&&(u.lastIndex=Ft(c,Ve(u.lastIndex),f))}for(var p,v="",y=0,m=0;m<d.length;m++){g=d[m];for(var _=String(g[0]),E=On(Nn(Pe(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=wn(_,c,E,T,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var kn=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},Mn=function(e,t,n){if(kn(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)}},An=[].push,Un=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,a=7==e,o=5==e||s;return function(u,c,l,h){for(var f,d,g=Y(u),p=F(g),v=Mn(c,l,3),y=Ve(p.length),m=0,_=h||Yt,E=t?_(u,y):n||a?_(u,0):void 0;y>m;m++)if((o||m in p)&&(d=v(f=p[m],m,g),e))if(t)E[m]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return m;case 2:An.call(E,f)}else switch(e){case 4:return!1;case 7:An.call(E,f)}return s?-1:r||i?i:E}},Ln={forEach:Un(0),map:Un(1),filter:Un(2),some:Un(3),every:Un(4),find:Un(5),findIndex:Un(6),filterOut:Un(7)},xn=Ln.filter,Pn=Wt("filter");at({target:"Array",proto:!0,forced:!Pn},{filter:function(e){return xn(this,e,arguments.length>1?arguments[1]:void 0)}});var Dn=Ln.map,Vn=Wt("map");at({target:"Array",proto:!0,forced:!Vn},{map:function(e){return Dn(this,e,arguments.length>1?arguments[1]:void 0)}});var Bn=Object.keys||function(e){return He(e,Ye)},Gn=A((function(){Bn(1)}));at({target:"Object",stat:!0,forced:Gn},{keys:function(e){return Bn(Y(e))}});var Fn=function(e,t){var n=[][e];return!!n&&A((function(){n.call(null,t||function(){throw 1},1)}))},qn=[].join,jn=F!=Object,Kn=Fn("join",",");at({target:"Array",proto:!0,forced:jn||!Kn},{join:function(e){return qn.call(j(this),void 0===e?",":e)}});var Hn=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()}))},Yn=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 a=0,o=e.length;a<o;a++)r+=(t=e.charCodeAt(a))<127?1:t<=2047?2:t<=65535?3:4;return r},Qn=function(e){return e.match(/\d+(\.\d+){2}/)[0]};N((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=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),a=new O(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 a=n.delegate;if(a){var o=S(a,n);if(o){if(o===p)continue;return o}}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,a),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(N([])));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,a,o){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,a,o)}),(function(e){n("throw",e,a,o)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,o)}))}o(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 O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function N(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,a=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 a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=R.constructor=m,m.constructor=y,y.displayName=u(m,o,"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,o,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},I(C.prototype),C.prototype[a]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var a=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(R),u(R,o,"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=N,O.prototype={constructor:O,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 o.type="throw",o.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.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 a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},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:N(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 Wn=re.f,Jn=Function.prototype,zn=Jn.toString,Zn=/^\s*function ([^ (]*)/,Xn="name";U&&!(Xn in Jn)&&Wn(Jn,Xn,{configurable:!0,get:function(){try{return zn.call(this).match(Zn)[1]}catch(e){return""}}});var $n,er=U?Object.defineProperties:function(e,t){te(e);for(var n,r=Bn(t),i=r.length,s=0;i>s;)re.f(e,n=r[s++],t[n]);return e},tr=Ue("document","documentElement"),nr=Ee("IE_PROTO"),rr=function(){},ir=function(e){return"<script>"+e+"</"+"script>"},sr=function(){try{$n=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;sr=$n?function(e){e.write(ir("")),e.close();var t=e.parentWindow.Object;return e=null,t}($n):((t=Z("iframe")).style.display="none",tr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(ir("document.F=Object")),e.close(),e.F);for(var n=Ye.length;n--;)delete sr.prototype[Ye[n]];return sr()};Te[nr]=!0;var ar=Object.create||function(e,t){var n;return null!==e?(rr.prototype=te(e),n=new rr,rr.prototype=null,n[nr]=e):n=sr(),void 0===t?n:er(n,t)},or=kt("unscopables"),ur=Array.prototype;null==ur[or]&&re.f(ur,or,{configurable:!0,value:ar(null)});var cr,lr,hr=function(e){ur[or][e]=!0},fr=je.includes;at({target:"Array",proto:!0},{includes:function(e){return fr(this,e,arguments.length>1?arguments[1]:void 0)}}),hr("includes"),e.LogLevel=void 0,(cr=e.LogLevel||(e.LogLevel={}))[cr.LOG=0]="LOG",cr[cr.DEBUG=0]="DEBUG",cr[cr.INFO=1]="INFO",cr[cr.WARN=2]="WARN",cr[cr.ERROR=3]="ERROR",cr[cr.FATAL=4]="FATAL",cr[cr.NONE=1e3]="NONE",e.LogType=void 0,(lr=e.LogType||(e.LogType={})).IM="IM",lr.RTC="RTC";var dr={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},gr=Ln.forEach,pr=Fn("forEach")?[].forEach:function(e){return gr(this,e,arguments.length>1?arguments[1]:void 0)};for(var vr in dr){var yr=M[vr],mr=yr&&yr.prototype;if(mr&&mr.forEach!==pr)try{ie(mr,"forEach",pr)}catch(e){mr.forEach=pr}}var _r={};_r[kt("toStringTag")]="z";var Er="[object z]"===String(_r),Tr=kt("toStringTag"),Rr="Arguments"==B(function(){return arguments}()),Ir=Er?B: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),Tr))?n:Rr?B(t):"Object"==(r=B(t))&&"function"==typeof t.callee?"Arguments":r},Cr=Er?{}.toString:function(){return"[object "+Ir(this)+"]"};Er||ke(Object.prototype,"toString",Cr,{unsafe:!0});var Sr=M.Promise,br=function(e,t,n){for(var r in t)ke(e,r,t[r],n);return e},wr=re.f,Or=kt("toStringTag"),Nr=function(e,t,n){e&&!W(e=n?e:e.prototype,Or)&&wr(e,Or,{configurable:!0,value:t})},kr=kt("species"),Mr=function(e){var t=Ue(e),n=re.f;U&&t&&!t[kr]&&n(t,kr,{configurable:!0,get:function(){return this}})},Ar=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Ur={},Lr=kt("iterator"),xr=Array.prototype,Pr=function(e){return void 0!==e&&(Ur.Array===e||xr[Lr]===e)},Dr=kt("iterator"),Vr=function(e){if(null!=e)return e[Dr]||e["@@iterator"]||Ur[Ir(e)]},Br=function(e){var t=e.return;if(void 0!==t)return te(t.call(e)).value},Gr=function(e,t){this.stopped=e,this.result=t},Fr=function(e,t,n){var r,i,s,a,o,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=Mn(t,l,1+h+d),p=function(e){return r&&Br(r),new Gr(!0,e)},v=function(e){return h?(te(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=Vr(e)))throw TypeError("Target is not iterable");if(Pr(i)){for(s=0,a=Ve(e.length);a>s;s++)if((o=v(e[s]))&&o instanceof Gr)return o;return new Gr(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{o=v(c.value)}catch(e){throw Br(r),e}if("object"==typeof o&&o&&o instanceof Gr)return o}return new Gr(!1)},qr=kt("iterator"),jr=!1;try{var Kr=0,Hr={next:function(){return{done:!!Kr++}},return:function(){jr=!0}};Hr[qr]=function(){return this},Array.from(Hr,(function(){throw 2}))}catch(e){}var Yr,Qr,Wr,Jr=function(e,t){if(!t&&!jr)return!1;var n=!1;try{var r={};r[qr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},zr=kt("species"),Zr=function(e,t){var n,r=te(e).constructor;return void 0===r||null==(n=te(r)[zr])?t:kn(n)},Xr=/(?:iphone|ipod|ipad).*applewebkit/i.test(Et),$r=M.location,ei=M.setImmediate,ti=M.clearImmediate,ni=M.process,ri=M.MessageChannel,ii=M.Dispatch,si=0,ai={},oi="onreadystatechange",ui=function(e){if(ai.hasOwnProperty(e)){var t=ai[e];delete ai[e],t()}},ci=function(e){return function(){ui(e)}},li=function(e){ui(e.data)},hi=function(e){M.postMessage(e+"",$r.protocol+"//"+$r.host)};ei&&ti||(ei=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return ai[++si]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Yr(si),si},ti=function(e){delete ai[e]},_t?Yr=function(e){ni.nextTick(ci(e))}:ii&&ii.now?Yr=function(e){ii.now(ci(e))}:ri&&!Xr?(Wr=(Qr=new ri).port2,Qr.port1.onmessage=li,Yr=Mn(Wr.postMessage,Wr,1)):M.addEventListener&&"function"==typeof postMessage&&!M.importScripts&&$r&&"file:"!==$r.protocol&&!A(hi)?(Yr=hi,M.addEventListener("message",li,!1)):Yr=oi in Z("script")?function(e){tr.appendChild(Z("script")).onreadystatechange=function(){tr.removeChild(this),ui(e)}}:function(e){setTimeout(ci(e),0)});var fi,di,gi,pi,vi,yi,mi,_i,Ei={set:ei,clear:ti},Ti=/web0s(?!.*chrome)/i.test(Et),Ri=ee.f,Ii=Ei.set,Ci=M.MutationObserver||M.WebKitMutationObserver,Si=M.document,bi=M.process,wi=M.Promise,Oi=Ri(M,"queueMicrotask"),Ni=Oi&&Oi.value;Ni||(fi=function(){var e,t;for(_t&&(e=bi.domain)&&e.exit();di;){t=di.fn,di=di.next;try{t()}catch(e){throw di?pi():gi=void 0,e}}gi=void 0,e&&e.enter()},Xr||_t||Ti||!Ci||!Si?wi&&wi.resolve?(mi=wi.resolve(void 0),_i=mi.then,pi=function(){_i.call(mi,fi)}):pi=_t?function(){bi.nextTick(fi)}:function(){Ii.call(M,fi)}:(vi=!0,yi=Si.createTextNode(""),new Ci(fi).observe(yi,{characterData:!0}),pi=function(){yi.data=vi=!vi}));var ki,Mi,Ai,Ui,Li=Ni||function(e){var t={fn:e,next:void 0};gi&&(gi.next=t),di||(di=t,pi()),gi=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=kn(t),this.reject=kn(n)},Pi={f:function(e){return new xi(e)}},Di=function(e,t){if(te(e),K(t)&&t.constructor===e)return t;var n=Pi.f(e);return(0,n.resolve)(t),n.promise},Vi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Bi=Ei.set,Gi=kt("species"),Fi="Promise",qi=Ne.get,ji=Ne.set,Ki=Ne.getterFor(Fi),Hi=Sr,Yi=M.TypeError,Qi=M.document,Wi=M.process,Ji=Ue("fetch"),zi=Pi.f,Zi=zi,Xi=!!(Qi&&Qi.createEvent&&M.dispatchEvent),$i="function"==typeof PromiseRejectionEvent,es="unhandledrejection",ts=it(Fi,(function(){if(!(fe(Hi)!==String(Hi))){if(66===Ct)return!0;if(!_t&&!$i)return!0}if(Ct>=51&&/native code/.test(Hi))return!1;var e=Hi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Gi]=t,!(e.then((function(){}))instanceof t)})),ns=ts||!Jr((function(e){Hi.all(e).catch((function(){}))})),rs=function(e){var t;return!(!K(e)||"function"!=typeof(t=e.then))&&t},is=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Li((function(){for(var r=e.value,i=1==e.state,s=0;n.length>s;){var a,o,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&&us(e),e.rejection=1),!0===l?a=r:(d&&d.enter(),a=l(r),d&&(d.exit(),u=!0)),a===c.promise?f(Yi("Promise-chain cycle")):(o=rs(a))?o.call(a,h,f):h(a)):f(r)}catch(e){d&&!u&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&as(e)}))}},ss=function(e,t,n){var r,i;Xi?((r=Qi.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),M.dispatchEvent(r)):r={promise:t,reason:n},!$i&&(i=M["on"+e])?i(r):e===es&&function(e,t){var n=M.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},as=function(e){Bi.call(M,(function(){var t,n=e.facade,r=e.value;if(os(e)&&(t=Vi((function(){_t?Wi.emit("unhandledRejection",r,n):ss(es,n,r)})),e.rejection=_t||os(e)?2:1,t.error))throw t.value}))},os=function(e){return 1!==e.rejection&&!e.parent},us=function(e){Bi.call(M,(function(){var t=e.facade;_t?Wi.emit("rejectionHandled",t):ss("rejectionhandled",t,e.value)}))},cs=function(e,t,n){return function(r){e(t,r,n)}},ls=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,is(e,!0))},hs=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Yi("Promise can't be resolved itself");var r=rs(t);r?Li((function(){var n={done:!1};try{r.call(t,cs(hs,n,e),cs(ls,n,e))}catch(t){ls(n,t,e)}})):(e.value=t,e.state=1,is(e,!1))}catch(t){ls({done:!1},t,e)}}};ts&&(Hi=function(e){Ar(this,Hi,Fi),kn(e),ki.call(this);var t=qi(this);try{e(cs(hs,t),cs(ls,t))}catch(e){ls(t,e)}},(ki=function(e){ji(this,{type:Fi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=br(Hi.prototype,{then:function(e,t){var n=Ki(this),r=zi(Zr(this,Hi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=_t?Wi.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&is(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Mi=function(){var e=new ki,t=qi(e);this.promise=e,this.resolve=cs(hs,t),this.reject=cs(ls,t)},Pi.f=zi=function(e){return e===Hi||e===Ai?new Mi(e):Zi(e)},"function"==typeof Sr&&(Ui=Sr.prototype.then,ke(Sr.prototype,"then",(function(e,t){var n=this;return new Hi((function(e,t){Ui.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Ji&&at({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Di(Hi,Ji.apply(M,arguments))}}))),at({global:!0,wrap:!0,forced:ts},{Promise:Hi}),Nr(Hi,Fi,!1),Mr(Fi),Ai=Ue(Fi),at({target:Fi,stat:!0,forced:ts},{reject:function(e){var t=zi(this);return t.reject.call(void 0,e),t.promise}}),at({target:Fi,stat:!0,forced:ts},{resolve:function(e){return Di(this,e)}}),at({target:Fi,stat:!0,forced:ns},{all:function(e){var t=this,n=zi(t),r=n.resolve,i=n.reject,s=Vi((function(){var n=kn(t.resolve),s=[],a=0,o=1;Fr(e,(function(e){var u=a++,c=!1;s.push(void 0),o++,n.call(t,e).then((function(e){c||(c=!0,s[u]=e,--o||r(s))}),i)})),--o||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=zi(t),r=n.reject,i=Vi((function(){var i=kn(t.resolve);Fr(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var fs="RC_Logs";function ds(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(fs),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=h({},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,fs,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var gs=function(){function e(){a(this,e)}return u(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 a=e._db.transaction([t],"readwrite").objectStore(t),o=IDBKeyRange.bound(r,i),u=a.index(n),c=[],l=u.openCursor(o);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._db&&(e._db.onclose=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has unexpectedly closed."),t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening error."),t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening aborted."),t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e._db=t.target.result,ds(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();gs._db=null;var ps=kt("match"),vs=function(e){var t;return K(e)&&(void 0!==(t=e[ps])?!!t:"RegExp"==B(e))},ys=ct.UNSUPPORTED_Y,ms=[].push,_s=Math.min,Es=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(q(this)),i=void 0===n?Es:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!vs(e))return t.call(r,e,i);for(var s,a,o,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=vt.call(h,r))&&!((a=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&ms.apply(u,s.slice(1)),o=s[0].length,l=a,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!o&&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=q(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 a=te(e),o=String(this),u=Zr(a,RegExp),c=a.unicode,l=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(ys?"g":"y"),h=new u(ys?"^(?:"+a.source+")":a,l),f=void 0===i?Es:i>>>0;if(0===f)return[];if(0===o.length)return null===qt(h,o)?[o]:[];for(var d=0,g=0,p=[];g<o.length;){h.lastIndex=ys?0:g;var v,y=qt(h,ys?o.slice(g):o);if(null===y||(v=_s(Ve(h.lastIndex+(ys?g:0)),o.length))===d)g=Ft(o,g,c);else{if(p.push(o.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(o.slice(d)),p}]}),ys);var Ts="toString",Rs=RegExp.prototype,Is=Rs.toString,Cs=A((function(){return"/a/b"!=Is.call({source:"a",flags:"b"})})),Ss=Is.name!=Ts;(Cs||Ss)&&ke(RegExp.prototype,Ts,(function(){var e=te(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Rs)?ot.call(e):n)}),{unsafe:!0});var bs,ws=function(e,t){return e+Math.floor(Math.random()*(t-e))},Os=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)}))},Ns=function(){var e=Os();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.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(bs||(bs={}));var ks,Ms=bs;!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"}(ks||(ks={}));var As,Us=ks,Ls=function(e){return"string"==typeof e},xs=function(e){return"boolean"==typeof e},Ps=function(e){return"number"==typeof e&&!isNaN(e)},Ds=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Vs=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Bs=function(e){return Ls(e)&&e.length>0},Gs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Fs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},qs=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},js=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ks=function(e){for(var t in e)return!0;return!1},Hs=function(e){var t=!1;if(Gs(e))for(var n in e)if(t=Ls(n)&&!/^[A-Za-z0-9_=+-]+$/.test(n))break;return t},Ys={};console&&(c(As={},e.LogLevel.DEBUG,console.debug.bind(console)),c(As,e.LogLevel.INFO,console.info.bind(console)),c(As,e.LogLevel.WARN,console.warn.bind(console)),c(As,e.LogLevel.ERROR,console.error.bind(console)),c(As,e.LogLevel.FATAL,console.log.bind(console)),Ys=As);var Qs=function(e){return Ls(e)||Ps(e)||qs(e)||xs(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Ws=function(){function t(n,r,i){a(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 u(t,[{key:"_defaultStdout",value:function(e,t){if(Ys[e]){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];(n=Ys)[e].apply(n,["".concat(t,":")].concat(i))}}},{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 a=Date.now();Yn(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,a="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return a;a+=e.charAt(s)}return e}(r,1e3));var o=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:a,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(o,'"\n'),userId:t.userId};t.databaseLogList.push(c),(t.databaseLogList.length>=100||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=s(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=C(t.databaseLogList),t.databaseLogList=[],!(r=gs.getInstance())){e.next=14;break}return e.next=6,r.addList(fs,n);case 6:return i=e.sent,e.next=9,r.getCount(fs,"time");case 9:return e.sent>1e5&&r.removeFirstData(fs,"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(t>e.LogLevel.DEBUG&&this.__pushLocalLog(t,r.map(Qs).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),a="".concat(s," - ").concat(r.map(Qs).join(" "));this._logStdout?this._logStdout(t,a):this._stdout?this._stdout(t,a):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}();Ws.databaseLogList=[],Ws.realTimeLogList=[],Ws.sessionId=Ns(),Ws.userId="";var Js=new Ws("RCLog"),zs=Wt("splice"),Zs=Math.max,Xs=Math.min,$s=9007199254740991,ea="Maximum allowed length exceeded";at({target:"Array",proto:!0,forced:!zs},{splice:function(e,t){var n,r,i,s,a,o,u=Y(this),c=Ve(u.length),l=Fe(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=Xs(Zs(Pe(t),0),c-l)),c+n-r>$s)throw TypeError(ea);for(i=Yt(u,r),s=0;s<r;s++)(a=l+s)in u&&Kt(i,s,u[a]);if(i.length=r,n<r){for(s=l;s<c-r;s++)o=s+n,(a=s+r)in u?u[o]=u[a]:delete u[o];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)o=s+n-1,(a=s+r-1)in u?u[o]=u[a]:delete u[o];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var ta,na=function(){function e(){a(this,e),this._map={}}return u(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 a=t[s],o=a.target,u=a.once,c=a.listener;u&&t.splice(s,1);try{c.call.apply(c,[o].concat(r))}catch(e){Js.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"}(ta||(ta={}));var ra,ia=ta;!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.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",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_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",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=35021]="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.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",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",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(ra||(ra={}));var sa,aa=ra;!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"}(sa||(sa={}));var oa,ua=sa,ca={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,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};!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",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(oa||(oa={}));var la,ha=oa;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(la||(la={}));var fa,da=la;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(fa||(fa={}));var ga,pa=fa;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(ga||(ga={}));var va,ya=ga;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(va||(va={}));var ma,_a=va;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ma||(ma={}));var Ea,Ta=ma;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Ea||(Ea={}));var Ra,Ia,Ca,Sa=Ea;e.RTCMode=void 0,(Ra=e.RTCMode||(e.RTCMode={}))[Ra.RTC=0]="RTC",Ra[Ra.LIVE=2]="LIVE",e.LiveType=void 0,(Ia=e.LiveType||(e.LiveType={}))[Ia.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",Ia[Ia.AUDIO=1]="AUDIO",e.LiveRole=void 0,(Ca=e.LiveRole||(e.LiveRole={}))[Ca.ANCHOR=1]="ANCHOR",Ca[Ca.AUDIENCE=2]="AUDIENCE";var ba,wa,Oa,Na={"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,(ba=e.RTCApiType||(e.RTCApiType={}))[ba.ROOM=1]="ROOM",ba[ba.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(wa=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[wa.AnchorToViewer=1]="AnchorToViewer",wa[wa.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(Oa=e.RTCJoinType||(e.RTCJoinType={}))[Oa.KICK=0]="KICK",Oa[Oa.REFUSE=1]="REFUSE",Oa[Oa.COEXIST=2]="COEXIST";var ka=function(e){var t=String(q(this)),n="",r=Pe(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},Ma=Math.ceil,Aa=function(e){return function(t,n,r){var i,s,a=String(q(t)),o=a.length,u=void 0===r?" ":String(r),c=Ve(n);return c<=o||""==u?a:((s=ka.call(u,Ma((i=c-o)/u.length))).length>i&&(s=s.slice(0,i)),e?a+s:s+a)}},Ua={start:Aa(!1),end:Aa(!0)},La=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Et),xa=Ua.start;at({target:"String",proto:!0,forced:La},{padStart:function(e){return xa(this,e,arguments.length>1?arguments[1]:void 0)}});var Pa,Da,Va={engine:"5.2.0"},Ba=function(){function e(){a(this,e)}return u(e,null,[{key:"add",value:function(e,t){Va[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Js.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Va.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Va}}]),e}();e.AssertRules=void 0,(Da=e.AssertRules||(e.AssertRules={}))[Da.STRING=0]="STRING",Da[Da.ONLY_STRING=1]="ONLY_STRING",Da[Da.NUMBER=2]="NUMBER",Da[Da.BOOLEAN=3]="BOOLEAN",Da[Da.OBJECT=4]="OBJECT",Da[Da.ARRAY=5]="ARRAY",Da[Da.CALLBACK=6]="CALLBACK",Da[Da.CHANNEL_ID=7]="CHANNEL_ID";var Ga=(c(Pa={},e.AssertRules.STRING,Bs),c(Pa,e.AssertRules.ONLY_STRING,Ls),c(Pa,e.AssertRules.NUMBER,Ps),c(Pa,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),c(Pa,e.AssertRules.OBJECT,Gs),c(Pa,e.AssertRules.ARRAY,Ds),c(Pa,e.AssertRules.CALLBACK,(function(e){var t=!0;return Gs(e)||(t=!1),(e=e||{}).onSuccess&&!Fs(e.onSuccess)&&(t=!1),e.onError&&!Fs(e.onError)&&(t=!1),t})),c(Pa,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ls(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),Pa),Fa=function(e){f(n,e);var t=T(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(m(Error)),qa=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=Ga[n]||n;var i=r&&!n(t)||!r&&!(qs(t)||null===t||n(t));return i&&Js.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},ja=[].slice,Ka=/MSIE .\./.test(Et),Ha=function(e){return function(t,n){var r=arguments.length>2,i=r?ja.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};at({global:!0,bind:!0,forced:Ka},{setTimeout:Ha(M.setTimeout),setInterval:Ha(M.setInterval)});var Ya=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 te(n),function(e){if(!K(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),Qa=function(e,t,n){var r,i;return Ya&&"function"==typeof(r=t.constructor)&&r!==n&&K(i=r.prototype)&&i!==n.prototype&&Ya(e,i),e},Wa=re.f,Ja=We.f,za=Ne.enforce,Za=kt("match"),Xa=M.RegExp,$a=Xa.prototype,eo=/a/g,to=/a/g,no=new Xa(eo)!==eo,ro=ct.UNSUPPORTED_Y;if(U&&it("RegExp",!no||ro||A((function(){return to[Za]=!1,Xa(eo)!=eo||Xa(to)==to||"/a/i"!=Xa(eo,"i")})))){for(var io=function(e,t){var n,r=this instanceof io,i=vs(e),s=void 0===t;if(!r&&i&&e.constructor===io&&s)return e;no?i&&!s&&(e=e.source):e instanceof io&&(s&&(t=ot.call(e)),e=e.source),ro&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var a=Qa(no?new Xa(e,t):Xa(e,t),r?this:$a,io);ro&&n&&(za(a).sticky=!0);return a},so=function(e){e in io||Wa(io,e,{configurable:!0,get:function(){return Xa[e]},set:function(t){Xa[e]=t}})},ao=Ja(Xa),oo=0;ao.length>oo;)so(ao[oo++]);$a.constructor=io,io.prototype=$a,ke(M,"RegExp",io)}Mr("RegExp");var uo,co,lo,ho=function(e){if(!Gs(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)},fo=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Os(),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(),a="";if(t){var o=t.split(".");a="."+o[o.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(a)},go=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,a=t.channelIdMi,o=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:o||""}},{MI:{channelId:a||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},po=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,a,o=Object.keys(e);if(0!==o.length){var u=o[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===(a=e[u])||void 0===a?void 0:a.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){Js.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},vo=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},yo=function(e){var t=e.length;return t<=4096&&t>=1},mo=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Gs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Ds(e)||Ls(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)}()},_o=function(e,t){return mo(e,(function(n,r){e[r]=t(n,r)})),e},Eo=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return mo(e,(function(e,r){t===e&&(n=r)})),n},To=function(e,t){var n=[];return mo(e,(function(e){n.push(e)})),-1!==Eo(n,t)},Ro=function(e){return JSON.parse(JSON.stringify(e))},Io=function(){return"undefined"!=typeof RCCppEngine},Co=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 a=r.match(i[s]);if(a){n=s,t=a[1]||a[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},So=function(e){switch(e){case ca.SERVER_UNAVAILABLE:return aa.SERVER_UNAVAILABLE;case ca.TOKEN_INCORRECT:return aa.RC_CONN_USER_OR_PASSWD_ERROR;case ca.REDIRECT:return aa.RC_CONN_REDIRECTED;case ca.APP_BLOCK_OR_DELETE:return aa.RC_CONN_APP_BLOCKED_OR_DELETED;case ca.BLOCK:return aa.RC_CONN_USER_BLOCKED;case ca.TOKEN_EXPIRE:return aa.RC_CONN_USER_OR_PASSWD_ERROR;case ca.HOSTNAME_ERROR:return aa.HOSTNAME_ERROR;case ca.HASOHTERSAMECLIENTONLINE:return aa.HAS_OHTER_SAME_CLIENT_ON_LINE;case ca.APP_AUTH_NOT_PASS:return aa.RC_APP_AUTH_NOT_PASS;case ca.OTP_USED:return aa.RC_OTP_USED;case ca.PLATFORM_ERROR:return aa.RC_PLATFORM_ERROR;default:return aa.RC_NET_UNAVAILABLE}},bo=function e(t){var n;if("object"===r(t))if(Array.isArray(t))for(var i in n=[],t)n.push(e(t[i]));else for(var s in n={},t)n[s]=e(t[s]);else n=t;return n},wo=function(e){var t;try{t=bo(e)}catch(n){Js.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},Oo=function(e){var t={},n=JSON.parse(e);return mo(n,(function(e,n){t[n]=e.v})),t},No={_delayTime:0,setTime:function(e){var t=(new Date).getTime();No._delayTime=t-e},getTime:function(){var e=No._delayTime;return(new Date).getTime()-e}},ko=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Mo=!A((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ao=Ee("IE_PROTO"),Uo=Object.prototype,Lo=Mo?Object.getPrototypeOf:function(e){return e=Y(e),W(e,Ao)?e[Ao]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Uo:null},xo=kt("iterator"),Po=!1;[].keys&&("next"in(lo=[].keys())?(co=Lo(Lo(lo)))!==Object.prototype&&(uo=co):Po=!0),(null==uo||A((function(){var e={};return uo[xo].call(e)!==e})))&&(uo={}),W(uo,xo)||ie(uo,xo,(function(){return this}));var Do={IteratorPrototype:uo,BUGGY_SAFARI_ITERATORS:Po},Vo=Do.IteratorPrototype,Bo=function(){return this},Go=Do.IteratorPrototype,Fo=Do.BUGGY_SAFARI_ITERATORS,qo=kt("iterator"),jo="keys",Ko="values",Ho="entries",Yo=function(){return this},Qo=function(e,t,n,r,i,s,a){!function(e,t,n){var r=t+" Iterator";e.prototype=ar(Vo,{next:D(1,n)}),Nr(e,r,!1),Ur[r]=Bo}(n,t,r);var o,u,c,l=function(e){if(e===i&&p)return p;if(!Fo&&e in d)return d[e];switch(e){case jo:case Ko:case Ho:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",f=!1,d=e.prototype,g=d[qo]||d["@@iterator"]||i&&d[i],p=!Fo&&g||l(i),v="Array"==t&&d.entries||g;if(v&&(o=Lo(v.call(new e)),Go!==Object.prototype&&o.next&&(Lo(o)!==Go&&(Ya?Ya(o,Go):"function"!=typeof o[qo]&&ie(o,qo,Yo)),Nr(o,h,!0))),i==Ko&&g&&g.name!==Ko&&(f=!0,p=function(){return g.call(this)}),d[qo]!==p&&ie(d,qo,p),Ur[t]=p,i)if(u={values:l(Ko),keys:s?p:l(jo),entries:l(Ho)},a)for(c in u)(Fo||f||!(c in d))&&ke(d,c,u[c]);else at({target:t,proto:!0,forced:Fo||f},u);return u},Wo="Array Iterator",Jo=Ne.set,zo=Ne.getterFor(Wo),Zo=Qo(Array,"Array",(function(e,t){Jo(this,{type:Wo,target:j(e),index:0,kind:t})}),(function(){var e=zo(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");Ur.Arguments=Ur.Array,hr("keys"),hr("values"),hr("entries");var Xo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,$o=function(e){if(void 0===e)return 0;var t=Pe(e),n=Ve(t);if(t!==n)throw RangeError("Wrong length or index");return n},eu=Math.abs,tu=Math.pow,nu=Math.floor,ru=Math.log,iu=Math.LN2,su=function(e,t,n){var r,i,s,a=new Array(n),o=8*n-t-1,u=(1<<o)-1,c=u>>1,l=23===t?tu(2,-24)-tu(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=eu(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=nu(ru(e)/iu),e*(s=tu(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*tu(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*tu(2,t),r+=c):(i=e*tu(2,c-1)*tu(2,t),r=0));t>=8;a[f++]=255&i,i/=256,t-=8);for(r=r<<t|i,o+=t;o>0;a[f++]=255&r,r/=256,o-=8);return a[--f]|=128*h,a},au=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,a=s>>1,o=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;o>0;l=256*l+e[u],u--,o-=8);for(n=l&(1<<-o)-1,l>>=-o,o+=t;o>0;n=256*n+e[u],u--,o-=8);if(0===l)l=1-a;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=tu(2,t),l-=a}return(c?-1:1)*n*tu(2,l-t)},ou=function(e){for(var t=Y(this),n=Ve(t.length),r=arguments.length,i=Fe(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,a=void 0===s?n:Fe(s,n);a>i;)t[i++]=e;return t},uu=We.f,cu=re.f,lu=Ne.get,hu=Ne.set,fu="ArrayBuffer",du="DataView",gu="Wrong index",pu=M.ArrayBuffer,vu=pu,yu=M.DataView,mu=yu&&yu.prototype,_u=Object.prototype,Eu=M.RangeError,Tu=su,Ru=au,Iu=function(e){return[255&e]},Cu=function(e){return[255&e,e>>8&255]},Su=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},bu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},wu=function(e){return Tu(e,23,4)},Ou=function(e){return Tu(e,52,8)},Nu=function(e,t){cu(e.prototype,t,{get:function(){return lu(this)[t]}})},ku=function(e,t,n,r){var i=$o(n),s=lu(e);if(i+t>s.byteLength)throw Eu(gu);var a=lu(s.buffer).bytes,o=i+s.byteOffset,u=a.slice(o,o+t);return r?u:u.reverse()},Mu=function(e,t,n,r,i,s){var a=$o(n),o=lu(e);if(a+t>o.byteLength)throw Eu(gu);for(var u=lu(o.buffer).bytes,c=a+o.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Xo){if(!A((function(){pu(1)}))||!A((function(){new pu(-1)}))||A((function(){return new pu,new pu(1.5),new pu(NaN),pu.name!=fu}))){for(var Au,Uu=(vu=function(e){return Ar(this,vu),new pu($o(e))}).prototype=pu.prototype,Lu=uu(pu),xu=0;Lu.length>xu;)(Au=Lu[xu++])in vu||ie(vu,Au,pu[Au]);Uu.constructor=vu}Ya&&Lo(mu)!==_u&&Ya(mu,_u);var Pu=new yu(new vu(2)),Du=mu.setInt8;Pu.setInt8(0,2147483648),Pu.setInt8(1,2147483649),!Pu.getInt8(0)&&Pu.getInt8(1)||br(mu,{setInt8:function(e,t){Du.call(this,e,t<<24>>24)},setUint8:function(e,t){Du.call(this,e,t<<24>>24)}},{unsafe:!0})}else vu=function(e){Ar(this,vu,fu);var t=$o(e);hu(this,{bytes:ou.call(new Array(t),0),byteLength:t}),U||(this.byteLength=t)},yu=function(e,t,n){Ar(this,yu,du),Ar(e,vu,du);var r=lu(e).byteLength,i=Pe(t);if(i<0||i>r)throw Eu("Wrong offset");if(i+(n=void 0===n?r-i:Ve(n))>r)throw Eu("Wrong length");hu(this,{buffer:e,byteLength:n,byteOffset:i}),U||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},U&&(Nu(vu,"byteLength"),Nu(yu,"buffer"),Nu(yu,"byteLength"),Nu(yu,"byteOffset")),br(yu.prototype,{getInt8:function(e){return ku(this,1,e)[0]<<24>>24},getUint8:function(e){return ku(this,1,e)[0]},getInt16:function(e){var t=ku(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=ku(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return bu(ku(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return bu(ku(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Ru(ku(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Ru(ku(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){Mu(this,1,e,Iu,t)},setUint8:function(e,t){Mu(this,1,e,Iu,t)},setInt16:function(e,t){Mu(this,2,e,Cu,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){Mu(this,2,e,Cu,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){Mu(this,4,e,Su,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){Mu(this,4,e,Su,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){Mu(this,4,e,wu,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){Mu(this,8,e,Ou,t,arguments.length>2?arguments[2]:void 0)}});Nr(vu,fu),Nr(yu,du);var Vu={ArrayBuffer:vu,DataView:yu},Bu=Vu.ArrayBuffer,Gu=Vu.DataView,Fu=Bu.prototype.slice,qu=A((function(){return!new Bu(2).slice(1,void 0).byteLength}));at({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:qu},{slice:function(e,t){if(void 0!==Fu&&void 0===t)return Fu.call(te(this),e);for(var n=te(this).byteLength,r=Fe(e,n),i=Fe(void 0===t?n:t,n),s=new(Zr(this,Bu))(Ve(i-r)),a=new Gu(this),o=new Gu(s),u=0;r<i;)o.setUint8(u++,a.getUint8(r++));return s}});var ju,Ku=re.f,Hu=M.Int8Array,Yu=Hu&&Hu.prototype,Qu=M.Uint8ClampedArray,Wu=Qu&&Qu.prototype,Ju=Hu&&Lo(Hu),zu=Yu&&Lo(Yu),Zu=Object.prototype,Xu=Zu.isPrototypeOf,$u=kt("toStringTag"),ec=me("TYPED_ARRAY_TAG"),tc=Xo&&!!Ya&&"Opera"!==Ir(M.opera),nc=!1,rc={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ic={BigInt64Array:8,BigUint64Array:8},sc=function(e){if(!K(e))return!1;var t=Ir(e);return W(rc,t)||W(ic,t)};for(ju in rc)M[ju]||(tc=!1);if((!tc||"function"!=typeof Ju||Ju===Function.prototype)&&(Ju=function(){throw TypeError("Incorrect invocation")},tc))for(ju in rc)M[ju]&&Ya(M[ju],Ju);if((!tc||!zu||zu===Zu)&&(zu=Ju.prototype,tc))for(ju in rc)M[ju]&&Ya(M[ju].prototype,zu);if(tc&&Lo(Wu)!==zu&&Ya(Wu,zu),U&&!W(zu,$u))for(ju in nc=!0,Ku(zu,$u,{get:function(){return K(this)?this[ec]:void 0}}),rc)M[ju]&&ie(M[ju],ec,ju);var ac={NATIVE_ARRAY_BUFFER_VIEWS:tc,TYPED_ARRAY_TAG:nc&&ec,aTypedArray:function(e){if(sc(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Ya){if(Xu.call(Ju,e))return e}else for(var t in rc)if(W(rc,ju)){var n=M[t];if(n&&(e===n||Xu.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 rc){var i=M[r];i&&W(i.prototype,e)&&delete i.prototype[e]}zu[e]&&!n||ke(zu,e,n?t:tc&&Yu[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(U){if(Ya){if(n)for(r in rc)(i=M[r])&&W(i,e)&&delete i[e];if(Ju[e]&&!n)return;try{return ke(Ju,e,n?t:tc&&Hu[e]||t)}catch(e){}}for(r in rc)!(i=M[r])||i[e]&&!n||ke(i,e,t)}},isView:function(e){if(!K(e))return!1;var t=Ir(e);return"DataView"===t||W(rc,t)||W(ic,t)},isTypedArray:sc,TypedArray:Ju,TypedArrayPrototype:zu},oc=ac.NATIVE_ARRAY_BUFFER_VIEWS,uc=M.ArrayBuffer,cc=M.Int8Array,lc=!oc||!A((function(){cc(1)}))||!A((function(){new cc(-1)}))||!Jr((function(e){new cc,new cc(null),new cc(1.5),new cc(e)}),!0)||A((function(){return 1!==new cc(new uc(2),1,void 0).length})),hc=function(e,t){var n=function(e){var t=Pe(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},fc=ac.aTypedArrayConstructor,dc=function(e){var t,n,r,i,s,a,o=Y(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Vr(o);if(null!=h&&!Pr(h))for(a=(s=h.call(o)).next,o=[];!(i=a.call(s)).done;)o.push(i.value);for(l&&u>2&&(c=Mn(c,arguments[2],2)),n=Ve(o.length),r=new(fc(this))(n),t=0;n>t;t++)r[t]=l?c(o[t],t):o[t];return r},gc=N((function(e){var t=We.f,n=Ln.forEach,r=Ne.get,i=Ne.set,s=re.f,a=ee.f,o=Math.round,u=M.RangeError,c=Vu.ArrayBuffer,l=Vu.DataView,h=ac.NATIVE_ARRAY_BUFFER_VIEWS,f=ac.TYPED_ARRAY_TAG,d=ac.TypedArray,g=ac.TypedArrayPrototype,p=ac.aTypedArrayConstructor,v=ac.isTypedArray,y="BYTES_PER_ELEMENT",m="Wrong length",_=function(e,t){for(var n=0,r=t.length,i=new(p(e))(r);r>n;)i[n]=t[n++];return i},E=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},T=function(e){var t;return e instanceof c||"ArrayBuffer"==(t=Ir(e))||"SharedArrayBuffer"==t},R=function(e,t){return v(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},I=function(e,t){return R(e,t=H(t,!0))?D(2,e[t]):a(e,t)},C=function(e,t,n){return!(R(e,t=H(t,!0))&&K(n)&&W(n,"value"))||W(n,"get")||W(n,"set")||n.configurable||W(n,"writable")&&!n.writable||W(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};U?(h||(ee.f=I,re.f=C,E(g,"buffer"),E(g,"byteOffset"),E(g,"byteLength"),E(g,"length")),at({target:"Object",stat:!0,forced:!h},{getOwnPropertyDescriptor:I,defineProperty:C}),e.exports=function(e,a,p){var E=e.match(/\d+$/)[0]/8,R=e+(p?"Clamped":"")+"Array",I="get"+e,C="set"+e,S=M[R],b=S,w=b&&b.prototype,O={},N=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[I](t*E+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);p&&(n=(n=o(n))<0?0:n>255?255:255&n),i.view[C](t*E+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};h?lc&&(b=a((function(e,t,n,r){return Ar(e,b,R),Qa(K(t)?T(t)?void 0!==r?new S(t,hc(n,E),r):void 0!==n?new S(t,hc(n,E)):new S(t):v(t)?_(b,t):dc.call(b,t):new S($o(t)),e,b)})),Ya&&Ya(b,d),n(t(S),(function(e){e in b||ie(b,e,S[e])})),b.prototype=w):(b=a((function(e,t,n,r){Ar(e,b,R);var s,a,o,h=0,f=0;if(K(t)){if(!T(t))return v(t)?_(b,t):dc.call(b,t);s=t,f=hc(n,E);var d=t.byteLength;if(void 0===r){if(d%E)throw u(m);if((a=d-f)<0)throw u(m)}else if((a=Ve(r)*E)+f>d)throw u(m);o=a/E}else o=$o(t),s=new c(a=o*E);for(i(e,{buffer:s,byteOffset:f,byteLength:a,length:o,view:new l(s)});h<o;)N(e,h++)})),Ya&&Ya(b,d),w=b.prototype=ar(g)),w.constructor!==b&&ie(w,"constructor",b),f&&ie(w,f,R),O[R]=b,at({global:!0,forced:b!=S,sham:!h},O),y in b||ie(b,y,E),y in w||ie(w,y,E),Mr(R)}):e.exports=function(){}}));gc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var pc=Math.min,vc=[].copyWithin||function(e,t){var n=Y(this),r=Ve(n.length),i=Fe(e,r),s=Fe(t,r),a=arguments.length>2?arguments[2]:void 0,o=pc((void 0===a?r:Fe(a,r))-s,r-i),u=1;for(s<i&&i<s+o&&(u=-1,s+=o-1,i+=o-1);o-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},yc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("copyWithin",(function(e,t){return vc.call(yc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var mc=Ln.every,_c=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("every",(function(e){return mc(_c(this),e,arguments.length>1?arguments[1]:void 0)}));var Ec=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("fill",(function(e){return ou.apply(Ec(this),arguments)}));var Tc=ac.aTypedArrayConstructor,Rc=function(e,t){for(var n=Zr(e,e.constructor),r=0,i=t.length,s=new(Tc(n))(i);i>r;)s[r]=t[r++];return s},Ic=Ln.filter,Cc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("filter",(function(e){var t=Ic(Cc(this),e,arguments.length>1?arguments[1]:void 0);return Rc(this,t)}));var Sc=Ln.find,bc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("find",(function(e){return Sc(bc(this),e,arguments.length>1?arguments[1]:void 0)}));var wc=Ln.findIndex,Oc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("findIndex",(function(e){return wc(Oc(this),e,arguments.length>1?arguments[1]:void 0)}));var Nc=Ln.forEach,kc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("forEach",(function(e){Nc(kc(this),e,arguments.length>1?arguments[1]:void 0)}));var Mc=je.includes,Ac=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("includes",(function(e){return Mc(Ac(this),e,arguments.length>1?arguments[1]:void 0)}));var Uc=je.indexOf,Lc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("indexOf",(function(e){return Uc(Lc(this),e,arguments.length>1?arguments[1]:void 0)}));var xc=kt("iterator"),Pc=M.Uint8Array,Dc=Zo.values,Vc=Zo.keys,Bc=Zo.entries,Gc=ac.aTypedArray,Fc=ac.exportTypedArrayMethod,qc=Pc&&Pc.prototype[xc],jc=!!qc&&("values"==qc.name||null==qc.name),Kc=function(){return Dc.call(Gc(this))};Fc("entries",(function(){return Bc.call(Gc(this))})),Fc("keys",(function(){return Vc.call(Gc(this))})),Fc("values",Kc,!jc),Fc(xc,Kc,!jc);var Hc=ac.aTypedArray,Yc=[].join;(0,ac.exportTypedArrayMethod)("join",(function(e){return Yc.apply(Hc(this),arguments)}));var Qc=Math.min,Wc=[].lastIndexOf,Jc=!!Wc&&1/[1].lastIndexOf(1,-0)<0,zc=Fn("lastIndexOf"),Zc=Jc||!zc?function(e){if(Jc)return Wc.apply(this,arguments)||0;var t=j(this),n=Ve(t.length),r=n-1;for(arguments.length>1&&(r=Qc(r,Pe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Wc,Xc=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("lastIndexOf",(function(e){return Zc.apply(Xc(this),arguments)}));var $c=Ln.map,el=ac.aTypedArray,tl=ac.aTypedArrayConstructor;(0,ac.exportTypedArrayMethod)("map",(function(e){return $c(el(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(tl(Zr(e,e.constructor)))(t)}))}));var nl=function(e){return function(t,n,r,i){kn(n);var s=Y(t),a=F(s),o=Ve(s.length),u=e?o-1:0,c=e?-1:1;if(r<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:o<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:o>u;u+=c)u in a&&(i=n(i,a[u],u,s));return i}},rl={left:nl(!1),right:nl(!0)},il=rl.left,sl=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("reduce",(function(e){return il(sl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var al=rl.right,ol=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("reduceRight",(function(e){return al(ol(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var ul=ac.aTypedArray,cl=ac.exportTypedArrayMethod,ll=Math.floor;cl("reverse",(function(){for(var e,t=this,n=ul(t).length,r=ll(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var hl=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("set",(function(e){hl(this);var t=hc(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=Y(e),i=Ve(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 fl=ac.aTypedArray,dl=ac.aTypedArrayConstructor,gl=[].slice;(0,ac.exportTypedArrayMethod)("slice",(function(e,t){for(var n=gl.call(fl(this),e,t),r=Zr(this,this.constructor),i=0,s=n.length,a=new(dl(r))(s);s>i;)a[i]=n[i++];return a}),A((function(){new Int8Array(1).slice()})));var pl=Ln.some,vl=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("some",(function(e){return pl(vl(this),e,arguments.length>1?arguments[1]:void 0)}));var yl=ac.aTypedArray,ml=[].sort;(0,ac.exportTypedArrayMethod)("sort",(function(e){return ml.call(yl(this),e)}));var _l=ac.aTypedArray;(0,ac.exportTypedArrayMethod)("subarray",(function(e,t){var n=_l(this),r=n.length,i=Fe(e,r);return new(Zr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,Ve((void 0===t?r:Fe(t,r))-i))}));var El=M.Int8Array,Tl=ac.aTypedArray,Rl=ac.exportTypedArrayMethod,Il=[].toLocaleString,Cl=[].slice,Sl=!!El&&A((function(){Il.call(new El(1))}));Rl("toLocaleString",(function(){return Il.apply(Sl?Cl.call(Tl(this)):Tl(this),arguments)}),A((function(){return[1,2].toLocaleString()!=new El([1,2]).toLocaleString()}))||!A((function(){El.prototype.toLocaleString.call([1,2])})));var bl=ac.exportTypedArrayMethod,wl=M.Uint8Array,Ol=wl&&wl.prototype||{},Nl=[].toString,kl=[].join;A((function(){Nl.call({})}))&&(Nl=function(){return kl.call(this)});var Ml=Ol.toString!=Nl;bl("toString",Nl,Ml);var Al=kt("iterator"),Ul=kt("toStringTag"),Ll=Zo.values;for(var xl in dr){var Pl=M[xl],Dl=Pl&&Pl.prototype;if(Dl){if(Dl[Al]!==Ll)try{ie(Dl,Al,Ll)}catch(e){Dl[Al]=Ll}if(Dl[Ul]||ie(Dl,Ul,xl),dr[xl])for(var Vl in Zo)if(Dl[Vl]!==Zo[Vl])try{ie(Dl,Vl,Zo[Vl])}catch(e){Dl[Vl]=Zo[Vl]}}}var Bl=Object.assign,Gl=Object.defineProperty,Fl=!Bl||A((function(){if(U&&1!==Bl({b:1},Bl(Gl({},"a",{enumerable:!0,get:function(){Gl(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!=Bl({},e)[n]||Bn(Bl({},t)).join("")!=r}))?function(e,t){for(var n=Y(e),r=arguments.length,i=1,s=Je.f,a=P.f;r>i;)for(var o,u=F(arguments[i++]),c=s?Bn(u).concat(s(u)):Bn(u),l=c.length,h=0;l>h;)o=c[h++],U&&!a.call(u,o)||(n[o]=u[o]);return n}:Bl;at({target:"Object",stat:!0,forced:Object.assign!==Fl},{assign:Fl});var ql=function(e){if(vs(e))throw TypeError("The method doesn't accept regular expressions");return e},jl=kt("match");at({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[jl]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(q(this)).indexOf(ql(e),arguments.length>1?arguments[1]:void 0)}});var Kl,Hl,Yl,Ql,Wl,Jl="[\t\n\v\f\r                 \u2028\u2029\ufeff]",zl=RegExp("^"+Jl+Jl+"*"),Zl=RegExp(Jl+Jl+"*$"),Xl=function(e){return function(t){var n=String(q(t));return 1&e&&(n=n.replace(zl,"")),2&e&&(n=n.replace(Zl,"")),n}},$l={start:Xl(1),end:Xl(2),trim:Xl(3)},eh=We.f,th=ee.f,nh=re.f,rh=$l.trim,ih="Number",sh=M.Number,ah=sh.prototype,oh=B(ar(ah))==ih,uh=function(e){var t,n,r,i,s,a,o,u,c=H(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=rh(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(a=(s=c.slice(2)).length,o=0;o<a;o++)if((u=s.charCodeAt(o))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(it(ih,!sh(" 0o1")||!sh("0b1")||sh("+0x1"))){for(var ch,lh=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof lh&&(oh?A((function(){ah.valueOf.call(n)})):B(n)!=ih)?Qa(new sh(uh(t)),n,lh):uh(t)},hh=U?eh(sh):"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(","),fh=0;hh.length>fh;fh++)W(sh,ch=hh[fh])&&!W(lh,ch)&&nh(lh,ch,th(sh,ch));lh.prototype=ah,ah.constructor=lh,ke(M,ih,lh)}!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"}(Hl||(Hl={})),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"}(Yl||(Yl={})),function(e){e.PUB="pub",e.QUERY="qry"}(Ql||(Ql={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Wl||(Wl={}));var dh,gh=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];a(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 u(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}(),ph=function(){function e(){a(this,e)}return u(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ls(e))for(var i=0,s=e.length;i<s;i++){var a=e.charCodeAt(i);a>=0&&a<=127?(r+=1,n.push(a)):a>=128&&a<=2047?(r+=2,n.push(192|31&a>>6),n.push(128|63&a)):a>=2048&&a<=65535&&(r+=3,n.push(224|15&a>>12),n.push(128|63&a>>6),n.push(128|63&a))}for(var o=0,u=n.length;o<u;o++)n[o]>255&&(n[o]&=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,a="";++i<s.length;){var o=Number(s[i]);if(o===(127&o)||(240==(240&o)?o=(o=(o=(o^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&o)?o=(o=(o^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&o)&&(o=(o^=192)<<6|128^s[++i])),!isFinite(o)||o<0||o>1114111||Math.floor(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=(o-=65536)>>10|55296,n=o%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(a+=String.fromCharCode.apply(null,r),r.length=0)}return a}}]),e}(),vh=function(){function e(t){a(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return u(e,[{key:"check",value:function(){return this._position>=this._pool.length}},{key:"read2Byte",value:function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)}},{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 ph.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),yh=function(){function e(){a(this,e),this._pool=[],this._position=0,this._writen=0}return u(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=ph.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),mh="UpStreamMessage",_h="PushExtra",Eh="DownStreamMessage",Th="DownStreamMessages",Rh="SessionsAttQryInput",Ih="SessionsAttOutput",Ch="SyncRequestMsg",Sh="ChrmPullMsg",bh="NotifyMsg",wh="HistoryMsgInput",Oh="HistoryMsgOuput",Nh="RelationQryInput",kh="RelationsOutput",Mh="DeleteSessionsInput",Ah="SessionInfo",Uh="DeleteSessionsOutput",Lh="RelationsInput",xh="DeleteMsgInput",Ph="CleanHisMsgInput",Dh="SessionMsgReadInput",Vh="ChrmInput",Bh="ChrmOutput",Gh="QueryChatRoomInfoInput",Fh="QueryChatRoomInfoOutput",qh="RtcInput",jh="RtcUserListOutput",Kh="SetUserStatusInput",Hh="RtcSetDataInput",Yh="RtcUserSetDataInput",Qh="RtcDataInput",Wh="RtcSetOutDataInput",Jh="MCFollowInput",zh="RtcTokenOutput",Zh="RtcQryOutput",Xh="RtcQryUserOutDataInput",$h="RtcUserOutDataOutput",ef="RtcQueryListInput",tf="RtcRoomInfoOutput",nf="RtcValueInfo",rf="RtcKeyDeleteInput",sf="GetQNupTokenInput",af="GetQNupTokenOutput",of="GetQNdownloadUrlInput",uf="GetDownloadUrlInput",cf="GetQNdownloadUrlOutput",lf="GetDownloadUrlOutput",hf="SetChrmKV",ff="SetChrmKVS",df="DeleteChrmKVS",gf="ChrmKVOutput",pf="ChrmKVSOutput",vf="ChrmKVSOutputEntity",yf="QueryChrmKV",mf="SetUserSettingInput",_f="SetUserSettingOutput",Ef="PullUserSettingInput",Tf="PullUserSettingOutput",Rf="UserSettingNotification",If="SessionReq",Cf="SessionStates",Sf="SessionState",bf="SessionStateItem",wf="SessionStateModifyReq",Of="SessionStateModifyResp",Nf="GrpReadReceiptMsg",kf="GrpReadReceiptQryReq",Mf="GrpReadReceiptQryResp",Af="GrpMsgReadUser",Uf="SessionTagAddInput",Lf="SessionTagItem",xf="SessionTagDelInput",Pf="SessionDisTagReq",Df="ReportSDKInput",Vf="ReportSDKOutput",Bf="UltraGrpPullSes",Gf="UltraGrpPullMsg",Ff="MsgChangeReq",qf="QueryMsgChange",jf="MsgChange",Kf="MsgChangeList",Hf="MsgQuery",Yf="MessageQueryInfo",Qf="MsgQueryAck",Wf="OperateStatus",Jf="OperateStatusNotify",zf="OperateInfo",Zf="OperateSummary",Xf="RtcNotifyMsg",$f="RtcPullKV",ed="RtcKVOutput",td="RtcQueryUserJoinedInput",nd="RtcQueryUserJoinedOutput",rd="RtcViewerJoinedOutput",id="RtcInviteInput",sd="RtcCancelInviteInput",ad="RtcInviteAnswerInput",od="RtcEndInviteInput",ud=(c(dh={},mh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),c(dh,Th,["list","syncTime","finished"]),c(dh,Eh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),c(dh,_h,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),c(dh,Rh,["nothing"]),c(dh,Ih,["inboxTime","sendboxTime","totalUnreadCount"]),c(dh,Ch,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),c(dh,Sh,["syncTime","count"]),c(dh,bh,["type","time","chrmId"]),c(dh,wh,["targetId","time","count","order","busChannel"]),c(dh,Oh,["list","syncTime","hasMsg"]),c(dh,Nh,["type","count","startTime","order"]),c(dh,kh,["info","isFinished"]),c(dh,Mh,["sessions"]),c(dh,Ah,["type","channelId","busChannel"]),c(dh,Uh,["nothing"]),c(dh,Lh,["type","msg","count","busChannel","startTime","endTime"]),c(dh,xh,["type","conversationId","msgs","busChannel"]),c(dh,Ph,["targetId","dataTime","conversationType","busChannel"]),c(dh,Dh,["type","msgTime","channelId","busChannel"]),c(dh,Vh,["nothing"]),c(dh,Bh,["nothing","sessionId","joinTime"]),c(dh,Gh,["count","order"]),c(dh,Fh,["userTotalNums","userInfos"]),c(dh,sf,["type","key","httpMethod","queryString"]),c(dh,of,["type","key","fileName"]),c(dh,uf,["type","key","fileName"]),c(dh,af,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),c(dh,cf,["downloadUrl"]),c(dh,lf,["downloadUrl"]),c(dh,hf,["entry","bNotify","notification","type"]),c(dh,ff,["entry","bNotify","notification","type"]),c(dh,df,["entry","bNotify","notification","type"]),c(dh,gf,["entries","bFullUpdate","syncTime"]),c(dh,pf,["timestamp","errorKeys"]),c(dh,vf,["key","errorCode"]),c(dh,yf,["timestamp"]),c(dh,mf,["version","value"]),c(dh,_f,["version","reserve"]),c(dh,Ef,["version","reserve"]),c(dh,Tf,["items","version"]),c(dh,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),c(dh,If,["time"]),c(dh,Cf,["version","state"]),c(dh,Sf,["type","channelId","time","stateItem","busChannel"]),c(dh,bf,["sessionStateType","value","tags"]),c(dh,wf,["version","state"]),c(dh,Of,["version"]),c(dh,Nf,["msgId","busChannel"]),c(dh,kf,["msgId","busChannel"]),c(dh,Mf,["totalMemberNum","list"]),c(dh,Af,["readTime","userId"]),c(dh,Uf,["version","tags"]),c(dh,Lf,["tagId","name","createdTime","isTop"]),c(dh,xf,["version","tags"]),c(dh,Pf,["tagId"]),c(dh,Rf,["version","reserve"]),c(dh,Df,["sdkInfo"]),c(dh,Vf,["nothing"]),c(dh,Bf,["syncTime","isEraseMsgContent"]),c(dh,Gf,["syncTime"]),c(dh,Ff,["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"]),c(dh,qf,["syncTime"]),c(dh,Kf,["list","syncTime","hasNext"]),c(dh,jf,["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel"]),c(dh,Hf,["targetId","type","query"]),c(dh,Yf,["msgTime","msgUID","busChannel"]),c(dh,Qf,["list"]),c(dh,Wf,["targetId","type","opType","busChannel"]),c(dh,Jf,["type","notifyType","info","summary"]),c(dh,zf,["targetId","busChannel","userId","opType","optime"]),c(dh,Zf,["targetId","busChannel","count","opType"]),c(dh,qh,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),c(dh,jh,["users","token","sessionId","roomInfo"]),c(dh,Kh,["status"]),c(dh,Hh,["interior","target","key","value","objectName","content"]),c(dh,Yh,["valueInfo","objectName","content"]),c(dh,Qh,["interior","target","key","objectName","content"]),c(dh,Wh,["target","valueInfo","objectName","content"]),c(dh,Jh,["state"]),c(dh,zh,["rtcToken"]),c(dh,Zh,["outInfo"]),c(dh,Xh,["userId"]),c(dh,$h,["user"]),c(dh,ef,["order"]),c(dh,tf,["roomId","roomData","userCount","list"]),c(dh,nf,["key","value"]),c(dh,rf,["key"]),c(dh,Xf,["type","time","roomId"]),c(dh,$f,["timestamp","roomId"]),c(dh,ed,["entries","bFullUpdate","syncTime"]),c(dh,td,["userId"]),c(dh,nd,["info"]),c(dh,id,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),c(dh,sd,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),c(dh,ad,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),c(dh,od,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),dh),cd={},ld=function(e){var t=ud[e];cd[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(Hn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},cd[e].decode=function(e){var t={};Ls(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(Hn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var hd in ud)ld(hd);cd.getModule=function(e){return cd[e]()},gc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var fd="\npackage Modules;\nmessage probuf {\n message ".concat(Kh,"\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(bh," {\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(mh," {\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 optional string busChannel = 13; // 该消息所属会话的业务标识\n }\n message ").concat(_h," {\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(Th," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(Eh," {\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 optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略\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 ULTRAGROUP = 10;\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(Us.IMAGE,";\n audio = ").concat(Us.AUDIO,";\n video = ").concat(Us.VIDEO,";\n file = ").concat(Us.FILE,";\n }\n message ").concat(sf," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(of," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(uf," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(af," {\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(cf," {\n required string downloadUrl = 1;\n }\n message ").concat(lf," {\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(Vh," {\n required int32 nothing = 1;\n }\n message ").concat(Bh," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Sh," {\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(Nh,"\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(Lh,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(kh,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\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 busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(Ph,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\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(Gh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Fh,"\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(Jh,"\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(wh,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message ").concat(Oh,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(ef,"{\n optional int32 order=1;\n }\n\n message ").concat(rf,"{\n repeated string key=1;\n }\n\n message ").concat(nf,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(nf," userData=2; //用户资源信息\n }\n\n message ").concat(jh,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(nf," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(qh,"{\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 optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(nf," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(nf," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Zh,"{\n repeated ").concat(nf," 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(Qh,"{\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(Hh,"{\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(Yh," {\n repeated ").concat(nf," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(nf," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(zh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Wh,"{\n required targetType target=1;\n repeated ").concat(nf," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Xh,"{\n repeated string userId = 1;\n }\n message ").concat($h,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Rh,"{\n required int32 nothing = 1;\n }\n message ").concat(Ih,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Dh,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Mh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(Ah,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Uh,"\n {\n optional int32 nothing=1;\n }\n message ").concat(xh,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\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(hf," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(ff," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(df," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(gf," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(pf," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(vf,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(yf," {\n required int64 timestamp = 1;\n }\n message ").concat(mf," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(_f," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ef," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Tf," {\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(If," {\n required int64 time = 1;\n }\n message ").concat(Cf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Sf," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message ").concat(bf," {\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(wf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Of," {\n required int64 version=1;\n }\n message ").concat(Nf," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(kf," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Mf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Af," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Uf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Lf," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(xf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Pf," {\n repeated string tagId=1;\n }\n message ").concat(Rf," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Df,' {\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(Xf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat($f,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(ed,"\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 message ").concat(td,"\n {\n required string userId = 1;\n }\n message ").concat(nd,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(rd,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(id,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(sd,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(ad,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(od,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(Bf,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Gf,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Ff,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(qf," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Kf," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message MsgChange //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0,设为 1 时,IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n }\n message ").concat(Hf," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(Qf," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Wf," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(Jf," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(zf," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(Zf," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n}\n"),dd=/"/g;at({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(q(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+String(n).replace(dd,"&quot;")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var gd="ArrayBuffer",pd=Vu.ArrayBuffer,vd=M.ArrayBuffer;at({global:!0,forced:vd!==pd},{ArrayBuffer:pd}),Mr(gd),at({target:"Array",proto:!0},{fill:ou}),hr("fill");var yd,md,_d,Ed,Td,Rd=(yd=fd,function(e,t){var n,i,s={};return s.ByteBuffer=e,s.c=e,n=e,s.Long=t||null,s.VERSION="5.0.1",s.WIRE_TYPES={},s.WIRE_TYPES.VARINT=0,s.WIRE_TYPES.BITS64=1,s.WIRE_TYPES.LDELIM=2,s.WIRE_TYPES.STARTGROUP=3,s.WIRE_TYPES.ENDGROUP=4,s.WIRE_TYPES.BITS32=5,s.PACKABLE_WIRE_TYPES=[s.WIRE_TYPES.VARINT,s.WIRE_TYPES.BITS64,s.WIRE_TYPES.BITS32],s.TYPES={int32:{name:"int32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},uint64:{name:"uint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.UZERO:void 0},sint64:{name:"sint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},bool:{name:"bool",wireType:s.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:s.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:s.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.ZERO:void 0},float:{name:"float",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:s.WIRE_TYPES.STARTGROUP,defaultValue:null}},s.MAP_KEY_TYPES=[s.TYPES.int32,s.TYPES.sint32,s.TYPES.sfixed32,s.TYPES.uint32,s.TYPES.fixed32,s.TYPES.int64,s.TYPES.sint64,s.TYPES.sfixed64,s.TYPES.uint64,s.TYPES.fixed64,s.TYPES.bool,s.TYPES.string,s.TYPES.bytes],s.ID_MIN=1,s.ID_MAX=536870911,s.convertFieldsToCamelCase=!1,s.populateAccessors=!0,s.populateDefaults=!0,s.Util=function(){var e={};return e.IS_NODE=!("object"!==("undefined"==typeof process?"undefined":r(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}(),s.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},s.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,a,o={},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+")"},o.Tokenizer=u,(a=(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()},a._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},a._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)},a._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(";")},a._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)}},a._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)},a._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},a._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),a={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(a.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),a.isGroup=!0),"["===(s=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(a,s);else if("oneof"===s)this._parseMessageOneOf(a);else if("enum"===s)this._parseEnum(a);else if("message"===s)this._parseMessage(a);else if("option"===s)this._parseOption(a);else if("service"===s)this._parseService(a);else if("extensions"===s)a.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(a);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(a,"optional",s)}return this.tn.omit(";"),e.messages.push(a),a},a._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(e,r,i){var s,a,o;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("<"),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field type: "+a);if(s.keytype=a,this.tn.skip(","),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field: "+a);if(s.type=a,this.tn.skip(">"),a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(o=this._parseMessage(e,s),!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);s.type=o.name,s.name=o.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,a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},a._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},a._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()},a._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)},a._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},a._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},a.toString=function(){return"Parser at line "+this.tn.line},o.Parser=s,o}(s,s.Lang),s.Reflect=function(t){function i(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 s(e,n){var r=n.readVarint32(),i=7&r,a=r>>>3;switch(i){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:s(a,n);break;case t.WIRE_TYPES.ENDGROUP:if(a===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+a+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+i)}return!0}var a,o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=I,(o=(a=function(e,t,n,r,i){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(I.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 l.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof l.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 R.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof R.T&&(!t||n instanceof R.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 R.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 a&&(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},R.Namespace=a,c=(u=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,u.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},c.verifyValue=function(n){var s,a,o,u=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)&&u(r(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)&&u(r(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 i(n,!1)}catch(e){u(r(n),e.message)}else u(r(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return i(n,!0)}catch(e){u(r(n),e.message)}else u(r(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&u(r(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&u(r(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||u(r(n),"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(s=this.resolvedType.getChildren(t.Reflect.Enum.Value),o=0;o<s.length;o++){if(s[o].name==n)return s[o].id;if(s[o].id==n)return s[o].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&u(r(n),"not an integer"),(n>4294967295||n<0)&&u(r(n),"not in range for uint32"),n;u(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===r(n)||u(r(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in a={},n)n.hasOwnProperty(o)&&(a[o]=n[o]);n=a}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},c.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)")},c.encodeValue=function(e,r,i){var s,a;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:a=(new n).LE(),this.resolvedType.encode(r,a),i.writeVarint32(a.offset),i.append(a.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},c.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")},c.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)}},c.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()},R.Element=u,(h=(l=function(e,t,n,r,i,s){a.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(a.prototype)).build=function(i){var s,a,o,u;if(this.clazz&&!i)return this.clazz;for(s=function(t,i){function s(e,i,a,o){var u,c,l,h,f,d,g;if(null===e||"object"!==r(e))return o&&o instanceof t.Reflect.Enum&&null!==(u=t.Reflect.Enum.getName(o.object,e))?u:e;if(n.isByteBuffer(e))return i?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return a?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=s(e,i,a,o)})),c;if(c={},e instanceof t.Map){for(h=(l=e.entries()).next();!h.done;h=l.next())c[e.keyElem.valueToString(h.value[0])]=s(h.value[1],i,a,e.valueElem.resolvedType);return c}for(g in f=e.$type,d=void 0,e)e.hasOwnProperty(g)&&(c[g]=f&&(d=f.getChild(g))?s(e[g],i,a,d.resolvedType):s(e[g],i,a));return c}var a,o,u=i.getChildren(t.Reflect.Message.Field),c=i.getChildren(t.Reflect.Message.OneOf),l=function e(s){var a,o,l,h;for(t.Builder.Message.call(this),a=0,o=c.length;o>a;++a)this[c[a].name]=null;for(a=0,o=u.length;o>a;++a)this[(l=u[a]).name]=l.repeated?[]:l.map?new t.Map(l):null,!l.required&&"proto3"!==i.syntax||null===l.defaultValue||(this[l.name]=l.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===s||"object"!==r(s)||!("function"!=typeof s.encode||s instanceof e)||Array.isArray(s)||s instanceof t.Map||n.isByteBuffer(s)||s instanceof ArrayBuffer||t.Long&&s instanceof t.Long)for(a=0,o=arguments.length;o>a;++a)void 0!==(h=arguments[a])&&this.$set(u[a].name,h);else this.$set(s)},h=l.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,r){var s=i._fieldsByName[e];if(!r){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},h.$add=h.add,h.set=function(e,n,s){var a,o,u;if(e&&"object"===r(e)){for(a in s=n,e)e.hasOwnProperty(a)&&void 0!==(n=e[a])&&this.$set(a,n,s);return this}if(o=i._fieldsByName[e],s)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&&(u=this[o.oneof.name],null!==n?(null!==u&&u!==o.name&&(this[u]=null),this[o.oneof.name]=o.name):u===e&&(this[o.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,n){if(n)return this[e];var r=i._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},h.$get=h.get,a=0;a<u.length;a++)(o=u[a])instanceof t.Reflect.Message.ExtensionField||i.builder.options.populateAccessors&&function(e){var t,n,r,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},r=function(){return this[e.name]},null===i.getChild("set"+s)&&(h["set"+s]=n),null===i.getChild("set_"+t)&&(h["set_"+t]=n),null===i.getChild("get"+s)&&(h["get"+s]=r),null===i.getChild("get_"+t)&&(h["get_"+t]=r)}(o);return h.encode=function(t,n){var r,s;"boolean"==typeof t&&(n=t,t=void 0),r=!1,t||(t=new e,r=!0),s=t.littleEndian;try{return i.encode(this,t.LE(),n),(r?t.flip():t).LE(s)}catch(e){throw t.LE(s),e}},l.encode=function(e,t,n){return new l(e).encode(t,n)},h.calculate=function(){return i.calculate(this)},h.encodeDelimited=function(e){var t,r=!1;return e||(e=new n,r=!0),t=(new n).LE(),i.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return s(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(s(this,!0,!0,this.$type))},l.decode=function(e,t){var r,s;"string"==typeof e&&(e=n.wrap(e,t||"base64")),r=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return s=i.decode(e.LE()),e.LE(r),s}catch(t){throw e.LE(r),t}},l.decodeDelimited=function(e,t){var r,s,a;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(r=e.offset,s=e.readVarint32(),e.remaining()<s)return e.offset=r,null;try{return a=i.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,a}catch(t){throw e.offset+=s,t}},l.decode64=function(e){return l.decode(e,"base64")},l.decodeHex=function(e){return l.decode(e,"hex")},l.decodeJSON=function(e){return new l(JSON.parse(e))},h.toString=function(){return i.toString()},Object.defineProperty&&(Object.defineProperty(l,"$options",{value:i.buildOpt()}),Object.defineProperty(h,"$options",{value:l.$options}),Object.defineProperty(l,"$type",{value:i}),Object.defineProperty(h,"$type",{value:i})),l}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,u=this.children.length;u>o;o++)if((a=this.children[o])instanceof v||a instanceof l||a instanceof _){if(s.hasOwnProperty(a.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+a.toString(!0)+" cannot override static property '"+a.name+"'");s[a.name]=a.build()}else if(a instanceof l.Field)a.build(),this._fields.push(a),this._fieldsById[a.id]=a,this._fieldsByName[a.name]=a;else if(!(a instanceof l.OneOf||a instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=s},h.encode=function(e,t,n){var r,i,s,a,o,u=null;for(s=0,a=this._fields.length;a>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(o=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,o;return t},h.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},h.decode=function(e,n,r){var i,a,o,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(o=(i=e.readVarint32())>>>3,(a=7&i)===t.WIRE_TYPES.ENDGROUP){if(o!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[o])u.repeated&&!u.options.packed?l[u.name].push(u.decode(a,e)):u.map?(f=u.decode(a,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(a,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(a){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(;s(o,e););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+a)}}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},R.Message=l,(d=(f=function(e,n,r,i,s,a,o,u,c,h){I.call(this,e,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=s,this.resolvedType=null,this.id=o,this.options=u||{},this.defaultValue=null,this.oneof=c||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof l.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(I.prototype)).build=function(){this.element=new u(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new u(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=u.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var i,s,a;if(n=n||!1,i=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&&i(r(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(r(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),a=[],s=0;s<e.length;s++)a.push(this.element.verifyValue(e[s]));return a}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(r(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(r(e),"no array expected"),this.element.verifyValue(e))},d.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}},d.encode=function(e,i,s){var a,o,u,c,l;if(null===this.type||"object"!==r(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return i;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.ensureCapacity(i.offset+=1),o=i.offset,a=0;a<e.length;a++)this.element.encodeValue(this.id,e[a],i);u=i.offset-o,(c=n.calculateVarint32(u))>1&&(l=i.slice(o,i.offset),o+=c-1,i.offset=o,i.append(l)),i.writeVarint32(u,o-c)}else for(a=0;a<e.length;a++)i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[a],i);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.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.writeVarint32(s),i.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,i),i.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,i)}),this):this.hasWirePresence(e,s)&&(i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,i))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.calculate=function(e,i){var s,a,o;if(e=this.verifyValue(e),null===this.type||"object"!==r(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;s=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(s+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),o=0,a=0;a<e.length;a++)o+=this.element.calculateLength(this.id,e[a]);s+=n.calculateVarint32(o),s+=o}else for(a=0;a<e.length;a++)s+=n.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,e[a]);else this.map?e.forEach((function(e,r){var i=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);s+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s+=n.calculateVarint32(i),s+=i}),this):this.hasWirePresence(e,i)&&(s+=n.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return s},d.decode=function(e,n,r){var i,s,a,o,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,a=[];n.offset<s;)a.push(this.decode(this.type.wireType,n,!0));return a}if(this.map){if(o=u.defaultFieldValue(this.keyType),i=u.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))o=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[o,i]}return this.element.decode(n,e,this.id)},R.Message.Field=f,(g=function(e,t,n,r,i,s,a){f.call(this,e,t,n,null,r,i,s,a),this.extension}).prototype=Object.create(f.prototype),R.Message.ExtensionField=g,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},R.Message.OneOf=p,(v=function(e,t,n,r,i){a.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},(v.prototype=Object.create(a.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(v.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},R.Enum=v,(y=function(e,t,n,r){I.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(I.prototype),R.Enum.Value=y,(m=function(e,t,n,r){I.call(this,e,t,n),this.field=r}).prototype=Object.create(I.prototype),R.Extension=m,((_=function(e,t,n,r){a.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(a.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var i,s=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)}},a=s.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(i=0;i<o.length;i++)!function(e){a[e.name]=function(i,s){try{try{i=e.resolvedRequestType.clazz.decode(n.wrap(i))}catch(e){if(!(e instanceof TypeError))throw e}if(null===i||"object"!==r(i))throw Error("Illegal arguments");i instanceof e.resolvedRequestType.clazz||(i=new e.resolvedRequestType.clazz(i)),this.rpcImpl(e.fqn(),i,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void s(null,r):void s(Error("Illegal response type received in service method "+t.name+"#"+e.name))}s(n)}))}catch(e){setTimeout(s.bind(this,e),0)}},s[e.name]=function(t,n,r){new s(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(s[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(a[e.name],"$options",{value:s[e.name].$options}))}(o[i]);return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:t.buildOpt()}),Object.defineProperty(a,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:t}),Object.defineProperty(a,"$type",{value:t})),s}(t,this)},R.Service=_,((E=function(e,t,n,r){I.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(I.prototype)).buildOpt=o.buildOpt,R.Service.Method=E,(T=function(e,t,n,r,i,s,a,o){E.call(this,e,t,n,o),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=a,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(E.prototype),R.Service.RPCMethod=T,R}(s),s.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var s=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},a=s.prototype;return s.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},s.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},s.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},s.isService=function(e){return!("string"!=typeof e.name||"object"!==r(e.rpc)||!e.rpc)},s.isExtend=function(e){return"string"==typeof e.ref},a.reset=function(){return this.ptr=this.ns,this},a.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},a.create=function(t){var i,a,o,u,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(a=t.shift(),s.isMessage(a)){if(o=new n.Message(this,this.ptr,a.name,a.options,a.isGroup,a.syntax),u={},a.oneofs&&Object.keys(a.oneofs).forEach((function(e){o.addChild(u[e]=new n.Message.OneOf(this,o,e))}),this),a.fields&&a.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"!==r(e.options))throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=u[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,a.syntax),t&&t.fields.push(e),o.addChild(e)}),this),c=[],a.enums&&a.enums.forEach((function(e){c.push(e)})),a.messages&&a.messages.forEach((function(e){c.push(e)})),a.services&&a.services.forEach((function(e){c.push(e)})),a.extensions&&(o.extensions="number"==typeof a.extensions[0]?[a.extensions]:a.extensions),this.ptr.addChild(o),c.length>0){i.push(t),t=c,c=null,this.ptr=o,o=null;continue}c=null}else if(s.isEnum(a))o=new n.Enum(this,this.ptr,a.name,a.options,a.syntax),a.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(s.isService(a))o=new n.Service(this,this.ptr,a.name,a.options),Object.keys(a.rpc).forEach((function(e){var t=a.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(!s.isExtend(a))throw Error("not a valid definition: "+JSON.stringify(a));if(o=this.ptr.resolve(a.ref,!0))a.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(a.ref))throw Error("extended message "+a.ref+" is not defined")}a=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},a.import=function(t,n){var s,a,o,u,c,l,h,f,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"===r(n)){if(s=n.root,e.Util.IS_NODE,(s.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),a=s+d+n.file,!0===this.files[a])return this.reset();this.files[a]=!0}if(t.imports&&t.imports.length>0){for(u=!1,"object"===r(n)?(this.importRoot=n.root,u=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),d="\\"):o=".":o=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(l=t.imports[c]))continue;if(l=o+d+l,!0===this.files[l])continue;if(/\.proto$/i.test(l)&&!e.DotProto&&(l=l.replace(/\.proto$/,".json")),null===(h=e.Util.fetch(l)))throw Error("failed to import '"+l+"' in '"+n+"': file not found");/\.json$/i.test(l)?this.import(JSON.parse(h+""),l):this.import(e.DotProto.Parser.parse(h),l)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);u&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),f=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){f.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=f),t.enums&&(this.create(t.enums),this.ptr=f),t.services&&(this.create(t.services),this.ptr=f),t.extends&&this.create(t.extends),this.reset()},a.resolveAll=function(){var i;if(null==this.ptr||"object"===r(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(!(i=(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=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.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(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}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: "+r(this.ptr)+": "+this.ptr);return this.reset()},a.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},a.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},a.toString=function(){return"Builder"},s.Message=function(){},s.Enum=function(){},s.Service=function(){},s}(s,s.Lang,s.Reflect),s.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,a;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]),a=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(s)]={key:s,value:a}},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,s.Reflect),s.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),s.loadJson(s.DotProto.Parser.parse(e),t,n)},s.protoFromString=s.loadProto,s.loadProtoFile=function(e,t,n){if(t&&"object"===r(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,s.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"===r(e)?e.root+"/"+e.file:e);return null===i?null:s.loadProto(i,n,e)},s.protoFromFile=s.loadProtoFile,s.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=s.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=s.populateAccessors),new s.Builder(e)},s.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"===r(t)||(t=s.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},s.loadJsonFile=function(e,t,n){if(t&&"object"===r(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,s.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"===r(e)?e.root+"/"+e.file:e);return null===i?null:s.loadJson(JSON.parse(i),n,e)},i=yd,s.loadProto(i,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("")+u.apply(String,e):(e.length+arguments.length>1024&&(t.push(u.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function i(e,t,n,r,i){var s,a,o=8*i-r-1,u=(1<<o)-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+=o;l>0;s=256*s+e[t+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),s-=c}return(d?-1:1)*a*Math.pow(2,s-r)}function s(e,t,n,r,i,s){var a,o,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?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,i),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&o,d+=g,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[n+d]=255&a,d+=g,a/=256,c-=8);e[n+d-g]|=128*p}var a,o,u,c,l,h=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 h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(a=h.prototype).__isByteBuffer__,Object.defineProperty(a,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),u=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.concat=function(e,t,n,r){var i,s,a,o,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,a=0,o=e.length;o>a;++a)h.isByteBuffer(e[a])||(e[a]=h.wrap(e[a],t)),(s=e[a].limit-e[a].offset)>0&&(i+=s);if(0===i)return new h(0,n,r);for(c=new h(i,n,r),a=0;o>a;)(s=(u=e[a++]).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},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.wrap=function(e,t,n,i){var s,o;if("string"!=typeof t&&(i=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==r(e))throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(s=a.clone.call(e)).markedOffset=-1,s;if(e instanceof Uint8Array)s=new h(0,n,i),e.length>0&&(s.buffer=e.buffer,s.offset=e.byteOffset,s.limit=e.byteOffset+e.byteLength,s.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)s=new h(0,n,i),e.byteLength>0&&(s.buffer=e,s.offset=0,s.limit=e.byteLength,s.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((s=new h(e.length,n,i)).limit=e.length,o=0;o<e.length;++o)s.view[o]=e[o]}return s},a.writeBitSet=function(e,t){var n,r,i,s,a,o,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,a=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(n,t++);if(i>a){for(o=0,n=0;i>a;)n|=(1&!!e[a++])<<o++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},a.readBitSet=function(e){var t,n,r,i,s,a,o,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,a=[],e+=n.length;i--;)t=this.readByte(e++),a[s++]=!!(1&t),a[s++]=!!(2&t),a[s++]=!!(4&t),a[s++]=!!(8&t),a[s++]=!!(16&t),a[s++]=!!(32&t),a[s++]=!!(64&t),a[s++]=!!(128&t);if(r>s)for(o=0,t=this.readByte(e++);r>s;)a[s++]=!!(1&t>>o++);return u&&(this.offset=e),a},a.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},a.writeBytes=a.append,a.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},a.writeByte=a.writeInt8,a.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},a.readByte=a.readInt8,a.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},a.writeUInt8=a.writeUint8,a.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},a.readUInt8=a.readUint8,a.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},a.writeShort=a.writeInt16,a.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},a.readShort=a.readInt16,a.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},a.writeUInt16=a.writeUint16,a.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},a.readUInt16=a.readUint16,a.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},a.writeInt=a.writeInt32,a.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},a.readInt=a.readInt32,a.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},a.writeUInt32=a.writeUint32,a.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},a.readUInt32=a.readUint32,e&&(a.writeInt64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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),a&&(this.offset+=8),this},a.writeLong=a.writeInt64,a.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},a.readLong=a.readInt64,a.writeUint64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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),a&&(this.offset+=8),this},a.writeUInt64=a.writeUint64,a.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},a.readUInt64=a.readUint64),a.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,s(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},a.writeFloat=a.writeFloat32,a.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=i(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},a.readFloat=a.readFloat32,a.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,s(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},a.writeDouble=a.writeFloat64,a.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=i(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},a.readDouble=a.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},a.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=h.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},a.writeVarint32ZigZag=function(e,t){return this.writeVarint32(h.zigZagEncode32(e),t)},a.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}},a.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===r(t)?t.value=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.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},h.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()},h.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()},a.writeVarint64=function(t,n){var r,i,s,a,o,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=h.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,a=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,r){case 10:this.view[n+9]=1&a>>>7;case 9:this.view[n+8]=9!==r?128|a:127&a;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},a.writeVarint64ZigZag=function(e,t){return this.writeVarint64(h.zigZagEncode64(e),t)},a.readVarint64=function(t){var n,r,i,s,a,o,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,a=0,r=127&(a=this.view[t++]),128&a&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(i=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");return o=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,o):{value:o,length:t-n}},a.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=h.zigZagDecode64(n.value):n=h.zigZagDecode64(n),n}),a.writeCString=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,a?(this.offset=n,this):i},a.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,l.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}},a.writeIString=function(e,n){var r,i,s,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(i=n,r=l.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,l.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 a?(this.offset=n,this):n-i},a.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,h.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",a.writeUTF8String=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),a?(this.offset=n,this):n-i},a.writeString=a.writeUTF8String,h.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(t(e))[0]},h.calculateString=h.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(t(e))[1]},a.readUTF8String=function(e,t,r){var i,s,a,o,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=h.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(a=0,o=r,t===h.METRICS_CHARS){if(s=n(),l.decodeUTF8(function(){return e>a&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-o}}if(t===h.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,l.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-o}}throw TypeError("Unsupported metrics: "+t)},a.readString=a.readUTF8String,a.writeVString=function(e,n){var r,i,s,a,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(s=n,r=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=h.calculateVarint32(r),n+=i+r,a=this.buffer.byteLength,n>a&&this.resize((a*=2)>n?a:n),n-=i+r,n+=this.writeVarint32(r,n),l.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 o?(this.offset=n,this):n-s},a.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,h.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},a.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 h||(e=h.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},a.appendTo=function(e,t){return e.append(this,t),this},a.assert=function(e){return this.noAssert=!e,this},a.capacity=function(){return this.buffer.byteLength},a.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},a.clone=function(e){var t=new h(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},a.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)},a.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 h(0,this.littleEndian,this.noAssert);var n=t-e,r=new h(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},a.copyTo=function(e,t,n,r){var i,s,a;if(!this.noAssert&&!h.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==(a=r-n)?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),s&&(e.offset+=a),this)},a.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},a.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},a.flip=function(){return this.limit=this.offset,this.offset=0,this},a.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},a.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},a.LE=function(e){return this.littleEndian=void 0===e||!!e,this},a.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},a.prepend=function(e,t,n){var r,i,s,a,o;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 h||(e=h.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(a=new ArrayBuffer(this.buffer.byteLength+s),(o=new Uint8Array(a)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=o,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},a.prependTo=function(e,t){return e.prepend(this,t),this},a.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},a.remaining=function(){return this.limit-this.offset},a.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},a.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},a.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},a.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},a.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},a.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},a.toArrayBuffer=a.toBuffer,a.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)}},c=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,a;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(a=i[r])&&n(r),t(s<<2>>>0|(48&a)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&a)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(a=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|a)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),a.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 c.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new h(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.fromBase64(e).toBinary()},a.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)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new h(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},a.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",a="";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+=" ";a+=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+=" ";a+=i+s+"\n"}return e?a:i},h.fromDebug=function(e,t,n){for(var r,i,s=e.length,a=new h(0|(s+1)/3,t,n),o=0,u=0,c=!1,l=!1,f=!1,d=!1,g=!1;s>o;){switch(r=e.charAt(o++)){case"!":if(!n){if(l||f||d){g=!0;break}l=f=d=!0}a.offset=a.markedOffset=a.limit=u,c=!1;break;case"|":if(!n){if(l||d){g=!0;break}l=d=!0}a.offset=a.limit=u,c=!1;break;case"[":if(!n){if(l||f){g=!0;break}l=f=!0}a.offset=a.markedOffset=u,c=!1;break;case"<":if(!n){if(l){g=!0;break}l=!0}a.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}a.limit=a.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}a.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}a.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(o++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+o)}if(!n){if(!l||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return a},a.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("")},h.fromHex=function(e,t,n){var r,i,s,a,o;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 h(0|i/2,t),a=0,o=0;i>a;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[o++]=r}return s.limit=o,s},l=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,a=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())&&a([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&a([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()))&&a([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}(),a.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{l.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()},h.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new h(l.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return l.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},h}(md=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=o[e])?r:(n=i(e,e<0?-1:0,!1),s&&(o[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,a,o,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(a=r(c(n,8)),o=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)),o=o.mul(f).add(r(h))):o=(o=o.mul(a)).add(r(h));return o.unsigned=t,o}function a(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}var o,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,o={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=a,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,a,o,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),a=this,o="";;){if(u=a.div(s),l=(a.sub(u.mul(s)).toInt()>>>0).toString(e),(a=u).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},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=a(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=a(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,o,u,c,l,h,f,d,g;return t(e)||(e=a(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=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+=o+(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=a(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,s,o,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=a(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,o=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+=o*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=o*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+o*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,o,u,l,h;if(t(e)||(e=a(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=(o=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,o-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=a(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=a(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=a(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=a(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}()),md));Rd.getModule=function(e){var t=new Rd[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Vs(e)?[].slice.call(new Int8Array(e)):e},t};var Id="pgMsgP",Cd="chatMsg",Sd="pcMsgP",bd={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},wd="delMsg",Od="joinChrm",Nd="joinChrmR",kd="exitChrm",Md="setKV",Ad="delKV",Ud="setKVS",Ld="delKVS",xd="qryRelationR",Pd="delRelation",Dd="setSeAtt",Vd={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Bd="qryPMsg",Gd="qryGMsg",Fd="qryCHMsg",qd="qryCMsg",jd="qrySMsg",Kd=(c(_d={},"ppMsgP",Ms.PRIVATE),c(_d,Id,Ms.GROUP),c(_d,Cd,Ms.CHATROOM),c(_d,Sd,Ms.CUSTOMER_SERVICE),_d),Hd=(c(Ed={},Ms.PRIVATE,Bd),c(Ed,Ms.GROUP,Gd),c(Ed,Ms.CHATROOM,Fd),c(Ed,Ms.CUSTOMER_SERVICE,qd),c(Ed,Ms.SYSTEM,jd),Ed),Yd=(c(Td={},Ms.PRIVATE,Vd.PRIVATE),c(Td,Ms.GROUP,Vd.GROUP),c(Td,Ms.ULTRA_GROUP,Vd.ULTRA_GROUP),c(Td,Ms.CUSTOMER_SERVICE,Vd.CUSTOMER_SERVICE),c(Td,Ms.SYSTEM,Vd.SYSTEM),Td),Qd="1",Wd="0",Jd=1,zd=2,Zd=3,Xd=function(){function t(e){a(this,t),this._codec="websocket"===e?Rd:cd,this._connectType=e}return u(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,a=(c(r={},Th,i._formatSyncMessages),c(r,Eh,i._formatReceivedMessage),c(r,mh,i._formatSentMessage),c(r,Oh,i._formatHistoryMessages),c(r,kh,i._formatConversationList),c(r,Fh,i._formatChatRoomInfos),c(r,jh,i._formatRTCUserList),c(r,Zh,i._formatRTCData),c(r,gf,i._formatChatRoomKVList),c(r,Tf,i._formatUserSetting),c(r,Cf,i._formatConversationStatus),c(r,Mf,i._formatGrpReadReceiptQryResp),c(r,_f,i._formatSetUserSettingOutput),c(r,Rf,i._formatUserSettingNotification),c(r,Kf,i._formatUltraMsgChangeList),c(r,Jf,i._formatUltraOperateStatusNotifyList),c(r,Qf,i._formatUltraMsgList),c(r,ed,i._formatRTCRoomKVList),c(r,zh,i._formatRTCAuidenceJoinRoomData),c(r,nd,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Gs(s)&&(s=function(e){for(var t in e)Gs(e[t])&&(e[t]=ho(e[t]));return e}(s)),Fs(a)&&(s=a.call(this,s,n))}catch(n){Js.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=Vs(n)?new Uint8Array(n):n;return ph.readUTF(i.subarray(t,r))}catch(e){Js.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Js.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(qs(s)||null===s)&&(e.finished=!0),e.syncTime=ho(i),e.list=_o(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){if(!e)return e;var r=t=t||{},i=r.currentUserId,s=r.connectedTime,a=e.content,o=e.fromUserId,u=e.type,c=e.groupId,l=e.status,f=e.dataTime,d=e.classname,g=e.msgId,p=e.extraContent,v=e.pushContent,y=e.pushExt,m=e.configFlag,_=e.extStatus,E=(e.direction||ia.RECEIVE)===ia.SEND,T=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),R=T.isPersited,I=T.isCounted,C=T.isMentioned,S=T.disableNotification,b=T.receivedStatus,w=T.canIncludeExpansion,O=!!(2&(_||0)),N=[Ms.GROUP,Ms.CHATROOM,Ms.RTC_ROOM,Ms.ULTRA_GROUP].indexOf(u)>-1?c:o,k=E?i:o,M=ho(f),A=M<s,U=u===Ms.CHATROOM,L=this._formatBytes(a),x={};if(y&&(x=po(y.pushConfigs,y.pushId)),L.user){var P=L.user,D=P.portrait,V=P.portraitUri,B=D||V;B&&(L.user.portrait=L.user.portraitUri=B)}var G,F=h(h({},x),{},{pushTitle:null==y?void 0:y.title,pushContent:v,pushData:v,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==y?void 0:y.templateId}),q=E?ia.SEND:ia.RECEIVE;U&&o===i&&(q=ia.SEND),p&&(G={},G=Oo(p));var j={conversationType:u,targetId:N,senderUserId:k,messageType:d,messageUId:g,isPersited:R,isCounted:I,isMentioned:C,sentTime:M,messageDirection:q,receivedTime:No.getTime(),disableNotification:S,receivedStatus:b,canIncludeExpansion:w,content:L,expansion:G,configFlag:m,pushConfig:F,channelId:e.busChannel||"",isInterrupt:O};return u!==Ms.ULTRA_GROUP&&(j.isOffLineMessage=A),j}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,i=e.classname,s=e.sessionId,a=e.msgId,o=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,f=e.extStatus,d=t.signal,g=t.currentUserId,p=d.date,v=d.topic,y=d.targetId,m=!!(2&(f||0)),_=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(s),E=_.isPersited,T=_.isCounted,R=_.disableNotification,I=_.canIncludeExpansion,C=Kd[v]||Ms.PRIVATE,S=To(bd,v),b=this._formatBytes(r),w=y;i===ha.RECALL&&(C=b.conversationType||C,w=b.targetId||y),o&&(n={},n=Oo(o));var O={};u&&(O=po(u.pushConfigs,u.pushId));var N=h(h({},O),{},{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:C,targetId:w,messageType:i,messageUId:a,isPersited:E,isCounted:T,isStatusMessage:S,senderUserId:g,content:this._formatBytes(r),sentTime:1e3*p,receivedTime:No.getTime(),messageDirection:ia.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:I,expansion:n,pushConfig:N,channelId:e.busChannel||"",isInterrupt:m}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,a=r.targetId,o=ho(e.syncTime),u=[];return mo(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===Ms.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=a,u.push(i)}),{isReverse:!0}),{syncTime:o,list:u,hasMore:!!s}}},{key:"_formatUltraMsgChangeList",value:function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,s=e.msgUID,a=e.msgTime,o=e.busChannel,u=e.isAdmin,c=e.isDel;return{targetId:t,conversationType:n,changeType:i,messageUId:s,changeTime:ho(r),sendTime:ho(a),channelId:o,isAdmin:u,isDel:c}})),hasNext:r}}},{key:"_formatUltraOperateStatusNotifyList",value:function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,s=[],a=[],o=2==(2&n),u=1==(1&n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,a=e.optime,o=ho(a);s.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:o})})),o&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;a.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:s,summary:a,hasInfo:u,hasSummary:o}}},{key:"_formatUltraMsgList",value:function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){},s={list:r=_o(r,(function(e){var r=e.msg,s=e.userId,a=e.type,o=e.unreadCount,u=e.busChannel,c=e.versionTime,l=e.remindCount,h=null;r&&((h=n._formatReceivedMessage(r,t)).targetId=s);var f={targetId:s,conversationType:a,unreadMessageCount:ho(o)||0,latestMessage:h||{},channelId:u||""};return a===Ms.ULTRA_GROUP&&(f.versionTime=ho(c)||0,f.unreadMentionedCount=ho(l)||0),i(f)||f}))};return((null==t?void 0:t.conversationType)||Ms.NONE)===Ms.ULTRA_GROUP&&(s.isFinished=e.isFinished),s}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:_o(n,(function(e){var t=e.id,n=e.time;return{id:t,time:ho(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=_o(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?_a.DELETE:_a.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:s,timestamp:ho(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return mo(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=ho(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=ho(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return mo(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,a=e.busChannel,o=da.CLOSE,u=!1,c=[];mo(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Jd:o=n===Qd?da.OPEN:da.CLOSE;break;case zd:u=n===Qd;break;case Zd:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:o,isTop:u,updatedTime:ho(i),tags:c,channelId:a||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,a={};return mo(t,(function(e){var t=e.userId,n=e.userData,r={};mo(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return mo(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 mo(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=ho(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:ho(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"_formatRTCJoinedUserInfo",value:function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:ho(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(Rh);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=e.conversationType,i=t.messageType,s=t.isMentioned,a=t.mentionedType,o=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=t.channelId;[Ms.GROUP,Ms.ULTRA_GROUP].includes(r);var m,_,E,T=this._codec.getModule(mh),R=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),I=v||{},C=I.pushTitle,S=I.pushContent,b=I.pushData,w=I.iOSConfig,O=I.androidConfig,N=I.templateId,k=I.disablePushTitle,M=I.forceShowDetailContent,A=0;(T.setSessionId(R),s&&u)&&(u.mentionedInfo={userIdList:(null===(m=u.mentionedInfo)||void 0===m?void 0:m.userIdList)||o||[],type:(null===(_=u.mentionedInfo)||void 0===_?void 0:_.type)||a||pa.ALL,mentionedContent:(null===(E=u.mentionedInfo)||void 0===E?void 0:E.mentionedContent)||""});var U=S||c||"",L=b||l||"";if(U&&T.setPushText(U),L&&T.setAppData(L),h&&T.setUserId(h),A|=d?1:0,A|=f?2:0,A|=k?4:0,A|=M?8:0,T.setConfigFlag(A),T.setClassname(i),u.user&&u.user.portraitUri&&(u.user.portrait=u.user.portraitUri),T.setContent(JSON.stringify(u)),g&&p){var x={};mo(p,(function(e,t){x[t]={v:e}})),T.setExtraContent(JSON.stringify(x))}if(v){var P=this._codec.getModule(_h);if(C&&P.setTitle(C),w&&O){var D=go(w,O);P.setPushConfigs(D)}(null==O?void 0:O.notificationId)&&P.setPushId(null==O?void 0:O.notificationId),P.setTemplateId(N||""),T.setPushExt(n?P.getArrayData():P)}return qs(y)||T.setBusChannel(y),T}},{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(Sh);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=t.channelId,a=this._codec.getModule(wh);return a.setTargetId(e),a.setTime(i),a.setCount(n),a.setOrder(r),a.setBusChannel(s||""),a.getArrayData()}},{key:"encodeSuperSyncMsg",value:function(e){var t=this._codec.getModule(Gf);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Nh);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 a=this._codec.getModule(Nh);return a.setType(r),a.setCount(n),a.setStartTime(i),a.setOrder(s),a.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(Lh);return i.setType(n),r&&i.setBusChannel([r]),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(Mh),r=[];return mo(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(Ah);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n,r){var i=this._codec.getModule(xh),s=[];return mo(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(s),i.setBusChannel(r),i.getArrayData()}},{key:"encodeClearMessages",value:function(e,t,n,r){var i=this._codec.getModule(Ph);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,s=t.timestamp,a=this._codec.getModule(Dh);return s=s||+new Date,a.setType(n),a.setChannelId(r),a.setMsgTime(s),a.setBusChannel(i),a.getArrayData()}},{key:"encodeExpandUltraMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.keys,u={mid:s,put:e.expansion,del:o,clear:e.removeAll?1:0},c=this._codec.getModule(Ff);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(s),c.setMsgTime(a),c.setContent(JSON.stringify(u)),c.getArrayData()}},{key:"encodemodifyMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.content,u=this._codec.getModule(Ff);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(s),u.setMsgTime(a),u.setContent(JSON.stringify(o)),u.getArrayData()}},{key:"encodeQueryMsgChange",value:function(e){var t=this._codec.getModule(qf);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeMsgQuery",value:function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(Hf),s=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(s),i.getArrayData()}},{key:"encodeOperateStatus",value:function(e,t,n,r){var i=this._codec.getModule(Wf);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(Vh);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Gh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(sf);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(hf),s=t.key,a=t.value,o=t.notificationExtra,u=t.isSendNotification,c=t.type||_a.UPDATE,l=ko(t,c),h={key:s,value:a||"",uid:n};if(qs(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:Ms.CHATROOM,targetId:e},d={key:s,value:a,extra:o,type:c},g=this._getUpMsgModule(f,{messageType:ha.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(Ms.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(ff),i=t.entries,s=t.type||_a.UPDATE,a=ko(t,s),o=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};qs(a)||(t.status=a),o.push(t)})),r.setEntry(o),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(yf);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(Ef);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(If);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(wf),i=No.getTime(),s=[];return mo(e,(function(e){var r=t._codec.getModule(Sf),a=e.conversationType,o=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(a),r.setChannelId(o),r.setTime(i),r.setBusChannel(l);var f=u===da.OPEN,d={};qs(u)||(d[Jd]=f),qs(c)||(d[zd]=c),mo(d,(function(e,r){if(!qs(e)){var i=t._codec.getModule(bf);e=e?Qd:Wd,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;h.push(s)}})),r.setStateItem(h);var g=n?r.getArrayData():r;s.push(g)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(Nf);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(Uf),s=[];return e.forEach((function(e){var t=n._codec.getModule(Lf);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(Nf);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(xf),s=[];return e.forEach((function(e){var t=n._codec.getModule(Lf);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(Pf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(wf),s=[];return t.forEach((function(t){var i=n._codec.getModule(Sf),a=n._codec.getModule(bf),o=[];e.forEach((function(e){var t=n._codec.getModule(Lf);t.setTagId(e.tagId),qs(e.isTop)||t.setIsTop(e.isTop),o.push(r?t.getArrayData():t)})),a.setSessionStateType(Zd),a.setValue(JSON.stringify(o)),a.setTags(o),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?a.getArrayData():a]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(No.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(Df);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeUltraGroup",value:function(e,t){var n=this._codec.getModule(Bf);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n,r,i){var s=this,a="comet"===this._connectType,o=this._codec.getModule(qh);if(e=e||0,o.setRoomType(e),qs(t)||o.setBroadcastType(t),qs(n)||o.setJoinType(n),r){var u=[],c=this._codec.getModule(nf);for(var l in r)c.setKey(l),c.setValue(r[l]),a?u.push(c.getArrayData()):u.push(c);o.setInnerDatas(u)}if(i){var h=[];Object.keys(i).forEach((function(e){var t=s._codec.getModule(nf);t.setKey(e),t.setValue(i[e]),a?h.push(t.getArrayData()):h.push(t)})),o.setOuterDatas(h)}return o.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(Kh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(Hh);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var a=i.content;a&&(Gs(a)&&(a=JSON.stringify(a)),s.setContent(a))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,a=this._codec.getModule(Yh);a.setObjectName(n);var o=this._codec.getModule(nf);o.setKey(e.name),o.setValue(e.content),s?a.setContent(o.getArrayData()):a.setContent(o);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(nf);n.setKey(e);var a="uris"===e?t:r;n.setValue(a),s?u.push(n.getArrayData()):u.push(n)})),a.setValueInfo(u),a.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(Yh);n.setObjectName(e);var r=this._codec.getModule(nf);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(Qh);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(Qh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},a=s.name,o=s.content;return!qs(a)&&i.setObjectName(a),qs(o)||(Gs(o)&&(o=JSON.stringify(o)),i.setContent(o)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(Wh);r.setTarget(t),Ds(e)||(e=[e]),mo(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,a=i.content;return!qs(s)&&r.setObjectName(s),qs(a)||(Gs(a)&&(a=JSON.stringify(a)),r.setContent(a)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Xh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(Jh);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(ef);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(nf);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(rf);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(qh);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($f);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(td);return t.setUserId(e),t.getArrayData()}},{key:"encodeRequestRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,s=e.inviteInfo,a=this._codec.getModule(id);return a.setInvitedRoomId(t),a.setInvitedUserId(n),a.setInviteSessionId(r),a.setTimeoutTime(i),a.setInviteInfo(s),a.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(sd);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setInviteInfo(i),s.getArrayData()}},{key:"encodeResponseRoomPK",value:function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,s=e.key,a=e.value,o=e.agree?1:0,u=this._codec.getModule(ad);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(a),u.setAnswerCode(o),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(od);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),$d=function e(t,n){a(this,e),this._watcher=n,this.codec=new Xd(t)},eg=function(e,t){return e&&t?t+"_"+e:e||Date.now()},tg=function(){function e(t){a(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return u(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return eg(e,t)}},{key:"read",value:function(e,t,n){this.readMessage(e,t,n)}},{key:"readMessage",value:function(e,t,n){return{stream:e,length:t}}}]),e}(),ng=function(){function e(t){a(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new gh(t,!1,Kl.AT_MOST_ONCE,!1)}return u(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return eg(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 yh;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),rg=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments))._name=Yl.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return u(n,[{key:"readMessage",value:function(e,t,r){if(e.readByte(),this.status=+e.readByte(),t<=n.MESSAGE_LENGTH)return{stream:e,length:t};if(r===Wl.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&e.readUTF(),4&i&&(this.timestamp=e.readLong()),8&i&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var s=e.readUTF();Js.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(tg);rg.MESSAGE_LENGTH=2;var ig=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments))._name=Yl.DISCONNECT,e.status=0,e}return u(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(tg);ig.MESSAGE_LENGTH=2;var sg,ag=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.call(this,Hl.PING_REQ))._name=Yl.PING_REQ,e}return u(n,[{key:"writeMessage",value:function(e){}}]),n}(ng),og=function(e){f(n,e);var t=T(n);function n(e){var r;return a(this,n),(r=t.call(this,e))._name=Yl.PING_RESP,r}return n}(tg),ug=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments)).messageId=0,e}return u(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}(tg),cg=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments)).messageId=0,e}return u(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(ng),lg=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments))._name=Yl.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=Ql.PUB,e}return u(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),R(d(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(ug),hg=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return a(this,n),(s=t.call(this,Hl.PUBLISH))._name=Yl.PUBLISH,s.syncMsg=!1,s.identifier=Ql.PUB,s.topic=e,s.data=Ls(r)?ph.writeUTF(r):r,s.targetId=i,s}return u(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),R(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(cg),fg=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments))._name=Yl.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=Ql.PUB,e.topic="",e.targetId="",e}return u(n,[{key:"readMessage",value:function(e,t){return R(d(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}(ug),dg=function(e){f(n,e);var t=T(n);function n(e){var r;return a(this,n),(r=t.call(this,Hl.PUB_ACK))._name=Yl.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return u(n,[{key:"writeMessage",value:function(e){R(d(n.prototype),"writeMessage",this).call(this,e)}}]),n}(cg),gg=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return a(this,n),(s=t.call(this,Hl.QUERY)).name=Yl.QUERY,s.identifier=Ql.QUERY,s.topic=e,s.data=Ls(r)?ph.writeUTF(r):r,s.targetId=i,s}return u(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),R(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(cg),pg=function(e){f(n,e);var t=T(n);function n(e){var r;return a(this,n),(r=t.call(this,Hl.QUERY_CONFIRM))._name=Yl.QUERY_CON,r.messageId=e,r}return n}(cg),vg=function(e){f(n,e);var t=T(n);function n(){var e;return a(this,n),(e=t.apply(this,arguments))._name=Yl.QUERY_ACK,e.status=0,e.identifier=Ql.QUERY,e.topic="",e.targetId="",e}return u(n,[{key:"readMessage",value:function(e,t){return R(d(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}(ug),yg=function(e){var t,n=e.type;switch(n){case Hl.CONN_ACK:t=new rg(e);break;case Hl.PUBLISH:(t=new lg(e)).syncMsg=e.syncMsg;break;case Hl.PUB_ACK:t=new fg(e);break;case Hl.QUERY_ACK:t=new vg(e);break;case Hl.SUB_ACK:case Hl.UNSUB_ACK:case Hl.PING_RESP:t=new og(e);break;case Hl.DISCONNECT:t=new ig(e);break;default:t=new tg(e),Js.error("No support for deserializing "+n+" messages")}return t},mg=function(e,t){var n=new Uint8Array(e),r=new vh(n),i=r.readByte(),s=new gh(i),a=yg(s);return a.read(r,n.length-1,t),a},_g=function(e){var t=e.headerCode,n=new gh(t),r=yg(n);for(var i in e)r[i]=e[i];return r},Eg=Bt.charAt,Tg="String Iterator",Rg=Ne.set,Ig=Ne.getterFor(Tg);Qo(String,"String",(function(e){Rg(this,{type:Tg,string:String(e),index:0})}),(function(){var e,t=Ig(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Eg(n,r),t.index+=e.length,{value:e,done:!1})})),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.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf"}(sg||(sg={}));var Cg=sg;s(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=s(regeneratorRuntime.mark((function e(t){var i,s,a;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(ws(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:sn});case 4:return a=e.sent,e.abrupt("return",{status:a.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)})));var Sg,bg,wg=(Sg=s(regeneratorRuntime.mark((function e(t,n,r,i){var a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=0,t.forEach(function(){var e=s(regeneratorRuntime.mark((function e(s){var o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o="".concat(n,"://").concat(s,"/ping?r=").concat(ws(1e3,9999)),Js.debug("start ping",o),e.next=4,r.httpReq({url:o,timeout:sn});case 4:u=e.sent,Js.debug("end ping",a,o,u.status),a++,i({finished:a===t.length,code:u.status,host:s});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return Sg.apply(this,arguments)}),Og=function(e,t,n,r,i,s,a,o){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(a,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(o?"&protocolVer="+o:"")},Ng=function(e){return[Cg.ppMsgS,Cg.pgMsgS,Cg.chatMsgS].map((function(e){return Cg[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"}(bg||(bg={}));var kg,Mg=function(e,t){Js.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)},Ag=function(e){f(l,e);var t,n,r,i,o,c=T(l);function l(e,t){var n;return a(this,l),(n=c.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 u(l,[{key:"connect",value:(o=s(regeneratorRuntime.mark((function e(t,n,r,i,a,o){var u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var c=[],l=0,h=!1,f=!1,d=function(){var r=s(regeneratorRuntime.mark((function r(){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==c.length&&!h){r.next=2;break}return r.abrupt("return");case 2:return h=!0,r.next=5,u._connect(t,n,c.shift(),i,a,o);case 5:if((s=r.sent)!==aa.SUCCESS){r.next=11;break}u._checkAlive(),e(s),r.next=20;break;case 11:if(s!==ca.REDIRECT){r.next=15;break}e(s),r.next=20;break;case 15:if(!f||0!==c.length){r.next=18;break}return e(So(s)),r.abrupt("return");case 18:h=!1,d();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();a=Qn(a),u._watcher.status(ua.CONNECTING),wg(r,i,u._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;f=r,200===n&&(c.push(i),l++,d()),r&&0===l&&(Js.error("No valid websocket server hosts!"),e(aa.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,s){return o.apply(this,arguments)})},{key:"_connect",value:(i=s(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.replace("http","ws"),u=Og(o,r,t,n,this._runtime,s,"",a),Js.debug("conenct start -> ".concat(u)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(u),l=function(e){f._timer&&(clearTimeout(f._timer),f._timer=null),f._socket===c&&(f._socket=null,f._watcher.status(e))},e.next=8,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=mg(t,a);if(n instanceof og&&f._pingResolve)return f._pingResolve(aa.SUCCESS),void(f._pingResolve=void 0);if(n instanceof rg)return Js.debug("recv connect ack -> ".concat(n.status)),n.status!==ca.ACCEPTED?(Js.warn("connect failed: ".concat(n.status)),void e(n.status)):(Js.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(aa.SUCCESS));if(n instanceof ig){var r=n.status;switch(Js.warn("recv disconnect signal -> status: ".concat(r)),r){case bg.BLOCK_NEW:case bg.BLOCK:f._watcher.status(ua.BLOCKED);break;case bg.OTHER_DEVICE_LOGIN:f._watcher.status(ua.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case bg.REDIRECT_NEW:case bg.REDIRECT:f._watcher.status(ua.REDIRECT);break;default:f._watcher.status(ua.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else Js.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Js.warn("websocket closed! code:",t,"reason:",n),l(ua.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(aa.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in Js.error("websocket error!",null==t?void 0:t.stack),l(ua.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(aa.RC_NET_CHANNEL_INVALID)}e(aa.NETWORK_ERROR)})),c.onOpen((function(){return Js.debug("websocket open =>",u)})),setTimeout((function(){e(aa.TIMEOUT)}),an)}));case 8:return(h=e.sent)===aa.SUCCESS?this._socket=c:(Js.warn("connect result -> code: ".concat(h,", url: ").concat(u)),c.close()),e.abrupt("return",h);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s,a){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=s(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 Js.debug("send ping ->"),this.sendOnly(new ag),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(aa.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===aa.SUCCESS){e.next=12;break}return this._failedCount+=1,Js.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Js.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(ua.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:Js.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=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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 lg&&!t.syncMsg&&(Js.info("send pubAck -> ".concat(n," ").concat(t.topic)),this.sendOnly(new dg(n))),t instanceof vg&&(Js.info("send queryCon -> ".concat(n," ").concat(t.topic)),this.sendOnly(new pg(n)))),n>0&&(t instanceof fg||t instanceof vg)&&(Js.info("recv ack -> messageId: ".concat(n," ").concat(t.topic)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof lg)){e.next=17;break}if(s=t.syncMsg,a=t.topic,Js.info("recv PublishReader -> messageId: ".concat(n," ").concat(a)),a!==Cg[Cg.userSetData]){e.next=9;break}return e.abrupt("return");case 9:if(s&&!Ng(a)){e.next=12;break}return this._watcher.signal(t),e.abrupt("return");case 12:return e.next=14,new Promise((function(e){u._syncMessageIds[n]=e}));case 14:o=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&((e instanceof hg||e instanceof gg)&&(e.messageId=this._generateMessageId()),Mg(e,this._socket))}},{key:"send",value:(t=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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]:ln,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,Mg(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(a=e.sent){e.next=11;break}return Js.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:aa.TIMEOUT});case 11:if(a instanceof vg||a instanceof fg){e.next=13;break}return e.abrupt("return",{code:a});case 13:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=17;break}return Js.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(a.status)),e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 17:return e.abrupt("return",{code:aa.SUCCESS,data:o});case 18:return e.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 19: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(ua.DISCONNECTED))}}]),l}($d);e.HttpMethod=void 0,(kg=e.HttpMethod||(e.HttpMethod={})).GET="GET",kg.POST="POST";var Ug=function(e){if(Gs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},Lg=function(t){f(h,t);var n,r,i,o,c,l=T(h);function h(e,t){var n;return a(this,h),(n=l.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 u(h,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ls(e.data)?JSON.parse(e.data):e.data;return n?!Ds(n)||(mo(n,function(){var e=s(regeneratorRuntime.mark((function e(n){var r,i,s,a,o,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=_g(n),s=i.messageId,a=i._header,o=i.status,i.identifier,u=a&&a.qos!==Kl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof lg&&!i.syncMsg&&(l=new dg(s),t.sendOnly(l)),i instanceof vg&&(h=new pg(s),t.sendOnly(h))),!(i instanceof ig)){e.next=20;break}e.t0=o,e.next=e.t0===bg.OTHER_DEVICE_LOGIN?11:e.t0===bg.BLOCK||e.t0===bg.BLOCK_NEW?13:e.t0===bg.REDIRECT_NEW||e.t0===bg.REDIRECT?15:17;break;case 11:return t._watcher.status(ua.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(ua.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(ua.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(ua.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof lg)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!Ng(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):(Js.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(c=s(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,"&timestrap=").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(ua.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"connect",value:(o=s(regeneratorRuntime.mark((function e(t,n,r,i,a,o){var u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Qn(a),this._protocol=i,this._isDisconnected=!1,this._watcher.status(ua.CONNECTING),u=[],c=0,l=!1,h=!1,e.abrupt("return",new Promise((function(e){var o,d=(o=s(regeneratorRuntime.mark((function r(){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==u.length&&!l){r.next=2;break}return r.abrupt("return");case 2:return l=!0,r.next=5,f._connect(t,n,u.shift(),i,a);case 5:if((s=r.sent)!==aa.SUCCESS){r.next=11;break}f._startPullSignal(i),e(s),r.next=20;break;case 11:if(s!==ca.REDIRECT){r.next=15;break}e(s),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(So(s)),r.abrupt("return");case 18:l=!1,d();case 20:case"end":return r.stop()}}),r)}))),function(){return o.apply(this,arguments)});f._watcher.status(ua.CONNECTING),wg(r,i,f._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,d()),r&&0===c&&(Js.error("No valid websocket server hosts!"),e(aa.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return o.apply(this,arguments)})},{key:"_connect",value:(i=s(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){return 200!==e.status&&202!==e.status?(Js.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(Ug(e.data)?Gs(e.data)?e.data:JSON.parse(e.data):(Js.error("received data is not a validJson",e.data),!1))},o=Og(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),Js.debug("conenct start -> ".concat(o)),e.next=6,this._runtime.httpReq({url:o,body:{pid:this._pid},timeout:an});case 6:return u=e.sent,c=a(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Js.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(o)),e.abrupt("return",null==c?void 0:c.status);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=s(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,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,a=n.messageId,o=n.topic,u=n.targetId,n.identifier,c=n.getHeaderFlag(),l=o?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(o,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&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=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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]:ln,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(a=e.sent){e.next=9;break}return e.abrupt("return",{code:aa.TIMEOUT});case 9:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=12;break}return e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 12:return e.abrupt("return",{code:aa.SUCCESS,data:o});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(ua.DISCONNECTED)}}]),h}($d),xg=function e(t,n,r){a(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()},Pg=Ln.find,Dg="find",Vg=!0;Dg in[]&&Array(1).find((function(){Vg=!1})),at({target:"Array",proto:!0,forced:Vg},{find:function(e){return Pg(this,e,arguments.length>1?arguments[1]:void 0)}}),hr(Dg);var Bg=function(e){return["navi",e].join("_")},Gg=function(e,t,n){var r,i,s=Bg(e);try{var a=n.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();return i.length>0&&(i=i.filter((function(e){return o-e.timestamp<rn}))),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},Fg=function(){function e(t,n){a(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Qn(this._options.apiVersion)}var t;return u(e,[{key:"getInfo",value:(t=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=Gg(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return a=this._options.navigators.slice(),n.length&&n.forEach((function(e){a.indexOf(e)<0&&a.unshift(e)})),e.next=9,this._reqNavi(a,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=Bg(e);try{var a=r.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();i.length>0&&(i=i.filter((function(e){return o-e.timestamp<rn&&t!==e.token}))),i.push({timestamp:o,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=Bg(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<rn&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),qg=Ln.findIndex,jg="findIndex",Kg=!0;jg in[]&&Array(1).findIndex((function(){Kg=!1})),at({target:"Array",proto:!0,forced:Kg},{findIndex:function(e){return qg(this,e,arguments.length>1?arguments[1]:void 0)}}),hr(jg);var Hg=P.f,Yg=function(e){return function(t){for(var n,r=j(t),i=Bn(r),s=i.length,a=0,o=[];s>a;)n=i[a++],U&&!Hg.call(r,n)||o.push(e?[n,r[n]]:r[n]);return o}},Qg={entries:Yg(!0),values:Yg(!1)}.values;at({target:"Object",stat:!0},{values:function(e){return Qg(e)}});var Wg=!A((function(){return Object.isExtensible(Object.preventExtensions({}))})),Jg=N((function(e){var t=re.f,n=me("meta"),r=0,i=Object.isExtensible||function(){return!0},s=function(e){t(e,n,{value:{objectID:"O"+ ++r,weakData:{}}})},a=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!K(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!W(e,n)){if(!i(e))return"F";if(!t)return"E";s(e)}return e[n].objectID},getWeakData:function(e,t){if(!W(e,n)){if(!i(e))return!0;if(!t)return!1;s(e)}return e[n].weakData},onFreeze:function(e){return Wg&&a.REQUIRED&&i(e)&&!W(e,n)&&s(e),e}};Te[n]=!0})),zg=re.f,Zg=Jg.fastKey,Xg=Ne.set,$g=Ne.getterFor;!function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),s=r?"set":"add",a=M[e],o=a&&a.prototype,u=a,c={},l=function(e){var t=o[e];ke(o,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!K(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return i&&!K(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!K(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(it(e,"function"!=typeof a||!(i||o.forEach&&!A((function(){(new a).entries().next()})))))u=n.getConstructor(t,e,r,s),Jg.REQUIRED=!0;else if(it(e,!0)){var h=new u,f=h[s](i?{}:-0,1)!=h,d=A((function(){h.has(1)})),g=Jr((function(e){new a(e)})),p=!i&&A((function(){for(var e=new a,t=5;t--;)e[s](t,t);return!e.has(-0)}));g||((u=t((function(t,n){Ar(t,u,e);var i=Qa(new a,t,u);return null!=n&&Fr(n,i[s],{that:i,AS_ENTRIES:r}),i}))).prototype=o,o.constructor=u),(d||p)&&(l("delete"),l("has"),r&&l("get")),(p||f)&&l(s),i&&o.clear&&delete o.clear}c[e]=u,at({global:!0,forced:u!=a},c),Nr(u,e),i||n.setStrong(u,e,r)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,r){var i=e((function(e,s){Ar(e,i,t),Xg(e,{type:t,index:ar(null),first:void 0,last:void 0,size:0}),U||(e.size=0),null!=s&&Fr(s,e[r],{that:e,AS_ENTRIES:n})})),s=$g(t),a=function(e,t,n){var r,i,a=s(e),u=o(e,t);return u?u.value=n:(a.last=u={index:i=Zg(t,!0),key:t,value:n,previous:r=a.last,next:void 0,removed:!1},a.first||(a.first=u),r&&(r.next=u),U?a.size++:e.size++,"F"!==i&&(a.index[i]=u)),e},o=function(e,t){var n,r=s(e),i=Zg(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return br(i.prototype,{clear:function(){for(var e=s(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,U?e.size=0:this.size=0},delete:function(e){var t=this,n=s(t),r=o(t,e);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first==r&&(n.first=i),n.last==r&&(n.last=a),U?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=s(this),r=Mn(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!o(this,e)}}),br(i.prototype,n?{get:function(e){var t=o(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),U&&zg(i.prototype,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=$g(t),s=$g(r);Qo(e,t,(function(e,t){Xg(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),Mr(t)}});var ep="outbox",tp="inbox",np=function(e,t,n){return[e,t,n].join("_")},rp=function(){function e(t,n){a(this,e),this._runtime=t,this._appkey=n,this._users={}}return u(e,[{key:"_getMemData",value:function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})}},{key:"setInboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=np(tp,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getInboxTime",value:function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=np(tp,this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime}},{key:"setOutboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=np(ep,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getOutboxTime",value:function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=np(ep,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),ip={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},sp=function(){function e(t,n){a(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return u(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,a=this._getSetUserId(n),o=r===_a.DELETE,u=a===s,c=!this._isExisted(n),l=o?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)})),Js.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),ap=function(){function e(t){a(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return u(e,[{key:"_startPull",value:(t=s(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;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=ip.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,a=s.code,o=s.data,this._isPulling=!1,a===aa.SUCCESS?(ip.set(n,o.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){ip.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];Ks(r)||(r=new sp(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}(),op=function(){function e(t,n,r,i){a(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 u(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){Js.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],Ks(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}(),up="converStatusChanged",cp=function(){function e(t,n,r){a(this,e),this._eventEmitter=new na,this._pullQueue=[],this._isPulling=!1,this._storage=pn(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return u(e,[{key:"_set",value:function(e){var t=this;if(!qs(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(up,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=s(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===aa.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(up,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(up,(function(e){}))}}]),e}(),lp={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:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},hp={};for(var fp in lp){var dp=lp[fp].keyName;hp[dp]=fp}var gp,pp=function(){function e(t,n,r){a(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new yn(t,i),this._localStore=new yn(t,"CONVER-".concat(n,"-").concat(r))}return u(e,[{key:"_getStoreKey",value:function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value:function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:Ms.PRIVATE,targetId:"",channelId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,a=e.isMentioned,o=e.content,u=e.senderUserId,c=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=hp.mentionedInfo,d=hp.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=o.mentionedInfo;if(v){if(a&&r===Ms.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===pa.ALL&&p.indexOf(u)<0&&p.push(u);if(s===ha.RECALL&&r===Ms.GROUP){var y=p.indexOf(u);y>=0&&p.splice(y,1)}v={userIdList:p,type:(null===(t=v)||void 0===t?void 0:t.type)||g.type},0!==p.length?(h[f]=v,h[d]=!0):(delete h[f],delete h[d]),Ks(h)?this._localStore.set(l,h):this._localStore.remove(l)}}},{key:"set",value:function(e,t,n,r){var i=this._getStoreKey(e,t,r),s=this._localStore.get(i)||{};for(var a in n){var o=hp[a],u=n[a];if(!qs(o)&&!qs(u)&&"hasMentioned"!==a&&"MentionedInfo"!==a){if(u===lp[o].defaultVal||"tags"===a&&!Ks(u))delete s[o];else if("tags"===a){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[o]=u}else s[o]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}Ks(s)?this._localStore.set(i,s):this._localStore.remove(i)}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},s={};for(var a in lp){var o=lp[a],u=o.keyName,c=o.defaultVal;s[u]=i[a]||Ro(c)}return s}},{key:"getValue",value:function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},a=t[r];for(var o in a){var u=lp[o],c=u.keyName,l=u.defaultVal;s[c]=a[o]||Ro(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,s=r.targetId,a={},o=e[n];for(var u in o){var c=lp[u],l=c.keyName,h=c.defaultVal;a[l]=o[u]||Ro(h)}for(var f in a.tags){qs(t[f])&&(t[f]=[]);var d=Object.assign({},a,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}},{key:"adaptOldStore",value:function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}}catch(e){Js.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),vp=[Ms.PRIVATE,Ms.GROUP,Ms.SYSTEM,Ms.PUBLIC_SERVICE,Ms.APP_PUBLIC_SERVICE],yp="conversationChanged",mp="conTagStatusChanged",_p=function(){function e(t,n,r,i,s){var o=this;a(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new na,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new pp(t.runtime,n,r),this._statusManager=new cp(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(yp,(function(e){i(e)})),this._eventEmitter.on(mp,(function(){s()}))}return u(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,a=e.messageDirection,o=e.senderUserId,u=a===ia.SEND&&o===this._loginUserId,c=r===ha.RECALL,l=Gs(n),h=!1,f={},d=t.lastUnreadTime||0,g=t.unreadMessageCount||0;if(d>i||u)return{hasChanged:h,localConversation:t,updateItems:f};(s&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,h=!0),c&&l)&&(d>=n.sentTime&&g&&(t.unreadMessageCount=g-1,h=!0));return h&&(f.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:f}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;ia.SEND;var s=Gs(n),a=!1,o={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,a=!0,o.hasMentioned={val:!0,time:i},o.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:a,localConversation:t,updateItems:o}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===ia.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,a=s.type,o=s.userIdList;if(a===pa.ALL||(o||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(Gs(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),s=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(s,e)}}},{key:"_setConTagStatusChanged",value:function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var s in i)if(!n[s]||i[s].isTop!==n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}},{key:"addStatus",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,s=e.notificationStatus,a=e.isTop,o=e.tags,u=e.channelId,c={},l={};n!==Ms.ULTRA_GROUP&&(qs(s)||(l.notificationStatus={time:i,val:s}),qs(a)||(l.isTop={time:i,val:a}),qs(o)||(l.tags={time:i,val:o},null==o||o.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:a,tags:c},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged())}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(yp,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(mp),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId,a=e.channelId;if(vp.indexOf(r)>=0){var o=!1,u=this._store.get(r,s,a),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,s=r.localConversation,a=r.updateItems;o=o||i,c=h(h({},c),a),u=Ro(s)})),o&&this._store.set(r,s,u,a),this._store.updateMentionedData(e),i){var l=this._store.get(r,s,a);l.updatedItems=h({latestMessage:{time:e.sentTime,val:e}},c),l.latestMessage=e;var f=Object.assign(l,{conversationType:r,targetId:s,channelId:a});this._setUpdatedConversation(f)}(o||i)&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._store.get(e,t,n)}},{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,a=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(a))&&(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,n){return this._store.get(e,t,n).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=this._store.get(e,t,n),s=i.unreadMessageCount,a=i.hasMentioned,o={};if(s&&(i.unreadMessageCount=0,o.unreadMessageCount={val:0,time:Date.now()}),a&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,o.hasMentioned={val:!1,time:Date.now()},o.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(o).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:o});this._setUpdatedConversation(u),this._notifyConversationChanged()}}},{key:"clearAllUnreadCount",value:function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,e._store.set(t.conversationType,t.targetId,t,t.channelId))}))}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n}},{key:"getDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]}},{key:"clearDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]}},{key:"addTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;s=Object.assign(s,n),this._store.set(e,t,{tags:s},r)}},{key:"deleteTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;n.forEach((function(e){delete s[e]})),this._store.set(e,t,{tags:s},r)}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}},{key:"getBlockConversationList",value:function(){return this._store.getValue().filter((function(e){return e.notificationStatus===da.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"getTopConversationList",value:function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"adaptOldStore",value:function(){this._store.adaptOldStore()}},{key:"getUnreadMentionedCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=this.get(t,n,e);return r.unreadMentionedCount||0}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t}},{key:"getAllConversationState",value:function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))}}]),e}(),Ep=function(){function e(t,n,r,i){a(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=pn(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return u(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=s(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;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!==aa.SUCCESS||qs(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,a=i.version,o=s.Tag,qs(o)||this._updateTag(o),this._storage.set(this._storagePullTimeKey,a),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}(),Tp=function(e){f(i,e);var t,n,r=T(i);function i(e,t){var n;return a(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return u(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=s(regeneratorRuntime.mark((function e(t,n,r){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(a=this._runtime.isSupportSocket()&&"websocket"===this._connectType?un.join(","):cn.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):a||"",n=[]),e.abrupt("return",R(d(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=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,a=t.length;case 2:if(!(s<a)){e.next=28;break}return o=this._formatJSONPUrl(t[s],r,n,i),Js.debug("req navi => ".concat(o)),e.next=7,this._runtime.httpReq({url:o,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?Js.error("request navi error: "+aa.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&Js.error("request navi error: "+aa.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",25);case 11:return e.prev=11,c=u.data.match(/{[\d\D]+}/),0===(l=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),h=JSON.parse(l),f=/^https/.test(o)?"https":"http",h.protocol=f,this._runtime.useNavi||(h.server="",h.backupServer=this._miniConnectUrl,h.logSwitch=0),e.abrupt("return",h);case 22:e.prev=22,e.t0=e.catch(11),Js.error("parse navi err =>",e.t0);case 25:s+=1,e.next=2;break;case 28:if(this._runtime.useNavi){e.next=31;break}return d={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",d);case 31:return e.abrupt("return",null);case 32:case"end":return e.stop()}}),e,this,[[11,22]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(Fg),Rp=function(){function e(t){a(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return u(e,[{key:"_startPull",value:(t=s(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;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,a=s.code,o=s.data,a===aa.SUCCESS?(this._isPulling=!1,this._pullTime=o.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}(),Ip=function(e,t){return["send_msg",e,t].join("_")},Cp=function(){function e(t,n){a(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return u(e,[{key:"init",value:function(e){this._userId=e;var t=Ip(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=Ip(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=Ip(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}(),Sp=function(e){var t="RCDeviceId",n=pn(e),r="",i=n.get(t);return i?r=i:(r=Ns(),n.set(t,r)),r};c(gp={},Ms.PRIVATE,Cg.qryPMsg),c(gp,Ms.GROUP,Cg.qryGMsg),c(gp,Ms.CHATROOM,Cg.qryCHMsg),c(gp,Ms.CUSTOMER_SERVICE,Cg.qryCMsg),c(gp,Ms.SYSTEM,Cg.qrySMsg);var bp=[Cg[Cg.recallMsg],Cg[Cg.ppMsgS],Cg[Cg.pgMsgS],Cg[Cg.ppMsgP],Cg[Cg.pgMsgP],Cg[Cg.chatMsg],Cg[Cg.pcMsgP],Cg[Cg.prMsgS],Cg[Cg.updUgRTime]],wp=function(e){var t;return(t={},c(t,Ms.PRIVATE,Cg.ppMsgP),c(t,Ms.GROUP,Cg.pgMsgP),c(t,Ms.CHATROOM,Cg.chatMsg),c(t,Ms.CUSTOMER_SERVICE,Cg.pcMsgP),c(t,Ms.RTC_ROOM,Cg.prMsgS),t)[e]},Op=function(e,t,r,i,s,a){return{conversationType:e,targetId:t,senderUserId:a,messageDirection:ia.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,channelId:r.channelId,isInterrupt:r.isInterrupt}},Np=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},kp=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i}))},Mp=function(t){f(Ke,t);var n,r,i,o,l,d,g,p,v,y,m,E,R,S,b,O,N,k,M,A,U,L,x,P,D,V,B,G,F,q,j,K,H,Y,Q,W,J,z,Z,X,$,ee,te,ne,re,ie,se,ae,oe,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e,Ee,Te,Re,Ie,Ce,Se,be,we,Oe,Ne,ke,Me,Ae,Ue,Le,xe,Pe,De,Ve,Be,Ge,Fe,qe,je=T(Ke);function Ke(e,t,n){var r;return a(this,Ke),(r=je.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._status=ua.DISCONNECTED,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._lastSyncUltraMsgTimeStamp=0,r._lastSyncUltraMsgLocalTimeStamp=0,r._ultraGroupTimer=-1,r._isUltraPulling=!1,r._ultraGroupTimeQue=[],r._isUltraGroupListExist=!1,r._ultraGroupMap={},r._firstPullUltraGroupTime=0,r._ultraMsgMap={},r._pullUltraChangeMessageQue=[],r._isPullingUltraChangeMessage=!1,r._lastPullingUltraChangeMessageTime=0,r._ultraMsgChangeMap={},r._letterbox=new rp(e,n.appkey),r._sendMessageStore=new Cp(e,n.appkey),r._chrmEntryHandler=new ap(_(r)),r}return u(Ke,[{key:"_createNavi",value:function(){return new Tp(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(qe=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u=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):Js.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 Js.error("navi invaild.",r),e.abrupt("return",aa.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){u._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),a=Wl.V3,1===n.openAnti&&(a=Wl.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,a);case 13:return(o=e.sent)===aa.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(ua.CONNECTED),this._status=ua.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new _p(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Ep(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Rp(this),this._joinedChrmManager=new op(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval(),1===n.ugMsg&&this._startUltraSyncInterval()):s.close(),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return qe.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Js.warn("connection status changed:",e),this._status=e,e!==ua.CONNECTING)if(e!==ua.CONNECTED){if(this._channel&&e!==ua.DISCONNECTED)return e===ua.BLOCKED||e===ua.KICKED_OFFLINE_BY_OTHER_CLIENT||e===ua.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==ua.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:(Fe=s(regeneratorRuntime.mark((function e(t,n,r){var i,s=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 i=Wl.V3,1===this._naviInfo.openAnti&&(i=Wl.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==aa.SUCCESS){e.next=16;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(ua.CONNECTED),this._status=ua.CONNECTED,this._startUltraSyncInterval(),this._rejoinChrm(),Js.__insertLogIntoDatabase(),e.abrupt("return");case 16:this._watcher.status(ua.WEBSOCKET_UNAVAILABLE),this._status=ua.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Fe.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=Cg[r];if(i)switch(i){case Cg.s_ntf:Js.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case Cg.s_msg:this._receiveMsg(e);break;case Cg.s_cmd:this._receiveStateNotify(e);break;case Cg.s_us:this._receiveSettingNotify(e);break;case Cg.rtc_ntf:this._receiveRtcKv(e);break;case Cg.s_opNtf:this._pullOperateStatusNotify(e)}else Js.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,bh),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});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Rf)).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,Xf),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(bp.includes(e.topic)){if(e.topic===Cg[Cg.updUgRTime]){var r,i=null===(r=this._channel)||void 0===r?void 0:r.codec.decodeByPBName(e.data,Dh),s=i.channelId,a=i.busChannel,o=this._ultraGroupMap[a+"_"+s];return o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.lastReadTime=t.timestamp,this._watcher.conversation(wo([o]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var u=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,mh,{currentUserId:this.currentUserId,signal:e});u=this._handleMsgProperties(u),t&&(u.sentTime=t.timestamp,u.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||u.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),u.messageType!==ha.EXPANSION_NOTIFY?(u.messageType===ha.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(u.conversationType,u.targetId,u.channelId),this._conversationManager.setConversationCacheByMessage(u,!0),this._watcher.batchMessage([u])):this._receiveMessageExpansion(u))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,bh),n=t.type,r=t.chrmId,i=t.time;if(Js.info("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:(Ge=s(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,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),Js.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new gg(Cg[Cg.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,Th,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(a=e.sent,o=a.code,u=a.data,this._latestSyncTimestamp=Date.now(),o===aa.SUCCESS&&u&&!qs(u.finished)&&!qs(u.list)&&!qs(u.syncTime)){e.next=21;break}return Js.warn("pullMsg failed -> code:",o,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Js.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===ia.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==ha.EXPANSION_NOTIFY){if(e.messageType===ha.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}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,C(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 Ge.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,Eh,{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!==ha.EXPANSION_NOTIFY?t.messageType===ha.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([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,a=e.isStatusMessage,o=r in dn,u=r in this._customMessageType;if(t=o?h(h({},dn[r]),{},{isStatusMessage:gn.includes(r)}):u?this._customMessageType[r]:{isCounted:!js(i)&&i,isPersited:!js(s)&&s,isStatusMessage:!1},Object.assign(e,t),n&&!qs(a)&&(e.isStatusMessage=a),!n){var c=e.content.user;if(c){var l=c.portrait,f=c.portraitUri,d=l||f;d&&(c.portrait=c.portraitUri=d)}}return e}},{key:"getHistoryMessage",value:(Be=s(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=p.length>5&&void 0!==p[5]?p[5]:"",o=this.currentUserId,u=this._channel,c=Hd[t]||Bd,l=1===i&&0===r,!u){e.next=15;break}return h=u.codec.encodeGetHistoryMsg(n,{timestamp:r,count:l?2:i,order:s,channelId:a}),e.next=8,u.send(new gg(c,h,o),Oh,{currentUserId:o,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:d});case 12:return g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===s?g.list.shift():g.list.pop()),e.abrupt("return",{code:d,data:{list:g.list,hasMore:g.hasMore}});case 15:return e.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return Be.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Js.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new gg(Cg[Cg.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==aa.SUCCESS&&Js.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(Ve=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=11;break}return o=a.codec.encodeDeleteMessages(t,n,r,i),u=new gg(wd,o,s),e.next=6,a.send(u);case 6:if(c=e.sent,(l=c.code)===aa.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",aa.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Ve.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(De=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=12;break}return o=a.codec.encodeClearMessages(n,r,i,t),u=new gg(Yd[t],o,s),e.next=7,a.send(u);case 7:if(c=e.sent,(l=c.code)===aa.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",aa.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return De.apply(this,arguments)})},{key:"getConversationList",value:(Pe=s(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,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,a=this._channel,n=n||Ms.PRIVATE,!a){e.next=17;break}return o=a.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new gg(xd,o,s),e.next=12,a.send(u,kh,{currentUserId:s,connectedTime:a.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=f._conversationManager.get(t,n,r);return Object.assign(e,i),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===aa.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:null==h?void 0:h.list});case 17:return e.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return Pe.apply(this,arguments)})},{key:"removeConversation",value:(xe=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=this._channel)){e.next=12;break}return s=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:r,targetId:n}),a=new gg(Pd,s,n),e.next=6,i.send(a);case 6:if(o=e.sent,Js.info("RemoveConversation =>",o),(u=o.code)===aa.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",aa.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return xe.apply(this,arguments)})},{key:"getConversation",value:(Le=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==Ms.ULTRA_GROUP){e.next=6;break}if(i=this._ultraGroupMap[r+"_"+n]){e.next=4;break}return e.abrupt("return",{code:aa.CONVER_GET_ERROR});case 4:e.next=18;break;case 6:if(s=this._conversationManager.get(t,n,r)){e.next=9;break}return e.abrupt("return",{code:aa.CONVER_GET_ERROR});case 9:return e.next=11,this.getHistoryMessage(t,n,0,1,0);case 11:if(a=e.sent,o=a.code,u=a.data,o===aa.SUCCESS){e.next=16;break}return e.abrupt("return",{code:aa.CONVER_GET_ERROR});case 16:c=(null==u?void 0:u.list[0])||null,i={conversationType:t,targetId:n,channelId:r,unreadMessageCount:s.unreadMessageCount||0,latestMessage:c,notificationStatus:s.notificationStatus||da.CLOSE,isTop:s.isTop||!1,lastUnreadTime:s.lastUnreadTime||0,unreadMentionedCount:s.unreadMentionedCount||0};case 18:return e.abrupt("return",{code:aa.SUCCESS,data:i});case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Le.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:aa.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r,i;e===Ms.ULTRA_GROUP?r=(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:aa.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(aa.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(aa.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(aa.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:aa.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(aa.SUCCESS)}},{key:"pullConversationStatus",value:(Ue=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=13;break}return i=n.codec.encodeGetConversationStatus(t),s=new gg(Cg[Cg.pullSeAtts],i,r),e.next=6,n.send(s,Cf);case 6:if(a=e.sent,o=a.code,u=a.data,o===aa.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,s=e.isTop,a=l._ultraGroupMap[i+"_"+n];t===Ms.ULTRA_GROUP?a&&(void 0!==r&&(a.notificationStatus=r),"boolean"==typeof s&&(a.isTop=s)):c.push(e)})),e.abrupt("return",{code:o,data:c});case 13:return e.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(Ae=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=15;break}return i=r.codec.encodeSetConversationStatus(t),s=new gg(Dd,i,n),e.next=6,r.send(s,Of);case 6:if(a=e.sent,o=a.code,u=a.data,o!==aa.SUCCESS){e.next=14;break}return c=u,l=[],t.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,s=e.isTop;if(t===Ms.ULTRA_GROUP){var a=d._ultraGroupMap[i+"_"+n];a&&(void 0!==r&&(a.notificationStatus=r),void 0!==s&&(a.isTop=s),l.push(a))}else d._conversationManager.addStatus(h(h({},e),{},{updatedTime:c.version}),!0)})),l.length>0&&(f=wo(l),f=kp(f),this._watcher.conversation(f)),e.abrupt("return",o);case 14:return e.abrupt("return",o);case 15:return e.abrupt("return",aa.RC_NET_CHANNEL_INVALID);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return Ae.apply(this,arguments)})},{key:"_joinChrm",value:(Me=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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",aa.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),a=new gg(r?Nd:Od,s,t),e.next=8,i.send(a,Bh);case 8:return o=e.sent,u=o.code,c=o.data,u===aa.SUCCESS&&(l=c.joinTime,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 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Me.apply(this,arguments)})},{key:"_rejoinChrm",value:(ke=s(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)===aa.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 ke.apply(this,arguments)})},{key:"_pullChrmMsg",value:(Ne=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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,a=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,o=this._channel.codec.encodeChrmSyncMsg(a,n),u=new gg(Cg[Cg.chrmPull],o,t),e.next=13,this._channel.send(u,Th,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===aa.SUCCESS&&h){e.next=20;break}return Js.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<a||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 Ne.apply(this,arguments)})},{key:"joinChatroom",value:(Oe=s(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 Oe.apply(this,arguments)})},{key:"joinExistChatroom",value:(we=s(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 we.apply(this,arguments)})},{key:"quitChatroom",value:(be=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;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",aa.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new gg(kd,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(a=s.code)===aa.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return be.apply(this,arguments)})},{key:"getChatroomInfo",value:(Se=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),a=new gg(Cg[Cg.queryChrmI],s,t),e.next=7,i.send(a,Fh);case 7:if(o=e.sent,u=o.code,c=o.data,u===aa.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 Se.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(Ce=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),o=new gg(Fd,a,t),e.next=7,s.send(o,Oh,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===aa.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 Ce.apply(this,arguments)})},{key:"_modifyChatroomKV",value:(Ie=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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",aa.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),a=n.type===_a.UPDATE?Md:Ad,o=new gg(a,s,t),e.next=8,r.send(o);case 8:if(u=e.sent,(c=u.code)!==aa.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 Ie.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(Re=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,h,f,d;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:aa.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),a=n.type===_a.UPDATE?Ud:Ld,o=new gg(a,s,t),e.next=8,r.send(o,pf);case 8:return u=e.sent,c=u.code,-1!==[aa.SUCCESS,aa.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(f=Object.assign({},n)).entries,n.entries.forEach((function(e){h.push(Object.assign({},e,f))})),c===aa.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,Js.warn("设置失败的属性:",d.errorKeys),l=d.errorKeys,d&&Array.isArray(d.errorKeys)&&d.errorKeys.forEach((function(e){var t=h.findIndex((function(t){return e.key===t.key}));-1!==t&&h.splice(t,1)}))),Js.warn("设置成功的属性:",h),this._chrmEntryHandler.setLocal(t,{kvEntries:h,syncTime:(new Date).getTime()},i)),e.abrupt("return",{code:c,data:l});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"setChatroomEntry",value:(Te=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 Te.apply(this,arguments)})},{key:"setChatroomEntries",value:(Ee=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 Ee.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(_e=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 _e.apply(this,arguments)})},{key:"removeChatroomEntry",value:(me=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 me.apply(this,arguments)})},{key:"removeChatroomEntries",value:(ye=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 ye.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(ve=s(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=_a.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 ve.apply(this,arguments)})},{key:"getChatroomEntry",value:(pe=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:aa.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),a=new gg(Cg[Cg.pullKV],s,t),e.next=12,i.send(a,gf);case 12:if(o=e.sent,!((u=o.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:aa.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:aa.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(ge=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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:aa.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:aa.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),a=new gg(Cg[Cg.pullKV],s,t),e.next=13,r.send(a,gf);case 13:return o=e.sent,(u=o.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:aa.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return ge.apply(this,arguments)})},{key:"pullChatroomEntry",value:(de=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),a=new gg(Cg[Cg.pullKV],s,t),e.next=7,r.send(a,gf);case 7:if(o=e.sent,u=o.code,c=o.data,u!==aa.SUCCESS){e.next=17;break}return Js.info("Pull success ChrmKV, "+JSON.stringify(o)),this._chrmEntryHandler.setLocal(t,c,i),Js.info("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 de.apply(this,arguments)})},{key:"sendMessage",value:(fe=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,l,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(r=Np(r,this.currentUserId),r=this._handleMsgProperties(r,!0),i=!![Ms.PRIVATE,Ms.GROUP].includes(t)&&r.isStatusMessage,s=i?(v=t,y=void 0,(y={},c(y,Ms.PRIVATE,Cg.ppMsgS),c(y,Ms.GROUP,Cg.pgMsgS),y)[v]):wp(t)||Cg.ppMsgP,i&&(r.isPersited=!1,r.isCounted=!1),a=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(o=new hg(Cg[s],a,n)).setHeaderQos(Kl.AT_LEAST_ONCE),!i){e.next=13;break}return this._channel.sendOnly(o),e.abrupt("return",{code:aa.SUCCESS,data:Op(t,n,h({},r),"",0,this.currentUserId)});case 13:return u=Date.now()-this._localConnectedTime+this._connectedTime,l=Op(t,n,h({},r),"",u,this.currentUserId),e.next=17,this._channel.send(o);case 17:if(f=e.sent,d=f.code,g=f.data,d===aa.SUCCESS){e.next=22;break}return e.abrupt("return",{code:d,data:l});case 22:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),l.sentTime=p.timestamp,l.messageUId=p.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),e.abrupt("return",{code:aa.SUCCESS,data:l});case 28:case"end":return e.stop()}var v,y}),e,this)}))),function(e,t,n){return fe.apply(this,arguments)})},{key:"recallMsg",value:(he=s(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c,l,f,d,g,p,v,y;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:aa.RC_NET_CHANNEL_INVALID});case 2:return o=s.user,u={content:{conversationType:t,targetId:n,messageUId:r,sentTime:i,user:o},messageType:"RC:RcCmd",disableNotification:null==s?void 0:s.disableNotification,pushConfig:null==s?void 0:s.pushConfig,pushContent:(null===(a=s.pushConfig)||void 0===a?void 0:a.pushContent)||s.pushContent||"",channelId:s.channelId},c=Cg[Cg.recallMsg],l=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},u),(f=new hg(c,l,this.currentUserId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=10,this._channel.send(f);case 10:if(d=e.sent,g=d.code,p=d.data,g===aa.SUCCESS){e.next=15;break}return e.abrupt("return",{code:g});case 15:if(v=p,t!==Ms.ULTRA_GROUP){e.next=21;break}return this._ultraMsgMap[v.messageUId]=v.timestamp,e.abrupt("return",{code:aa.SUCCESS});case 21:return this._sendMessageStore.setMessage(v.messageUId,v.timestamp),y=Op(t,n,h(h({},u),{},{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),e.abrupt("return",{code:aa.SUCCESS,data:y});case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return he.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(le=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new gg(Cg[Cg.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 le.apply(this,arguments)})},{key:"getMessageReader",value:(ce=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new gg(Cg[Cg.rrList],i,t),e.next=6,this._channel.send(s,Mf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ce.apply(this,arguments)})},{key:"pullUserSettings",value:(ue=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new gg(Cg[Cg.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,Tf));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"getFileToken",value:(oe=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":fo(t,n),a=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),o=new gg(Cg[Cg.qnTkn],a,this.currentUserId),e.next=7,this._channel.send(o,af);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==aa.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 oe.apply(this,arguments)})},{key:"getFileUrl",value:(ae=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return s="",a="",o="",n===ya.QINIU?(a=of,o=cf):(a=uf,o=lf),s=n===ya.QINIU?Cg[Cg.qnUrl]:n===ya.AWS?Cg[Cg.s3Url]:n===ya.STC?Cg[Cg.stcUrl]:Cg[Cg.aliUrl],u=this._channel.codec.encodeGetFileUrl(a,t,r,i),c=new gg(s,u,this.currentUserId),e.next=11,this._channel.send(c,o);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==aa.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 ae.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._pullQueue.length=0,this._stopSyncInterval(),this._stopUltraSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(se=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new gg(Cg[Cg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,_f);case 7:if(s=e.sent,a=s.code,o=s.data,a===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.addTag([h(h({},t),{},{createdTime:u})],u),e.abrupt("return",{code:aa.SUCCESS,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"removeTag",value:(ie=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new gg(Cg[Cg.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,_f);case 7:if(s=e.sent,a=s.code,o=s.data,a===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:aa.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"updateTag",value:(re=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new gg(Cg[Cg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,_f);case 7:if(s=e.sent,a=s.code,o=s.data,a===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:aa.SUCCESS,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"getTagList",value:(ne=s(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:aa.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return ne.apply(this,arguments)})},{key:"addTagForConversations",value:(te=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:aa.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new gg(Cg[Cg.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(a=s.code)===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return(o={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),e.abrupt("return",{code:aa.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return te.apply(this,arguments)})},{key:"removeTagForConversations",value:(ee=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o=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:aa.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new gg(Cg[Cg.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(a=s.code)===aa.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return n.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:aa.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"removeTagsForConversation",value:($=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,a=n.map((function(e){return{tagId:e}})),o=this._channel.codec.encodeUpdateConversationTag(a,[t]),u=new gg(Cg[Cg.delTag],o,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:l});case 12:return this._conversationManager.deleteTagStatus(r,i,n,s),e.abrupt("return",{code:aa.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"getConversationListByTag",value:(X=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeOldConversationList({count:r,type:Ms.PRIVATE,startTime:n}),o=new gg(xd,a,i),e.next=7,s.send(o,kh,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,null==l?void 0:l.list),Js.info("GetConversationListByTag",h),c===aa.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 X.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,a=t.targetId,o=t.channelId,u=n._conversationManager.get(s,a,o),c=u.hasMentioned,l=u.mentionedInfo,f=u.lastUnreadTime,d=u.notificationStatus,g=u.isTop,p=u.tags,v=u.unreadMessageCount,y=p&&p[e];if(y){var m=h(h({},t),{},{hasMentioned:c,mentionedInfo:l,lastUnreadTime:f,notificationStatus:d,isTop:g,unreadMessageCount:v});y.isTop?r.push(h(h({},m),{},{isTopInTag:!0})):i.push(h(h({},m),{},{isTopInTag:!1}))}})),[].concat(C(r.sort(s)),C(i.sort(s)))}},{key:"getUnreadCountByTag",value:(Z=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:aa.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return Z.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(z=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,a=n.channelId,o=r.isTop,u=[{tagId:t,isTop:o}],(c=this._conversationManager.get(s,i,a)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:aa.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new gg(Cg[Cg.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===aa.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},o&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,a),e.abrupt("return",{code:aa.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return z.apply(this,arguments)})},{key:"getTagsForConversation",value:(J=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,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",{code:aa.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(s in n.tags)i.push({tagId:s,tagName:null===(a=r[s])||void 0===a?void 0:a.tagName});return e.abrupt("return",{code:aa.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:aa.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:aa.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t,n;e.conversationType===Ms.ULTRA_GROUP?t=(null===(n=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===n?void 0:n.unreadMentionedCount)||0:t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:aa.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:aa.SUCCESS,data:e})}},{key:"getUltraGroupList",value:(W=s(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isUltraGroupListExist){e.next=2;break}return e.abrupt("return",{code:aa.METHOD_NOT_AVAILABLE});case 2:return t=Object.values(this._ultraGroupMap),t=kp(t),n=wo(t),e.abrupt("return",{code:aa.SUCCESS,data:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"getBlockUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:aa.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===da.OPEN&&t.push({conversationType:Ms.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:aa.SUCCESS,data:t})}},{key:"getTopUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:aa.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:Ms.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:aa.SUCCESS,data:t})}},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:aa.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:aa.SUCCESS,data:t})}},{key:"clearUltraUnreadcount",value:(Q=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:"",this._isUltraGroupListExist){e.next=3;break}return e.abrupt("return",Promise.resolve(aa.METHOD_NOT_AVAILABLE));case 3:if(this._channel){e.next=5;break}return e.abrupt("return",aa.RC_NET_CHANNEL_INVALID);case 5:if(this._status===ua.CONNECTED){e.next=7;break}return e.abrupt("return",aa.RC_NET_UNAVAILABLE);case 7:return r=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:Ms.ULTRA_GROUP,targetId:t,channelId:n},{timestamp:r}),(s=new hg(Cg[Cg.updUgRTime],i,this.currentUserId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=13,this._channel.send(s);case 13:return a=e.sent,(o=a.code)===aa.SUCCESS&&(u=this._ultraGroupMap[n+"_"+t])&&(u.unreadMessageCount=0,u.unreadMentionedCount=0,u.lastReadTime=r),e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Q.apply(this,arguments)})},{key:"_getUltraGroupList",value:(Y=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===ua.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:return n=this._channel.codec.encodeUltraGroup(t,!1),r=new gg(Cg[Cg.pullUgSes],n,this.currentUserId),e.next=7,this._channel.send(r,kh,{currentUserId:this.currentUserId,conversationType:Ms.ULTRA_GROUP});case 7:if(i=e.sent,s=i.code,a=i.data,s===aa.SUCCESS&&a){e.next=14;break}return Js.warn("pull super conversation failed, code:",s,", data:",a,"retrying..."),o=setTimeout((function(){p._firstPullUltraGroupTime=t,p._getUltraGroupList(t),clearTimeout(o)}),3e3),e.abrupt("return");case 14:if(u=(null==a?void 0:a.list)||[],c=null==a?void 0:a.isFinished,u.forEach((function(e){e.notificationStatus=da.CLOSE,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e})),!1!==c){e.next=22;break}l=u.length>0&&u[u.length-1].versionTime||0,this._getUltraGroupList(l),e.next=33;break;case 22:return e.next=24,this.pullConversationStatus(this._firstPullUltraGroupTime);case 24:h=e.sent,f=h.code,d=h.data,f!==aa.SUCCESS&&Js.warn("pullConversationStatus fail code: ".concat(f,", data: ").concat(d)),g=Object.values(this._ultraGroupMap),g=kp(g),this._watcher.ultraGroupEnable(wo(g)),this._isUltraGroupListExist=!0,0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 33:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_startUltraSyncInterval",value:function(){var e=this;this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),function t(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)}()}},{key:"_stopUltraSyncInterval",value:function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)}},{key:"_syncUltraMsg",value:(H=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===ua.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(!this._isUltraPulling){e.next=4;break}return e.abrupt("return");case 4:return Js.info("start pull ultra msg, time: ".concat(t)),this._isUltraPulling=!0,r=this._channel.codec.encodeSuperSyncMsg(t),i=new gg(Cg[Cg.pullUgMsg],r,this.currentUserId),e.next=10,this._channel.send(i,Th,{currentUserId:this.currentUserId,conversation:{conversationType:Ms.ULTRA_GROUP}});case 10:if(s=e.sent,a=s.code,o=s.data,Js.info("end pull ultra msg, code: ".concat(a,", syncTime: ").concat(null==o?void 0:o.syncTime,", count: ").concat(null==o||null===(n=o.list)||void 0===n?void 0:n.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),a===aa.SUCCESS&&o){e.next=19;break}return Js.warn("sync super message failed, code:",a,", data:",o),this._isUltraPulling=!1,e.abrupt("return");case 19:if(this._isUltraPulling=!1,u=o.list,c=o.syncTime,l=o.finished,this._isUltraGroupListExist){e.next=27;break}return Js.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=c,e.abrupt("return");case 27:for(g in h={},f=[],u.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,a=e.messageType,o=e.messageUId,u=e.channelId;if(e.sentTime,p._ultraMsgMap[o])delete p._ultraMsgMap[o];else{var l=0;((null==s||null===(t=s.mentionedInfo)||void 0===t?void 0:t.type)===pa.ALL||null!=s&&null!==(n=s.mentionedInfo)&&void 0!==n&&null!==(r=n.userIdList)&&void 0!==r&&r.includes(p.currentUserId))&&(l=1);var d=p._ultraGroupMap[u+"_"+i];if(d)a===ha.RECALL?d.unreadMessageCount>0&&(d.unreadMessageCount-=1):(d.unreadMessageCount+=1,d.unreadMentionedCount+=l),d.versionTime=c,d.latestMessage=e,h[u+"_"+i]=d;else{var g={conversationType:Ms.ULTRA_GROUP,targetId:i,channelId:u,unreadMessageCount:1,unreadMentionedCount:l,versionTime:c,latestMessage:e,notificationStatus:da.CLOSE,isTop:!1};p._ultraGroupMap[u+"_"+i]=g,h[u+"_"+i]=g}f.push(e)}})),Object.keys(h).length>0&&(Js.info("notice ultragroups"),d=Object.values(h),d=kp(d),this._watcher.conversation(wo(d))),Js.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>c})),this._ultraMsgMap)this._ultraMsgMap[g]<c&&delete this._ultraMsgMap[g];!1===l?this._syncUltraMsg(c):u&&u.length>0&&(this._lastSyncUltraMsgTimeStamp=c),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 37:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"sendUltraMessage",value:(K=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return"RC:SRSMsg"===n.messageType&&Js.warn("ultra group -> direction message convert to message"),n=this._handleMsgProperties(n,!0),r=this._channel.codec.encodeUpMsg({conversationType:Ms.ULTRA_GROUP,targetId:t},n),(i=new hg(Cg[Cg.ugMsg],r,t)).setHeaderQos(Kl.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,a=Op(Ms.ULTRA_GROUP,t,h({},n),"",s,this.currentUserId),e.next=13,this._channel.send(i);case 13:if(o=e.sent,u=o.code,c=o.data,u===aa.SUCCESS){e.next=18;break}return e.abrupt("return",{code:u,data:a});case 18:return l=c,a.sentTime=l.timestamp,a.messageUId=l.messageUId,this._ultraMsgMap[l.messageUId]=l.timestamp,f=n.channelId||"",(d=this._ultraGroupMap[f+"_"+t])?d.latestMessage=a:(d={conversationType:Ms.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:a.sentTime,latestMessage:a,notificationStatus:da.CLOSE,isTop:!1},this._ultraGroupMap[f+"_"+t]=d),this._watcher.conversation(wo([d])),e.abrupt("return",{code:u,data:a});case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"sendUltraGroupTypingStatus",value:(j=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return r=t.conversationType,i=t.channelId,s=t.targetId,a=this._channel.codec.encodeOperateStatus(s,r,i||"",n||0),(o=new hg(Cg[Cg.operate],a,s)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=10,this._channel.send(o);case 10:if(u=e.sent,(c=u.code)===aa.SUCCESS){e.next=14;break}return e.abrupt("return",{code:c,msg:aa[c]});case 14:return e.abrupt("return",{code:c});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getUltraGroupMessageListByMessageUId",value:(q=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:if(!(t.messages&&t.messages.length<1)){e.next=6;break}return e.abrupt("return",{code:aa.MSG_LIMIT_ERROR});case 6:if(!(t.messages&&t.messages.length>20)){e.next=8;break}return e.abrupt("return",{code:aa.MSG_LIMIT_ERROR});case 8:return n={},t.messages.forEach((function(e){n[e.messageUId]=void 0})),r=this._channel.codec.encodeMsgQuery(t),(i=new hg(Cg[Cg.qryMsg],r,this.currentUserId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=16,this._channel.send(i,Qf);case 16:if(s=e.sent,a=s.code,o=s.data,a===aa.SUCCESS){e.next=21;break}return e.abrupt("return",{code:a,msg:aa[a]});case 21:return u=(o||{}).list,Array.isArray(u)&&u.forEach((function(e){var t=e.messageUId;n[t]=e})),e.abrupt("return",{code:0,data:n});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)})},{key:"_pullOperateStatusNotify",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Jf),n=t.conversationType,r=t.info,i=t.summary;Js.info("s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}}},{key:"expandUltraMessage",value:(F=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeExpandUltraMessage(t,this.currentUserId),(r=new hg(Cg[Cg.upMsgEx],n,t.targetId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===aa.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:aa[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"modifyMessage",value:(G=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodemodifyMessage(t,this.currentUserId),(r=new hg(Cg[Cg.modifyMsg],n,t.targetId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===aa.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:aa[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"_pullUltraChangeMessageList",value:(B=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R,S,b,O,N,k,M,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");case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return");case 4:if(!this._isPullingUltraChangeMessage){e.next=6;break}return e.abrupt("return");case 6:return this._isPullingUltraChangeMessage=!0,r=this._channel.codec.encodeQueryMsgChange(t),(i=new hg(Cg[Cg.qryMsgChange],r,this.currentUserId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=12,this._channel.send(i,Kf);case 12:if(s=e.sent,a=s.code,o=s.data,this._isPullingUltraChangeMessage=!1,a===aa.SUCCESS){e.next=18;break}return e.abrupt("return");case 18:for(d in c=(u=o||{}).hasNext,l=u.list,h=(null==o?void 0:o.syncTime)||0,f={},Array.isArray(l)&&l.forEach((function(e){var t=e.targetId,n=e.conversationType,r=e.sendTime,i=e.messageUId,s=e.changeType,a=n+"_"+t,o=i+"_"+(e.channelId||"")+"_"+r,u=f[a];if(u)u.add(o);else{var c=new Set([o]);f[a]=c}U._ultraMsgChangeMap[i]=s})),f){g=d.split("_"),p=g.shift(),v=g.join("_"),y=f[d],m=[],_=w(y);try{for(_.s();!(E=_.n()).done;)T=E.value,R=T.split("_"),S=I(R,3),b=S[0],O=S[1],N=S[2],m.push({sendTime:Number(N),messageUId:b,channelId:O})}catch(e){_.e(e)}finally{_.f()}k={targetId:v,conversationType:Number(p),messages:m},this._pullUltraMessageList(k)}for(A in M=this._pullUltraChangeMessageQue.filter((function(e){return e>h})),this._pullUltraChangeMessageQue.length=0,(n=this._pullUltraChangeMessageQue).push.apply(n,C(M)),this._ultraMsgMap)this._ultraMsgMap[A]<h&&delete this._ultraMsgMap[A];c?this._pullUltraChangeMessageList(h):this._lastPullingUltraChangeMessageTime=h;case 28:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"_pullUltraMessageList",value:(V=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeMsgQuery(t),(r=new hg(Cg[Cg.qryMsg],n,this.currentUserId)).setHeaderQos(Kl.AT_LEAST_ONCE),e.next=9,this._channel.send(r,Qf);case 9:if(i=e.sent,s=i.code,a=i.data,s===aa.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:aa[s]});case 14:o=(a||{}).list,u=[],c=[],l=[],Array.isArray(o)&&o.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=h._ultraGroupMap[n+"_"+t];i&&i.latestMessage.messageUId===e.messageUId&&(i.latestMessage=e);var s=h._ultraMsgChangeMap[r+""];1===s?u.push(e):2===s?c.push(e):l.push(e)})),u.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(u||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]),l.length>0&&this._watcher.ultraGroupMessageRecalled(l||[]);case 22:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"getUltraHistoryMsg",value:(D=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return r=this._channel.codec.encodeGetHistoryMsg(t,n),i=new gg(Cg[Cg.qryUgMsg],r,this.currentUserId),e.next=8,this._channel.send(i,Oh,{currentUserId:this.currentUserId,conversation:{conversationType:Ms.ULTRA_GROUP,targetId:t}});case 8:if(s=e.sent,a=s.code,o=s.data,a===aa.SUCCESS&&o){e.next=14;break}return Js.warn("get super history message failed, code:",a,", data:",o),e.abrupt("return",{code:a});case 14:return e.abrupt("return",{code:a,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"searchUltraGroupMessages",value:(P=s(regeneratorRuntime.mark((function e(t){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:aa.RC_NET_CHANNEL_INVALID});case 2:if(this._status===ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.RC_NET_UNAVAILABLE});case 4:return e.abrupt("return",{code:aa.SUCCESS});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"getAllConversationState",value:function(){return Promise.resolve({code:aa.SUCCESS,data:this._conversationManager.getAllConversationState()})}},{key:"joinRTCRoom",value:(x=s(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return o=this._channel.codec.encodeJoinRTCRoom(n,r,i,s,a),u=new gg(Cg[Cg.rtcRJoin_data],o,t),e.abrupt("return",this._channel.send(u,jh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return x.apply(this,arguments)})},{key:"quitRTCRoom",value:(L=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new gg(Cg[Cg.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 L.apply(this,arguments)})},{key:"rtcPing",value:(U=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,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",aa.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new gg(Cg[Cg.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return U.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(A=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new gg(Cg[Cg.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,tf));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(M=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,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",{code:aa.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new gg(Cg[Cg.rtcUData],n,t),e.next=6,this._channel.send(r,jh);case 6:return i=e.sent,s=i.code,a=i.data,e.abrupt("return",{code:s,data:a?{users:a.users}:a});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setRTCUserInfo",value:(k=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,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",aa.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new gg(Cg[Cg.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return k.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(N=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",aa.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new hg(Cg[Cg.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"setRTCData",value:(O=s(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,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",aa.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeSetRTCData(n,r,i,s,a),u=new hg(Cg[Cg.rtcSetData],o,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 O.apply(this,arguments)})},{key:"setRTCTotalRes",value:(b=s(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,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",aa.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeUserSetRTCData(n,r,i,s),o=new gg(Cg[Cg.userSetData],a,t),e.next=6,this._channel.send(o);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 b.apply(this,arguments)})},{key:"setRTCCDNUris",value:(S=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,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",aa.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new gg(Cg[Cg.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return S.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:aa.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new gg(Cg[Cg.rtcQryData],i,e);return this._channel.send(s,Zh)}},{key:"removeRTCData",value:(R=s(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,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",aa.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeRemoveRTCData(n,r,i,s),o=new hg(Cg[Cg.rtcDelData],a,t),e.next=6,this._channel.send(o);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 R.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:(E=s(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:aa.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new gg(Cg[Cg.rtcToken],i,t),e.abrupt("return",this._channel.send(s,zh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return E.apply(this,arguments)})},{key:"setRTCState",value:(m=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",aa.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new gg(Cg[Cg.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"getRTCUserInfo",value:(y=s(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 y.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:aa.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new gg(Cg[Cg.rtcUList],t,e);return this._channel.send(n,jh)}},{key:"joinLivingRoomAsAudience",value:(v=s(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,u,c,l,h,f=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=f.length>1&&void 0!==f[1]?f[1]:e.RTCMode.LIVE,i=f.length>2?f[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),a=new gg(Cg[Cg.viewerJoinR],s,n),t.next=8,this._channel.send(a,rd);case 8:if(o=t.sent,u=o.code,c=o.data,u===aa.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return l=c.rtcToken,h=c.entries,t.abrupt("return",{code:u,data:{token:l,kvEntries:h}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return v.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(p=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new gg(Cg[Cg.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 p.apply(this,arguments)})},{key:"rtcIdentityChange",value:(g=s(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new gg(Cg[Cg.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,jh);case 6:if(a=e.sent,o=a.code,u=a.data,o===aa.SUCCESS){e.next=11;break}return e.abrupt("return",{code:o});case 11:return e.abrupt("return",{code:o,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return g.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(d=s(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,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:aa.RC_NET_CHANNEL_INVALID});case 3:return Js.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),a=new gg(Cg[Cg.rtcPullKv],s,i),e.next=8,r.send(a,ed);case 8:if(o=e.sent,u=o.code,c=o.data,Js.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==aa.SUCCESS){e.next=16;break}return l=c.kvEntries,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 16:return e.abrupt("return",{code:u});case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(l=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,n){e.next=3;break}return e.abrupt("return",{code:aa.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new gg(Cg[Cg.rtcQueryJoined],i,r),e.next=7,n.send(s,nd);case 7:if(a=e.sent,o=a.code,u=a.data,o!==aa.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o,data:u});case 12:return e.abrupt("return",{code:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"getDeviceId",value:function(){return Sp(this.runtime)}},{key:"requestRoomPK",value:(o=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new gg(Cg[Cg.rtcInvite],n,t.roomId),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 o.apply(this,arguments)})},{key:"cancelRoomPK",value:(i=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new gg(Cg[Cg.rtcCancelInvite],n,t.roomId),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:"responseRoomPK",value:(r=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new gg(Cg[Cg.rtcInviteAnswer],n,t.roomId),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 r.apply(this,arguments)})},{key:"endRoomPK",value:(n=s(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",aa.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new gg(Cg[Cg.rtcEndInvite],n,t.roomId),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 n.apply(this,arguments)})},{key:"callExtra",value:function(e){return Promise.resolve({code:aa.EXTRA_METHOD_UNDEFINED})}},{key:"getConversationListWithAllChannel",value:function(){throw new Error("Method not implemented.")}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){throw new Error("Method not implemented.")}},{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){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:aa.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:aa.CONVER_GET_ERROR})}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),Ke}(xg),Ap=function(){function e(t){a(this,e),this._context=t}return u(e,[{key:"__getContext",value:function(){return this._context}},{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{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()}},{key:"getRTCJoinedUserInfo",value:function(e){return this._context.getRTCJoinedUserInfo(e)}}]),e}(),Up=function(e){f(n,e);var t=T(n);function n(){return a(this,n),t.apply(this,arguments)}return u(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._context.joinRTCRoom(e,t,n,r,i,s)}},{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)}},{key:"requestRoomPK",value:function(e){return this._context.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._context.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._context.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._context.endRoomPK(e)}}]),n}(Ap),Lp=function(){function e(){a(this,e)}return u(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=[],a=[],o=function(){if(a.length>0){var e=a.join("");if(a=[],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)a.push(e.charAt(u++));else if(c.length<4)a.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)a.push(e.substr(u,c.length)),u+=c.length;else{o();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}o();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,a=15&i,o=void 0;switch(s){case t.dataType.Compressed:var u=a>>2,c=3&a;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((o=t.numberDecode(e.substr(n,a)))!==r.length)throw console.log(r.length),console.log(o),new Error("Data parsing error,at "+n);n+=a;break e;case t.dataType.NormalExt:o=t.numberDecode(e.substr(n,a)),r+=e.substr(n+=a,o),n+=o;break;case t.dataType.Normal:r+=e.substr(n,a),n+=a;break;case t.dataType.Mark:if(a>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+a),n+=16+a;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,a=0,o=i.length;a<o;a++){var u=i[a],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}();Lp.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},Lp.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Lp.scale=Lp.chars.length,Lp.max=238327;var xp=1,Pp=!1,Dp="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",Vp=function(){function e(t){a(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=Sp(t.runtime),this.logSwitch=t.logSwitch;var n=Co(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(Ws.sessionId),this.startReport()}var t;return u(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&Pp){var t=this.itv*Math.pow(2,xp-1);xp<this.times&&xp++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=Ws.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=Lp.compress(t.map((function(e){return e.content})).join("")),r="".concat(Dp).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){Js.__clearRealTimeLog(),Js.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,xp=1),e.startReport()})).catch((function(t){Js.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,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,a=t.uri,o=gs.getInstance(),Js.debug("received report log msg, ".concat(i.toLowerCase()),o),"web"===i.toLowerCase()&&o){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return Js.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 8:return e.next=10,Js.__insertLogIntoDatabase();case 10:return e.next=12,o.getRangeData(fs,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=Lp.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&Pp){var t=a||h.logUrl,n="".concat(Dp).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(){Pp&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Js.debug("report full log success!")})).catch((function(t){e(),Js.warn("report full log error -> "+t)}))}),r)}}();case 19:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){xp=1,Pp=!1}}],[{key:"init",value:function(t){return Pp=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function Bp(e){return Object.assign({},e)}var Gp,Fp=function(){function e(t,n){var r;(a(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.2.0",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=ua.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,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,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,C(on));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._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this)};this._engine=Io()?new RCCppEngine(t,i,this._options):new Mp(t,i,this._options)}var t,n,r,i,o,l,h,f,d,g,p,v,y,m,_,E,T,R,S,b,w,O,N,k,M,A,U,L,x,P,D,V,B,G,F,q,j,K,H,Y,Q;return u(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Js.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new Up(this):new Ap(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Js.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:(Q=s(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Js.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:t=e.sent,(n=t.code)!==aa.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(n),setTimeout((function(){r._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"_connectionStatusListener",value:(Y=s(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===ua.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(t),this._handleRedirect()):t===ua.BLOCKED||t===ua.KICKED_OFFLINE_BY_OTHER_CLIENT||t===ua.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(t)):t===ua.CONNECTING?this._handleConnecting():t===ua.CONNECTED?this._handleConnected():t===ua.DISCONNECTED?this._handleDisconnect(t):t===ua.NETWORK_UNAVAILABLE&&this._handleSuspend(t),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 Y.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(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)}},{key:"_handleSuspend",value:function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===Ms.RTC_ROOM||Object.prototype.hasOwnProperty.call(Na,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Bp(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==ha.TYPING_STATUS||(this._addTypingInfo(Bp(e)),!this._watcher.typingState))if(e.messageType!==ha.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==ha.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Bp(e))}catch(e){return Js.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(Bp(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var r,i=null===(r=e.content)||void 0===r?void 0:r.receiptMessageDic;i&&Array.isArray(i[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[this._engine.currentUserId])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var s,a=e.content,o=a.startTime,u=a.endTime,l=a.platform,h=a.logId,f=a.uri,d=a.packageName,g={startTime:parseInt(o),endTime:parseInt(u),platform:l,logId:h,uri:f,packageName:d};null===(s=Vp.getInstance())||void 0===s||s.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var p={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){p[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:p,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:c({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Ta.QUIT:Ta.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(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedListener",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_MessageBlockedListener",value:function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)}},{key:"_ultraGroupEnableListener",value:function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)}},{key:"_operateStatusListener",value:function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)}},{key:"_ultraGroupMessageExpansionUpdatedListener",value:function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)}},{key:"_ultraGroupMessageModifiedListener",value:function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)}},{key:"_ultraGroupMessageRecalledListener",value:function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)}},{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]=Fs(r)||Gs(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,a=i.typingContentType,o=s||"",u="".concat(n,"#").concat(r,"#").concat(o);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===a?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:a,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:(H=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],r=h.length>2?h[2]:void 0,this._connectionStatus!==ua.CONNECTED){e.next=4;break}return e.abrupt("return",{code:aa.SUCCESS,userId:this._engine.currentUserId});case 4:if(this._connectionStatus!==ua.CONNECTING){e.next=6;break}return e.abrupt("return",{code:aa.BIZ_ERROR_CONNECTING});case 6:if("string"==typeof t&&0!==t.length){e.next=8;break}return e.abrupt("return",{code:aa.RC_CONN_USER_OR_PASSWD_ERROR});case 8:return this._token=t,i=t.split("@"),s=I(i,2),a=s[1],o=a?a.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=13,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 13:if(u=e.sent){e.next=16;break}return e.abrupt("return",{code:aa.RC_NAVI_RESOURCE_ERROR});case 16:if(1!==(null==u?void 0:u.type)){e.next=18;break}return e.abrupt("return",{code:aa.PACKAGE_ENVIRONMENT_ERROR});case 18:return c=Ba.getInfo(),e.next=21,this._engine.connect(this._getTokenWithoutNavi(),u,r);case 21:if(l=e.sent,Js.__insertLogIntoDatabase(),l!==ca.REDIRECT){e.next=28;break}return this._connectionStatus=ua.REDIRECT,e.next=27,this.connect(t,!0);case 27:return e.abrupt("return",e.sent);case 28:return l===aa.SUCCESS&&(Js.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==u?void 0:u.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),Vp.init({runtime:this._runtime,logSwitch:(null==u?void 0:u.logSwitch)||0,logPolicy:JSON.parse((null==u?void 0:u.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Ws.init(this._engine.currentUserId),this._isInternalConnected=!0),l!==aa.SUCCESS||Io()||1===u.openUS&&this._pullUserSettings(),l!==aa.SUCCESS&&(this._connectionStatus=ua.CONNECTION_CLOSED),e.abrupt("return",{code:l,userId:this._engine.currentUserId});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_pullUserSettings",value:(K=s(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 K.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=Vp.getInstance())||void 0===e||e.distroy(),Js.__insertLogIntoDatabase(),Ws.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Js.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(e){return this._isInternalConnected?Promise.resolve({code:aa.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)}},{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]:[],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._engine.registerMessageType(e,t,n,r,i)}},{key:"sendMessage",value:function(e,t,n,r){if(e!==Ms.ULTRA_GROUP){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===ha.READ_RECEIPT_RESPONSE)return Promise.resolve({code:aa.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,o=n.expansion;if(a&&Hs(o))return Promise.resolve({code:aa.BIZ_ERROR_INVALID_PARAMETER});var u=JSON.stringify(n.content);return Yn(u)>hn?Promise.resolve({code:aa.RC_MSG_CONTENT_EXCEED_LIMIT}):e===Ms.ULTRA_GROUP?this._engine.sendUltraMessage(t,n):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(j=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y;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,a=t.keys,o=t.expansion,u=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:aa.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=Hs(o),h=!1,!Gs(o)){e.next=18;break}f=Object.keys(o).length,c=f>20,e.t0=regeneratorRuntime.keys(o);case 10:if((e.t1=e.t0()).done){e.next=18;break}if(d=e.t1.value,g=o[d],!(h=d.length>32||g.length>4096)&&!l){e.next=16;break}return e.abrupt("break",18);case 16:e.next=10;break;case 18:if(!c&&!h){e.next=20;break}return e.abrupt("return",{code:aa.EXPANSION_LIMIT_EXCEET});case 20:if(!l){e.next=22;break}return e.abrupt("return",{code:aa.BIZ_ERROR_INVALID_PARAMETER});case 22:return p={mid:s},o&&(p.put=o),a&&(p.del=a),u&&(p.removeAll=1),e.next=28,this._engine.sendMessage(r,i,{content:p,messageType:ha.EXPANSION_NOTIFY,channelId:n});case 28:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(q=s(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:aa.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 q.apply(this,arguments)})},{key:"getMessageReader",value:(F=s(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:aa.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 F.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){Js.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=Vp.getInstance())||void 0===e||e.distroy(),Ws.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]:"",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";if(e===Ms.ULTRA_GROUP){var o={timestamp:n,count:r,order:i,channelId:s};return this._engine.getUltraHistoryMsg(t,o)}return this._engine.getHistoryMessage(e,t,n,r,i,s,a||"")}},{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]:"";if(t===Ms.ULTRA_GROUP){var s=aa.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:aa[s]})}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 e===Ms.ULTRA_GROUP?Promise.resolve(aa.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)}},{key:"getUltraGroupList",value:function(){return this._engine.getUltraGroupList()}},{key:"getBlockUltraGroupList",value:function(){return this._engine.getBlockUltraGroupList()}},{key:"getTopUltraGroupList",value:function(){return this._engine.getTopUltraGroupList()}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e===Ms.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)}},{key:"clearAllUnreadCount",value:function(){return this._engine.clearAllUnreadCount()}},{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){if(t&&t.includes(Ms.ULTRA_GROUP)){var r=aa.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:aa[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Ms.PRIVATE,Ms.GROUP,Ms.SYSTEM,Ms.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]:"";if(e===Ms.ULTRA_GROUP&&void 0!==n)return Promise.resolve(aa.METHOD_NOT_SUPPORT);var s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(s)}},{key:"saveConversationMessageDraft",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.saveConversationMessageDraft(e,t,n,r)}},{key:"getConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationMessageDraft(e,t,n)}},{key:"clearConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationMessageDraft(e,t,n)}},{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 e===Ms.ULTRA_GROUP?Promise.resolve(aa.METHOD_NOT_SUPPORT):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 vo(n)&&yo(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(aa.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(!vo(i)||!yo(s))return Promise.resolve({code:aa.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return vo(n)&&yo(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(aa.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return vo(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(aa.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(!vo(r))return Promise.resolve({code:aa.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return vo(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(aa.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:(G=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),a=(null==s?void 0:s.bosAddr)||"",o=(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!==aa.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:a,qiniu:o,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 G.apply(this,arguments)})},{key:"getFileUrl",value:(B=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,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]:ya.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(a=e.sent,o=a.code,u=a.data,o!==aa.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(o));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return B.apply(this,arguments)})},{key:"createTag",value:(V=s(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 V.apply(this,arguments)})},{key:"removeTag",value:(D=s(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 D.apply(this,arguments)})},{key:"updateTag",value:(P=s(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 P.apply(this,arguments)})},{key:"getTagList",value:(x=s(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 x.apply(this,arguments)})},{key:"addTagForConversations",value:(L=s(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(aa.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 L.apply(this,arguments)})},{key:"removeTagForConversations",value:(U=s(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 U.apply(this,arguments)})},{key:"removeTagsForConversation",value:(A=s(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 A.apply(this,arguments)})},{key:"getConversationListByTag",value:(M=s(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 M.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(k=s(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 k.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(N=s(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 N.apply(this,arguments)})},{key:"getTagsForConversation",value:(O=s(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 O.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){return this._engine.getBlockConversationList()}},{key:"getTopConversationList",value:function(){return this._engine.getTopConversationList()}},{key:"getUnreadMentionedCount",value:function(e){return this._engine.getUnreadMentionedCount(e)}},{key:"getAllUnreadMentionedCount",value:function(){return this._engine.getAllUnreadMentionedCount()}},{key:"sendUltraGroupTypingStatus",value:function(e){if(e.conversationType!==Ms.ULTRA_GROUP){var t=aa.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:aa[t]})}return this._engine.sendUltraGroupTypingStatus(e)}},{key:"getUltraGroupMessageListByMessageUId",value:function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)}},{key:"expandUltraMessage",value:(w=s(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.channelId,n=t.conversationType,t.targetId,t.messageUId,t.keys,r=t.expansion,t.removeAll,i=t.canIncludeExpansion,n===Ms.ULTRA_GROUP){e.next=4;break}return s=aa.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:s,msg:aa[s]});case 4:if(i){e.next=6;break}return e.abrupt("return",{code:aa.MESSAGE_KV_NOT_SUPPORT});case 6:if(a=!1,o=Hs(r),u=!1,!Gs(r)){e.next=21;break}c=Object.keys(r).length,a=c>20,e.t0=regeneratorRuntime.keys(r);case 13:if((e.t1=e.t0()).done){e.next=21;break}if(l=e.t1.value,h=r[l],!(u=l.length>32||h.length>64)){e.next=19;break}return e.abrupt("break",21);case 19:e.next=13;break;case 21:if(!a&&!u){e.next=23;break}return e.abrupt("return",{code:aa.EXPANSION_LIMIT_EXCEET});case 23:if(!o){e.next=25;break}return e.abrupt("return",{code:aa.BIZ_ERROR_INVALID_PARAMETER});case 25:return e.next=27,this._engine.expandUltraMessage(t);case 27:return f=e.sent,d=f.code,e.abrupt("return",{code:d});case 30:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"modifyMessage",value:(b=s(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.conversationType===Ms.ULTRA_GROUP){e.next=3;break}return n=aa.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:n,msg:aa[n]});case 3:return e.next=5,this._engine.modifyMessage(t);case 5:return r=e.sent,i=r.code,e.abrupt("return",{code:i});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)}},{key:"getAllConversationState",value:function(){return this._engine.getAllConversationState()}},{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:(S=s(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 S.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Js.error(e)}}))}},{key:"addToBlacklist",value:(R=s(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 R.apply(this,arguments)})},{key:"removeFromBlacklist",value:(T=s(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 T.apply(this,arguments)})},{key:"getBlacklist",value:(E=s(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 E.apply(this,arguments)})},{key:"getBlacklistStatus",value:(_=s(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 _.apply(this,arguments)})},{key:"insertMessage",value:(m=s(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 m.apply(this,arguments)})},{key:"deleteMessages",value:(y=s(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 y.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(v=s(regeneratorRuntime.mark((function e(t,n,r,i){var s,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=a.length>4&&void 0!==a[4]?a[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 v.apply(this,arguments)})},{key:"clearMessages",value:(p=s(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 p.apply(this,arguments)})},{key:"getMessage",value:(g=s(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 g.apply(this,arguments)})},{key:"setMessageContent",value:(d=s(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 d.apply(this,arguments)})},{key:"setMessageSearchField",value:(f=s(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 f.apply(this,arguments)})},{key:"setMessageSentStatus",value:(h=s(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 h.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(l=s(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 l.apply(this,arguments)})},{key:"setUserStatus",value:(o=s(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 o.apply(this,arguments)})},{key:"subscribeUserStatus",value:(i=s(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=s(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=s(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=s(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,a,o));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,a){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:"getConversationListWithAllChannel",value:function(){return this._engine.getConversationListWithAllChannel()}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._engine.joinRTCRoom(e,t,n,r,i,s)}},{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:"getRTCJoinedUserInfo",value:function(e){return this._engine.getRTCJoinedUserInfo(e)}},{key:"requestRoomPK",value:function(e){return this._engine.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._engine.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._engine.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._engine.endRoomPK(e)}}],[{key:"init",value:function(t,n){return Js.setLogLevel(n.logLevel),Js.setLogStdout(n.logStdout),(n.indexDBSwitch||qs(n.indexDBSwitch))&&gs.init(),Js.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Js.error("Repeat initialize!"),this._context):(Js.warn("RCEngine Commit:","cda3e1dfb825b2da0cbcb293dd38c8393cd8773f"),this._context=new e(t,n),Js.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(Gp=e.TagChangeType||(e.TagChangeType={}))[Gp.add=1]="add",Gp[Gp.update=2]="update",Gp[Gp.delete=3]="delete";e.AEngine=xg,e.ANavi=Fg,e.APIContext=Fp,e.AppStorage=yn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=Na,e.ChatroomEntryType=_a,e.ChatroomMemberChangeType=Ta,e.CometChannel=Lg,e.ConnectResultCode=ca,e.ConnectionStatus=ua,e.ConversationType=Ms,e.DelayTimer=No,e.ErrorCode=aa,e.EventEmitter=na,e.FileType=Us,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=ln,e.Logger=Ws,e.MAX_MESSAGE_CONTENT_BYTES=hn,e.MINI_COMET_CONNECT_URIS=cn,e.MINI_SOCKET_CONNECT_URIS=un,e.MentionedType=pa,e.MessageBlockType=Sa,e.MessageDirection=ia,e.MessageType=ha,e.NAVI_CACHE_DURATION=rn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=da,e.PING_REQ_TIMEOUT=sn,e.PUBLIC_CLOUD_NAVI_URIS=on,e.PluginContext=Ap,e.RCAssertError=Fa,e.RTCPluginContext=Up,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=dn,e.STATUS_MESSAGE=gn,e.STORAGE_ROOT_KEY=fn,e.UploadMethod=ya,e.VersionManage=Ba,e.WEB_SOCKET_TIMEOUT=an,e.WebSocketChannel=Ag,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(!qa(e,t,n,r))throw new Fa("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.clone=wo,e.cloneByJSON=Ro,e.forEach=mo,e.formatConnectResponseCode=So,e.getBrowser=Co,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case Us.IMAGE:t="image/jpeg";break;case Us.AUDIO:t="audio/amr";break;case Us.VIDEO:t="video/3gpp";break;case Us.SIGHT:t="video/mpeg4";break;case Us.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=fo,e.indexOf=Eo,e.isArray=Ds,e.isArrayBuffer=Vs,e.isBoolean=xs,e.isFunction=Fs,e.isHttpUrl=function(e){return Ls(e)&&/https?:\/\//.test(e)},e.isInObject=To,e.isInclude=function(e,t){return-1!==Eo(e,t)},e.isNull=js,e.isNumber=Ps,e.isObject=Gs,e.isString=Ls,e.isUndefined=qs,e.isValidChrmEntryKey=vo,e.isValidChrmEntryValue=yo,e.isValidConversationType=function(e){return Ps(e)&&Object.prototype.hasOwnProperty.call(Ms,e)},e.isValidExpansion=Hs,e.isValidFileType=function(e){return Ps(e)&&Object.prototype.hasOwnProperty.call(Us,e)},e.map=_o,e.notEmptyArray=function(e){return Ds(e)&&e.length>0},e.notEmptyObject=Ks,e.notEmptyString=Bs,e.pushConfigsToJSON=go,e.pushJSONToConfigs=po,e.todo=function(e){return new mn(e)},e.usingCppEngine=Io,e.validate=qa,e.version="5.2.0",Object.defineProperty(e,"__esModule",{value:!0})}));