index-legacy.25e8c249.js 713 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. !function(){var e=["MESSAGES"];function t(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(u){return void n(u)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=e.apply(n,r);function a(e){t(s,i,o,a,c,"next",e)}function c(e){t(s,i,o,a,c,"throw",e)}a(void 0)}))}}function r(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(c){a=!0,i=c}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||E(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 a(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||E(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 c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=u(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},c.apply(this,arguments)}function u(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}function d(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function h(e){var t=function(){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}}();return function(){var n,r=m(e);if(t){var i=m(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return f(this,n)}}function f(e,t){if(t&&("object"===S(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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 R(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=E(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 o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function E(e,t){if(e){if("string"==typeof e)return T(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)?T(e,t):void 0}}function T(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 S(e){return S="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},S(e)}var I=document.createElement("style");I.innerHTML="._liveHeader_8nata_1{padding:0 40px 0 20px;height:var(--header-bar-height);background:var(--live-main-color);box-shadow:0 0 2px rgba(0,0,0,.25),0 0 6px 2px rgba(0,0,0,.1);display:flex;justify-content:space-between;align-items:center;color:var(--live-color);overflow:overlay}._liveHeader_8nata_1 ._liveLogo_8nata_12{height:36px;width:36px;padding-right:10px}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17{display:flex;align-items:center;font-weight:700;font-size:22px}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17 ._liveHeaderLeftIcon_8nata_23{display:inherit;align-items:inherit}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17 ._liveHeaderLeftText_8nata_27{padding-left:20px}._avatarWrapper_8nata_30{display:flex;align-items:center;color:var(--live-color);font-weight:500;font-size:18px}._avatarWrapper_8nata_30 ._userAvatar_8nata_37{width:34px;height:34px}._avatarWrapper_8nata_30 span{padding-left:8px}._header_22t18_1{display:flex;justify-content:space-between;align-items:center;padding:13px 19px;height:var(--header-height);box-sizing:border-box}._header_22t18_1>._title_22t18_9{font-size:18px;font-weight:400}.el-message-box{border-color:transparent;background-color:var(--live-main-color)}.el-message-box__header{background-color:var(--live-backound-color);color:var(--live-color)}.el-message-box__title,.el-message-box__container,.el-message-box__headerbtn .el-message-box__close{color:var(--live-color)}._action-bar_1akc3_1{box-sizing:border-box;height:var(--action-bar-height);padding:14px 22px;display:flex;align-items:center;justify-content:space-between}._action-bar_1akc3_1 button{overflow:hidden}._bar-btn_1akc3_12{display:flex;flex-direction:column;align-items:center;color:var(--live-color);font-size:14px}._bar-btn_1akc3_12 ._bar-btn-text_1akc3_19{padding-top:6px;line-height:20px}._bar-btn_1akc3_12+._bar-btn_1akc3_12{margin-left:25px}.el-dialog{margin-bottom:10vh}.el-dialog .el-dialog__header{background:var(--live-main-color);padding:15px 20px}.el-dialog .el-dialog__header .el-dialog__title,.el-dialog .el-dialog__header .el-dialog__headerbtn .el-dialog__close{color:#fff}.el-dropdown__popper.el-popper{border-color:var(--live-main-color)!important}.el-dropdown__popper.el-popper[role=tooltip] .el-popper__arrow:before{border-color:var(--live-main-color);background-color:var(--live-main-color)}.el-slider{--el-slider-height: 2px;--el-slider-button-size: 14px;--el-slider-button-wrapper-offset: -17px;--el-slider-main-bg-color: var(--live-text-color)}.el-slider__button{border-color:var(--live-color);background-color:var(--live-text-color)}.el-dropdown-menu{background-color:var(--live-main-color);color:var(--live-color);border-radius:2px}.el-dropdown-menu .el-dropdown-menu__item{color:inherit}.el-dropdown-menu .is-disabled{opacity:.5}.el-dropdown-menu .el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--live-main-color);color:var(--live-color)}._volumeSlider_1akc3_71{display:flex;align-items:center;padding:0 12px;width:195px;height:55px;background-color:var(--live-main-color);border-color:var(--live-main-color)}._volumeSlider_1akc3_71 ._volumeIcon_1akc3_80{width:14px;height:15px;padding-right:8px}._btnInner_1akc3_85{display:flex;align-items:center;justify-content:center;width:60px;height:32px;background:rgba(94,98,109,.33);border-radius:16px}._shareWrap_d61fv_1{background:#f9f9f9;padding:16px}._shareWrap_d61fv_1 h2{font-size:18px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#333;line-height:25px;margin-bottom:18px}._shareWrap_d61fv_1 h4{font-size:16px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#333;line-height:28px}._shareWrap_d61fv_1 p{font-size:16px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#333;line-height:30px}._shareBtn_d61fv_27{height:48px;background:var(--el-color-primary);border-radius:32px;width:192px;color:#fff;margin:24px auto 0;text-align:center;line-height:48px;font-size:20px;cursor:pointer}._shareWrap_ap100_1{background-color:#f9f9f9;padding:15px}._chioseBox_ap100_5 .el-checkbox__inner{width:20px;height:20px;border-radius:50%}._chioseBox_ap100_5 .el-checkbox__inner:after{height:8px;left:6px;position:absolute;top:3px;width:4px}._cell_ap100_17{height:63px;background:#ffffff;padding:10px 18px;display:flex;flex-direction:row;align-items:center;cursor:pointer;margin-bottom:10px}._dotle_ap100_27{width:42px;height:43px;background:var(--el-color-primary);border-radius:4px;line-height:42px;text-align:center;color:#fff;margin-left:17px;font-size:14px}._teamInfo_ap100_38{font-size:14px;margin-left:8px}._teamInfo_ap100_38 ._title_ap100_42{font-weight:500;color:#1a1a1a;line-height:22px}._teamInfo_ap100_38 ._subInfo_ap100_47{color:#666;line-height:22px}._tableWrap_ap100_51{max-height:500px;overflow-y:scroll}._third_z0wkr_1{position:relative;background:linear-gradient(135deg,#8d8cff 0%,#9664ec 100%);padding:43px 20px 54px}._third_z0wkr_1 h2{width:254px;font-size:30px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:40px;text-shadow:0px 2px 4px #9366ee}._third_z0wkr_1 ._preCore_z0wkr_15 ._title_z0wkr_15{background:#fa912c}._second_z0wkr_18{position:relative;background:linear-gradient(135deg,#ff9d9d 0%,#ff6d6d 100%);padding:43px 20px 54px}._second_z0wkr_18 h2{width:254px;font-size:30px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:40px;text-shadow:0px 2px 4px #ff5f5f}._second_z0wkr_18 ._preCore_z0wkr_15 ._title_z0wkr_15{background:#fa502c}._first_z0wkr_35{position:relative;background:linear-gradient(135deg,#4f8dff 0%,#0055ee 100%);padding:43px 20px 54px}._first_z0wkr_35 h2{width:254px;font-size:30px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:40px;text-shadow:0px 2px 4px #1054f1}._icon_z0wkr_49{width:231px;height:223px;position:absolute;right:3px;top:8px}._teacher_z0wkr_56{font-size:16px!important;font-family:PingFangSC-Medium,PingFang SC!important;font-weight:500!important;color:#fff!important;line-height:20px!important;margin-top:15px!important;margin-bottom:67px!important}._preCore_z0wkr_15{position:relative;z-index:100;padding:12px;background:#ffffff;border-radius:11px;border-image:linear-gradient(180deg,#ffffff,#ffffff) 1 1}._preCore_z0wkr_15 ._start_z0wkr_73{width:50px;height:59px;position:absolute;top:24px;right:-11px}._preCore_z0wkr_15 ._title_z0wkr_15{width:85px;background:#faab2c;border-radius:7px;padding:2px;font-size:18px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:25px;text-align:center}._preCore_z0wkr_15 ._time_z0wkr_92{font-size:18px;font-family:PingFangSC-Medium,PingFang SC;font-weight:600;color:#000;line-height:25px;margin:15px 0 15px 4px}._preCore_z0wkr_15 ._content_z0wkr_101{margin-top:20px;position:relative;background:linear-gradient(49deg,#fff8e2 0%,#fff1d5 100%);border-radius:8px;padding:20px;font-size:14px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#000;line-height:25px;margin-bottom:12px}._preCore_z0wkr_15 ._content_z0wkr_101 ._pre_z0wkr_15{width:20px;height:20px;position:absolute;left:-3px;top:-4px}._preCore_z0wkr_15 ._content_z0wkr_101 ._end_z0wkr_121{width:20px;height:20px;position:absolute;bottom:-4px;right:10px}._bottom_z0wkr_128{display:flex;flex-direction:row;justify-content:space-between;margin:30px 8px 0}._bottom_z0wkr_128 ._logo_z0wkr_134{width:202px;height:84px}._bottom_z0wkr_128 ._code_z0wkr_138{padding:2px;width:80px;height:80px;background-color:#fff}._container_19awp_1{position:absolute;top:50%;left:50%;display:flex;background-color:var(--tips-backound-color);color:var(--live-color);border-radius:8px;transform:translate(-50%,-50%)}._container_19awp_1>div{padding:32px 100px;text-align:center;width:360px;box-sizing:border-box}._container_19awp_1>div svg{width:74px;height:68px}._container_19awp_1>div ._title_19awp_21{font-size:20px;margin-top:15px}._container_19awp_1>div ._tips_19awp_25{font-size:14px;color:var(--tips-color);margin-top:5px}._main_1b4ip_1{--header-height: 68px;--action-bar-height: 88px;width:calc(100% - 385px);background-color:var(--live-backound-color);color:var(--live-color);display:flex;flex-direction:column;height:calc(100vh - var(--header-bar-height));overflow:hidden}._main_1b4ip_1 ._video_1b4ip_12{width:100%;max-height:calc(100vh - var(--header-bar-height) - var(--header-height) - var(--action-bar-height));flex:1;background-color:var(--video-backound-color);position:relative}._main_1b4ip_1 ._video_1b4ip_12 video{width:100%;height:100%}._container_jmhhf_1{width:385px!important;height:calc(100vh - var(--header-bar-height));background-color:var(--live-main-color)}._dataCount_jmhhf_6{text-align:center;margin:16px 16px 0;border-radius:2px;background-color:var(--message-color);display:flex;justify-content:space-around;align-items:center;height:120px;color:var(--live-color)}._dataCount_jmhhf_6 ._num_jmhhf_17{font-size:24px;font-weight:700;padding-bottom:16px}._dataCount_jmhhf_6 ._text_jmhhf_22{display:flex;font-size:14px}._dataCount_jmhhf_6 ._dataIcon_jmhhf_26{padding-right:5px;width:20px;height:20px}._tabContainer_jmhhf_31 ._tabIcon_jmhhf_31{margin-right:6px;width:20px;height:20px}._tabContainer_jmhhf_31 .el-tabs__header{margin-bottom:0}._tabContainer_jmhhf_31 .el-tabs__nav-wrap:after{background-color:var(--message-color)}._tabContainer_jmhhf_31 .el-tabs__nav{padding:12px 0;width:100%;text-align:center}._tabContainer_jmhhf_31 .el-tabs__item{color:var(--live-color);font-size:16px;padding:0 31px}._tabContainer_jmhhf_31 .el-tabs__item.is-active{color:#00fff0}._tabContainer_jmhhf_31 .el-tabs__active-bar{background-color:#00fff0}._tabContent_jmhhf_58{--message-bar-height: 88px;position:relative;height:calc(100vh - var(--header-bar-height) - var(--message-bar-height) - 216px);padding-bottom:var(--message-bar-height)}._tabContent_jmhhf_58 ._tabList_jmhhf_64{height:calc(100vh - var(--header-bar-height) - var(--message-bar-height) - 276px);overflow:auto}._message_4zab7_1 ._buttonGroup_4zab7_1{display:flex;align-items:center;background:rgba(99,108,132,.1);padding:15px 16px}._message_4zab7_1 .el-button--info{--el-button-text-color: var(--live-color);--el-button-hover-text-color: var(--live-light-color);--el-button-disabled-text-color: var(--el-text-color-placeholder);background-color:var(--message-color);border-color:var(--message-color)}._sendMessage_p2cnx_1{position:fixed;bottom:0;height:88px;width:353px;display:flex;align-items:center;padding:0 16px}._sendMessage_p2cnx_1 ._form_p2cnx_10{display:flex;align-items:center;width:100%;background-color:var(--message-color);border-radius:60px}._sendMessage_p2cnx_1 .el-input{border-radius:60px;overflow:hidden;font-size:16px}._sendMessage_p2cnx_1 .el-input__inner{height:46px;line-height:46px;padding-left:20px;background-color:transparent;border:0;color:var(--live-color)}._sendMessage_p2cnx_1 .el-button{border:0;background-color:#00a79d;height:46px;line-height:46px;border-radius:46px;color:var(--live-color);font-weight:600;padding:0 23px;font-size:16px}._sendMessage_p2cnx_1 .el-button.is-disabled{background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}._itemContent_1wo39_1{padding:16px 16px 5px;display:flex;color:var(--live-color)}._itemContent_1wo39_1>img{width:28px;height:28px;margin-right:8px}._itemInfo_1wo39_11{width:100%}._itemName_1wo39_14{display:flex;justify-content:space-between;align-items:center;padding-top:3px}._itemName_1wo39_14 ._userName_1wo39_20{font-size:14px;line-height:22px;align-items:center;font-weight:500}._itemName_1wo39_14 ._name-style_1wo39_26{line-height:24px;color:var(--live-text-color)}._itemName_1wo39_14 ._rightTime_1wo39_30{font-size:12px}._itemName_1wo39_14 .el-tag--default{border-radius:20px;margin-right:8px;height:20px}._itemText_1wo39_38{font-size:15px;line-height:20px}._itemText_1wo39_38._active_1wo39_42{color:var(--live-text-color)}._joinText_1wo39_45{display:flex;justify-content:space-between;align-items:center}._joinText_1wo39_45 ._join_1wo39_45{display:flex;align-items:center}._btn_1wo39_54{font-size:13px;line-height:20px;background-color:var(--live-light-color);border-color:var(--live-light-color);text-align:center;padding:3px 15px 1px;border-radius:2px;cursor:pointer;color:var(--live-color);text-decoration:none}._btn_1wo39_54._downBtn_1wo39_66{background-color:transparent;border-color:var(--live-light-color);color:var(--live-light-color)}._loadingStyle_1wo39_71{position:absolute;left:0;right:0;top:0;bottom:0}._empty-container_1svqd_1{height:100%;width:100%;text-align:center;color:#a4a6a9;font-size:14px;padding:20px 0}._empty-container_1svqd_1 ._icon_1svqd_9{width:126px;height:89px;margin-bottom:8px}._container_13n1h_1{display:flex}._home_13n1h_4{--header-bar-height: 76px}\n",document.head.appendChild(I),System.register(["./index-legacy.02b4b6c8.js","./vendor-legacy.a1955742.js"],(function(t){"use strict";var r,u,l,f,y,E,T,I,b,w,k,N,O,A,x,P,M,L,U,D,V,B,F,H,j,K,q,G,Y,J;return{setters:[function(e){r=e.s,u=e.r,l=e.a},function(e){f=e.j,y=e.n,E=e.d,T=e.i,I=e.f,b=e.l,w=e.p,k=e.t,N=e.u,O=e.v,A=e.x,x=e.y,P=e.z,M=e.A,L=e.B,U=e.C,D=e.D,V=e.F,B=e.r,F=e.G,H=e.H,j=e.I,K=e.J,q=e.K,G=e.L,Y=e.M,J=e.N}],execute:function(){var z,W,Q="_liveHeader_8nata_1",X="_liveLogo_8nata_12",Z="_liveHeaderLeft_8nata_17",$="_liveHeaderLeftIcon_8nata_23",ee="_liveHeaderLeftText_8nata_27",te="_avatarWrapper_8nata_30",ne="_userAvatar_8nata_37";!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"}(W||(W={}));var re,ie,oe=W,se=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],ae=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],ce=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],ue={"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}},de=["RC:TypSts","RC:InterceptMsg"];!function(e){e.WEBSOCKET="websocket",e.COMET="comet"}(re||(re={}));var le=function(e){return ie||(ie={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}}),ie},he=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),fe=function(){function e(e,t){var n,r=t?"RCV4-"+t:"RCV4-";this._rootStorage=le(e);var i=this._rootStorage.get(r)||{};this._cache=new he(((n={})[r]=i,n)),this._storageKey=r}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),pe=function(e,t){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function ge(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var me,ve,_e=function(){return(_e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function ye(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function Re(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Ce(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}!function(e){function t(t){return e.call(this,"TODO => "+t)||this}ge(t,e)}(Error);var Ee=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))},Te=function(e,t){void 0===t&&(t="utf-8");var n,r=0;if("utf-16"===t)for(var i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<=65535?2:4;else for(i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<127?1:n<=2047?2:n<=65535?3:4;return r},Se=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return e+"="+t[e]})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},Ie=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(me||(me={})),function(e){e.IM="IM",e.RTC="RTC"}(ve||(ve={}));var be="RC_Logs";var we,ke=function(){function e(){}return e.init=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 "+(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 "+(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 "+(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,function(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(be),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=_e({},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,be,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}(t)}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),o=i.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))},e.prototype.getRangeData=function(t,n,r,i){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),c=s.index(n),u=[],d=c.openCursor(a);d.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},d.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=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)}))},e.prototype.removeFirstData=function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),o=i.getAllKeys(IDBKeyRange.lowerBound(0),r);o.onsuccess=function(){var e=o.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e}(),Ne=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)}))},Oe=function(){var e=Ne();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}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"}(we||(we={}));var Ae,xe=we;!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"}(Ae||(Ae={}));var Pe,Me,Le=Ae,Ue=function(e){return"string"==typeof e},De=function(e){return"boolean"==typeof e},Ve=function(e){return"number"==typeof e&&!isNaN(e)},Be=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Fe=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},He=function(e){return Ue(e)&&e.length>0},je=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ke=function(e){return"[object Function]"===Object.prototype.toString.call(e)},qe=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Ge=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ye=function(e){return Ue(e)&&/https?:\/\//.test(e)},Je=function(e){for(var t in e)return!0;return!1},ze=function(e){return Ve(e)&&Object.prototype.hasOwnProperty.call(Le,e)},We=((Pe={})[me.DEBUG]=console.debug.bind(console),Pe[me.INFO]=console.info.bind(console),Pe[me.WARN]=console.warn.bind(console),Pe[me.ERROR]=console.error.bind(console),Pe[me.FATAL]=console.log.bind(console),Pe),Qe=function(e){return Ue(e)||Ve(e)||qe(e)||De(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Xe=function(){function e(e,t,n){this.tag=e,this.type=t,this.initiator=n,this._outLevel=me.WARN,this.debug=this.log.bind(this,me.DEBUG),this.info=this.log.bind(this,me.INFO),this.warn=this.log.bind(this,me.WARN),this.error=this.log.bind(this,me.ERROR),this.fatal=this.log.bind(this,me.FATAL)}return e.init=function(t){e.userId=t},e.reset=function(){e.userId=""},e.prototype._defaultStdout=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];We[e].apply(We,Ce([t+":"],n))},e.prototype.__pushLocalLog=function(t,n,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?ve.RTC:ve.IM;var o=Date.now();Te(n)>=1e3&&(n=function(e,t,n){if(void 0===n&&(n="utf-8"),!e)return"";var r="utf-8"===n?3:2,i=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?i+=r:i++,i>1e3)return s;s+=e.charAt(o)}return e}(n));var s=JSON.stringify({message:n,userId:e.userId}).replace(/"/g,'""'),a=/^[\w]+-[\w]+-[\w]+?/.test(r)?r:(this.initiator||"L")+"-"+r+"-O",c={sessionId:e.sessionId,time:o,level:4-t,content:e.sessionId+","+Date.now()+","+i+","+(4-t)+","+a+',"'+s+'"\n',userId:e.userId};e.databaseLogList.push(c),(e.databaseLogList.length>=100||t===me.FATAL)&&this.__insertLogIntoDatabase()},e.prototype.__insertLogIntoDatabase=function(){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return t=Ce([],e.databaseLogList),e.databaseLogList=[],(n=ke.getInstance())?[4,n.addList(be,t)]:[3,3];case 1:return r=i.sent(),[4,n.getCount(be,"time")];case 2:return i.sent()>1e5&&n.removeFirstData(be,"time",2e3),[2,r];case 3:return[2,!1]}}))}))},e.prototype.setLogLevel=function(e){this._outLevel="number"!=typeof e?me.WARN:e},e.prototype.setLogStdout=function(e){this._logStdout=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>me.DEBUG&&this.__pushLocalLog(e,t.map(Qe).join(" "),this.tag),!(e<this._outLevel)){var r=(new Date).toISOString()+"["+this.tag+"]["+me[e]+"]",i=r+" - "+t.map(Qe).join(" ");this._logStdout?this._logStdout(e,i):this._stdout?this._stdout(e,i):this._defaultStdout.apply(this,Ce([e,r],t))}},e.prototype.reportLog=function(t,n,r){this.__pushLocalLog(4-t,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'+i+'"';var o={level:t,content:[e.sessionId,Date.now(),this.type,t,n,i].join()+"\n"};e.realTimeLogList.push(o),e.realTimeLogList.length>=600&&(e.realTimeLogList=e.realTimeLogList.slice(-500))},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e.prototype.__clearRealTimeLog=function(){e.realTimeLogList=[]},e.databaseLogList=[],e.realTimeLogList=[],e.sessionId=Oe(),e.userId="",e}(),Ze=new Xe("RCLog"),$e=function(){function e(){this._map={}}return e.prototype.on=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})},e.prototype.once=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})},e.prototype.off=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])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,c=o.listener;a&&r.splice(i,1);try{c.call.apply(c,Ce([s],t))}catch(e){Ze.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(Me||(Me={}));var et,nt=Me;!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"}(et||(et={}));var rt,it=et;!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"}(rt||(rt={}));var ot,st=rt,at=0,ct=3,ut=4,dt=6,lt=8,ht=9,ft=10,pt=12,gt=13,mt=16,vt=17,_t=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"}(ot||(ot={}));var yt,Rt=ot;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(yt||(yt={}));var Ct,Et=yt;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Ct||(Ct={}));var Tt,St=Ct;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Tt||(Tt={}));var It,bt=Tt;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(It||(It={}));var wt,kt=It;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(wt||(wt={}));var Nt,Ot,At,xt,Pt=wt;!function(e){
  2. /*!
  3. 全局敏感词:命中了融云内置的全局敏感词
  4. */
  5. e[e.GLOBAL=1]="GLOBAL",
  6. /*!
  7. 自定义敏感词拦截:命中了客户在融云自定义的敏感词
  8. */
  9. e[e.CUSTOM=2]="CUSTOM",
  10. /*!
  11. 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
  12. */
  13. e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Nt||(Nt={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(Ot||(Ot={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(At||(At={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(xt||(xt={}));var Mt,Lt,Ut,Dt={"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"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Mt||(Mt={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Lt||(Lt={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Ut||(Ut={}));var Vt,Bt,Ft={engine:"5.1.1"},Ht=function(){function e(){}return e.add=function(e,t){Ft[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Ze.warn("The validation engine version '"+e+"' is invalid!"),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Ft.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Ft},e}();!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID"}(Bt||(Bt={}));var jt,Kt,qt,Gt,Yt,Jt=((Vt={})[Bt.STRING]=He,Vt[Bt.ONLY_STRING]=Ue,Vt[Bt.NUMBER]=Ve,Vt[Bt.BOOLEAN]=function(e){return"boolean"==typeof e},Vt[Bt.OBJECT]=je,Vt[Bt.ARRAY]=Be,Vt[Bt.CALLBACK]=function(e){var t=!0;return je(e)||(t=!1),(e=e||{}).onSuccess&&!Ke(e.onSuccess)&&(t=!1),e.onError&&!Ke(e.onError)&&(t=!1),t},Vt[Bt.CHANNEL_ID]=function(e){var t=!1;return Ue(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Vt),zt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return ge(t,e),t}(Error),Wt=function(e,t,n,r){if(void 0===r&&(r=!1),!Qt(e,t,n,r))throw new zt("'"+e+"' is invalid: "+JSON.stringify(t))},Qt=function(e,t,n,r){void 0===r&&(r=!1),n=Jt[n]||n;var i=r&&!n(t)||!r&&!(qe(t)||null===t||n(t));return i&&Ze.error("'"+e+"' is invalid: "+JSON.stringify(t)),!i},Xt=function(e){if(!je(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)},Zt=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,o,s,a=Object.keys(e);if(0!==a.length){var c=a[0];switch(c){case"HW":return void(r.channelIdHW=null===(t=e[c])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[c])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(o=e[c])||void 0===o?void 0:o.channelId);case"VIVO":return void(r.typeVivo=null===(s=e[c])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[c]["thread-id"],n.apnsCollapseId=e[c]["apns-collapse-id"],n.category=e[c].category,void(n.richMediaUri=e[c].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[c].collapse_key||"",imageUrl:e[c].imageUrl||"",priority:e[c].priority||""}}}}))}catch(t){Ze.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},$t=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&n<=128&&n>=1},en=function(e){var t=e.length;return t<=4096&&t>=1},tn=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;je(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Be(e)||Ue(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},nn=function(e,t){return tn(e,(function(n,r){e[r]=t(n,r)})),e},rn=function(e,t){var n=[];return tn(e,(function(e){n.push(e)})),-1!==function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return tn(e,(function(e,r){t===e&&(n=r)})),n}(n,t)},on=function(e){return JSON.parse(JSON.stringify(e))},sn=function(){return"undefined"!=typeof RCCppEngine},an=function(e){switch(e){case ct:return it.SERVER_UNAVAILABLE;case ut:return it.RC_CONN_USER_OR_PASSWD_ERROR;case dt:return it.RC_CONN_REDIRECTED;case lt:return it.RC_CONN_APP_BLOCKED_OR_DELETED;case ht:return it.RC_CONN_USER_BLOCKED;case ft:return it.RC_CONN_USER_OR_PASSWD_ERROR;case pt:return it.HOSTNAME_ERROR;case gt:return it.HAS_OHTER_SAME_CLIENT_ON_LINE;case mt:return it.RC_APP_AUTH_NOT_PASS;case vt:return it.RC_OTP_USED;case _t:return it.RC_PLATFORM_ERROR;default:return it.RC_NET_UNAVAILABLE}},cn=function(e){var t={},n=JSON.parse(e);return tn(n,(function(e,n){t[n]=e.v})),t},un={_delayTime:0,setTime:function(e){var t=(new Date).getTime();un._delayTime=t-e},getTime:function(){var e=un._delayTime;return(new Date).getTime()-e}},dn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!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"}(jt||(jt={})),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"}(Kt||(Kt={})),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"}(qt||(qt={})),function(e){e.PUB="pub",e.QUERY="qry"}(Gt||(Gt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Yt||(Yt={}));var ln,hn=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=jt.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=jt.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var i=e>0;e&&i&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=r)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,(e|=this.qos<<1)|(this._dup?8:0)},e}(),fn=function(){function e(){}return e.writeUTF=function(e,t){var n=[],r=0;if(Ue(e))for(var i=0,o=e.length;i<o;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(r+=1,n.push(s)):s>=128&&s<=2047?(r+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(r+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(i=0,o=n.length;i<o;i++)n[i]>255&&(n[i]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++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===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),pn=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=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)},e.prototype.readInt=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)},e.prototype.readLong=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)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return fn.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),gn=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=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},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=fn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),mn="UpStreamMessage",vn="PushExtra",_n="DownStreamMessage",yn="DownStreamMessages",Rn="SessionsAttQryInput",Cn="SessionsAttOutput",En="SyncRequestMsg",Tn="ChrmPullMsg",Sn="NotifyMsg",In="HistoryMsgInput",bn="HistoryMsgOuput",wn="RelationQryInput",kn="RelationsOutput",Nn="DeleteSessionsInput",On="SessionInfo",An="DeleteSessionsOutput",xn="RelationsInput",Pn="DeleteMsgInput",Mn="CleanHisMsgInput",Ln="SessionMsgReadInput",Un="ChrmInput",Dn="ChrmOutput",Vn="QueryChatRoomInfoInput",Bn="QueryChatRoomInfoOutput",Fn="RtcInput",Hn="RtcUserListOutput",jn="SetUserStatusInput",Kn="RtcSetDataInput",qn="RtcUserSetDataInput",Gn="RtcDataInput",Yn="RtcSetOutDataInput",Jn="MCFollowInput",zn="RtcTokenOutput",Wn="RtcQryOutput",Qn="RtcQryUserOutDataInput",Xn="RtcUserOutDataOutput",Zn="RtcQueryListInput",$n="RtcRoomInfoOutput",er="RtcValueInfo",tr="RtcKeyDeleteInput",nr="GetQNupTokenInput",rr="GetQNupTokenOutput",ir="GetQNdownloadUrlInput",or="GetDownloadUrlInput",sr="GetQNdownloadUrlOutput",ar="GetDownloadUrlOutput",cr="SetChrmKV",ur="SetChrmKVS",dr="DeleteChrmKVS",lr="ChrmKVOutput",hr="ChrmKVSOutput",fr="ChrmKVSOutputEntity",pr="QueryChrmKV",gr="SetUserSettingInput",mr="SetUserSettingOutput",vr="PullUserSettingInput",_r="PullUserSettingOutput",yr="UserSettingNotification",Rr="SessionReq",Cr="SessionStates",Er="SessionState",Tr="SessionStateItem",Sr="SessionStateModifyReq",Ir="SessionStateModifyResp",br="GrpReadReceiptMsg",wr="GrpReadReceiptQryReq",kr="GrpReadReceiptQryResp",Nr="GrpMsgReadUser",Or="SessionTagAddInput",Ar="SessionTagItem",xr="SessionTagDelInput",Pr="SessionDisTagReq",Mr="ReportSDKInput",Lr="ReportSDKOutput",Ur="RtcNotifyMsg",Dr="RtcPullKV",Vr="RtcKVOutput",Br="RtcQueryUserJoinedInput",Fr="RtcQueryUserJoinedOutput",Hr="RtcViewerJoinedOutput",jr="RtcInviteInput",Kr="RtcCancelInviteInput",qr="RtcInviteAnswerInput",Gr="RtcEndInviteInput",Yr=((ln={})[mn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],ln[yn]=["list","syncTime","finished"],ln[_n]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"],ln[vn]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],ln[Rn]=["nothing"],ln[Cn]=["inboxTime","sendboxTime","totalUnreadCount"],ln[En]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"],ln[Tn]=["syncTime","count"],ln[Sn]=["type","time","chrmId"],ln[In]=["targetId","time","count","order","busChannel"],ln[bn]=["list","syncTime","hasMsg"],ln[wn]=["type","count","startTime","order"],ln[kn]=["info"],ln[Nn]=["sessions"],ln[On]=["type","channelId","busChannel"],ln[An]=["nothing"],ln[xn]=["type","msg","count","busChannel","startTime","endTime"],ln[Pn]=["type","conversationId","msgs","busChannel"],ln[Mn]=["targetId","dataTime","conversationType","busChannel"],ln[Ln]=["type","msgTime","channelId"],ln[Un]=["nothing"],ln[Dn]=["nothing","sessionId","joinTime"],ln[Vn]=["count","order"],ln[Bn]=["userTotalNums","userInfos"],ln[nr]=["type","key","httpMethod","queryString"],ln[ir]=["type","key","fileName"],ln[or]=["type","key","fileName"],ln[rr]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],ln[sr]=["downloadUrl"],ln[ar]=["downloadUrl"],ln[cr]=["entry","bNotify","notification","type"],ln[ur]=["entry","bNotify","notification","type"],ln[dr]=["entry","bNotify","notification","type"],ln[lr]=["entries","bFullUpdate","syncTime"],ln[hr]=["timestamp","errorKeys"],ln[fr]=["key","errorCode"],ln[pr]=["timestamp"],ln[gr]=["version","value"],ln[mr]=["version","reserve"],ln[vr]=["version","reserve"],ln[_r]=["items","version"],ln.UserSettingItem=["targetId","type","key","value","version","status","tags"],ln[Rr]=["time"],ln[Cr]=["version","state"],ln[Er]=["type","channelId","time","stateItem","busChannel"],ln[Tr]=["sessionStateType","value","tags"],ln[Sr]=["version","state"],ln[Ir]=["version"],ln[br]=["msgId","busChannel"],ln[wr]=["msgId","busChannel"],ln[kr]=["totalMemberNum","list"],ln[Nr]=["readTime","userId"],ln[Or]=["version","tags"],ln[Ar]=["tagId","name","createdTime","isTop"],ln[xr]=["version","tags"],ln[Pr]=["tagId"],ln[yr]=["version","reserve"],ln[Mr]=["sdkInfo"],ln[Lr]=["nothing"],ln[Fn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],ln[Hn]=["users","token","sessionId","roomInfo"],ln[jn]=["status"],ln[Kn]=["interior","target","key","value","objectName","content"],ln[qn]=["valueInfo","objectName","content"],ln[Gn]=["interior","target","key","objectName","content"],ln[Yn]=["target","valueInfo","objectName","content"],ln[Jn]=["state"],ln[zn]=["rtcToken"],ln[Wn]=["outInfo"],ln[Qn]=["userId"],ln[Xn]=["user"],ln[Zn]=["order"],ln[$n]=["roomId","roomData","userCount","list"],ln[er]=["key","value"],ln[tr]=["key"],ln[Ur]=["type","time","roomId"],ln[Dr]=["timestamp","roomId"],ln[Vr]=["entries","bFullUpdate","syncTime"],ln[Br]=["userId"],ln[Fr]=["info"],ln[jr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],ln[Kr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],ln[qr]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],ln[Gr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],ln),Jr={},zr=function(e){var t=Yr[e];Jr[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],o="set"+Ee(i,0,1);n[o]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Jr[e].decode=function(e){var t={};Ue(e)&&(e=JSON.parse(e));var n=function(n){var r="get"+Ee(n,0,1);t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Wr in Yr)zr(Wr);Jr.getModule=function(e){return Jr[e]()};var Qr,Xr,Zr,$r,ei,ti="\npackage Modules;\nmessage probuf {\n message "+jn+"\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 "+Sn+" {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message "+En+" {\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 "+mn+" {\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 "+vn+" {\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 "+yn+" {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message "+_n+" {\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 = "+Le.IMAGE+";\n audio = "+Le.AUDIO+";\n video = "+Le.VIDEO+";\n file = "+Le.FILE+";\n }\n message "+nr+" {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message "+ir+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+or+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+rr+" {\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 "+sr+" {\n required string downloadUrl = 1;\n }\n message "+ar+" {\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 "+Un+" {\n required int32 nothing = 1;\n }\n message "+Dn+" {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message "+Tn+" {\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 "+wn+"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message "+xn+"\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 "+kn+"\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 "+Mn+"\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 "+Vn+"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message "+Bn+"\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 "+Jn+"\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 "+In+"\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 "+bn+"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message "+Zn+"{\n optional int32 order=1;\n }\n\n message "+tr+"{\n repeated string key=1;\n }\n\n message "+er+"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated "+er+" userData=2; //用户资源信息\n }\n\n message "+Hn+"{\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 "+er+" roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message "+Fn+"{\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 }\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 "+Wn+"{\n repeated "+er+" outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message "+Gn+"{\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 "+Kn+"{\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 "+qn+" {\n repeated "+er+" valueInfo = 1;\n required string objectName = 2;\n repeated "+er+" content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message "+zn+"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message "+Yn+"{\n required targetType target=1;\n repeated "+er+" valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message "+Qn+"{\n repeated string userId = 1;\n }\n message "+Xn+"{\n repeated RtcUserInfo user = 1;\n }\n message "+Rn+"{\n required int32 nothing = 1;\n }\n message "+Cn+"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message "+Ln+"\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 "+Nn+"\n {\n repeated SessionInfo sessions = 1;\n }\n message "+On+"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message "+An+"\n {\n optional int32 nothing=1;\n }\n message "+Pn+"\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 "+cr+" {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+ur+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+dr+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+lr+" {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message "+hr+" {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message "+fr+"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message "+pr+" {\n required int64 timestamp = 1;\n }\n message "+gr+" {\n required int64 version=1;\n required string value=2;\n }\n message "+mr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+vr+" {\n required int64 version=1;\n optional bool reserve=2;\n }\n message "+_r+" {\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 "+Rr+" {\n required int64 time = 1;\n }\n message "+Cr+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Er+" {\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 "+Tr+" {\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 "+Sr+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Ir+" {\n required int64 version=1;\n }\n message "+br+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+wr+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+kr+" {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message "+Nr+" {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message "+Or+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Ar+" {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message "+xr+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Pr+" {\n repeated string tagId=1;\n }\n message "+yr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Mr+' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message '+Lr+"\n {\n optional int32 nothing=1; //占位\n }\n message "+Ur+" \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message "+Dr+"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message "+Vr+"\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 "+Br+"\n {\n required string userId = 1;\n }\n message "+Fr+"\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 "+Hr+"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message "+jr+"\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 "+Kr+"\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 "+qr+"\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 "+Gr+"\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",ni=(Qr=ti,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":S(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 o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._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]},u.next=function(){var e,n,r,i,o;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('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,(s=(o=function(e){this.tn=new c(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},o.parse=function(e){return new o(e).parse()},s._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},s._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)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(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(";")},s._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)}},s._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)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._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()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];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()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._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},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,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(),o=7&r,s=r>>>3;switch(o){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(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,c,u,d,l,h,f,p,g,m,v,_,y,R,C={},E=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},T=E.prototype;return T.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},T.toString=function(e){return(e?this.className+" ":"")+this.fqn()},T.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},C.T=E,(s=(o=function(e,t,n,r,i){E.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(E.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},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.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)},s.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},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof C.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof C.T&&(!t||n instanceof C.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.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 C.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},C.Namespace=o,c=(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},c.verifyValue=function(n){var i,o,s,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(S(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(S(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(S(n),e.message)}else a(S(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(S(n),e.message)}else a(S(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(S(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(S(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(S(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),s=0;s<i.length;s++){if(i[s].name==n)return i[s].id;if(i[s].id==n)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(S(n),"not an integer"),(n>4294967295||n<0)&&a(S(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"==S(n)||a(S(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}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 o,s;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");o=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(r,s),i.writeVarint32(s.offset),i.append(s.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,o;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(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);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()},C.Element=a,(d=(u=function(e,t,n,r,i,s){o.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(o.prototype)).build=function(r){var i,o,s,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,o,s){var a,c,u,d,l,h,f;if(null===e||"object"!=S(e))return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=i(e,r,o,s)})),c;if(c={},e instanceof t.Map){for(d=(u=e.entries()).next();!d.done;d=u.next())c[e.keyElem.valueToString(d.value[0])]=i(d.value[1],r,o,e.valueElem.resolvedType);return c}for(f in l=e.$type,h=void 0,e)e.hasOwnProperty(f)&&(c[f]=l&&(h=l.getChild(f))?i(e[f],r,o,h.resolvedType):i(e[f],r,o));return c}var o,s,a=r.getChildren(t.Reflect.Message.Field),c=r.getChildren(t.Reflect.Message.OneOf),u=function e(i){var o,s,u,d;for(t.Builder.Message.call(this),o=0,s=c.length;s>o;++o)this[c[o].name]=null;for(o=0,s=a.length;s>o;++o)this[(u=a[o]).name]=u.repeated?[]:u.map?new t.Map(u):null,!u.required&&"proto3"!==r.syntax||null===u.defaultValue||(this[u.name]=u.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!=S(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(o=0,s=arguments.length;s>o;++o)void 0!==(d=arguments[o])&&this.$set(a[o].name,d);else this.$set(i)},d=u.prototype=Object.create(t.Builder.Message.prototype);for(d.add=function(e,n,i){var o=r._fieldsByName[e];if(!i){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},d.$add=d.add,d.set=function(e,n,i){var o,s,a;if(e&&"object"==S(e)){for(o in i=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,i);return this}if(s=r._fieldsByName[e],i)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},d.$set=d.set,d.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]},d.$get=d.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.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"+o)&&(d["set"+o]=n),null===r.getChild("set_"+t)&&(d["set_"+t]=n),null===r.getChild("get"+o)&&(d["get"+o]=i),null===r.getChild("get_"+t)&&(d["get_"+t]=i)}(s);return d.encode=function(t,n){var i,o;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),o=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(e,t,n){return new u(e).encode(t,n)},d.calculate=function(){return r.calculate(this)},d.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},d.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},d.toArrayBuffer=d.encodeAB,d.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},d.toBuffer=d.encodeNB,d.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},d.toBase64=d.encode64,d.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},d.toHex=d.encodeHex,d.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},d.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},u.decode=function(e,t){var i,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=r.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},u.decodeDelimited=function(e,t){var i,o,s;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,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=r.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},d.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:r.buildOpt()}),Object.defineProperty(d,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:r}),Object.defineProperty(d,"$type",{value:r})),u}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||o instanceof u||o instanceof _){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof v))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},d.encode=function(e,t,n){var r,i,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===c&&(c=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},d.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>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},d.decode=function(e,n,r){var o,s,a,c,u,d,l,h,f,p,g,m;for(n="number"==typeof n?n:-1,u=e.offset,d=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===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(c=this._fieldsById[a])c.repeated&&!c.options.packed?d[c.name].push(c.decode(s,e)):c.map?(h=c.decode(s,e),d[c.name].set(h[0],h[1])):(d[c.name]=c.decode(s,e),c.oneof&&(null!==(f=d[c.oneof.name])&&f!==c.name&&(d[f]=null),d[c.oneof.name]=c.name));else switch(s){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:l=e.readVarint32(),e.offset+=l;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: "+s)}}for(p=0,g=this._fields.length;g>p;++p)if(null===d[(c=this._fields[p]).name])if("proto3"===this.syntax)d[c.name]=c.defaultValue;else{if(c.required)throw(m=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=d,m;t.populateDefaults&&null!==c.defaultValue&&(d[c.name]=c.defaultValue)}return d},C.Message=u,(h=(l=function(e,n,r,i,o,s,a,c,d,l){E.call(this,e,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=d||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(E.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)},h.verifyValue=function(e,n){var r,i,o;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(S(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(S(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],i=0;i<e.length;i++)o.push(this.element.verifyValue(e[i]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(S(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(S(e),"no array expected"),this.element.verifyValue(e))},h.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}},h.encode=function(e,r,i){var o,s,a,c,u;if(null===this.type||"object"!=S(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),s=r.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],r);a=r.offset-s,(c=n.calculateVarint32(a))>1&&(u=r.slice(s,r.offset),s+=c-1,r.offset=s,r.append(u)),r.writeVarint32(a,s-c)}else for(o=0;o<e.length;o++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],r);else this.map?e.forEach((function(e,i){var o=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(o),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},h.calculate=function(e,r){var i,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=S(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),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);i+=n.calculateVarint32(s),i+=s}else for(o=0;o<e.length;o++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,r){var o=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(o),i+=o}),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},h.decode=function(e,n,r){var i,o,s,c,u,d,l;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(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(d=u.readVarint32()),1==(l=d>>>3))c=this.keyElement.decode(u,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,e,l)}return[c,i]}return this.element.decode(n,e,this.id)},C.Message.Field=l,(f=function(e,t,n,r,i,o,s){l.call(this,e,t,n,null,r,i,o,s),this.extension}).prototype=Object.create(l.prototype),C.Message.ExtensionField=f,p=function(e,t,n){E.call(this,e,t,n),this.fields=[]},C.Message.OneOf=p,(g=function(e,t,n,r,i){o.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},(g.prototype=Object.create(o.prototype)).build=function(e){var n,r,i,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,o=(r=this.getChildren(g.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},C.Enum=g,(m=function(e,t,n,r){E.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(E.prototype),C.Enum.Value=m,(v=function(e,t,n,r){E.call(this,e,t,n),this.field=r}).prototype=Object.create(E.prototype),C.Extension=v,((_=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(o.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)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<s.length;r++)!function(e){o[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"!=S(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(o[e.name],"$options",{value:i[e.name].$options}))}(s[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(t,this)},C.Service=_,((y=function(e,t,n,r){E.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(E.prototype)).buildOpt=s.buildOpt,C.Service.Method=y,(R=function(e,t,n,r,i,o,s,a){y.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(y.prototype),C.Service.RPCMethod=R,C}(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||{}},o=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"!=S(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,c;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(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=S(e.options))throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){r.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,c,u,d,l,h="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==S(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(h="\\"),o=i+h+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==S(n)?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),h="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+h+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(d=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(d+""),u):this.import(e.DotProto.Parser.parse(d),u)}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]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var r;if(null==this.ptr||"object"==S(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: "+S(this.ptr)+": "+this.ptr);return this.reset()},o.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},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.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,o,s;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++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},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"==S(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"==S(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"==S(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"==S(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"==S(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Qr,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 o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,d=-7,l=n?i-1:0,h=n?-1:1,f=e[t+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+e[t+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+e[t+l],l+=h,d-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,d=(1<<u)-1,l=d>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}var o,s,a,c,u,d=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?s: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 d.VERSION="5.0.1",d.LITTLE_ENDIAN=!0,d.BIG_ENDIAN=!1,d.DEFAULT_CAPACITY=16,d.DEFAULT_ENDIAN=d.BIG_ENDIAN,d.DEFAULT_NOASSERT=!1,d.Long=e||null,(o=d.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,d.accessor=function(){return Uint8Array},d.allocate=function(e,t,n){return new d(e,t,n)},d.concat=function(e,t,n,r){var i,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)d.isByteBuffer(e[s])||(e[s]=d.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new d(0,n,r);for(u=new d(i,n,r),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},d.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},d.type=function(){return ArrayBuffer},d.wrap=function(e,t,n,r){var i,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return d.fromBase64(e,n);case"hex":return d.fromHex(e,n);case"binary":return d.fromBinary(e,n);case"utf8":return d.fromUTF8(e,n);case"debug":return d.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=S(e))throw TypeError("Illegal buffer");if(d.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new d(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 d(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 d(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,c=void 0===t;if(c&&(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,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,c=void 0===e;for(c&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.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},o.writeBytes=o.append,o.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},o.writeByte=o.writeInt8,o.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},o.readByte=o.readInt8,o.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},o.writeUInt8=o.writeUint8,o.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},o.readUInt8=o.readUint8,o.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},o.writeShort=o.writeInt16,o.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},o.readShort=o.readInt16,o.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},o.writeUInt16=o.writeUint16,o.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},o.readUInt16=o.readUint16,o.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},o.writeInt=o.writeInt32,o.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},o.readInt=o.readInt32,o.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},o.writeUInt32=o.writeUint32,o.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},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,i,o,s=void 0===n;if(s&&(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,o=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&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,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),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(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),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(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,o=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&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,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),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(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),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.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},o.writeFloat=o.writeFloat32,o.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},o.readFloat=o.readFloat32,o.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},o.writeDouble=o.writeFloat64,o.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},o.readDouble=o.readFloat64,d.MAX_VARINT32_BYTES=5,d.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},d.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},d.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(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=d.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,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(d.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(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,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==S(t)?t.value=d.zigZagDecode32(t.value):t=d.zigZagDecode32(t),t},e&&(d.MAX_VARINT64_BYTES=10,d.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},d.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()},d.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()},o.writeVarint64=function(t,n){var r,i,o,s,a,c=void 0===n;if(c&&(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=d.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=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&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;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 c?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(d.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,s,a,c=void 0===t;if(c&&(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,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=d.zigZagDecode64(n.value):n=d.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(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=u.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(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,u.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),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(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=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o: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,u.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 s?(this.offset=n,this):n-i},o.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,d.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},d.METRICS_CHARS="c",d.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,s=void 0===n;if(s&&(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=u.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,d.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},d.calculateString=d.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},o.readUTF8String=function(e,t,r){var i,o,s,a,c;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=d.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(s=0,a=r,t===d.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===d.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(c=r+e,u.decodeUTF8toUTF16(function(){return c>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,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(o=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=d.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.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,d.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,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 d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new d(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){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=s,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)},o.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 d(0,this.littleEndian,this.noAssert);var n=t-e,r=new d(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!d.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=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==(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.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},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.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},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,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 d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):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},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){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},o.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},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(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},o.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?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.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,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.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()},d.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new d(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},d.btoa=function(e){return d.fromBinary(e).toBase64()},d.atob=function(e){return d.fromBase64(e).toBinary()},o.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)},d.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new d(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}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+=" ";s+=i+o+"\n"}return e?s:i},d.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new d(0|(o+1)/3,t,n),a=0,c=0,u=!1,l=!1,h=!1,f=!1,p=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(l||h||f){p=!0;break}l=h=f=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(l||f){p=!0;break}l=f=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(l||h){p=!0;break}l=h=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(l){p=!0;break}l=!0}s.offset=c,u=!1;break;case"]":if(!n){if(f||h){p=!0;break}f=h=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(f){p=!0;break}f=!0}s.limit=c,u=!1;break;case"'":if(!n){if(h){p=!0;break}h=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){p=!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");s.view[c++]=i,u=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!f)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.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("")},d.fromHex=function(e,t,n){var r,i,o,s,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,o=new d(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},u=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,o,s=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())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([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===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},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}(),o.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{u.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()},d.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new d(u.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},d}(Xr=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,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=c[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?g:p;if(t){if(e<0)return g;if(e>=l)return R}else{if(-h>=e)return C;if(e+1>=h)return y}return e<0?r(-e,t).neg():i(0|e%d,0|e/d,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,c,d,l,h;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;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 o(e.substring(1),t,n).neg();for(s=r(u(n,8)),a=p,c=0;c<e.length;c+=8)d=Math.min(8,e.length-c),l=parseInt(e.substring(c,c+d),n),d<8?(h=r(u(n,d)),a=a.mul(h).add(r(l))):a=(a=a.mul(s)).add(r(l));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,u=Math.pow,e.fromString=o,e.fromValue=s,h=(l=(d=4294967296)*d)/2,f=n(16777216),p=n(0),e.ZERO=p,g=n(0,!0),e.UZERO=g,m=n(1),e.ONE=m,v=n(1,!0),e.UONE=v,_=n(-1),e.NEG_ONE=_,y=i(-1,2147483647,!1),e.MAX_VALUE=y,R=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=R,C=i(0,-2147483648,!1),e.MIN_VALUE=C,(E=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},E.toString=function(e){var t,n,i,o,s,a,c,d;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(C)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),d=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(C)?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},E.isZero=function(){return 0===this.high&&0===this.low},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},E.eq=E.equals,E.notEquals=function(e){return!this.eq(e)},E.neq=E.notEquals,E.lessThan=function(e){return this.comp(e)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(e){return this.comp(e)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(e){return this.comp(e)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(e){return this.comp(e)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(e){if(t(e)||(e=s(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},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(m)},E.neg=E.negate,E.add=function(e){var n,r,o,a,c,u,d,l,h,f,p;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,d=e.low>>>16,l=0,h=0,f=0,p=0,f+=(p+=a+(65535&e.low))>>>16,h+=(f+=o+d)>>>16,l+=(h+=r+u)>>>16,l+=n+c,i((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},E.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){var n,o,a,c,u,d,l,h,g,m,v,_;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(C)?e.isOdd()?C:p:e.eq(C)?this.isOdd()?C:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(f)&&e.lt(f)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,d=65535&e.high,l=e.low>>>16,g=0,m=0,v=0,_=0,v+=(_+=c*(h=65535&e.low))>>>16,m+=(v+=a*h)>>>16,v&=65535,m+=(v+=c*l)>>>16,g+=(m+=o*h)>>>16,m&=65535,g+=(m+=a*l)>>>16,m&=65535,g+=(m+=c*d)>>>16,g+=n*h+o*l+a*d+c*u,i((v&=65535)<<16|(_&=65535),(g&=65535)<<16|(m&=65535),this.unsigned)))},E.mul=E.multiply,E.divide=function(e){var n,i,o,a,c,d,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return v;o=g}else{if(this.eq(C))return e.eq(m)||e.eq(_)?C:e.eq(C)?m:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?m:_:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(C))return this.unsigned?g:p;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();o=p}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),l=(d=r(n)).mul(e);l.isNegative()||l.gt(i);)l=(d=r(n-=c,this.unsigned)).mul(e);d.isZero()&&(d=m),o=o.add(d),i=i.sub(l)}return o},E.div=E.divide,E.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return i(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},E.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)},E.shl=E.shiftLeft,E.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)},E.shr=E.shiftRight,E.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))},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},E.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},E.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]},E.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}()),Xr));ni.getModule=function(e){var t=new ni[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return Fe(e)?[].slice.call(new Int8Array(e)):e},t};var ri,ii={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},oi="qryRelationR",si="cleanPMsg",ai="cleanGMsg",ci="cleanCMsg",ui="cleanSMsg",di="qryPMsg",li="qryCHMsg",hi=((Zr={}).ppMsgP=xe.PRIVATE,Zr.pgMsgP=xe.GROUP,Zr.chatMsg=xe.CHATROOM,Zr.pcMsgP=xe.CUSTOMER_SERVICE,Zr),fi=(($r={})[xe.PRIVATE]=di,$r[xe.GROUP]="qryGMsg",$r[xe.CHATROOM]=li,$r[xe.CUSTOMER_SERVICE]="qryCMsg",$r[xe.SYSTEM]="qrySMsg",$r),pi=((ei={})[xe.PRIVATE]=si,ei[xe.GROUP]=ai,ei[xe.CUSTOMER_SERVICE]=ci,ei[xe.SYSTEM]=ui,ei),gi=function(){function e(e){this._codec="websocket"===e?ni:Jr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[yn]=i._formatSyncMessages,r[_n]=i._formatReceivedMessage,r[mn]=i._formatSentMessage,r[bn]=i._formatHistoryMessages,r[kn]=i._formatConversationList,r[Bn]=i._formatChatRoomInfos,r[Hn]=i._formatRTCUserList,r[Wn]=i._formatRTCData,r[lr]=i._formatChatRoomKVList,r[_r]=i._formatUserSetting,r[Cr]=i._formatConversationStatus,r[kr]=i._formatGrpReadReceiptQryResp,r[mr]=i._formatSetUserSettingOutput,r[yr]=i._formatUserSettingNotification,r[Vr]=i._formatRTCRoomKVList,r[zn]=i._formatRTCAuidenceJoinRoomData,r[Fr]=i._formatRTCJoinedUserInfo,r)[t];try{o=e.length>0&&i._codec[t].decode(e),je(o)&&(o=function(e){for(var t in e)je(e[t])&&(e[t]=Xt(e[t]));return e}(o)),Ke(s)&&(o=s.call(this,o,n))}catch(n){Ze.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Fe(n)?new Uint8Array(n):n;return fn.readUTF(i.subarray(t,r))}catch(e){Ze.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Ze.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(qe(o)||null===o)&&(e.finished=!0),e.syncTime=Xt(i),e.list=nn(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){var n=(t=t||{}).currentUserId,r=t.connectedTime,i=e.content,o=e.fromUserId,s=e.type,a=e.groupId,c=e.status,u=e.dataTime,d=e.classname,l=e.msgId,h=e.extraContent,f=e.pushContent,p=e.pushExt,g=e.configFlag,m=(e.direction||nt.RECEIVE)===nt.SEND,v=function(e){var t=oe.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?oe.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(c),_=v.isPersited,y=v.isCounted,R=v.isMentioned,C=v.disableNotification,E=v.receivedStatus,T=v.canIncludeExpansion,S=[xe.GROUP,xe.CHATROOM,xe.RTC_ROOM].indexOf(s)>-1?a:o,I=m?n:o,b=Xt(u),w=b<r,k=s===xe.CHATROOM,N=this._formatBytes(i),O={};if(p&&(O=Zt(p.pushConfigs,p.pushId)),N.user){var A=N.user,x=A.portrait,P=A.portraitUri,M=x||P;M&&(N.user.portrait=N.user.portraitUri=M)}var L,U=_e(_e({},O),{pushTitle:null==p?void 0:p.title,pushContent:f,pushData:f,disablePushTitle:!!g&&Boolean(4&g),forceShowDetailContent:!!g&&Boolean(8&g),templateId:null==p?void 0:p.templateId}),D=m?nt.SEND:nt.RECEIVE;return k&&o===n&&(D=nt.SEND),h&&(L={},L=cn(h)),{conversationType:s,targetId:S,senderUserId:I,messageType:d,messageUId:l,isPersited:_,isCounted:y,isMentioned:R,sentTime:b,isOffLineMessage:w,messageDirection:D,receivedTime:un.getTime(),disableNotification:C,receivedStatus:E,canIncludeExpansion:T,content:N,expansion:L,configFlag:g,pushConfig:U,channelId:e.busChannel||""}},e.prototype._formatSentMessage=function(e,t){var n,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,c=e.pushExt,u=e.pushContent,d=e.configFlag,l=t.signal,h=t.currentUserId,f=l.date,p=l.topic,g=l.targetId,m=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=m.isPersited,_=m.isCounted,y=m.disableNotification,R=m.canIncludeExpansion,C=hi[p]||xe.PRIVATE,E=rn(ii,p),T=this._formatBytes(r),S=g;i===Rt.RECALL&&(C=T.conversationType||C,S=T.targetId||g),a&&(n={},n=cn(a));var I={};c&&(I=Zt(c.pushConfigs,c.pushId));var b=_e(_e({},I),{pushTitle:null==c?void 0:c.title,pushContent:u,pushData:u,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:S,messageType:i,messageUId:s,isPersited:v,isCounted:_,isStatusMessage:E,senderUserId:h,content:this._formatBytes(r),sentTime:1e3*f,receivedTime:un.getTime(),messageDirection:nt.SEND,isOffLineMessage:!1,disableNotification:y,canIncludeExpansion:R,expansion:n,pushConfig:b,channelId:e.busChannel||""}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=Xt(e.syncTime),c=[];return tn(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatConversationList=function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=nn(r,(function(e){var r=e.msg,o=e.userId,s=e.type,a=e.unreadCount,c=e.busChannel,u=null;r&&((u=n._formatReceivedMessage(r,t)).targetId=o);var d={targetId:o,conversationType:s,unreadMessageCount:a,latestMessage:u,channelId:c||""};return i(d)||d})))||[]},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:nn(n,(function(e){var t=e.id,n=e.time;return{id:t,time:Xt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=nn(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?kt.DELETE:kt.UPDATE}}(r);return{key:t,value:n,isAutoDelete:s.isAutoDelete,isOverwrite:s.isOverwrite,type:s.type,userId:o,timestamp:Xt(i)}})),isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return tn(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=Xt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=Xt(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return tn(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=Et.CLOSE,c=!1,u=[];tn(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case 1:a="1"===n?Et.OPEN:Et.CLOSE;break;case 2:c="1"===n;break;case 3:u=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,isTop:c,updatedTime:Xt(i),tags:u,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,o=e.entries,s={};return tn(t,(function(e){var t=e.userId,n=e.userData,r={};tn(n,(function(e){var t=e.key,n=e.value;r[t]=n})),s[t]=r})),{users:s,token:n,sessionId:r,roomInfo:i,kvEntries:o}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return tn(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return tn(r,(function(e){i[e.key]=e.value})),i},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=Xt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=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:Xt(t)})})),isFullUpdate:n,syncTime:r}},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Xt(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Rn);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,r,i,o="comet"===this._connectType,s=(e.conversationType,t.messageType),a=t.isMentioned,c=t.mentionedType,u=t.mentionedUserIdList,d=t.content,l=t.pushContent,h=t.pushData,f=t.directionalUserIdList,p=t.isFilerWhiteBlacklist,g=t.isVoipPush,m=t.canIncludeExpansion,v=t.expansion,_=t.pushConfig,y=t.channelId;xe.GROUP;var R=this._codec.getModule(mn),C=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),E=_||{},T=E.pushTitle,S=E.pushContent,I=E.pushData,b=E.iOSConfig,w=E.androidConfig,k=E.templateId,N=E.disablePushTitle,O=E.forceShowDetailContent,A=0;R.setSessionId(C),a&&d&&(d.mentionedInfo={userIdList:(null===(n=d.mentionedInfo)||void 0===n?void 0:n.userIdList)||u||[],type:(null===(r=d.mentionedInfo)||void 0===r?void 0:r.type)||c||St.ALL,mentionedContent:(null===(i=d.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""});var x=S||l||"",P=I||h||"";if(x&&R.setPushText(x),P&&R.setAppData(P),f&&R.setUserId(f),A|=g?1:0,A|=p?2:0,A|=N?4:0,A|=O?8:0,R.setConfigFlag(A),R.setClassname(s),d.user&&d.user.portraitUri&&(d.user.portrait=d.user.portraitUri),R.setContent(JSON.stringify(d)),m&&v){var M={};tn(v,(function(e,t){M[t]={v:e}})),R.setExtraContent(JSON.stringify(M))}if(_){var L=this._codec.getModule(vn);if(T&&L.setTitle(T),b&&w){var U=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,d=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=r||"",l.category=i||"",l.richMediaUri=o||"";var h={};h.collapse_key=null==d?void 0:d.collapseKey,h.imageUrl=null==d?void 0:d.imageUrl;var f=null==d?void 0:d.priority;f&&!["high","normal"].includes(f)&&(f="normal"),h.priority=f;var p=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:l},{FCM:h}];return JSON.stringify(p)}(b,w);L.setPushConfigs(U)}(null==w?void 0:w.notificationId)&&L.setPushId(null==w?void 0:w.notificationId),L.setTemplateId(k||""),R.setPushExt(o?L.getArrayData():L)}return qe(y)||R.setBusChannel(y),R},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(En);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Tn);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,i=t.timestamp,o=t.channelId,s=this._codec.getModule(In);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(wn);return r.setType(1),r.setCount(t),r.setStartTime(n),r.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=this._codec.getModule(wn);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=this._codec.getModule(xn);return r.setType(t),r.setBusChannel(n),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(Nn),r=[];return tn(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(On);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=this._codec.getModule(Pn),o=[];return tn(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n){var r=this._codec.getModule(Mn);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,i=t.timestamp,o=this._codec.getModule(Ln);return i=i||+new Date,o.setType(n),o.setChannelId(r),o.setMsgTime(i),o.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Un);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Vn);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(nr);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(cr),o=t.key,s=t.value,a=t.notificationExtra,c=t.isSendNotification,u=t.type||kt.UPDATE,d=dn(t,u),l={key:o,value:s||"",uid:n};if(qe(d)||(l.status=d),i.setEntry(l),c){var h={conversationType:xe.CHATROOM,targetId:e},f={key:o,value:s,extra:a,type:u},p=this._getUpMsgModule(h,{messageType:Rt.CHRM_KV_NOTIFY,content:f,isPersited:!1,isCounted:!1});r?i.setNotification(p.getArrayData()):i.setNotification(p),i.setBNotify(!0),i.setType(xe.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var r=this._codec.getModule(ur),i=t.entries,o=t.type||kt.UPDATE,s=dn(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};qe(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(pr);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(vr);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Rr);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Sr),i=un.getTime(),o=[];return tn(e,(function(e){var r=t._codec.getModule(Er),s=e.conversationType,a=e.targetId,c=e.notificationStatus,u=e.isTop,d=e.channelId,l=[];r.setType(s),r.setChannelId(a),r.setTime(i),r.setBusChannel(d);var h=c===Et.OPEN,f={};qe(c)||(f[1]=h),qe(u)||(f[2]=u),tn(f,(function(e,r){if(!qe(e)){var i=t._codec.getModule(Tr);e=e?"1":"0",i.setSessionStateType(Number(r)),i.setValue(e);var o=n?i.getArrayData():i;l.push(o)}})),r.setStateItem(l);var p=n?r.getArrayData():r;o.push(p)})),r.setVersion(i),r.setState(o),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(br);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Or),o=[];return e.forEach((function(e){var t=n._codec.getModule(Ar);t.setTagId(e.tagId),t.setName(e.tagName),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(br);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(xr),o=[];return e.forEach((function(e){var t=n._codec.getModule(Ar);t.setTagId(e),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Pr);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Sr),o=[];return t.forEach((function(t){var i=n._codec.getModule(Er),s=n._codec.getModule(Tr),a=[];e.forEach((function(e){var t=n._codec.getModule(Ar);t.setTagId(e.tagId),qe(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),s.setSessionStateType(3),s.setValue(JSON.stringify(a)),s.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?s.getArrayData():s]),o.push(r?i.getArrayData():i)})),i.setState(o),i.setVersion(un.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Mr);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n){var r=this._codec.getModule(Fn);return e=e||0,r.setRoomType(e),qe(t)||r.setBroadcastType(t),qe(n)||r.setJoinType(n),r.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(jn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,r,i){var o=this._codec.getModule(Kn);if(o.setInterior(n),o.setTarget(r),o.setKey(e),o.setValue(t),i){i.name&&o.setObjectName(i.name);var s=i.content;s&&(je(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,r){var i=this,o="comet"===this._connectType,s=this._codec.getModule(qn);s.setObjectName(n);var a=this._codec.getModule(er);a.setKey(e.name),a.setValue(e.content),o?s.setContent([a.getArrayData()]):s.setContent(a);var c=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(er);n.setKey(e);var s="uris"===e?t:r;n.setValue(s),o?c.push(n.getArrayData()):c.push(n)})),s.setValueInfo(c),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(qn);n.setObjectName(e);var r=this._codec.getModule(er);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var r=this._codec.getModule(Gn);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,r){var i=this._codec.getModule(Gn);i.setInterior(t),i.setTarget(n),i.setKey(e);var o=(r=r||{}).name,s=r.content;return!qe(o)&&i.setObjectName(o),qe(s)||(je(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var r=this._codec.getModule(Yn);r.setTarget(t),Be(e)||(e=[e]),tn(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||{}).name,o=n.content;return!qe(i)&&r.setObjectName(i),qe(o)||(je(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(Qn);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Jn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(Zn);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(er);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(tr);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var r=this._codec.getModule(Fn);return r.setRoomType(Ot.LIVE),t&&r.setBroadcastType(t),r.setIdentityChangeType(e),r.setNeedSysChatroom(n),r.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(Dr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(Br);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(jr);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setTimeoutTime(i),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=this._codec.getModule(Kr);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setInviteInfo(i),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree?1:0,c=this._codec.getModule(qr);return c.setInviteUserId(t),c.setInviteRoomId(n),c.setInviteSessionId(r),c.setContent(i),c.setKey(o),c.setValue(s),c.setAnswerCode(a),c.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=this._codec.getModule(Gr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(r),o.setInviteRoomKeys(i),o.getArrayData()},e}(),mi=function(e,t){this._watcher=t,this.codec=new gi(e)},vi=function(e,t){return e&&t?t+"_"+e:e||Date.now()},_i=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return vi(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),yi=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new hn(e,!1,jt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return vi(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new gn;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),Ri=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=qt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return ge(t,e),t.prototype.readMessage=function(e,n,r){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(r===Yt.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 o=e.readUTF();Ze.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(_i),Ci=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=qt.DISCONNECT,t.status=0,t}return ge(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(_i),Ei=function(e){function t(){var t=e.call(this,Kt.PING_REQ)||this;return t._name=qt.PING_REQ,t}return ge(t,e),t.prototype.writeMessage=function(e){},t}(yi),Ti=function(e){function t(t){var n=e.call(this,t)||this;return n._name=qt.PING_RESP,n}return ge(t,e),t}(_i),Si=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return ge(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(_i),Ii=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return ge(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)},t}(yi),bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=qt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Gt.PUB,t}return ge(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(Si),wi=function(e){function t(t,n,r){var i=e.call(this,Kt.PUBLISH)||this;return i._name=qt.PUBLISH,i.syncMsg=!1,i.identifier=Gt.PUB,i.topic=t,i.data=Ue(n)?fn.writeUTF(n):n,i.targetId=r,i}return ge(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ii),ki=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=qt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=Gt.PUB,t.topic="",t.targetId="",t}return ge(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(Si),Ni=function(e){function t(t){var n=e.call(this,Kt.PUB_ACK)||this;return n._name=qt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return ge(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Ii),Oi=function(e){function t(t,n,r){var i=e.call(this,Kt.QUERY)||this;return i.name=qt.QUERY,i.identifier=Gt.QUERY,i.topic=t,i.data=Ue(n)?fn.writeUTF(n):n,i.targetId=r,i}return ge(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ii),Ai=function(e){function t(t){var n=e.call(this,Kt.QUERY_CONFIRM)||this;return n._name=qt.QUERY_CON,n.messageId=t,n}return ge(t,e),t}(Ii),xi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=qt.QUERY_ACK,t.status=0,t.identifier=Gt.QUERY,t.topic="",t.targetId="",t}return ge(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(Si),Pi=function(e){var t,n=e.type;switch(n){case Kt.CONN_ACK:t=new Ri(e);break;case Kt.PUBLISH:(t=new bi(e)).syncMsg=e.syncMsg;break;case Kt.PUB_ACK:t=new ki(e);break;case Kt.QUERY_ACK:t=new xi(e);break;case Kt.SUB_ACK:case Kt.UNSUB_ACK:case Kt.PING_RESP:t=new Ti(e);break;case Kt.DISCONNECT:t=new Ci(e);break;default:t=new _i(e),Ze.error("No support for deserializing "+n+" messages")}return t};!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"}(ri||(ri={}));var Mi,Li=ri,Ui=function(e,t,n,r){return ye(void 0,void 0,void 0,(function(){var i;return Re(this,(function(o){return i=0,e.forEach((function(o){return ye(void 0,void 0,void 0,(function(){var s,a;return Re(this,(function(c){switch(c.label){case 0:return s=t+"://"+o+"/ping?r="+(9999,1e3+Math.floor(8999*Math.random())),Ze.debug("start ping",s),[4,n.httpReq({url:s,timeout:5e3})];case 1:return a=c.sent(),Ze.debug("end ping",i,s,a.status),i++,r({finished:i===e.length,code:a.status,host:o}),[2]}}))}))})),[2]}))}))},Di=function(e,t,n,r,i,o,s,a){return e+"://"+t+"/websocket?appId="+n+"&token="+encodeURIComponent(r)+"&sdkVer="+o+"&pid="+s+"&apiVer="+(i.isFromUniapp?"uniapp":"normal")+(i.connectPlatform?"&platform="+i.connectPlatform:"")+(a?"&protocolVer="+a:"")},Vi=function(e){return[Li.ppMsgS,Li.pgMsgS,Li.chatMsgS].map((function(e){return Li[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"}(Mi||(Mi={}));var Bi,Fi=function(e,t){Ze.info("websocket send -> messageId: "+e.messageId);var n=e.getBufferData();t.send(n.buffer)},Hi=function(e){function t(t,n){var r=e.call(this,"websocket",n)||this;return r._runtime=t,r._socket=null,r._messageIds={},r._syncMessageIds={},r._failedCount=0,r.ALLOW_FAILED_TIMES=2,r._timer=null,r._idCount=0,r._generateMessageId=function(){return r._idCount>=65535&&(r._idCount=0),++r._idCount},r}return ge(t,e),t.prototype.connect=function(e,t,n,r,i,o){return ye(this,void 0,void 0,(function(){var s=this;return Re(this,(function(a){return[2,new Promise((function(a){var c=[],u=0,d=!1,l=!1,h=function n(){return ye(s,void 0,void 0,(function(){var s;return Re(this,(function(u){switch(u.label){case 0:return 0===c.length||d?[2]:(d=!0,[4,this._connect(e,t,c.shift(),r,i,o)]);case 1:if((s=u.sent())===it.SUCCESS)this._checkAlive(),a(s);else if(s===dt)a(s);else{if(l&&0===c.length)return a(an(s)),[2];d=!1,n()}return[2]}}))}))};i=Ie(i),s._watcher.status(st.CONNECTING),Ui(n,r,s._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;l=n,200===t&&(c.push(r),u++,h()),n&&0===u&&(Ze.error("No valid websocket server hosts!"),a(it.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i,o){return ye(this,void 0,void 0,(function(){var s,a,c,u,d,l=this;return Re(this,(function(h){switch(h.label){case 0:return s=r.replace("http","ws"),a=Di(s,n,e,t,this._runtime,i,"",o),Ze.debug("conenct start -> "+a),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(a),u=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===c&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),r=new pn(n),i=r.readByte(),o=new hn(i),s=Pi(o);return s.read(r,n.length-1,t),s}(t,o);if(n instanceof Ti&&l._pingResolve)return l._pingResolve(it.SUCCESS),void(l._pingResolve=void 0);if(n instanceof Ri)return Ze.debug("recv connect ack -> "+n.status),n.status!==at?(Ze.warn("connect failed: "+n.status),void e(n.status)):(Ze.info("connect success -> "+a),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(it.SUCCESS));if(n instanceof Ci){var r=n.status;switch(Ze.warn("recv disconnect signal -> status: "+r),r){case Mi.BLOCK:l._watcher.status(st.BLOCKED);break;case Mi.OTHER_DEVICE_LOGIN:l._watcher.status(st.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Mi.REDIRECT_NEW:case Mi.REDIRECT:l._watcher.status(st.REDIRECT);break;default:l._watcher.status(st.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else Ze.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Ze.warn("websocket closed! code:",t,"reason:",n),u(st.CONNECTION_CLOSED),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(it.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){var n;for(var r in Ze.error("websocket error!",null===(n=t)||void 0===n?void 0:n.stack),u(st.WEBSOCKET_ERROR),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(it.RC_NET_CHANNEL_INVALID)}e(it.NETWORK_ERROR)})),c.onOpen((function(){return Ze.debug("websocket open =>",a)})),setTimeout((function(){e(it.TIMEOUT)}),5e3)}))];case 1:return(d=h.sent())===it.SUCCESS?this._socket=c:(Ze.warn("connect result -> code: "+d+", url: "+a),c.close()),[2,d]}}))}))},t.prototype._checkAlive=function(){var e;return ye(this,void 0,void 0,(function(){var t,n=this;return Re(this,(function(r){switch(r.label){case 0:return this._socket?(Ze.debug("send ping ->"),this.sendOnly(new Ei),[4,new Promise((function(e){n._pingResolve=e,n._timer&&clearTimeout(n._timer),n._timer=setTimeout((function(){n._pingResolve=void 0,e(it.TIMEOUT)}),15e3)}))]):[2];case 1:return(t=r.sent())!==it.SUCCESS?(this._failedCount+=1,Ze.warn("ping failed count: "+this._failedCount+", code: "+t),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Ze.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._watcher.status(st.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(Ze.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return n._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a=this;return Re(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==jt.AT_MOST_ONCE&&(e instanceof bi&&!e.syncMsg&&(Ze.debug("send pubAck -> "+t),this.sendOnly(new Ni(t))),e instanceof xi&&(Ze.debug("send queryCon -> "+t),this.sendOnly(new Ai(t)))),t>0&&(e instanceof ki||e instanceof xi)&&(Ze.debug("recv ack -> messageId: "+t),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof bi?(i=e.syncMsg,(o=e.topic)===Li[Li.userSetData]?[2]:!i||Vi(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&Fi(e,this._socket)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),ye(this,void 0,void 0,(function(){var i,o,s,a=this;return Re(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,Fi(e,this._socket),[4,new Promise((function(e){a._messageIds[i]=e,setTimeout((function(){a._messageIds[i]&&delete a._messageIds[i],e()}),r)}))]):[3,2];case 1:return(o=c.sent())?o instanceof xi||o instanceof ki?(s=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(Ze.warn("send failed -> message: "+i+", respPBName: "+t+", status: "+o.status),[2,{code:o.status,data:t&&o.data?s:null}]):[2,{code:it.SUCCESS,data:s}]):[2,{code:o}]:(Ze.warn("send timeout -> message: "+i+", respPBName: "+t+", timeout: "+r),[2,{code:it.TIMEOUT}]);case 2:return[2,{code:it.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(st.DISCONNECTED))},t}(mi);!function(e){e.GET="GET",e.POST="POST"}(Bi||(Bi={}));var ji=function(e){function t(t,n){var r=e.call(this,"comet",n)||this;return r._runtime=t,r._messageIds={},r._syncMessageIds={},r._idCount=0,r._generateMessageId=function(){return++r._idCount},r._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),r}return ge(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ue(e.data)?JSON.parse(e.data):e.data;return n?!Be(n)||(tn(n,(function(e){return ye(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l,h=this;return Re(this,(function(f){switch(f.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new hn(t),r=Pi(n);for(var i in e)r[i]=e[i];return r}(e),r=n.messageId,i=n._header,o=n.status,n.identifier,s=i&&i.qos!==jt.AT_MOST_ONCE,r&&n.getIdentifier&&((a=this._messageIds[r])&&a(n),this._syncMessageIds[r]&&this._syncMessageIds[r](n)),s&&(n instanceof bi&&!n.syncMsg&&(c=new Ni(r),this.sendOnly(c)),n instanceof xi&&(c=new Ai(r),this.sendOnly(c))),n instanceof Ci){switch(o){case Mi.OTHER_DEVICE_LOGIN:this._watcher.status(st.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Mi.BLOCK:this._watcher.status(st.BLOCKED);break;case Mi.REDIRECT_NEW:case Mi.REDIRECT:this._watcher.status(st.REDIRECT);break;default:this._watcher.status(st.DISCONNECT_BY_SERVER)}return[2]}return n instanceof bi?(u=n.syncMsg,d=n.topic,!u||Vi(d)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){h._syncMessageIds[r]=e}))]):[3,2];case 1:l=f.sent(),delete this._syncMessageIds[r],this._watcher.signal(n,l),f.label=2;case 2:return[2]}}))}))})),!0):(Ze.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i;return Re(this,(function(o){switch(o.label){case 0:return t=(new Date).getTime(),n=e+"://"+this._domain+"/pullmsg.js?sessionid="+this._sessionid+"&timestrap="+t+"&pid="+this._pid,[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return r=o.sent(),i=this.handleCometRes(r),this._isDisconnected||(i?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(st.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,r,i,o){return ye(this,void 0,void 0,(function(){var o,s,a,c,u=this;return Re(this,(function(d){return i=Ie(i),this._protocol=r,this._isDisconnected=!1,this._watcher.status(st.CONNECTING),o=[],s=0,a=!1,c=!1,[2,new Promise((function(d){var l=function n(){return ye(u,void 0,void 0,(function(){var s;return Re(this,(function(u){switch(u.label){case 0:return 0===o.length||a?[2]:(a=!0,[4,this._connect(e,t,o.shift(),r,i)]);case 1:if((s=u.sent())===it.SUCCESS)this._startPullSignal(r),d(s);else if(s===dt)d(s);else{if(c&&0===o.length)return d(an(s)),[2];a=!1,n()}return[2]}}))}))};u._watcher.status(st.CONNECTING),Ui(n,r,u._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;c=n,200===t&&(o.push(r),s++,l()),n&&0===s&&(Ze.error("No valid websocket server hosts!"),d(it.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i){return ye(this,void 0,void 0,(function(){var o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(Ze.error("handle comet res -> res: "+JSON.stringify(e||{})),!1):!!e.data&&(function(e){if(je(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?je(e.data)?e.data:JSON.parse(e.data):(Ze.error("received data is not a validJson",e.data),!1))},s=Di(r,n,e,t,this._runtime,i,this._pid),this.sendConnectTime=Date.now(),Ze.debug("conenct start -> "+s),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=u.sent(),c=o(a),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Ze.warn("connect result -> code: "+(null==c?void 0:c.status)+", url: "+s),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d;return Re(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,r=t._sessionid,i=t._pid,o=e.messageId,s=e.topic,a=e.targetId,e.identifier,c=e.getHeaderFlag(),u=s?this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&topic="+s+"&targetid="+a+"&pid="+i:this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&pid="+i,[4,this._runtime.httpReq({url:u,method:Bi.POST,body:e.getCometData()})];case 1:return d=l.sent(),this.handleCometRes(d),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),ye(this,void 0,void 0,(function(){var i,o,s,a=this;return Re(this,(function(c){switch(c.label){case 0:return i=this._generateMessageId(),e.messageId=i,this.sendCometData(e),[4,new Promise((function(e){a._messageIds[i]=e,setTimeout((function(){delete a._messageIds[i],e()}),r)}))];case 1:return(o=c.sent())?(s=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?s:null}]:[2,{code:it.SUCCESS,data:s}]):[2,{code:it.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(st.DISCONNECTED)},t}(mi),Ki=function(e){return["navi",e].join("_")},qi=function(){function e(e,t){this._runtime=e,this._options=t,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Ie(this._options.apiVersion)}return e.prototype.getInfo=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o;return Re(this,(function(s){switch(s.label){case 0:return n&&this._clear(e),(i=function(e,t,n){var r,i,o=Ki(e);try{var s=n.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5}))),0===i.length?n.removeItem(o):n.setItem(o,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null}(this._appkey,e,this._runtime.localStorage))?(this._naviInfo=i,[2,i]):(o=this._options.navigators.slice(),t.length&&t.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),[4,this._reqNavi(o,this._appkey,e,r)]);case 1:return(i=s.sent())?(this._naviInfo=i,this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){this._naviInfo=t,function(e,t,n,r){var i,o=Ki(e);try{var s=r.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(o,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)},e.prototype.getInfoFromCache=function(e){return this._naviInfo},e.prototype._clear=function(e){!function(e,t,n){var r,i=Ki(e);try{var o=n.getItem(i);r=o?JSON.parse(o):[]}catch(e){r=[]}var s=Date.now();r.length>0&&(r=r.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)},e}(),Gi=function(e,t,n){return[e,t,n].join("_")},Yi=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=Gi("inbox",this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Gi("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=Gi("outbox",this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Gi("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),Ji={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},zi=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===kt.DELETE,c=s===o,u=!this._isExisted(n),d=a?this._remove:this._add;(t||i||c||u)&&d.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r},e.prototype.setEntries=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)})),Ze.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Wi=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Re(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=Ji.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===it.SUCCESS?(Ji.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Ji.clear(e);var t=this._storeCaches[e];t&&t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var r=this._storeCaches[e];Je(r)||(r=new zi(e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),Qi=function(){function e(e,t,n,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-"+this._appkey+"-"+this._userId}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(ie){Ze.error("parse rejoined chrm infos error -> "+t),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],Je(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),Xi="converStatusChanged",Zi=function(){function e(e,t,n){this._eventEmitter=new $e,this._pullQueue=[],this._isPulling=!1,this._storage=le(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-"+t+"-"+n}return e.prototype._set=function(e){var t=this;if(!qe(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(Xi,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=i.sent(),n=t.code,r=t.data,n===it.SUCCESS?(this._isPulling=!1,this._set(r),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(Xi,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(Xi,(function(e){}))},e}(),$i={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}},eo={};for(var to in $i){var no=$i[to].keyName;eo[no]=to}var ro,io=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var r="con-"+t+"-"+n;this.storage=new fe(e,r),this._localStore=new fe(e,"CONVER-"+t+"-"+n)}return e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+t},e.prototype._getConOptionByKey=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:xe.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,r=e.targetId,i=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,r,c),d=this._localStore.get(u)||{},l=eo.mentionedInfo,h=eo.hasMentioned,f=d[l]||{},p=f.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===xe.GROUP&&((g.userIdList||[]).forEach((function(e){e===t._currentUserId&&p.indexOf(a)<0&&p.push(a)})),g.type===St.ALL&&p.indexOf(a)<0&&p.push(a)),i===Rt.RECALL&&n===xe.GROUP){var m=p.indexOf(a);m>=0&&p.splice(m,1)}g={userIdList:p,type:(null==g?void 0:g.type)||f.type},0!==p.length?(d[l]=g,d[h]=!0):(delete d[l],delete d[h]),Je(d)?this._localStore.set(u,d):this._localStore.remove(u)}},e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=eo[s],c=n[s];if(!qe(a)&&!qe(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(c===$i[a].defaultVal||"tags"===s&&!Je(c))delete o[a];else if("tags"===s){var u=c;for(var d in u)u[d].isTop||delete u[d].isTop;o[a]=c}else o[a]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}Je(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in $i){var a=$i[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||on(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s){var c=$i[a],u=c.keyName,d=c.defaultVal;o[u]=s[a]||on(d)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var c in a){var u=$i[c],d=u.keyName,l=u.defaultVal;s[d]=a[c]||on(l)}for(var h in s.tags){qe(t[h])&&(t[h]=[]);var f=Object.assign({},s,{conversationType:i,targetId:o});delete f.tags,t[h].push(f)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_"+t;this._localStore.set(n,e[t])}}catch(e){Ze.error("adaptOldStore error: "+e.message)}},e}(),oo=[xe.PRIVATE,xe.GROUP,xe.SYSTEM,xe.PUBLIC_SERVICE,xe.APP_PUBLIC_SERVICE],so="conversationChanged",ao="conTagStatusChanged",co=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new $e,this._draftMap={},this._appkey=t,this._loginUserId=n,this._store=new io(e.runtime,t,n),this._statusManager=new Zi(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(so,(function(e){r(e)})),this._eventEmitter.on(ao,(function(){i()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===nt.SEND&&a===this._loginUserId,u=r===Rt.RECALL,d=je(n),l=!1,h={},f=t.lastUnreadTime||0,p=t.unreadMessageCount||0;return f>i||c||(o&&(t.unreadMessageCount=p+1,t.lastUnreadTime=i,l=!0),u&&d&&f>=n.sentTime&&p&&(t.unreadMessageCount=p-1,l=!0),l&&(h.unreadMessageCount={val:t.unreadMessageCount,time:i})),{hasChanged:l,localConversation:t,updateItems:h}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;nt.SEND;var o=je(n),s=!1,a={};return r&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===nt.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===St.ALL||(a||[]).includes(this._loginUserId)){i=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(je(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i=t+"_"+n,o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=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 o in i)if(!n[o]||i[o].isTop!==n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.isTop,a=e.tags,c=e.channelId,u={},d={};qe(o)||(d.notificationStatus={time:i,val:o}),qe(s)||(d.isTop={time:i,val:s}),qe(a)||(d.tags={time:i,val:a},null==a||a.forEach((function(e){u[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,u,c),this._store.set(n,r,{notificationStatus:o,isTop:s,tags:u},c),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:d,channelId:c}),t&&this._notifyConversationChanged()},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(so,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ao),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId;if(oo.indexOf(r)>=0){var a=!1,c=this._store.get(r,o,s),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),i=r.hasChanged,o=r.localConversation,s=r.updateItems;a=a||i,u=_e(_e({},u),s),c=on(o)})),a&&this._store.set(r,o,c,s),this._store.updateMentionedData(e),i){var d=this._store.get(r,o,s);d.updatedItems=_e({latestMessage:{time:e.sentTime,val:e}},u),d.latestMessage=e;var l=Object.assign(d,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||i)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.conversationType;r=r||0,(n||1!==o)&&(t.length>0?t.includes(Number(s))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getUnreadCountByTag=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},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r){void 0===r&&(r=!0);var i=this._store.get(e,t,n),o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(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 c=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=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))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,r){var i=e+"_"+t+"_"+r;this._draftMap[i]=n},e.prototype.getDraft=function(e,t,n){var r=e+"_"+t+"_"+n;return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r=e+"_"+t+"_"+n;delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;i=Object.assign(i,n),this._store.set(e,t,{tags:i},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Et.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e}(),uo=function(){function e(e,t,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-"+t+"-"+n,this._storagePullTimeKey="us-s-"+t+"-"+n,this._storage=le(e.runtime),this._engine=e,this._tagWatcherFunc=r}return e.prototype._updateTag=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()},e.prototype.addTag=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)},e.prototype.deleteTag=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)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=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)}))},e.prototype.getTagById=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},e.prototype._startPull=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,r=t.data,n!==it.SUCCESS||qe(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,qe(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),lo=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._miniConnectUrl="",r._connectType=n.connectionType,r}return ge(t,e),t.prototype._formatJSONPUrl=function(e,t,n,r){return e+"/"+(this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi")+".js?appId="+n+"&token="+encodeURIComponent(t)+"&callBack="+r+"&v="+this._apiVersion+"&r="+Date.now()},t.prototype.getInfo=function(t,n,r){var i;return ye(this,void 0,void 0,(function(){var o;return Re(this,(function(s){return this._runtime.useNavi||(void 0,o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?ae.join(","):ce.join(","),this._miniConnectUrl=(null===(i=this._options.miniCMPProxy)||void 0===i?void 0:i.length)?this._options.miniCMPProxy.join(","):o||"",n=[]),[2,e.prototype.getInfo.call(this,t,n,r)]}))}))},t.prototype._reqNavi=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return Re(this,(function(h){switch(h.label){case 0:r="getServerEndpoint",i=0,o=e.length,h.label=1;case 1:return i<o?(s=this._formatJSONPUrl(e[i],n,t,r),Ze.debug("req navi => "+s),[4,this._runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(200!==(a=h.sent()).status)return 403===a.status?Ze.error("request navi error: "+it.RC_CONN_USER_OR_PASSWD_ERROR):401===a.status&&Ze.error("request navi error: "+it.RC_CONN_APP_BLOCKED_OR_DELETED),[3,3];try{return c=a.data.match(/{[\d\D]+}/),0===(u=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(u=JSON.parse('"'+u+'"')),l=JSON.parse(u),d=/^https/.test(s)?"https":"http",l.protocol=d,this._runtime.useNavi||(l.server="",l.backupServer=this._miniConnectUrl,l.logSwitch=0),[2,l]}catch(e){Ze.error("parse navi err =>",e)}h.label=3;case 3:return i+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:[2,l={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}]}}))}))},t}(qi),ho=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Re(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===it.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),fo=function(e,t){return["send_msg",e,t].join("_")},po=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=fo(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=fo(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=fo(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}(),go=function(e){var t="RCDeviceId",n=le(e),r="",i=n.get(t);return i?r=i:(r=Oe(),n.set(t,r)),r};(ro={})[xe.PRIVATE]=Li.qryPMsg,ro[xe.GROUP]=Li.qryGMsg,ro[xe.CHATROOM]=Li.qryCHMsg,ro[xe.CUSTOMER_SERVICE]=Li.qryCMsg,ro[xe.SYSTEM]=Li.qrySMsg;var mo=[Li[Li.recallMsg],Li[Li.ppMsgS],Li[Li.pgMsgS],Li[Li.ppMsgP],Li[Li.pgMsgP],Li[Li.chatMsg],Li[Li.pcMsgP],Li[Li.prMsgS]],vo=function(e,t,n,r,i,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:nt.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:oe.UNREAD,pushConfig:n.pushConfig,channelId:n.channelId}},_o=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._customMessageType={},i._reconnectTimer=-1,i._pullOfflineFinished=!1,i._connectedTime=0,i._localConnectedTime=0,i._pullingMsg=!1,i._pullQueue=[],i._chrmsQueue={},i._latestSyncTimestamp=0,i._intervalTimer=-1,i._letterbox=new Yi(t,r.appkey),i._sendMessageStore=new po(t,r.appkey),i._chrmEntryHandler=new Wi(i),i}return ge(t,e),t.prototype._createNavi=function(){return new lo(this.runtime,this._options)},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return Re(this,(function(c){switch(c.label){case 0:return n=[],this._naviInfo=t,t.server?n.push(t.server):Ze.warn("navi.server is invalid"),(r=t.backupServer)&&r.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(Ze.error("navi invaild.",n),[2,it.UNKNOWN]):(i=this.runtime.createDataChannel({status:function(r){a._connectionStatusHandler(r,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=Yt.V3,1===t.openAnti&&(o=Yt.V4),[4,i.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=c.sent())===it.SUCCESS?(this._channel=i,this.currentUserId=i.userId,this._connectedTime=i.connectedTime,this._localConnectedTime=Math.floor((Date.now()+i.sendConnectTime)/2),this._watcher.status(st.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new co(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new uo(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new ho(this),this._joinedChrmManager=new Qi(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval()):i.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,r){if(Ze.warn("connection status changed:",e),e!==st.CONNECTING)if(e!==st.CONNECTED){if(this._channel&&e!==st.DISCONNECTED)return e===st.BLOCKED||e===st.KICKED_OFFLINE_BY_OTHER_CLIENT||e===st.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==st.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)},t.prototype._try2Reconnect=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i=this;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=Yt.V3,1===this._naviInfo.openAnti&&(r=Yt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,r)]):[2];case 1:return o.sent()===it.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(st.CONNECTED),this._rejoinChrm(),Ze.__insertLogIntoDatabase(),[2]):(this._watcher.status(st.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){i._reconnectTimer=-1,i._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=Li[r];if(i)switch(i){case Li.s_ntf:Ze.info("recv s_ntf -> signal.messageId: "+e.messageId),this._pullMsg(e);break;case Li.s_msg:this._receiveMsg(e);break;case Li.s_cmd:this._receiveStateNotify(e);break;case Li.s_us:this._receiveSettingNotify(e);break;case Li.rtc_ntf:this._receiveRtcKv(e)}else Ze.error("unknown topic:",r)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Sn),r=n.time,i=n.type,o=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId})}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,yr)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Ur),r=n.time,i=n.type,o=n.roomId;if(1===i)this._rtcKVManager.pullEntry(o,r)},t.prototype._receiveMessageExpansion=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}})},t.prototype._receiveSyncMsg=function(e,t){var n;if(mo.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,mn,{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!==Rt.EXPANSION_NOTIFY?(r.messageType===Rt.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId,r.channelId),this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Sn),n=t.type,r=t.chrmId,i=t.time;if(Ze.info("s_ntf -> type: "+n+", chrmId: "+r+", time: "+i),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval(),this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,c,u,d,l,h,f,p=this;return Re(this,(function(g){switch(g.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),Ze.info("pullMsg -> sendboxTime: "+e+", inboxTime: "+t),n=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t}),r=new Oi(Li[Li.pullMsg],n,this.currentUserId),[4,this._channel.send(r,yn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return i=g.sent(),o=i.code,s=i.data,this._latestSyncTimestamp=Date.now(),o===it.SUCCESS&&s?(a=s.list,c=s.finished,u=s.syncTime,Ze.info("pullMsg success -> syncTime: "+u+", finished: "+c),d=0,l=[],a.forEach((function(e){if(e.messageDirection===nt.SEND&&(d=Math.max(e.sentTime,d),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==Rt.EXPANSION_NOTIFY){if(e.messageType===Rt.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),l.push(t)}else p._receiveMessageExpansion(e)})),this._watcher.batchMessage(l),this._letterbox.setInboxTime(u,this.currentUserId),this._letterbox.setOutboxTime(d,this.currentUserId),this._sendMessageStore.removeByTimestamp(d),this._pullingMsg=!1,h=this._pullQueue.filter((function(e){return e>u})),this._pullQueue.length=0,(f=this._pullQueue).push.apply(f,h),c&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!c||h.length>0)&&this._syncMsg(),[2]):(Ze.warn("pullMsg failed -> code:",o,", data: ",s),this._pullingMsg=!1,[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,_n,{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!==Rt.EXPANSION_NOTIFY?t.messageType===Rt.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isCounted,o=e.isPersited,s=e.isStatusMessage,a=r in ue,c=r in this._customMessageType;if(n=a?ue[r]:c?this._customMessageType[r]:{isCounted:!Ge(i)&&i,isPersited:!Ge(o)&&o},Object.assign(e,{isCounted:n.isCounted,isPersited:n.isPersited,isStatusMessage:de.includes(r)}),t&&(e.isStatusMessage=s),!t){var u=e.content.user;if(u){var d=u.portrait,l=u.portraitUri,h=d||l;h&&(u.portrait=u.portraitUri=h)}}return e},t.prototype.getHistoryMessage=function(e,t,n,r,i,o){return void 0===o&&(o=""),ye(this,void 0,void 0,(function(){var s,a,c,u,d,l,h,f,p;return Re(this,(function(g){switch(g.label){case 0:return a=(s=this).currentUserId,c=s._channel,u=fi[e]||di,d=1===r&&0===n,c?(l=c.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:r,order:i,channelId:o}),[4,c.send(new Oi(u,l,a),bn,{currentUserId:a,connectedTime:c.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return h=g.sent(),(f=h.code)!==it.SUCCESS?[2,{code:f}]:(p=h.data,d&&2===p.list.length&&(p.hasMore=!0,0===i?p.list.shift():p.list.pop()),[2,{code:f,data:{list:p.list,hasMore:p.hasMore}}]);case 2:return[2,{code:it.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){Ze.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Oi(Li[Li.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==it.SUCCESS&&Ze.warn("reportSDKInfo failed -> code: "+t)}))}},t.prototype.deleteRemoteMessage=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u,d;return Re(this,(function(l){switch(l.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,r),c=new Oi("delMsg",a,o),[4,s.send(c)]):[3,2];case 1:return u=l.sent(),d=u.code,it.SUCCESS,[2,d];case 2:return[2,it.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l;return Re(this,(function(h){switch(h.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeClearMessages(t,n,r),c=pi[e],u=new Oi(c,a,o),[4,s.send(u)]):[3,2];case 1:return d=h.sent(),l=d.code,it.SUCCESS,[2,l];case 2:return[2,it.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),ye(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l,h=this;return Re(this,(function(f){switch(f.label){case 0:return o=(i=this).currentUserId,s=i._channel,t=t||xe.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),c=new Oi(oi,a,o),[4,s.send(c,kn,{currentUserId:o,connectedTime:s.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=h._conversationManager.get(t,n,r);return Object.assign(e,i),e}})]):[3,2];case 1:return u=f.sent(),d=u.code,l=u.data,d!==it.SUCCESS?[2,{code:d}]:[2,{code:d,data:l}];case 2:return[2,{code:it.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return(r=this._channel)?(i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Oi("delRelation",i,t),[4,r.send(o)]):[3,2];case 1:return s=c.sent(),Ze.info("RemoveConversation =>",s),a=s.code,it.SUCCESS,[2,a];case 2:return[2,it.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:it.CONVER_GET_ERROR}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==it.SUCCESS?[2,{code:it.CONVER_GET_ERROR}]:(a=(null==s?void 0:s.list[0])||null,c={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:a,notificationStatus:r.notificationStatus||Et.CLOSE,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},[2,{code:it.SUCCESS,data:c}])}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:it.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:it.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(it.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(it.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(it.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:it.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(it.SUCCESS)},t.prototype.pullConversationStatus=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeGetConversationStatus(e),o=new Oi(Li[Li.pullSeAtts],i,r),[4,n.send(o,Cr)]):[3,2];case 1:return s=u.sent(),a=s.code,c=s.data,a!==it.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}];case 2:return[2,{code:it.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d=this;return Re(this,(function(l){switch(l.label){case 0:return n=(t=this).currentUserId,(r=t._channel)?(i=r.codec.encodeSetConversationStatus(e),o=new Oi("setSeAtt",i,n),[4,r.send(o,Ir)]):[3,2];case 1:return s=l.sent(),a=s.code,c=s.data,a===it.SUCCESS?(u=c,e.forEach((function(e){d._conversationManager.addStatus(_e(_e({},e),{updatedTime:u.version}),!0)})),[2,a]):[2,a];case 2:return[2,it.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u;return Re(this,(function(d){switch(d.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new Oi(n?"joinChrmR":"joinChrm",i,e),[4,r.send(o,Dn)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return s=d.sent(),a=s.code,c=s.data,a===it.SUCCESS&&(u=c.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,u),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t)),[2,a]}}))}))},t.prototype._rejoinChrm=function(){return ye(this,void 0,void 0,(function(){var e,t,n,r,i,o;return Re(this,(function(s){switch(s.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,s.label=1;case 1:return r<t.length?(i=t[r],[4,this._joinChrm(i,e[i]||10,!0)]):[3,4];case 2:(o=s.sent())===it.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:o}}),s.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h,f,p;return Re(this,(function(g){switch(g.label){case 0:return this._channel?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new Oi(Li[Li.chrmPull],s,e),[4,this._channel.send(a,yn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return c=g.sent(),u=c.code,d=c.data,r.pulling=!1,u===it.SUCCESS&&d?(l=d.list,h=d.syncTime,f=d.finished,r.timestamp=n?Math.max(h,n):h,r.queue=r.queue.filter((function(e){return e>h})),p=[],l.forEach((function(e){e.sentTime<o||p.push(e)})),this._watcher.batchMessage(p),(!f||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(Ze.warn("pull chatroom msg failed, code:",u,", data:",d),[2])}}))}))},t.prototype.joinChatroom=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._joinChrm(e,t,!1)]}))}))},t.prototype.joinExistChatroom=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._joinChrm(e,t,!0)]}))}))},t.prototype.quitChatroom=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o;return Re(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),r=new Oi("exitChrm",n,e),[4,t.send(r)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return i=s.sent(),(o=i.code)===it.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return(r=this._channel)?(i=r.codec.encodeGetChatRoomInfo(t,n),o=new Oi(Li[Li.queryChrmI],i,e),[4,r.send(o,Bn)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==it.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u;return Re(this,(function(d){switch(d.label){case 0:return(i=this._channel)?(o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new Oi(li,o,e),[4,i.send(s,bn,{conversation:{targetId:e}})]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return a=d.sent(),c=a.code,u=a.data,c!==it.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u;return Re(this,(function(d){switch(d.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKV(e,t,i),s=t.type===kt.UPDATE?"setKV":"delKV",a=new Oi(s,o,e),[4,r.send(a)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return c=d.sent(),(u=c.code)===it.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},i),[2,u]):[2,u]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,d,l,h,f;return Re(this,(function(p){switch(p.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===kt.UPDATE?"setKVS":"delKVS",a=new Oi(s,o,e),[4,r.send(a,hr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return c=p.sent(),u=c.code,-1!==[it.SUCCESS,it.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(l=[],delete(h=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,h))})),u===it.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,Ze.warn("设置失败的属性:",f.errorKeys),d=f.errorKeys,f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),Ze.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},i)),[2,{code:u,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.type=kt.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:it.SUCCESS,data:n})]:[3,1];case 1:return(r=this._channel)?(i=r.codec.encodePullChatRoomKV(0),o=new Oi(Li[Li.pullKV],i,e),[4,r.send(o,lr)]):[2,Promise.reject({code:it.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&void 0!==(c=a.kvEntries.find((function(e){return e.key===t})))?[2,Promise.resolve({code:it.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:it.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:it.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(r={},i=n.codec.encodePullChatRoomKV(0),o=new Oi(Li[Li.pullKV],i,e),[4,n.send(o,lr)]):[2,Promise.reject({code:it.RC_NET_CHANNEL_INVALID})];case 2:return s=c.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(r[e.key]=e.value||"")})),[2,Promise.resolve({code:it.SUCCESS,data:r})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,d,l;return Re(this,(function(h){switch(h.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodePullChatRoomKV(t),s=new Oi(Li[Li.pullKV],o,e),[4,r.send(s,lr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,c===it.SUCCESS?(Ze.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,u,i),Ze.info("Save into cache success!"),d=u.kvEntries,l=[],d.length>0&&(d.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp;l.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:l})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype.sendMessage=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h;return Re(this,(function(f){switch(f.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),r=!![xe.PRIVATE,xe.GROUP].includes(e)&&n.isStatusMessage,i=r?function(e){var t;return(t={},t[xe.PRIVATE]=Li.ppMsgS,t[xe.GROUP]=Li.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[xe.PRIVATE]=Li.ppMsgP,t[xe.GROUP]=Li.pgMsgP,t[xe.CHATROOM]=Li.chatMsg,t[xe.CUSTOMER_SERVICE]=Li.pcMsgP,t[xe.RTC_ROOM]=Li.prMsgS,t)[e]}(e)||Li.ppMsgP,r&&(n.isPersited=!1,n.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(s=new wi(Li[i],o,t)).setHeaderQos(jt.AT_LEAST_ONCE),r?(this._channel.sendOnly(s),[2,{code:it.SUCCESS,data:vo(e,t,_e({},n),"",0,this.currentUserId)}]):(a=Date.now()-this._localConnectedTime+this._connectedTime,c=vo(e,t,_e({},n),"",a,this.currentUserId),[4,this._channel.send(s)])):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),d=u.code,l=u.data,d!==it.SUCCESS?[2,{code:d,data:c}]:(h=l,this._sendMessageStore.setMessage(h.messageUId,h.timestamp),c.sentTime=h.timestamp,c.messageUId=h.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),[2,{code:it.SUCCESS,data:c}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return ye(this,void 0,void 0,(function(){var s,a,c,u,d,l,h,f,p,g;return Re(this,(function(m){switch(m.label){case 0:return this._channel?(s=i.user,a={content:{conversationType:e,targetId:t,messageUId:n,sentTime:r,user:s},messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},c=Li[Li.recallMsg],u=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},a),(d=new wi(c,u,this.currentUserId)).setHeaderQos(jt.AT_LEAST_ONCE),[4,this._channel.send(d)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return l=m.sent(),h=l.code,f=l.data,h!==it.SUCCESS?[2,{code:h}]:(p=f,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),g=vo(e,t,_e(_e({},a),{isPersited:!0}),p.messageUId,p.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(g,!0),[2,{code:it.SUCCESS,data:g}])}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeReadReceipt(t,n),i=new Oi(Li[Li.rrMsg],r,e),[4,this._channel.send(i)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeMessageReader(t,n),i=new Oi(Li[Li.rrList],r,e),[4,this._channel.send(i,kr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return ye(this,void 0,void 0,(function(){var t,n;return Re(this,(function(r){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new Oi(Li[Li.pullUS],t,this.currentUserId),[2,this._channel.send(n,_r)]):[2,{code:it.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u;return Re(this,(function(d){switch(d.label){case 0:return this._channel?(i=r&&"uploads"!==r?t||"":function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Ne(),i=function(e){e=e||"-";var t=new Date;return""+t.getFullYear()+e+(t.getMonth()+1)+e+t.getDate()}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s="."+a[a.length-1]}return e+"__RC-"+i+"_"+n+"_"+o+r+s}(e,t),o=this._channel.codec.encodeGetFileToken(e,i,n||"",r||""),s=new Oi(Li[Li.qnTkn],o,this.currentUserId),[4,this._channel.send(s,rr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return a=d.sent(),c=a.code,u=a.data,u=Object.assign(u,{fileName:i}),c===it.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l,h;return Re(this,(function(f){switch(f.label){case 0:return this._channel?("",o="",s="",t===bt.QINIU?(o=ir,s=sr):(o=or,s=ar),i=t===bt.QINIU?Li[Li.qnUrl]:t===bt.AWS?Li[Li.s3Url]:t===bt.STC?Li[Li.stcUrl]:Li[Li.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,r),c=new Oi(i,a,this.currentUserId),[4,this._channel.send(c,s)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),d=u.code,l=u.data,h=l,d===it.SUCCESS?[2,{code:d,data:h}]:[2,{code:d}]}}))}))},t.prototype.disconnect=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()},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new Oi(Li[Li.addSeTag],n,this.currentUserId),[4,this._channel.send(r,mr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==it.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([_e(_e({},e),{createdTime:a})],a),[2,{code:it.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),r=new Oi(Li[Li.delSeTag],n,this.currentUserId),[4,this._channel.send(r,mr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==it.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:it.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new Oi(Li[Li.addSeTag],n,this.currentUserId),[4,this._channel.send(r,mr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==it.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:it.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return ye(this,void 0,void 0,(function(){var e,t;return Re(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:it.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s=this;return Re(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Oi(Li[Li.addTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:it.TAG_NOT_EXIST}]:[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return(i=a.sent().code)!==it.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:it.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o=this;return Re(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Oi(Li[Li.delTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return(i=s.sent().code)!==it.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:it.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return ye(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return this._channel?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new Oi(Li[Li.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==it.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:it.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return Re(this,(function(h){switch(h.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeOldConversationList({count:n,type:xe.PRIVATE,startTime:t}),a=new Oi(oi,s,i),[4,o.send(a,kn,{currentUserId:i,connectedTime:o.connectedTime})]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return c=h.sent(),u=c.code,d=c.data,l=this._conversationHasTagFilter(e,d),Ze.info("GetConversationListByTag",l),u!==it.SUCCESS?[2,{code:u}]:[2,{code:u,data:l}]}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,c=n._conversationManager.get(o,s,a),u=c.hasMentioned,d=c.mentionedInfo,l=c.lastUnreadTime,h=c.notificationStatus,f=c.isTop,p=c.tags,g=c.unreadMessageCount,m=p&&p[e];if(m){var v=_e(_e({},t),{hasMentioned:u,mentionedInfo:d,lastUnreadTime:l,notificationStatus:h,isTop:f,unreadMessageCount:g});m.isTop?r.push(_e(_e({},v),{isTopInTag:!0})):i.push(_e(_e({},v),{isTopInTag:!1}))}})),Ce(Ce([],r.sort(o)),i.sort(o))},t.prototype.getUnreadCountByTag=function(e,t){return ye(this,void 0,void 0,(function(){var n;return Re(this,(function(r){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:it.SUCCESS,data:n}]):[2,{code:it.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h;return Re(this,(function(f){switch(f.label){case 0:return this._channel?(r=t.targetId,i=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(a,[t]),d=new Oi(Li[Li.addTag],u,this.currentUserId),[4,this._channel.send(d)]):[2,{code:it.NO_TAG_IN_CONVER}]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return(l=f.sent().code)!==it.SUCCESS?[2,{code:l}]:((h={})[e]={},s&&(h[e].isTop=!0),this._conversationManager.addTagStatus(i,r,h,o),[2,{code:it.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return ye(this,void 0,void 0,(function(){var n,r,i,o;return Re(this,(function(s){if(!this._channel)return[2,{code:it.RC_NET_CHANNEL_INVALID}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:it.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:it.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:it.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:it.SUCCESS,data:t})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:it.SUCCESS,data:e})},t.prototype.joinRTCRoom=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o;return Re(this,(function(s){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n,r),o=new Oi(Li[Li.rtcRJoin_data],i,e),[2,this._channel.send(o,Hn)]):[2,{code:it.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return ye(this,void 0,void 0,(function(){var t,n;return Re(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Oi(Li[Li.rtcRExit],t,e),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Oi(Li[Li.rtcPing],r,e),[4,this._channel.send(i)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return ye(this,void 0,void 0,(function(){var t,n;return Re(this,(function(r){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Oi(Li[Li.rtcRInfo],t,e),[2,this._channel.send(n,$n)]):[2,{code:it.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o;return Re(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Oi(Li[Li.rtcUData],t,e),[4,this._channel.send(n,Hn)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return r=s.sent(),i=r.code,o=r.data,[2,{code:i,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeSetRTCUserInfo(t,n),i=new Oi(Li[Li.rtcUPut],r,e),[4,this._channel.send(i)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return ye(this,void 0,void 0,(function(){var n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),r=new wi(Li[Li.rtcUDel],n,e),[4,this._channel.send(r)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return ye(this,void 0,void 0,(function(){var s,a;return Re(this,(function(c){switch(c.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,r,i,o),a=new wi(Li[Li.rtcSetData],s,e),[4,this._channel.send(a)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return ye(this,void 0,void 0,(function(){var o,s;return Re(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,r,i),s=new Oi(Li[Li.userSetData],o,e),[4,this._channel.send(s)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeUserSetRTCCDNUris(t,n),i=new Oi(Li[Li.userSetData],r,e),[4,this._channel.send(i)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){if(!this._channel)return Promise.resolve({code:it.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),o=new Oi(Li[Li.rtcQryData],i,e);return this._channel.send(o,Wn)},t.prototype.removeRTCData=function(e,t,n,r,i){return ye(this,void 0,void 0,(function(){var o,s;return Re(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,r,i),s=new wi(Li[Li.rtcDelData],o,e),[4,this._channel.send(s)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i;return Re(this,(function(o){return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Oi(Li[Li.rtcToken],r,e),[2,this._channel.send(i,zn)]):[2,{code:it.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return ye(this,void 0,void 0,(function(){var n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),r=new Oi(Li[Li.rtcUserState],n,e),[4,this._channel.send(r)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:it.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Oi(Li[Li.rtcUList],t,e);return this._channel.send(n,Hn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=Ot.LIVE),ye(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d;return Re(this,(function(l){switch(l.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Oi(Li[Li.viewerJoinR],r,e),[4,this._channel.send(i,Hr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==it.SUCCESS?[2,{code:s}]:(u=(c=a).rtcToken,d=c.entries,[2,{code:s,data:{token:u,kvEntries:d}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Oi(Li[Li.viewerExitR],t,e),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return ye(this,void 0,void 0,(function(){var r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._channel?(r=this._channel.codec.encodeIdentityChangeInfo(t,n),i=new Oi(Li[Li.rtcIdentityChange],r,e),[4,this._channel.send(i,Hn)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s!==it.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u;return Re(this,(function(d){switch(d.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(Ze.info("audience in room start pull KV"),i=n.codec.encodePullRTCRoomKV(e,0),o=new Oi(Li[Li.rtcPullKv],i,r),[4,n.send(o,Vr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return s=d.sent(),a=s.code,c=s.data,Ze.info("audience in room end pull KV, code: "+a+", data: "+JSON.stringify(c||{})),a===it.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:a,data:c}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return Re(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeQueryUserJoinedInfo(e),o=new Oi(Li[Li.rtcQueryJoined],i,r),[4,n.send(o,Fr)]):[2,{code:it.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a===it.SUCCESS?[2,{code:a,data:c}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return go(this.runtime)},t.prototype.requestRoomPK=function(e){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new Oi(Li[Li.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.cancelRoomPK=function(e){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new Oi(Li[Li.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.responseRoomPK=function(e){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new Oi(Li[Li.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.endRoomPK=function(e){return ye(this,void 0,void 0,(function(){var t,n,r;return Re(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new Oi(Li[Li.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,it.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:it.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.getConversationNotificationStatus=function(e,t,n){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:it.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:it.CONVER_GET_ERROR})},t.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},t}((function(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()})),yo=function(){function e(e){this._context=e}return e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),Ro=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ge(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,r){return this._context.joinRTCRoom(e,t,n,r)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,r,i,o){return this._context.setRTCData(e,t,n,r,i,o)},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,r){return this._context.getRTCData(e,t,n,r)},t.prototype.removeRTCData=function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)},t.prototype.setRTCOutData=function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(yo),Co=function(){function e(){}return e.compress=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 o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);o.push(i)}o.push(e)}},c=0;c<e.length;){var u=t.indexOf(n,e,c);if(u.length<2)s.push(e.charAt(c++));else if(u.length<4)s.push(e.substr(c,u.length)),c+=u.length;else{var d=t.numberEncode(c-u.offset),l=t.numberEncode(u.length);if(d.length+l.length>=u.length)s.push(e.substr(c,u.length)),c+=u.length;else{a();var h=String.fromCharCode(t.dataType.Compressed|d.length<<2|l.length);o.push(h+d+l),c+=u.length}}}a();var f=t.numberEncode(e.length),p=String.fromCharCode(t.dataType.Tail|f.length);return o.push(p+f),o.join("")},e.uncompress=function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),o=i&t.dataType.Mark,s=15&i,a=void 0;switch(o){case t.dataType.Compressed:var c=s>>2,u=3&s;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var d=t.numberDecode(e.substr(n,c)),l=t.numberDecode(e.substr(n+=c,u));if((d=r.length-d)+l>r.length)throw new Error("Data parsing error,at "+n);n+=u,r+=r.substr(d,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),r+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return r},e.indexOf=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 o=t.length-n,s=0,a=i.length;s<a;s++){var c=i[s],u=n-c;if(!(u>this.max)){var d=Math.min(o,u);if(d<=r.length)break;if(!(r.length>2&&t.charAt(c+r.length-1)!==t.charAt(n+r.length-1))){for(var l=2,h=l;h<d&&t.charAt(c+h)===t.charAt(n+h);h++)l++;l>=r.length&&(r.length=l,r.offset=c)}}}return r},e.numberEncode=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("")},e.numberDecode=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.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),Eo=1,To=!1,So="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",Io=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=go(e.runtime),this.logSwitch=e.logSwitch;var t=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 o in i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}}(e.runtime);this.deviceInfo=t.type+"|"+t.version+"|"+Xe.sessionId,this.startReport()}return e.init=function(t){return To=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.startReport=function(){var e=this;if(this.logSwitch&&To){var t=this.itv*Math.pow(2,Eo-1);Eo<this.times&&Eo++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}},e.prototype.reportRealtimeLog=function(){var e=this,t=Xe.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=Co.compress(t.map((function(e){return e.content})).join("")),r=""+So+this.logUrl+"?version="+this.info.version+"&appkey="+this.info.appkey+"&userId="+this.info.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web";this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){Ze.__clearRealTimeLog(),Ze.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,Eo=1),e.startReport()})).catch((function(t){Ze.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()},e.prototype.reportFullLog=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l=this;return Re(this,(function(h){switch(h.label){case 0:return t=e.startTime,n=e.endTime,r=e.platform,i=e.logId,o=e.uri,s=ke.getInstance(),Ze.debug("received report log msg, "+r.toLowerCase(),s),"web"===r.toLowerCase()&&s?t>n?(Ze.warn("report error: The start time("+t+") cannot be greater than the end time("+t+")"),[2]):[4,Ze.__insertLogIntoDatabase()]:[2];case 1:return h.sent(),[4,s.getRangeData(be,"time",t,n)];case 2:return a=(a=h.sent()).filter((function(e){return!e.userId||e.userId===l.info.userId})),c=Co.compress(a.map((function(e){return e.content})).join("")||"no data"),u=1,(d=function(){if(!(u>3)&&To){var e=o||l.logUrl,t=""+So+e+"?version="+l.info.version+"&appkey="+l.info.appkey+"&userId="+l.info.userId+"&logId="+i+"&deviceId="+l.deviceId+"&deviceInfo="+l.deviceInfo+"&platform=Web",n=5e3*(u-1);u++,setTimeout((function(){To&&l.info.runtime.httpReq({url:t,method:"POST",body:c}).then((function(){Ze.debug("report full log success!")})).catch((function(e){d(),Ze.warn("report full log error -> "+e)}))}),n)}})(),[2]}}))}))},e.prototype.distroy=function(){Eo=1,To=!1},e}();function bo(e){return Object.assign({},e)}var wo,ko=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=st.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({},t),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&&(n=this._options.navigators).push.apply(n,se);var r={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=sn()?new RCCppEngine(e,r,this._options):new _o(e,r,this._options)}return e.init=function(t,n){return Ze.setLogLevel(n.logLevel),Ze.setLogStdout(n.logStdout),(n.indexDBSwitch||qe(n.indexDBSwitch))&&ke.init(),Ze.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Ze.error("Repeat initialize!"),this._context):(Ze.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new e(t,n),Ze.__insertLogIntoDatabase(),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return Ze.warn("Repeat install plugin: "+e.tag),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new Ro(this):new yo(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Ze.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},e.prototype._handleRedirect=function(){return ye(this,void 0,void 0,(function(){var e=this;return Re(this,(function(t){switch(t.label){case 0:return Ze.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return t.sent().code!==it.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){e._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return e===st.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):e===st.BLOCKED||e===st.KICKED_OFFLINE_BY_OTHER_CLIENT||e===st.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):e===st.CONNECTING?this._handleConnecting():e===st.CONNECTED?this._handleConnected():e===st.DISCONNECTED?this._handleDisconnect():e===st.NETWORK_UNAVAILABLE&&this._handleSuspend(),this._connectionStatus=e,(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(){this._watcher.onDisconnect&&this._watcher.onDisconnect()},e.prototype._handleSuspend=function(){this._watcher.onSuspend&&this._watcher.onSuspend()},e.prototype._messageReceiver=function(e,t,n){var r,i,o;if((e.conversationType===xe.RTC_ROOM||Object.prototype.hasOwnProperty.call(Dt,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(bo(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Rt.TYPING_STATUS||(this._addTypingInfo(bo(e)),!this._watcher.typingState))if(e.messageType!==Rt.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Rt.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(bo(e))}catch(e){return Ze.error("plugin error =>",e),!1}})))if("RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return this._watcher.message&&this._watcher.message(bo(e),t,n),e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic;s&&Array.isArray(s[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[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 a=e.content,c=a.startTime,u=a.endTime,d=a.platform,l=a.logId,h=a.uri,f=a.packageName,p={startTime:parseInt(c),endTime:parseInt(u),platform:d,logId:l,uri:h,packageName:f};null===(i=Io.getInstance())||void 0===i||i.reportFullLog(p)}}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:(r={},r[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?Pt.QUIT:Pt.JOIN,r),chatroomId:e.targetId}})},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,i=[];e.forEach((function(e){var o=r._messageReceiver(e,t,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&this._watcher.batchMessage(i)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},e.prototype.assignWatcher=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]=Ke(r)||je(r)?r:void 0}}))},e.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=n+"#"+r+"#"+(o||"");this._typingInfo[a]||(this._typingInfo[a]=[]);var c=this._typingInfo[a].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[a][c].messageType===s?this._typingInfo[a][c].timestamp=Date.now():(c>=0&&this._typingInfo[a].splice(c,1),this._typingInfo[a].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=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))},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.currentUserId},e.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t){return void 0===t&&(t=!1),ye(this,void 0,void 0,(function(){var n,r,i,o,s,a;return Re(this,(function(c){switch(c.label){case 0:return this._connectionStatus===st.CONNECTED?[2,{code:it.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===st.CONNECTING?[2,{code:it.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:it.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,n=e.split("@"),r=n[1],i=r?r.split(";").map((function(e){return/^https?:/.test(e)?e:"https://"+e})):[],[4,this._engine.navi.getInfo(this._getTokenWithoutNavi(),i,t,this._options.checkCA)]);case 1:return(o=c.sent())?1===(null==o?void 0:o.type)?[2,{code:it.PACKAGE_ENVIRONMENT_ERROR}]:(s=Ht.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),o)]):[2,{code:it.RC_NAVI_RESOURCE_ERROR}];case 2:return a=c.sent(),Ze.__insertLogIntoDatabase(),a!==dt?[3,4]:(this._connectionStatus=st.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,c.sent()];case 4:return a===it.SUCCESS&&(Ze.info("connect success, userId: "+this._engine.currentUserId),1!==(null==o?void 0:o.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(s),Io.init({runtime:this._runtime,logSwitch:(null==o?void 0:o.logSwitch)||0,logPolicy:JSON.parse((null==o?void 0:o.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Xe.init(this._engine.currentUserId),this._isInternalConnected=!0),a!==it.SUCCESS||sn()||1===o.openUS&&this._pullUserSettings(),a!==it.SUCCESS&&(this._connectionStatus=st.CONNECTION_CLOSED),[2,{code:a,userId:this._engine.currentUserId}]}}))}))},e.prototype._pullUserSettings=function(){return ye(this,void 0,void 0,(function(){return Re(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=Io.getInstance())||void 0===e||e.distroy(),Ze.__insertLogIntoDatabase(),Xe.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Ze.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(){return this._isInternalConnected?Promise.resolve({code:it.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._engine.registerMessageType(e,t,n,r)},e.prototype.sendMessage=function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===Rt.READ_RECEIPT_RESPONSE)return Promise.resolve({code:it.READ_RECEIPT_ERROR});var o=JSON.stringify(n.content);return Te(o)>131072?Promise.resolve({code:it.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)},e.prototype.sendExpansionMessage=function(e){return ye(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l,h,f,p;return Re(this,(function(g){switch(g.label){case 0:if(t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,!e.canIncludeExpansion)return[2,{code:it.MESSAGE_KV_NOT_SUPPORT}];if(c=!1,u=!1,d=!1,je(s))for(h in l=Object.keys(s).length,c=l>20,s)if(f=s[h],u=Ue(h)&&!/^[A-Za-z0-9_=+-]+$/.test(h),(d=h.length>32||f.length>64)||u)break;return c||d?[2,{code:it.EXPANSION_LIMIT_EXCEET}]:u?[2,{code:it.BIZ_ERROR_INVALID_PARAMETER}]:(p={mid:i},s&&(p.put=s),o&&(p.del=o),a&&(p.removeAll=1),[4,this._engine.sendMessage(n,r,{content:p,messageType:Rt.EXPANSION_NOTIFY,channelId:t})]);case 1:return[2,{code:g.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return ye(this,void 0,void 0,(function(){var r;return Re(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:it.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return ye(this,void 0,void 0,(function(){var r;return Re(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:it.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=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){Ze.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=Io.getInstance())||void 0===e||e.distroy(),Xe.reset()},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s){return void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),this._engine.getHistoryMessage(e,t,n,r,i,o,s||"")},e.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),void 0===i&&(i=""),this._engine.getConversationList(e,t,n,r,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),this._engine.removeConversation(e,t,n)},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[xe.PRIVATE,xe.GROUP,xe.SYSTEM,xe.PUBLIC_SERVICE],!!n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationStatus=function(e,t,n,r,i){void 0===i&&(i="");var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(e,t,n,r)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)},e.prototype.deleteRemoteMessage=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessage(e,t,n,r)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)},e.prototype.joinChatroom=function(e,t){return void 0===t&&(t=10),this._engine.joinChatroom(e,t)},e.prototype.joinExistChatroom=function(e,t){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,r=t.value;return $t(n)&&en(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(it.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,o=r.value;if(!$t(i)||!en(o))return Promise.resolve({code:it.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return $t(n)&&en(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(it.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return $t(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(it.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!$t(r))return Promise.resolve({code:it.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return $t(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(it.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,r){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(e,r,t,n)},e.prototype.getFileToken=function(e,t,n,r){return ye(this,void 0,void 0,(function(){var i,o,s,a,c,u,d;return Re(this,(function(l){switch(l.label){case 0:return i=this.getInfoFromCache(),o=(null==i?void 0:i.bosAddr)||"",s=(null==i?void 0:i.uploadServer)||"",a=(null==i?void 0:i.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r)];case 1:return c=l.sent(),u=c.code,d=c.data,u===it.SUCCESS?[2,Promise.resolve(Object.assign(d,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(u)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=bt.QINIU),ye(this,void 0,void 0,(function(){var o,s,a;return Re(this,(function(c){switch(c.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(e,i,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===it.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return ye(this,void 0,void 0,(function(){return Re(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return t.length>1e3?[2,Promise.reject(it.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return ye(this,void 0,void 0,(function(){return Re(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return ye(this,void 0,void 0,(function(){return Re(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.callExtra=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,Ce([e],n))},e.prototype.clearConversations=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Ze.error(e)}}))},e.prototype.addToBlacklist=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return ye(this,void 0,void 0,(function(){return Re(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return ye(this,void 0,void 0,(function(){return Re(this,(function(r){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),ye(this,void 0,void 0,(function(){return Re(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,r,i)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),ye(this,void 0,void 0,(function(){return Re(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return ye(this,void 0,void 0,(function(){return Re(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return ye(this,void 0,void 0,(function(){return Re(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return ye(this,void 0,void 0,(function(){return Re(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setUserStatus=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return ye(this,void 0,void 0,(function(){return Re(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),void 0===n&&(n=""),ye(this,void 0,void 0,(function(){return Re(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,s){return void 0===s&&(s=""),ye(this,void 0,void 0,(function(){return Re(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.joinRTCRoom=function(e,t,n,r){return this._engine.joinRTCRoom(e,t,n,r)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,r,i,o){return this._engine.setRTCData(e,t,n,r,i,o)},e.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),this._engine.setRTCTotalRes(e,t,n,r,i)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)},e.prototype.removeRTCData=function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)},e.prototype.setRTCOutData=function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e}();!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(wo||(wo={}));
  14. /*! *****************************************************************************
  15. Copyright (c) Microsoft Corporation.
  16. Permission to use, copy, modify, and/or distribute this software for any
  17. purpose with or without fee is hereby granted.
  18. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  19. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  21. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  22. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  24. PERFORMANCE OF THIS SOFTWARE.
  25. ***************************************************************************** */
  26. var No=function(e,t){return No=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},No(e,t)},Oo=function(){return Oo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oo.apply(this,arguments)};function Ao(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function xo(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var Po,Mo=new Xe("RCIM"),Lo=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0}(uni))},Uo=Lo(),Do={tag:"browser",httpReq:function(e){var t=e.method||Bi.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Se(e.url,i);return new Promise((function(e){var i,a=(i="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&i?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),c="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,s),r&&a.setRequestHeader)for(var u in r)a.setRequestHeader(u,r[u]);if(c){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==S(o)?JSON.stringify(o):o;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(o)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||Mo.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:Uo,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,r=t.reason;e(n,r)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,t){return this.isSupportSocket()&&"websocket"===t?new Hi(this,e):new ji(this,e)}},Vo=Lo(),Bo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){Mo.error(e)}}},Fo={setItem:Bo("setStorageSync"),getItem:Bo("getStorageSync"),removeItem:Bo("removeStorageSync"),clear:Bo("clearStorageSync")},Ho={tag:"wechat",httpReq:function(e){var t=e.method||Bi.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Se(e.url,i);return new Promise((function(e){wx.request({url:s,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:it.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:Fo,sessionStorage:Fo,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Vo,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Hi(this,e):new ji(this,e)}},jo=Lo(),Ko=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){Mo.error(e)}}},qo={setItem:Ko("setStorageSync"),getItem:Ko("getStorageSync"),removeItem:Ko("removeStorageSync"),clear:Ko("clearStorageSync")},Go={tag:"alipay",httpReq:function(e){var t=e.method||Bi.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Se(e.url,i),a=e.dataType||"json";return new Promise((function(e){my.request({url:s,method:t,headers:r,timeout:n,data:o,dataType:a,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:it.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:qo,sessionStorage:qo,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:jo,createDataChannel:function(e,t){return"websocket"===t?new Hi(this,e):new ji(this,e)}},Yo=Lo(),Jo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){Mo.error(e)}}},zo={setItem:Jo("setStorageSync"),getItem:Jo("getStorageSync"),removeItem:Jo("removeStorageSync"),clear:Jo("clearStorageSync")},Wo={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Yo,localStorage:zo,sessionStorage:zo,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Hi(this,e):new ji(this,e)}},Qo=Lo(),Xo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){Mo.error(e)}}},Zo={setItem:Xo("setStorageSync"),getItem:Xo("getStorageSync"),removeItem:Xo("removeStorageSync"),clear:Xo("clearStorageSync")},$o={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Qo,localStorage:Zo,sessionStorage:Zo,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Hi(this,e):new ji(this,e)}},es=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){Mo.error(e)}}},ts={setItem:es("setStorageSync"),getItem:es("getStorageSync"),removeItem:es("removeStorageSync"),clear:es("clearStorageSync")},ns={tag:"uniapp",httpReq:function(e){var t=e.method||Bi.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Se(e.url,i);return new Promise((function(e){uni.request({url:s,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:it.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:ts,sessionStorage:ts,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},r=uni.connectSocket(n);return{onClose:function(e){r.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){r.onError((function(t){e(t.errMsg)}))},onMessage:function(e){r.onMessage((function(t){e(t.data)}))},onOpen:function(e){r.onOpen(e)},send:function(e){r.send({data:e})},close:function(e,t){r.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Hi(this,e):new ji(this,e)}},rs=function(e){return e&&e.canIUse&&e.getSystemInfo},is="undefined"!=typeof uni&&rs(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return ns;case"mp-baidu":return $o;case"mp-toutiao":return Wo;case"mp-alipay":return Go;case"mp-weixin":return Ho;default:return Do}}():"undefined"!=typeof wx&&rs(wx)?Ho:"undefined"!=typeof my&&rs(my)?Go:"undefined"!=typeof tt&&rs(tt)?Wo:"undefined"!=typeof swan&&rs(swan)?$o:Do;function os(e){var t=e.conversationType,n=e.channelId,r=e.messageType,i=e.content,o=e.senderUserId,s=e.targetId,a=e.sentTime,c=e.receivedTime,u=e.messageUId,d=e.messageDirection,l=e.isPersited,h=e.isCounted,f=e.isOffLineMessage,p=e.canIncludeExpansion,g=e.expansion,m=e.receivedStatus,v=e.disableNotification,_=e.isMentioned,y=e.isStatusMessage,R=e.readReceiptInfo,C=e.pushConfig,E=e.messageId;return m||(m=oe.UNREAD),{messageType:r,channelId:n||"",content:i,senderUserId:o,targetId:s,conversationType:t,sentTime:a,receivedTime:c,messageUId:u,messageDirection:d,isPersited:l,isCounted:h,isOffLineMessage:f,isMentioned:_,disableNotification:v,isStatusMessage:y,canIncludeExpansion:p,expansion:g,receivedStatus:m,readReceiptInfo:R,pushConfig:C,messageId:E}}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED"}(Po||(Po={}));var ss,as=function(e){function t(n){var r=e.call(this)||this;if(t.imClient)return Mo.error("Please do not repeatedly perform the init method"),t.imClient;Wt("options.navigators",n.navigators,(function(e){return Be(e)&&(0===e.length||e.every(Ye))}));var i=null==n?void 0:n.connectType;return i?re.WEBSOCKET!==i&&re.COMET!==i&&(Mo.warn("RongIMLib connectionType must be "+re.WEBSOCKET+" or "+re.COMET),i=re.WEBSOCKET):i=re.WEBSOCKET,r._context=ko.init(is,{appkey:n.appkey,apiVersion:"5.1.1",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:i,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),r.watch(),t.imClient=r,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}No(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(Po.CONNECTING)},onConnected:function(){e.emit(Po.CONNECTED)},onDisconnect:function(){e.emit(Po.DISCONNECT)},onSuspend:function(){e.emit(Po.SUSPEND)},batchMessage:function(t){e.emit(Po.MESSAGES,{messages:t.map((function(e){return os(e)}))})},typingState:function(t){e.emit(Po.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,r){e.emit(Po.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:r})},messageReceiptRequest:function(t,n,r){e.emit(Po.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:r})},messageReceiptResponse:function(t,n,r){e.emit(Po.MESSAGE_RECEIPT_RESPONSE,{conversation:t,receivedUserId:n,messageUIdList:r})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?os(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(Po.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(Po.CHATROOM,t)},expansion:function(t){e.emit(Po.EXPANSION,t)},pullFinished:function(){e.emit(Po.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(Po.TAG)},conversationTagChanged:function(){e.emit(Po.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(Po.MESSAGE_BLOCKED,t)}};this.context.assignWatcher(t)},t}($e),cs={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:it.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},us={},ds={};for(var ls in cs){var hs=cs[ls],fs=hs.code;us[fs]=ls,ds[fs]=hs}cs.ROAMING_SERVICE_UNAVAILABLE.code;function ps(e,t){return null==ss?void 0:ss.context.install(e,t)}function gs(e){return Ao(this,void 0,void 0,(function(){var t;return xo(this,(function(n){switch(n.label){case 0:return Wt("token",e,Bt.STRING,!0),Mo.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,ss.context.connect(e,!0)];case 1:return(t=n.sent()).code===it.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:us[t.code]}]}}))}))}function ms(e,t,n){ss.on(e,t,n)}function vs(e,t){return Ao(this,void 0,void 0,(function(){var n,r;return xo(this,(function(i){switch(i.label){case 0:return Wt("options.count",t.count,Bt.NUMBER,!0),n="id:"+e,Mo.debug("join chatroom ->"+n),[4,as.imClient.context.joinChatroom(e,t.count)];case 1:return(r=i.sent())!==it.SUCCESS?(Mo.warn("join chatroom fail ->code+:"+us[r]+","+n),[2,{code:r,msg:us[r]}]):[2,{code:r}]}}))}))}var _s=function(e,t,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=r};function ys(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=!0),function(r){return new _s(e,r,t,n)}}var Rs,Cs,Es=ys("RC:ImgMsg"),Ts=ys("RC:HQVCMsg"),Ss=ys("RC:SightMsg"),Is=ys("RC:TxtMsg"),bs=ys("RC:CombineMsg"),ws=ys("RC:FileMsg");ys("RC:GIFMsg"),ys("RC:VcMsg"),ys("RC:LBSMsg"),ys("RC:ReferenceMsg"),ys("RC:ImgTextMsg");var ks={qiniu:function(e,t,n,r){var i,o="https://"+t.uploadHost.qiniu;i=xs()+Ns[0][1]||o,Ns.shift();var s=new XMLHttpRequest;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),s.onreadystatechange=function(){if(4===s.readyState){var i=s.responseText||"{}";(i=JSON.parse(i)).filename=t.uniqueValue,i.uploadMethod=bt?bt.QINIU:"",200===s.status?n.onCompleted(i):Ns.length?ks[Ns[0][0]](e,t,n,r):n.onError("upload fail")}},t.isChunk&&(i=function(e,t){var n="";return As(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e}(i+="/mkblk/"+e.size,t.multi_parmas)),s.open(t.method,i,!0),n.onOpen(s),t.stream&&s.setRequestHeader("authorization","UpToken "+t.multi_parmas.token),As(t.headers,(function(e,t){s.setRequestHeader(e,t)})),s.send(e)},baidu:function(e,t,n,r){if(console.log(r,t),r.size>Os)throw new Error("the file size is over 5GB!");var i=t||{};t=t||Cs;var o=new XMLHttpRequest,s=xs();if(i.uploadHost.bos||i.bosUploadPath){var a=s+Ns[0][1]+i.bosUploadPath;Ns.shift();var c=i.bosHeader||{},u={filename:t.uniqueValue||r.uniqueName,name:r.name,downloadUrl:a,isBosRes:!0};o.upload&&t.support_options&&(o.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)}),o.onreadystatechange=function(){if(4===o.readyState){var i=o.responseText||"{}";(i=JSON.parse(i)).filename=t.uniqueValue,200===o.status?n.onCompleted(u,!0):Ns.length?ks[Ns[0][0]](e,t,n,r):n.onError("upload fail")}},o.open(t.method,a,!0),o.setRequestHeader("authorization",c.bosToken),o.setRequestHeader("x-bce-date",c.bosDate),o.send(r)}},aliyun:function(e,t,n,r){if(r.size>Os)throw new Error("the file size is over 5GB!");var i=new FormData;i.set("file",e.get("file")),i.set("key",e.get("key")),i.set("token",e.get("token"));var o=Ns[0][1];Ns.shift(),e=e||Rs,t=(t=t||{})||Cs;var s=new XMLHttpRequest,a=xs()+t.ossBucketName+"."+o;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),s.onreadystatechange=function(){if(4===s.readyState){var e=s.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=bt?bt.ALI:"",200===s.status?n.onCompleted(e):Ns.length?ks[Ns[0][0]](i,t,n,r):n.onError("upload fail")}},s.open(t.method,a,!0),console.log("ali:url",a);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",r),s.send(e)},s3:function(e,t,n,r){var i=new FormData,o=new XMLHttpRequest,s=xs(),a=Ns[0][1],c=s+t.s3BucketName+"."+a;console.log("uploadS3:url",c),Ns.shift(),o.upload&&t.support_options&&(o.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),o.onreadystatechange=function(){if(4===o.readyState){var i=o.responseText||"{}";if((i=JSON.parse(i)).name=t.uniqueValue,i.filename=t.uploadFileName,i.uploadMethod=bt.AWS,console.log("UploadMethod:",bt),200===o.status||204===o.status)n.onCompleted(i);else if(Ns.length){var s=new FormData;s.set("file",e.get("file")),s.set("key",e.get("key")),s.set("token",e.get("token")),ks[Ns[0][0]](s,t,n,r)}else n.onError("upload fail")}},o.open(t.method,c,!0);var u=t?t.s3Header:{},d=r&&r.type;"text/html"===d?i.set("Content-Disposition","inline;"):i.set("Content-Disposition","attachment;"),i.set("Content-Type",d),i.set("x-amz-credential",u.s3Credential),i.set("x-amz-algorithm",u.s3Algorithm),i.set("x-amz-date",u.s3Date),i.set("policy",u.s3Policy),i.set("x-amz-signature",u.s3Signature),i.set("key",t.uploadFileName),i.set("file",r),o.send(i)},stc:function(e,t,n,r){new FormData;var i=new XMLHttpRequest;xs();var o="https://"+Ns[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;Ns.shift(),i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),i.onreadystatechange=function(){if(4===i.readyState){var o=i.responseText||"{}";if((o=JSON.parse(o)).name=t.uniqueValue,o.filename=t.uploadFileName,o.uploadMethod=bt?bt.STC:"",200===i.status||204===i.status)n.onCompleted(o);else if(Ns.length){var s=new FormData;s.set("file",e.get("file")),s.set("key",e.get("key")),s.set("token",e.get("token")),ks[Ns[0][0]](s,t,n,r)}else n.onError("upload fail")}},i.open("PUT",o,!0);var s=t?t.stcHeader:{};i.setRequestHeader("Content-Type",r.type),"text/html"===r.type?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attachment;"),i.setRequestHeader("Authorization",s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),i.setRequestHeader("x-amz-date",s.stcDate),i.send(r)}},Ns=[],Os=5368709120;function As(e,t){for(var n in e)t(n,e[n])}function xs(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}var Ps={form:function(e,t){var n=new FormData;if(t.unique_key){var r=e.name.substr(e.name.lastIndexOf(".")),i=Ms()+r;n.append(t.unique_key,i),t.uniqueValue=i}return n.append(t.file_data_name,e),Ls(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var r=e.name.substr(e.name.lastIndexOf(".")),i=Ms()+r;n[t.unique_key]=i,t.uniqueValue=i}return n[t.file_data_name]=e,Ls(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Ms(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function Ls(e,t){for(var n in e)t(n,e[n])}var Us,Ds=0;function Vs(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:Ps.form,genUId:Ms};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;Ls(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(Rs=e,Cs=t,Ns=[],t.ossConfig){var r,i,o=JSON.parse(t.ossConfig),s="",a=[];o.forEach((function(e){var t=Number(e.p)-1;for(var n in e)"aliyun"===n&&(s=e[n]),"s3"===n&&(r=e[n]),"stc"===n&&(i=e[n]),"p"!==n&&(a[t]=[n,e[n]])})),a.forEach((function(e){e&&Ns.push(e)})),o.length!==Ns.length&&(Ns=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",s],["s3",r],["stc",i]])}else Ns=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var c;if(t.ossConfig){var u=t&&JSON.parse(t.ossConfig);Array.isArray(u)||(u=[]),c=u.find((function(e){return Object.keys(e).includes("stc")}))}if(c&&1===parseInt(c.p)&&e.size>=4194304)!function(e,t,n){var r,i,o=e&&e.type||"text/plain",s=o.indexOf("image")>-1?1:4,a=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var u=c.find((function(e){return Object.keys(e).includes("stc")})),d="uploads";as.imClient.getFileToken(s,r,"POST",d).then((function(e){r=e.fileName,i="https://"+u.stc+"/"+t.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var s=new XMLHttpRequest;s.open("POST",i+"?"+d,!0),"text/html"===o?s.setRequestHeader("Content-Disposition","inline;"):s.setRequestHeader("Content-Disposition","attacshment;"),s.setRequestHeader("Authorization",e&&e.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),s.setRequestHeader("x-amz-date",e&&e.stcDate),s.setRequestHeader("Content-Type",o),s.send(),s.onreadystatechange=function(e){if(4===s.readyState){var t=s.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===s.status||204===s.status?function(e){for(var t=[],n=1;n<=a;n++)t.push(p(e,n));f(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],h=new Map;function f(c,u){u&&Array.isArray(u)&&0!==u.length&&Promise.all(u).then((function(){var u="uploadId="+c;if(h.size===a)as.imClient.context.getFileToken(s,r,"POST",u).then((function(r){console.log("onSuccess",r),console.log("onSuccess:uploadId",c);var s=new XMLHttpRequest;s.open("POST",i+"?"+u,!0),s.setRequestHeader("Authorization",r&&r.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",r&&r.stcContentSha256),s.setRequestHeader("x-amz-date",r&&r.stcDate),s.setRequestHeader("Content-Type",o);var a="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",d=Array.from(h.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",d),d.map((function(e){a+="<Part><ETag>".concat(h.get(e),"</ETag><PartNumber>").concat(e,"</PartNumber></Part>")})),a+="</CompleteMultipartUpload>",s.send(a),console.log("xml",a),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var r={};r.name=e.name,r.filename=t.uploadFileName,r.uploadMethod=bt.STC,n.onCompleted(r)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var d,g=[],m=C(l);try{for(m.s();!(d=m.n()).done;){var v=d.value;g.push(p(c,v))}}catch(_){m.e(_)}finally{m.f()}f(c,g)}}),(function(e){console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t,r=[],i=C(l);try{for(i.s();!(t=i.n()).done;){var o=t.value;r.push(p(c,o))}}catch(s){i.e(s)}finally{i.f()}f(c,r)}))}function p(n,a){return new Promise((function(c,u){var d="partNumber="+a+"&uploadId="+n;as.imClient.context.getFileToken(s,r,"PUT",d).then((function(n){console.log("signature "+a+" onSuccess",n);var r=e&&e.slice((a-1)*t.stc_chunk_size,a*t.stc_chunk_size);console.log("fileChunk:size",r.size);var s=new XMLHttpRequest;s.open("PUT",i+"?"+d,!0),s.setRequestHeader("Authorization",n&&n.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),s.setRequestHeader("x-amz-date",n&&n.stcDate),s.setRequestHeader("Content-Type",o),s.send(r),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var e=s.getResponseHeader("etag");console.log("etag:"+a,e),h.set(a,e),c(e)}else l.includes(a)||l.push(a),u(a)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(a)||l.push(a),u(a)}))}))}}(e,t,n);else{var d=t.data(e,t);ks[Ns[0][0]](d,t,n,e)}}(e,this.options,{onProgress:function(e,n,r){Us=e,r?Us=Ds+e/n*(n-Ds):Ds=Us,t.onProgress(Us,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Bs,Fs,Hs=function(e){return new Vs(e)},js=function(e,t){!function(e,t,n){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image;o.onload=function(){var s=function(e,t,n){var r,i,o,s=e<t,a=0,c=0;return(s?t/e:e/t)>n.scale?(s?(i=100,c=((o=t/(r=e/100))-n.maxHeight)/2):(o=100,a=((i=e/(r=t/100))-n.maxWidth)/2),{w:i,h:o,x:-a,y:-c}):(s?(r=t/n.maxHeight,o=n.maxHeight,i=e/r):(r=e/n.maxWidth,i=n.maxWidth,o=t/r),{w:i,h:o,x:-a,y:-c})}(o.width,o.height,t);r.width=s.w>t.maxWidth?t.maxWidth:s.w,r.height=s.h>t.maxHeight?t.maxHeight:s.h,i.drawImage(o,s.x,s.y,s.w,s.h);try{var a=r.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");a=a.replace(c,""),n(a)}catch(e){throw new Error(e)}},o.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)}(e.file,e.compress,t)},Ks=function(e,t){if(e.getToken)e.getToken((function(n,r){r=r||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=r.bos,e.ossConfig=r.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=r.bosDate,e.bosHeader.bosToken=r.bosToken,e.bosUploadPath=r.path,e.aliHeader={},e.aliHeader.osskeyId=r.osskeyId,e.aliHeader.ossPolicy=r.ossPolicy,e.aliHeader.ossSign=r.ossSign,e.ossBucketName=r.ossBucketName,e.uploadFileName=r.fileName,e.s3Header={},e.s3Header.s3Credential=r.s3Credential,e.s3Header.s3Algorithm=r.s3Algorithm,e.s3Header.s3Date=r.s3Date,e.s3Header.s3Policy=r.s3Policy,e.s3Header.s3Signature=r.s3Signature,e.s3BucketName=r.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=r.stcAuthorization,e.stcHeader.stcContentSha256=r.stcContentSha256,e.stcHeader.stcDate=r.stcDate,e.stcBucketName=r.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",r);var i=Hs(e);t(i)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Hs(e);t(n)}},qs=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var r=e.compressThumbnail||js;e.compress?r(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Gs=function(e){var t=this;this.instance=e,this.upload=function(e,n){qs({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Ys=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var r={file:e,compress:n.cfg};qs(r,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Js=function(e,t){Ks(e,(function(e){var n=new Gs(e);t(n)}))},zs=function(e,t){Ks(e,(function(n){var r={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},i=new Ys(n,r);t(i)}))};function Ws(e){return Bs=Bs||new AudioContext,new Promise((function(t,n){Bs.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Qs(e,t,n){return Ao(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return xo(this,(function(h){switch(h.label){case 0:return n=n||{},t instanceof _s==0?(Mo.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,cs.ILLGAL_PARAMS]):(Wt("conversation.channelId",null==e?void 0:e.channelId,Bt.CHANNEL_ID),r=e.conversationType,i=e.targetId,o=e.channelId,s="conversationType:"+r+",targetId:"+i,Mo.debug("send message ->"+s),(a=Object.assign(n,t)).channelId=o||"",[4,as.imClient.context.sendMessage(r,i,a)]);case 1:return c=h.sent(),u=c.code,d=c.data,u===it.SUCCESS?(l=os(d),[2,{code:u,data:l}]):(Mo.warn("send message fail ->"+u+":"+us[u]+","+s),[2,{code:u,msg:us[u],data:os({isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:r,targetId:i,channelId:o||"",senderUserId:as.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:nt.SEND,isOffLineMessage:!1,sentTime:(null==d?void 0:d.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:oe.UNREAD})}])}}))}))}function Xs(e,t){return function(n,r,i,o){return new Promise((function(s){var a;!function(e,t,n,r){var i,o=this;if(void 0===t&&(t=Le.FILE),i=t===Le.IMAGE?Le.IMAGE:Le.FILE,!Fs){Fs="upload.qiniup.com";var s=as.imClient.context.getInfoFromCache();if(s&&s.ossConfig)try{var a=JSON.parse(s.ossConfig).find((function(e){return void 0!==e.qiniu}));a&&(Fs=a.qiniu)}catch(e){}}var c=Oo({domain:Fs,getToken:function(e){as.imClient.context.getFileToken(i).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},r);(i===Le.IMAGE?zs:Js)(c,(function(r){r.upload(e,{onProgress:function(e,t){var r,i=Math.floor(e/t*100);null===(r=n.onProgress)||void 0===r||r.call(n,i)},onCompleted:function(r){return Ao(o,void 0,void 0,(function(){var o=this;return xo(this,(function(s){return function(e,t,n,r,i){return Wt("fileType",e,ze,!0),Wt("filename",t,Bt.STRING),Wt("saveName",n,Bt.STRING),Wt("serverType",i,Bt.NUMBER),new Promise((function(o){as.imClient.context.getFileUrl(e,t,n,r,i).then((function(e){o({code:it.SUCCESS,data:e})})).catch((function(e){o({code:e})}))}))}(i,r.filename,r.name,r,r.uploadMethod).then((function(s){return Ao(o,void 0,void 0,(function(){var o,a;return xo(this,(function(c){return 0!==s.code?(n.onFail(s),[2]):((o=s.data).type=e.type,o.name=r.name||r.filename,t===Le.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Ws).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):((a=new FileReader).onload=function(){a.result?Ws(a.result).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):n.onSuccess(o)},a.onerror=function(){o.duration=0,n.onSuccess(o)},a.readAsArrayBuffer(e)),[2]):(i===Le.IMAGE&&(o.thumbnail=r.thumbnail),n.onSuccess(o),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(r.file,e,{onProgress:null==i?void 0:i.onProgress,onSuccess:function(e){var a,c=(null===(a=null==i?void 0:i.onComplete)||void 0===a?void 0:a.call(i,{url:e.downloadUrl}))||t(e,r);Qs(n,c,o).then(s)},onFail:function(e){s({code:it.UPLOAD_FILE_FAILED,msg:e||it[it.UPLOAD_FILE_FAILED]})}},(null===(a=o)||void 0===a?void 0:a.thumbnailConfig)||{})}))}}function Zs(e,t,n,r){return Wt("messageType",e,Bt.STRING,!0),Wt("isPersited",t,Bt.BOOLEAN,!0),Wt("isCounted",n,Bt.BOOLEAN,!0),as.imClient.context.registerMessageType(e,t,n,r),ys(e,t,n)}
  27. /*! *****************************************************************************
  28. Copyright (c) Microsoft Corporation.
  29. Permission to use, copy, modify, and/or distribute this software for any
  30. purpose with or without fee is hereby granted.
  31. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  32. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  33. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  34. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  35. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  36. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  37. PERFORMANCE OF THIS SOFTWARE.
  38. ***************************************************************************** */
  39. function $s(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}Xs(Le.FILE,(function(e,t){return new ws({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),Xs(Le.IMAGE,(function(e,t){return new Es({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Xs(Le.AUDIO,(function(e,t){return new Ts({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),Xs(Le.SIGHT,(function(e,t){return new Ss({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})})),Xs(Le.COMBINE_HTML,(function(e,t){return new bs({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})})),Ht.add("imlib","5.1.1"),Ht.validEngine("~5.1.1")||Mo.error("The current engine version '"+Ht.getInfo().engine+"' error,imlib required engine version at least '~5.1.1'.");var ea,ta,na=new Xe("RCRTC");!function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",e[e.PARAMS_ERROR=50001]="PARAMS_ERROR",e[e.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",e[e.NOT_IN_ROOM=50003]="NOT_IN_ROOM",e[e.SERVICE_INVALID=50004]="SERVICE_INVALID",e[e.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",e[e.SIGNAL_ERROR=53001]="SIGNAL_ERROR",e[e.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",e[e.REQUEST_FAILED=53004]="REQUEST_FAILED",e[e.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",e[e.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",e[e.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",e[e.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",e[e.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",e[e.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",e[e.PERMISSION_DENIED=53012]="PERMISSION_DENIED",e[e.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",e[e.INVALID_TAGS=53014]="INVALID_TAGS",e[e.INVALID_USER_ID=53015]="INVALID_USER_ID",e[e.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",e[e.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",e[e.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",e[e.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",e[e.TRACK_NOT_READY=53020]="TRACK_NOT_READY",e[e.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",e[e.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",e[e.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",e[e.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",e[e.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",e[e.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",e[e.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",e[e.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",e[e.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",e[e.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM"}(ea||(ea={})),function(e){e[e.JOIN_REFUSED=40032]="JOIN_REFUSED"}(ta||(ta={}));var ra=function(){function e(){_(this,e),this.queue=[],this.locked=!1}return R(e,[{key:"checkToStart",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.queue.length&&!this.locked){e.next=2;break}return e.abrupt("return");case 2:return this.locked=!0,t=this.queue.shift(),n=t.resolve,r=t.task,i=t.reject,e.prev=4,e.next=7,r();case 7:o=e.sent,n(o),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),i(e.t0);case 14:this.locked=!1,this.checkToStart();case 15:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"push",value:function(e){var t=this,n=new Promise((function(n,r){t.queue.push({resolve:n,task:e,reject:r})}));return this.checkToStart(),n}}]),e}(),ia=new ra,oa=function(e){return ia.push(e)},sa=!0,aa=!0;function ca(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function ua(e,t,n){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);var r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function da(e){return"boolean"!=typeof e?new Error("Argument type: "+S(e)+". Please use a boolean."):(sa=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function la(e){return"boolean"!=typeof e?new Error("Argument type: "+S(e)+". Please use a boolean."):(aa=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ha(){if("object"==("undefined"==typeof window?"undefined":S(window))){if(sa)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function fa(e,t){aa&&console.warn(e+" is deprecated, please use "+t+" instead.")}function pa(e){return"[object Object]"===Object.prototype.toString.call(e)}function ga(e){return pa(e)?Object.keys(e).reduce((function(t,n){var r=pa(e[n]),i=r?ga(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,v({},n,i))}),{}):e}function ma(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?ma(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((function(t){ma(e,e.get(t),n)}))})))}function va(e,t,n){var r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(n){n.type===r&&n.trackId===t.id&&ma(e,n,i)}))})),i}var _a=ha;function ya(e,t){var n=e&&e.navigator;if(n.mediaDevices){var r=function(e){if("object"!=S(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==S(e[n])?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach((function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==S(e.audio)){var o=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==S(e.video)){var s=e.video.facingMode;s=s&&("object"==S(s)?s:{ideal:s});var a,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?a=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(a=["front"]),a)return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return a.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&a.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=s.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=r(e.video),_a("chrome: "+JSON.stringify(e)),i(e)}));e.video=r(e.video)}return _a("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){r&&r(o(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function Ra(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ca(e){if("object"==S(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var n=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)})),t.stream.getTracks().forEach((function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else ua(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ea(e){if("object"==S(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){n._senders.push(t(n,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var n=t._senders.find((function(t){return t.track===e}));n&&t._senders.splice(t._senders.indexOf(n),1)}))}}else if("object"==S(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ta(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,n=Array.prototype.slice.call(arguments),r=n[0],i=n[1],o=n[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var s=function(e){var t={};return e.result().forEach((function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){n[t]=e.stat(t)})),t[n.id]=n})),t},a=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(a(s(e)))};return t.apply(this,[c,r])}return new Promise((function(n,r){t.apply(e,[function(e){n(a(s(e)))},r])})).then(i,o)}}}function Sa(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return va(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),ua(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return va(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,n,r,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(n?r=!0:n=e),e.track===o})),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Ia(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();n.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(n){var r=t._shimmedLocalStreams[n].indexOf(e);-1!==r&&t._shimmedLocalStreams[n].splice(r,1),1===t._shimmedLocalStreams[n].length&&delete t._shimmedLocalStreams[n]})),i.apply(this,arguments)}}function ba(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ia(e);var n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(n.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}r.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var s=this._streams[n.id];if(s)s.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var a=new e.MediaStream([t]);this._streams[n.id]=a,this._reverseStreams[a.id]=n,this.addStream(a)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[function(n){var r=a(e,n);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((function(t){return a(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=s.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){n._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=n._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function a(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}function c(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}}function wa(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function ka(e,t){ua(e,"negotiationneeded",(function(e){var n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}var Na,Oa,Aa=Object.freeze({__proto__:null,shimMediaStream:Ra,shimOnTrack:Ca,shimGetSendersWithDtmf:Ea,shimGetStats:Ta,shimSenderReceiverGetStats:Sa,shimAddTrackRemoveTrackWithNative:Ia,shimAddTrackRemoveTrack:ba,shimPeerConnection:wa,fixNegotiationNeeded:ka,shimGetUserMedia:ya,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((function(t){var r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),xa=(Na=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==S(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var o=r[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var a=t.parseRtpMap(s),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(a.parameters=c.length?t.parseFmtp(c[0]):{},a.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(a.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),s=-1!==i.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var s=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var o=t.writeRtpDescription(e.kind,n);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t},Na(Oa={exports:{}}),Oa.exports);function Pa(e,t,n,r,i){var o=xa.writeRtpDescription(e.kind,t);if(o+=xa.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=xa.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var a="msid:"+(r?r.id:"-")+" "+s+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+xa.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+xa.localCName+"\r\n"),o}function Ma(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var o=r(e.parameters.apt,n),s=r(t.parameters.apt,i);return o&&s&&o.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach((function(r){for(var o=0;o<t.codecs.length;o++){var s=t.codecs[o];if(r.name.toLowerCase()===s.name.toLowerCase()&&r.clockRate===s.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&s.parameters.apt&&!i(r,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(r.numChannels,s.numChannels),n.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function La(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function Ua(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function Da(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}function Va(e){var t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch((function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))}))}}function Ba(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function Fa(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var n=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){n.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var r=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw Da("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var o=n.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=xa.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw Da("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw Da("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw Da("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw Da("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};var s=e.candidate,a=!s||0===Object.keys(s).length;if(a)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),s.component=1,s.ufrag=i.getLocalParameters().usernameFragment;var c=xa.writeCandidate(s);o.candidate=Object.assign(o.candidate,xa.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=xa.getMediaSections(r._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=a?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r._localDescription.sdp=xa.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),a||r._dispatchEvent("icecandidate",o),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=Ma(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:xa.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(Da("TypeError",'Unsupported type "'+e.type+'"'));if(!La("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(Da("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=xa.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=xa.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=xa.splitSections(r._remoteDescription.sdp),n=t.shift();var i=xa.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var o=r.transceivers[t],s=o.iceGatherer,a=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,d=o.remoteCapabilities;if(!(xa.isRejected(e)&&0===xa.matchPrefix(e,"a=bundle-only").length||o.rejected)){var l=xa.getIceParameters(e,n),h=xa.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===a.state&&a.start(s,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var f=Ma(u,d);r._transceive(o,f.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(Da("TypeError",'Unsupported type "'+i.type+'"'));if(!La("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(Da("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var s={};o.remoteStreams.forEach((function(e){s[e.id]=e}));var a=[],c=xa.splitSections(i.sdp),u=c.shift(),d=xa.matchPrefix(u,"a=ice-lite").length>0,l=xa.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=l;var h=xa.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=xa.splitLines(r),f=xa.getKind(r),p=xa.isRejected(r)&&0===xa.matchPrefix(r,"a=bundle-only").length,g=h[0].substr(2).split(" ")[2],m=xa.getDirection(r,u),v=xa.parseMsid(r),_=xa.getMid(r)||xa.generateIdentifier();if(p||"application"===f&&("DTLS/SCTP"===g||"UDP/DTLS/SCTP"===g))o.transceivers[c]={mid:_,kind:f,protocol:g,rejected:!0};else{var y,R,C,E,T,S,I,b,w;!p&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(f,!0));var k,N,O=xa.parseRtpParameters(r);p||(k=xa.getIceParameters(r,u),(N=xa.getDtlsParameters(r,u)).role="client"),I=xa.parseRtpEncodingParameters(r);var A=xa.parseRtcpParameters(r),x=xa.matchPrefix(r,"a=end-of-candidates",u).length>0,P=xa.matchPrefix(r,"a=candidate:").map((function(e){return xa.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!p&&l&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||p)"answer"!==i.type||p||(R=(y=o.transceivers[c]).iceGatherer,C=y.iceTransport,E=y.dtlsTransport,T=y.rtpReceiver,S=y.sendEncodingParameters,b=y.localCapabilities,o.transceivers[c].recvEncodingParameters=I,o.transceivers[c].remoteCapabilities=O,o.transceivers[c].rtcpParameters=A,P.length&&"new"===C.state&&(!d&&!x||l&&0!==c?P.forEach((function(e){Ua(y.iceTransport,e)})):C.setRemoteCandidates(P)),l&&0!==c||("new"===C.state&&C.start(R,k,"controlling"),"new"===E.state&&E.start(N)),!Ma(y.localCapabilities,y.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&y.sendEncodingParameters[0].rtx&&delete y.sendEncodingParameters[0].rtx,o._transceive(y,"sendrecv"===m||"recvonly"===m,"sendrecv"===m||"sendonly"===m),!T||"sendrecv"!==m&&"sendonly"!==m?delete y.rtpReceiver:(w=T.track,v?(s[v.stream]||(s[v.stream]=new e.MediaStream),n(w,s[v.stream]),a.push([w,T,s[v.stream]])):(s.default||(s.default=new e.MediaStream),n(w,s.default),a.push([w,T,s.default]))));else{(y=o.transceivers[c]||o._createTransceiver(f)).mid=_,y.iceGatherer||(y.iceGatherer=o._createIceGatherer(c,l)),P.length&&"new"===y.iceTransport.state&&(!x||l&&0!==c?P.forEach((function(e){Ua(y.iceTransport,e)})):y.iceTransport.setRemoteCandidates(P)),b=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(b.codecs=b.codecs.filter((function(e){return"rtx"!==e.name}))),S=y.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var M,L=!1;"sendrecv"===m||"sendonly"===m?(L=!y.rtpReceiver,T=y.rtpReceiver||new e.RTCRtpReceiver(y.dtlsTransport,f),L&&(w=T.track,v&&"-"===v.stream||(v?(s[v.stream]||(s[v.stream]=new e.MediaStream,Object.defineProperty(s[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(w,"id",{get:function(){return v.track}}),M=s[v.stream]):(s.default||(s.default=new e.MediaStream),M=s.default)),M&&(n(w,M),y.associatedRemoteMediaStreams.push(M)),a.push([w,T,M]))):y.rtpReceiver&&y.rtpReceiver.track&&(y.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===y.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),y.associatedRemoteMediaStreams=[]),y.localCapabilities=b,y.remoteCapabilities=O,y.rtpReceiver=T,y.rtcpParameters=A,y.sendEncodingParameters=S,y.recvEncodingParameters=I,o._transceive(o.transceivers[c],!1,L)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(s).forEach((function(t){var n=s[t];if(n.getTracks().length){if(-1===o.remoteStreams.indexOf(n)){o.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}a.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(o,t,i,[n])}))}})),a.forEach((function(e){e[2]||r(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(Da("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(r=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var s=xa.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var o=r.track,s=r.kind,a=r.mid||xa.generateIdentifier();r.mid=a,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===s&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,s)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(s+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){s+=Pa(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),s+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,s+="a="+xa.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(s+="a=end-of-candidates\r\n"))}));var a=new e.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(a)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(Da("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(Da("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=xa.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=xa.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var s;e.stream&&("audio"===e.kind?s=e.stream.getAudioTracks()[0]:"video"===e.kind&&(s=e.stream.getVideoTracks()[0]),s&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var a=Ma(e.localCapabilities,e.remoteCapabilities);!a.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=Pa(e,a,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(Da("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var s=0;s<n.transceivers.length;s++)if(n.transceivers[s].mid===e.sdpMid){o=s;break}var a=n.transceivers[o];if(!a)return i(Da("OperationError","Can not add ICE candidate"));if(a.rejected)return r();var c=Object.keys(e.candidate).length>0?xa.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===o||o>0&&a.iceTransport!==n.transceivers[0].iceTransport)&&!Ua(a.iceTransport,c))return i(Da("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=xa.getMediaSections(n._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=xa.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=xa.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=xa.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw Da("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i}(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&fa("RTCIceServer.url","RTCIceServer.urls");var r="string"==typeof t;return r&&(t=[t]),t=t.filter((function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n})),delete e.url,e.urls=r?t[0]:t,!!t.length}}))}(e.iceServers,t.version),ha("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function Ha(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var ja=Object.freeze({__proto__:null,shimPeerConnection:Fa,shimReplaceTrack:Ha,shimGetUserMedia:Va,shimGetDisplayMedia:Ba});function Ka(e,t){var n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){fa("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var i=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"==S(e)&&"object"==S(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},r&&r.prototype.getSettings){var s=r.prototype.getSettings;r.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var a=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==S(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[e])}}}}function qa(e){"object"==S(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ga(e,t){if("object"==S(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],s=e[2];return r.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,s)}}}function Ya(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function Ja(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n}),ua(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function za(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;fa("removeStream","removeTrack"),this.getSenders().forEach((function(n){n.track&&e.getTracks().includes(n.track)&&t.removeTrack(n)}))})}function Wa(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Qa(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach((function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var r=t.apply(this,arguments);if(n){var i=r.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return r})}}function Xa(e){if("object"==S(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Za(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}function $a(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}var ec=Object.freeze({__proto__:null,shimOnTrack:qa,shimPeerConnection:Ga,shimSenderGetStats:Ya,shimReceiverGetStats:Ja,shimRemoveStream:za,shimRTCDataChannel:Wa,shimAddTransceiver:Qa,shimGetParameters:Xa,shimCreateOffer:Za,shimCreateAnswer:$a,shimGetUserMedia:Ka,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function tc(e){if("object"==S(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){n._localStreams?n._localStreams.includes(e)||n._localStreams.push(e):n._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var n=this._localStreams.indexOf(e);if(-1!==n){this._localStreams.splice(n,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function nc(e){if("object"==S(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function rc(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var a=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){var r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){var r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}}function ic(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,r=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return r(oc(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function oc(e){return e&&void 0!==e.video?Object.assign({},e,{video:ga(e.video)}):e}function sc(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var r=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(fa("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[i])}e.iceServers=r}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function ac(e){"object"==S(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function cc(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var n=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function uc(e){"object"!=S(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var dc=Object.freeze({__proto__:null,shimLocalStreamsAPI:tc,shimRemoteStreamsAPI:nc,shimCallbacksAPI:rc,shimGetUserMedia:ic,shimConstraints:oc,shimRTCIceServerUrls:sc,shimTrackEventTransceiver:ac,shimCreateOfferLegacy:cc,shimAudioContext:uc});function lc(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==S(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),r=xa.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,ua(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function hc(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var n=function(e){if(!e||!e.sdp)return!1;var t=xa.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=xa.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){var n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},o=function(e,n){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var i=xa.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),a=e.sdpSemantics;"plan-b"===a&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){var c,u=r(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return s.apply(this,arguments)}}}function fc(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return n(e,this),e},ua(e,"datachannel",(function(e){return n(e.channel,e.target),e}))}function n(e,t){var n=e.send;e.send=function(){var r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}}function pc(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}}function gc(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return n.apply(this,arguments)}}}function mc(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}var vc,_c,yc,Rc=Object.freeze({__proto__:null,shimRTCIceCandidate:lc,shimMaxMessageSize:hc,shimSendThrowTypeError:fc,shimConnectionState:pc,removeExtmapAllowMixed:gc,shimAddIceCandidateNullOrEmpty:mc}),Cc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},r=ha,i=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=ca(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=ca(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=ca(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=ca(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(t),o={browserDetails:i,commonShim:Rc,extractVersion:ca,disableLog:da,disableWarnings:la};switch(i.browser){case"chrome":if(!Aa||!wa||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=Aa,mc(t,i),ya(t,i),Ra(t),wa(t,i),Ca(t),ba(t,i),Ea(t),Ta(t),Sa(t),ka(t,i),lc(t),pc(t),hc(t,i),fc(t),gc(t,i);break;case"firefox":if(!ec||!Ga||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=ec,mc(t,i),Ka(t,i),Ga(t,i),qa(t),za(t),Ya(t),Ja(t),Wa(t),Qa(t),Xa(t),Za(t),$a(t),lc(t),pc(t),hc(t,i),fc(t);break;case"edge":if(!ja||!Fa||!n.shimEdge)return r("MS edge shim is not included in this adapter release."),o;r("adapter.js shimming edge."),o.browserShim=ja,Va(t),Ba(t),Fa(t,i),Ha(t),hc(t,i),fc(t);break;case"safari":if(!dc||!n.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=dc,mc(t,i),sc(t),cc(t),rc(t),tc(t),nc(t),ac(t),ic(t),uc(t),lc(t),hc(t,i),fc(t),gc(t,i);break;default:r("Unsupported browser!")}return o}({window:"undefined"==typeof window?void 0:window});!function(e){e.FPS_10="FPS_10",e.FPS_15="FPS_15",e.FPS_24="FPS_24",e.FPS_30="FPS_30"}(vc||(vc={})),function(e){e.W176_H132="W176_H132",e.W176_H144="W176_H144",e.W256_H144="W256_H144",e.W320_H180="W320_H180",e.W240_H240="W240_H240",e.W320_H240="W320_H240",e.W480_H360="W480_H360",e.W640_H360="W640_H360",e.W480_H480="W480_H480",e.W640_H480="W640_H480",e.W720_H480="W720_H480",e.W1280_H720="W1280_H720",e.W1920_H1080="W1920_H1080"}(_c||(_c={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(yc||(yc={}));var Ec=(v(z={},_c.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),v(z,_c.W176_H144,{width:176,height:144,maxBitrate:160,minBitrate:80}),v(z,_c.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),v(z,_c.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),v(z,_c.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),v(z,_c.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),v(z,_c.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),v(z,_c.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),v(z,_c.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),v(z,_c.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),v(z,_c.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),v(z,_c.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),v(z,_c.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),z),Tc=function(e,t){var n=e*t,r=Number.MAX_VALUE,i=null;for(var o in Ec){var s=Ec[o],a=Math.abs(s.width*s.height-n);a<r&&(i=s,r=a)}return i},Sc={10:1,15:1,24:1.5,30:1.5},Ic=function(e){var t=Number.MAX_VALUE,n=1;for(var r in Sc){var i=Math.abs(e-parseInt(r));i<t&&(t=i,n=Sc[r])}return n},bc=function(){return $s(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"videoinput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},wc=function(){return $s(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"audioinput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},kc=function(){return $s(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"audiooutput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},Nc=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s){var a;return _(this,n),(a=t.call(this))._tag=e,a._userId=r,a._kind=i,a._isLocalTrack=o,a._roomId=s,a._localMuted=!1,a._remoteMuted=!1,a._streamId=[a._userId||a._roomId,a._tag].join("_"),a._id=[a._streamId,a.isAudioTrack()?0:1].join("_"),a}return R(n,[{key:"getStreamId",value:function(){return this._streamId}},{key:"getTrackId",value:function(){return this._id}},{key:"getUserId",value:function(){return this._userId}},{key:"__innerGetMediaStreamTrack",value:function(){return this._msTrack}},{key:"getTag",value:function(){return this._tag}},{key:"isLocalTrack",value:function(){return this._isLocalTrack}},{key:"isVideoTrack",value:function(){return"video"===this._kind}},{key:"isAudioTrack",value:function(){return"audio"===this._kind}},{key:"isReady",value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}},{key:"__innerSetMediaStreamTrack",value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,n=t.getTracks()[0];n&&t.removeTrack(n),e?t.addTrack(e):this._element&&(this._element.pause(),this._element.srcObject=null)}},{key:"_setLocalMuted",value:function(e){this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e}},{key:"mute",value:function(){na.info("set ".concat(this._id," enabled: false")),this._setLocalMuted(!0)}},{key:"unmute",value:function(){na.info("set ".concat(this._id," enabled: true")),this._setLocalMuted(!1)}},{key:"isLocalMuted",value:function(){return this._localMuted}},{key:"isMCUTrack",value:function(){return Boolean(this._roomId)}},{key:"isOwnerMuted",value:function(){return this._remoteMuted}},{key:"play",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._msTrack){n.next=2;break}return n.abrupt("return",(na.warn("the track is not ready to play -> id: ".concat(this._id)),{code:ea.TRACK_NOT_READY}));case 2:if("ended"===this._msTrack.readyState&&na.warn("the track's readyState is 'ended' -> id: ".concat(this._id)),!(null==t?void 0:t.volume)){n.next=6;break}if(Ve(null==t?void 0:t.volume)){n.next=5;break}return n.abrupt("return",(na.error("".concat(null==t?void 0:t.volume," is not a number, the valid range of options.volume is 0-100")),{code:ea.PARAMS_ERROR}));case 5:(null==t?void 0:t.volume)<0&&(t.volume=0,na.warn("the valid range of options.volume is 0-100, the value of volume has been set 0")),(null==t?void 0:t.volume)>100&&(t.volume=100,na.warn("the valid range of options.volume is 0-100, the value of volume has been set 100"));case 6:if(!(null==t?void 0:t.audioDeviceId)){n.next=13;break}return n.next=9,kc();case 9:if(n.t0=function(e){return e.deviceId},n.t1=t.audioDeviceId,n.sent.map(n.t0).includes(n.t1)){n.next=13;break}return n.abrupt("return",(na.error("the options.audioDeviceId is invalid --\x3e ".concat(t.audioDeviceId)),{code:ea.PARAMS_ERROR}));case 13:if(!(r=this.isVideoTrack())||e&&e instanceof HTMLVideoElement){n.next=16;break}return n.abrupt("return",(na.error("the video track need an <video> to play -> id: ".concat(this._id)),{code:ea.VIDEO_TRACK_MISS_MEDIA_ELEMENT}));case 16:if(this._element=r?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t;na.debug("HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.ondurationchange=function(e){var t;na.debug("HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onloadedmetadata=function(e){var t;na.debug("HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onloadeddata=function(e){var t;na.debug("HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onabort=function(e){var t;na.info("HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.oncanplay=function(e){var t;na.info("HTMLMediaElement oncanplay -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onvolumechange=function(e){var t,n=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));na.info("HTMLMediaElement onvolumechange -> volume: ".concat(n,", trackId: ").concat(i._id))},this._element.srcObject=this._msStream,this._element.autoplay=!0,r&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),r||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=(null==t?void 0:t.volume)/100),n.prev=17,!(null==t?void 0:t.audioDeviceId)||r){n.next=23;break}return n.next=21,this._element.setSinkId(t.audioDeviceId);case 21:n.next=24;break;case 23:this._element.play();case 24:n.next=29;break;case 26:return n.prev=26,n.t2=n.catch(17),n.abrupt("return","No permission to use requested device"===n.t2.message?(na.error("setSinkId failed -> ".concat(n.t2.message)),{code:ea.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(na.error(n.t2),{code:ea.TRACK_PLAY_ERROR}));case 29:return n.abrupt("return",{code:ea.SUCCESS});case 30:case"end":return n.stop()}}),n,this,[[17,26]])})))}},{key:"__innerDestroy",value:function(){this.__innerSetMediaStreamTrack(void 0)}},{key:"__releaseMediaElement",value:function(){this._element&&(this._element.remove(),this._element.srcObject=null)}}]),n}($e),Oc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var s;return _(this,n),(s=t.call(this,e,r,i,!0))._isPublished=!1,s.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,s.emit(n.EVENT_LOCAL_TRACK_END,p(s)),s.removeAll(n.EVENT_LOCAL_TRACK_END)},s}return R(n,[{key:"_setLocalMuted",value:function(e){var t=this._localMuted!==e;c(m(n.prototype),"_setLocalMuted",this).call(this,e),this._remoteMuted=this._localMuted,t&&this.emit(n.__INNER_EVENT_MUTED_CHANGE__,this)}},{key:"__innerSetPublished",value:function(e){this._isPublished=e}},{key:"isPublished",value:function(){return this._isPublished}},{key:"destroy",value:function(){var e;na.info("track is destroyed -> trackId: ".concat(this.getTrackId())),null===(e=this._msTrack)||void 0===e||e.stop(),c(m(n.prototype),"__innerDestroy",this).call(this),this.isAudioTrack()&&c(m(n.prototype),"__releaseMediaElement",this).call(this),this.emit(n.__INNER_EVENT_DESTROY__,this)}},{key:"setBitrate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!Ve(e)||!Ve(t)||!Ve(n)||e<=0||t<=0||e<t?na.error("setBitrate params error ->"):this._bitrateInfo={max:e,min:t,start:n}}},{key:"getBitrate",value:function(){var e,t,n=this._msTrack?Wc(this._msTrack):{min:0,max:0},r=n.min,i=n.max;return{min:(null===(e=this._bitrateInfo)||void 0===e?void 0:e.min)||r,max:(null===(t=this._bitrateInfo)||void 0===t?void 0:t.max)||i}}}]),n}(Nc);Oc.EVENT_LOCAL_TRACK_END="local-track-end",Oc.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",Oc.__INNER_EVENT_DESTROY__="inner-destroy";var Ac=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"audio",i)}return R(n,[{key:"setBitrate",value:function(e,t,n){na.warn("`setBitrate` invalid for audio track")}},{key:"getBitrate",value:function(){return{start:32,max:32,min:32}}}]),n}(Oc),xc=function(e){d(n,e);var t=h(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _(this,n),(o=t.call(this,e,r,"video",i))._isTiny=s,o}return R(n,[{key:"__isTiny",value:function(){return this._isTiny}},{key:"getStreamId",value:function(){var e=c(m(n.prototype),"getStreamId",this).call(this);return this._isTiny?"".concat(e,"_tiny"):e}},{key:"getTrackId",value:function(){var e=c(m(n.prototype),"getTrackId",this).call(this);return this._isTiny?"".concat(e,"_tiny"):e}}]),n}(Oc),Pc=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s){var a;return _(this,n),(a=t.call(this,e,r,i,o))._resource=s,n.__innerSetMapping(a.getTrackId(),s),a}return R(n,[{key:"destroy",value:function(){this.isAudioTrack()&&this.mute(),n.__innerRemoveMapping(this.getTrackId(),this._resource),c(m(n.prototype),"destroy",this).call(this)}}],[{key:"__innerSetMapping",value:function(e,t){var n=this._mapping.get(t)||[];n.push(e),this._mapping.set(t,n)}},{key:"__innerRemoveMapping",value:function(e,t){var n,r,i=null===(n=this._mapping.get(t))||void 0===n?void 0:n.filter((function(t){return t!==e}));i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(r=t.parentNode)||void 0===r||r.removeChild(t))}}]),n}(Oc);Pc._mapping=new Map;var Mc,Lc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){return _(this,n),t.call(this,e,r,"video",i,o)}return R(n)}(Pc),Uc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){return _(this,n),t.call(this,e,r,"audio",i,o)}return R(n,[{key:"_setLocalMuted",value:function(e){this._resource&&(this._resource.muted=e),c(m(n.prototype),"_setLocalMuted",this).call(this,e)}},{key:"play",value:function(){return this._setLocalMuted(!1),Promise.resolve({code:ea.SUCCESS})}}]),n}(Pc),Dc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Ac),Vc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(xc),Bc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(xc),Fc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var s;return _(this,n),(s=t.call(this,e,r,i,!1,o))._isSubscribed=!1,s}return R(n,[{key:"__innerSetRemoteMuted",value:function(e){this._remoteMuted=e}},{key:"__innerSetSubscribed",value:function(e){this._isSubscribed=e}},{key:"isSubscribed",value:function(){return this._isSubscribed}}]),n}(Nc),Hc=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"audio",i)}return R(n)}(Fc),jc=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"video",i)}return R(n)}(Fc),Kc=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},qc=function(e){return JSON.stringify(e)},Gc=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Yc="http:"!==location.protocol||["localhost","127.0.0.1"].includes(location.hostname),Jc=function(e){if(void 0===e)return 0;if(Ve(e))return e;var t=e;return t.exact||t.ideal||t.max||0},zc=function(e){var t=e.getConstraints();return{width:Jc(t.width),height:Jc(t.height),frameRate:Jc(t.frameRate)}},Wc=function(e){var t=zc(e),n=t.width,r=t.height,i=t.frameRate,o=Tc(n,r),s=Ic(i);return{min:o.minBitrate*s,max:o.maxBitrate*s}},Qc=function(e){return[e.msid,e.mediaType].join("_")},Xc=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},Zc=function(e,t){return[e,t].join("_")},$c=function(e){return e.map((function(e){return Object.assign({},e)}))},eu=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.slice();var r=[],i=[],o=[];return t.forEach((function(t){var i=Qc(t),s=e.findIndex((function(e){return Qc(e)===i}));if(n&&(s=e.findIndex((function(e){return e.uri===t.uri}))),-1!==s){var a=e[s];a.uri!==t.uri?r.push(t):a.state!==t.state&&o.push(t),e.splice(s,1)}else r.push(t)})),i.push.apply(i,a(e)),{publishedList:r,unpublishedList:i,modifiedList:o}},tu=function(e){var t=e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),n=s(t,2);return{width:n[0],height:n[1]}},nu=function(e){return!!_c[e]},ru=function(e){return!!vc[e]},iu=function(e){return parseInt(e.replace("FPS_",""))},ou={browser:(Mc=Cc.browserDetails).browser,version:Mc.version,supportsUnifiedPlan:!1!==Mc.supportsUnifiedPlan};function su(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function au(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var cu,uu,du=function(e){return"[object Null]"===Object.prototype.toString.call(e)},lu=function(e){return 1===e.type},hu=function(e){var t={},n=Object.keys(e.users);return n.length&&n.forEach((function(n){var r=[],i=e.users[n];if(i.uris)try{r.push.apply(r,a(JSON.parse(i.uris)))}catch(e){na.warn("invalid user data -> userId: ".concat(n,", userData: ").concat(i))}t[n]=r})),t};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline"}(cu||(cu={})),function(e){e.SUCCESS="Success",e.FAIL="Fail"}(uu||(uu={}));var fu,pu=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;_(this,e),this._roomId=t,this._roomMode=n,this._context=r,this._gap=i,this._latestTimestamp=Date.now(),this._timer=null}return R(e,[{key:"start",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._timer||(this._timer=setInterval(this._loop.bind(this),this._gap));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"_loop",value:function(){var e,t,n;return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,new Promise((function(e){s._context.rtcPing(s._roomId,s._roomMode).then(e).catch((function(t){na.error("rtcping receive unknown error -> ".concat(t)),e(it.UNKNOWN)})),setTimeout(e,1e4,it.TIMEOUT)}));case 2:if(i=r.sent,o=Date.now(),i!==it.SUCCESS){r.next=6;break}return r.abrupt("return",(this._latestTimestamp=o,void(null===(e=this.onPingResult)||void 0===e||e.call(this,uu.SUCCESS))));case 6:null===(t=this.onPingResult)||void 0===t||t.call(this,uu.FAIL),na.warn("rtcping failed -> code: ".concat(i)),(40003===i||o-this._latestTimestamp>6e4)&&(this.stop(),null===(n=this.onFailed)||void 0===n||n.call(this,40003===i));case 7:case"end":return r.stop()}}),r,this)})))}},{key:"stop",value:function(){this._timer&&(clearInterval(this._timer),this._timer=null)}}]),e}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(fu||(fu={}));var gu,mu,vu,_u,yu,Ru=function(e,t){return Math.round(8*t/e)},Cu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n},Eu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e>1&&(e/=32767);var n=Math.pow(10,t);return Math.ceil(e*n)},Tu=function(e,t,n,r){if(0===t)return 0;if(!n||!r)return Cu(e/t,3);var i=t-r;if(0===i)return 0;var o=e-n;return o<0||i<0?0:Cu(o/i,3)},Su=function(e){var t=e.jitter,n=e.rtt,r=e.packetsLostRate;return!du(t)||!du(n)||0!==r},Iu=function(){function e(t,n){_(this,e),this._rtcPeerConn=t,this._sdpSemantics=n,this._latestPacketsSent={},this._latestBytesSent={},this._latestBytesRecv={},this._latestPacketsRecv={}}return R(e,[{key:"updateBytesSent",value:function(e,t,n){var r,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];r=t-o.bytesSent,i=n-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:n}}else r=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:n};return Ru(i,r)}},{key:"updateBytesRecv",value:function(e,t,n){var r,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];r=t-o.bytesRecv,i=n-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n}}else r=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n};return Ru(i,r)}},{key:"updateSenderPacketsLost",value:function(e,t,n){var r;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,s=i.packetsSent;r=Tu(t,n,o,s),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?s:n}else r=Tu(t,n),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=n;return r}},{key:"updateReceiverPacketsLost",value:function(e,t,n){var r;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,s=i.packetsRecv;r=Tu(t,n+t,o,s+o)}else r=Tu(t,n);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:n},r}},{key:"clearLatestpacketsSent",value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===yc.VIDEO_ONLY){var n="".concat(e,"_tiny");delete t._latestPacketsSent[n],delete t._latestBytesSent[n]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}},{key:"clearLatestPacketsRecv",value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}},{key:"parseRTCStatsReport",value:function(e){for(var t=e.keys(),n={},r=t.next();!r.done;){var i=r.value,o=e.get(i);/^RTCCodec_/.test(i)||(n[i]=o),r=t.next()}return n}},{key:"formatRCRTCStateReport",value:function(e){return{senders:[],receivers:[]}}},{key:"getAudioLevelList",value:function(e){return[]}},{key:"getResourceIdByParseSdp",value:function(e){var t,n,r,i=e.ssrc,o=e.kind||e.mediaType,s=null===(t=this._rtcPeerConn.currentLocalDescription)||void 0===t?void 0:t.sdp,a=null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp;r="unified-plan"===this._sdpSemantics?new RegExp("a=msid:(.*?) "):new RegExp("a=ssrc:".concat(i," msid:(.*?) "));var c=null==s?void 0:s.split("\r\nm="),u=null==c?void 0:c.filter((function(e){return e.includes("a=ssrc:".concat(i))}))[0],d=null==u?void 0:u.match(r),l=d?d[1]:"";if(l)return"".concat(l,"_").concat("video"===o?1:0);var h=null==a?void 0:a.split("\r\nm="),f=null==h?void 0:h.filter((function(e){return e.includes("a=ssrc:".concat(i))}))[0],p=null==f?void 0:f.match(r);return l=p?p[1]:"","".concat(l,"_").concat("video"===o?1:0)}},{key:"isValidSender",value:function(e){var t,n=null===(t=this._rtcPeerConn.currentLocalDescription)||void 0===t?void 0:t.sdp,r=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(r)&&e.includes("a=inactive")})))}},{key:"isValidReceiver",value:function(e){var t,n=null===(t=this._rtcPeerConn.currentRemoteDescription)||void 0===t?void 0:t.sdp,r=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(r)&&e.includes("a=inactive")})))}}]),e}(),bu=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);n.timestamp=r;var i=Object.keys(e),o=0,s=0;i.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var a=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidSender(a)){var c=a.id,u=a.kind,d=(a.transportId,a.mediaSourceId),l=a.remoteId,h=a.packetsSent,f=a.bytesSent,p=a.trackId,g=a.encoderImplementation,m=a.pliCount,v=a.nackCount;a.firCount;if(p){var _=a.framesPerSecond,y=a.frameWidth,R=a.frameHeight;"video"!==u||y||R||_||(y=e[p].frameWidth,R=e[p].frameHeight,_=d?e[d].framesPerSecond:null);var C=e[l],E=null,T=null,S=0;C&&(E=C.jitter,T=C.roundTripTime,S=C.packetsLost),o+=S;var I=t.getResourceIdByParseSdp(a),b=d?e[d].audioLevel:e[p].audioLevel,w=null;!t._latestPacketsSent[I]&&(t._latestPacketsSent[I]={}),C?w=t.updateSenderPacketsLost(I,S,h):t._latestPacketsSent[I].crtPacketsSent=h;var k=t.updateBytesSent(I,f,r);k<0&&(k=0),s+=k,n.senders.push({id:c,trackId:I,kind:u,packetsLostRate:w,remoteResource:!1,audioLevel:b||0===b?Eu(b):null,frameWidth:y,frameHeight:R,frameRate:_,bitrate:k,jitter:E?Math.round(1e3*E):E,rtt:T,encoderImplementation:g,pliCount:m,nackCount:v,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}}})),i.filter((function(e){return/RTCRemoteInboundRtp(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r],o=i.localId,s=i.jitter,a=i.roundTripTime,c=i.packetsLost,u=n.senders.filter((function(e){return e.id===o}))[0];if(u&&!Su(u)){var d=t.getResourceIdByParseSdp(e[u.id]);u.jitter=Math.round(1e3*s),u.rtt=a;var l=t._latestPacketsSent[d].crtPacketsSent;u.packetsLostRate=t.updateSenderPacketsLost(d,c,l)}}));var a=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var s=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(s)){var c=s.trackId,u=s.packetsLost,d=s.packetsReceived,l=s.jitter,h=s.bytesReceived,f=s.framesPerSecond,p=s.kind,g=s.codecImplementationName,m=s.nackCount,v=s.pliCount;if(c){var _=s.frameWidth,y=s.frameHeight,R=s.audioLevel;"video"===p?_||y||(_=e[c].frameWidth,y=e[c].frameHeight):R||(R=e[c].audioLevel),o+=u;var C=t.getResourceIdByParseSdp(s),E=t.updateReceiverPacketsLost(C,u,d),T=t.updateBytesRecv(C,h,r);T<0&&(T=0),a+=T,n.receivers.push({trackId:C,kind:p,packetsLostRate:E,remoteResource:!0,audioLevel:R||0===R?Eu(R):null,frameWidth:_,frameHeight:y,frameRate:f,bitrate:T,jitter:l?Math.round(1e3*l):0,codecImplementationName:g,nackCount:m,pliCount:v,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}}}));var c=i.filter((function(e){return/^RTCTransport_/.test(e)}))[0];if(c){var u=e[c].selectedCandidatePairId;if(u){var d=e[u],l=d.availableOutgoingBitrate,h=d.availableIncomingBitrate,f=d.currentRoundTripTime,p=d.localCandidateId,g=d.remoteCandidateId,m=e[p],v=m.ip,_=m.port,y=m.networkType,R=e[g],C=R.ip,E=R.port,T=R.protocol;n.iceCandidatePair={IP:v,port:_,networkType:y,remoteIP:C,remotePort:E,protocol:T,bitrateRecv:a,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:l,availableIncomingBitrate:h,totalPacketsLost:o},n.receivers.forEach((function(e){e.rtt=f}))}}return n}},{key:"getAudioLevelList",value:function(e){var t=this,n=[],r=Object.keys(e);return r.filter((function(e){return/^RTCOutboundRTPAudioStream_/.test(e)})).forEach((function(r){var i,o=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidSender(o)){var s=o.mediaSourceId,a=o.trackId,c=t.getResourceIdByParseSdp(o),u=s&&e[s]?e[s].audioLevel:(null===(i=e[a])||void 0===i?void 0:i.audioLevel)||null;n.push({trackId:c,audioLevel:u||0===u?Eu(u):null})}})),r.filter((function(e){return/^RTCInboundRTPAudioStream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(i)){var o=i.trackId,s=i.audioLevel||e[o].audioLevel,a=t.getResourceIdByParseSdp(i);n.push({trackId:a,audioLevel:s||0===s?Eu(s):null})}})),n}}]),n}(Iu),wu=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n=+new Date,r={senders:[],receivers:[],timestamp:n},i=0,o=0,s=0;for(var a in e){var c=e[a],u=c.type;if("outbound-rtp"===u){if("unified-plan"===this._sdpSemantics&&!this.isValidSender(c))continue;c.id;var d=c.kind,l=c.bytesSent,h=c.packetsSent,f=c.bitrateMean,p=c.framerateMean,g=c.nackCount,m=c.pliCount,v=c.remoteId,_=v?e[v]:{jitter:null,roundTripTime:null,packetsLost:0},y=_.jitter,R=_.roundTripTime,C=_.packetsLost,E=this.getResourceIdByParseSdp(c);i+=C;var T=null;!this._latestPacketsSent[E]&&(this._latestPacketsSent[E]={}),v?T=this.updateSenderPacketsLost(E,C,h):this._latestPacketsSent[E].crtPacketsSent=h;var S=0;"video"===d?f&&(S=Math.floor(f/1e3)):S=this.updateBytesSent(E,l,n),S<0&&(S=0),o+=S,r.senders.push({trackId:E,kind:d,packetsLostRate:T,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(p),bitrate:S,jitter:y?Math.round(1e3*y):null,rtt:R,encoderImplementation:null,pliCount:m,nackCount:g,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}if("remote-inbound-rtp"===u&&function(){var n=c.localId,i=t.getResourceIdByParseSdp(e[n]),o=r.senders.filter((function(e){return e.trackId===i}))[0];o&&Su(o)&&(o.jitter=Math.round(1e3*c.jitter),o.rtt=c.rtt,o.packetsLostRate=t.updateSenderPacketsLost(i,c.packetsLost,t._latestPacketsSent[i].crtPacketsSent))}(),"inbound-rtp"===u){if("unified-plan"===this._sdpSemantics&&!this.isValidReceiver(c))continue;c.id;var I=c.packetsLost,b=c.bytesReceived,w=c.packetsReceived,k=c.jitter,N=c.framerateMean,O=c.kind,A=c.bitrateMean,x=c.nackCount,P=c.pliCount,M=this.getResourceIdByParseSdp(c);i+=I;var L=this.updateReceiverPacketsLost(M,I,w),U=0;"video"===O?A&&(U=Math.floor(A/1e3)):U=this.updateBytesRecv(M,b,n),U<0&&(U=0),s+=U,r.receivers.push({trackId:M,kind:O,packetsLostRate:L,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(N),bitrate:U,jitter:k?Math.round(1e3*k):null,codecImplementationName:null,nackCount:x,pliCount:P,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}if("candidate-pair"===u&&"succeeded"===c.state){var D=e[c.localCandidateId],V=D.address,B=D.port,F=e[c.remoteCandidateId],H=F.address,j=F.port,K=F.protocol;r.iceCandidatePair={IP:V,port:B,networkType:null,remoteIP:H,remotePort:j,protocol:K,bitrateRecv:s,bitrateSend:o,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:i}}}return r.iceCandidatePair&&(r.iceCandidatePair.bitrateSend=o),r.iceCandidatePair&&(r.iceCandidatePair.bitrateRecv=s),r}},{key:"getAudioLevelList",value:function(e){var t=[];for(var n in e){var r=e[n],i=r.type;if("outbound-rtp"===i){if("unified-plan"===this._sdpSemantics&&!this.isValidSender(r))continue;if("video"===r.kind)continue;var o=this.getResourceIdByParseSdp(r);t.push({trackId:o,audioLevel:null})}if("inbound-rtp"===i){if("unified-plan"===this._sdpSemantics&&!this.isValidReceiver(r))continue;if("video"===r.kind)continue;var s=this.getResourceIdByParseSdp(r);t.push({trackId:s,audioLevel:null})}}return t}}]),n}(Iu),ku=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);n.timestamp=r;var i=Object.keys(e),o=0,s=0;i.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var o=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidSender(o)){var a=t.getResourceIdByParseSdp(o),c=o.mediaType,u=(o.transportId,o.remoteId,o.packetsSent,o.bytesSent),d=o.trackId,l=o.encoderImplementation,h=o.pliCount,f=o.nackCount;o.firCount;if(d){var p=e[d],g=p.audioLevel,m=p.frameHeight,v=p.frameWidth,_=t.updateBytesSent(a,u,r);_<0&&(_=0),s+=_,n.senders.push({trackId:a,kind:c,packetsLostRate:null,remoteResource:!1,audioLevel:g||0===g?Eu(g):null,frameWidth:v,frameHeight:m,frameRate:null,bitrate:_,jitter:null,rtt:null,encoderImplementation:l,pliCount:h,nackCount:f,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}}}));var a=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var s=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(s)){var c=s.trackId,u=s.packetsLost,d=s.packetsReceived,l=s.jitter,h=s.bytesReceived,f=s.mediaType,p=s.nackCount,g=s.pliCount,m=t.getResourceIdByParseSdp(s);if(c){var v=e[c],_=v.frameHeight,y=v.frameWidth,R=v.audioLevel;o+=u;var C=t.updateReceiverPacketsLost(m,u,d),E=t.updateBytesRecv(m,h,r);E<0&&(E=0),a+=E,n.receivers.push({trackId:m,kind:f,packetsLostRate:C,remoteResource:!0,audioLevel:R||0===R?Eu(R):null,frameWidth:y,frameHeight:_,frameRate:null,bitrate:E,jitter:l,codecImplementationName:null,nackCount:p,pliCount:g,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}}}));var c=i.filter((function(e){return/^RTCTransport_/.test(e)}))[0];if(c){var u=e[c].selectedCandidatePairId;if(u){var d=e[u],l=d.availableOutgoingBitrate,h=d.availableIncomingBitrate,f=d.currentRoundTripTime,p=d.localCandidateId,g=d.remoteCandidateId,m=e[p],v=m.address,_=m.port,y=e[g],R=y.address,C=y.port,E=y.protocol;n.iceCandidatePair={IP:v||null,port:_,networkType:null,remoteIP:R,remotePort:C,protocol:E,bitrateRecv:a,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:l,availableIncomingBitrate:h,totalPacketsLost:o},n.receivers.forEach((function(e){e.rtt=f}))}}return n}},{key:"getAudioLevelList",value:function(e){var t=this,n=[],r=Object.keys(e);return r.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidSender(i)){var o=i.trackId;if("video"!==i.mediaType){var s=t.getResourceIdByParseSdp(i),a=e[o];n.push({trackId:s,audioLevel:a||0===a?Eu(a):null})}}})),r.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(i)){var o=i.trackId,s=i.mediaType;if(o&&"video"!==s){var a=e[o].audioLevel,c=t.getResourceIdByParseSdp(i);n.push({trackId:c,audioLevel:a||0===a?Eu(a):null})}}})),n}}]),n}(Iu),Nu=function(){function e(t){_(this,e),this._peer=t,this._outboundStreams={}}return R(e,[{key:"getOutboundVideoInfo",value:function(){var e=[];for(var t in this._outboundStreams){var n=this._outboundStreams[t].getVideoTracks()[0];if(n){var r=/_tiny$/.test(t),i=zc(n),o=i.width,s=i.height;e.push({trackId:n.id,simulcast:r?fu.TINY:fu.NORMAL,resolution:"".concat(o,"x").concat(s)})}}return e}},{key:"setRemoteAnswer",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=e.replace(/\s+\r\n/g,"\r\n"),t.prev=1,t.next=4,this._peer.setRemoteDescription({type:"answer",sdp:e});case 4:t.next=9;break;case 6:return t.prev=6,t.t0=t.catch(1),t.abrupt("return",(na.error(t.t0),ea.SET_REMOTE_DESCRIPTION_FAILED));case 9:return t.abrupt("return",ea.SUCCESS);case 10:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"getStatParsr",value:function(e,t){return/chrome/i.test(ou.browser)?new bu(e,t):/Firefox/i.test(ou.browser)?new wu(e,t):/Safari/i.test(ou.browser)?new ku(e,t):null}}],[{key:"setSdpSemantics",value:function(e){var t=ou.browser,n=ou.version;ou.supportsUnifiedPlan?/chrome/i.test(t)?this._sdpSemantics=n>92?"unified-plan":n<72?"plan-b":e:/firefox/i.test(t)?this._sdpSemantics="unified-plan":/safari/i.test(t)?this._sdpSemantics=n<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan":this._sdpSemantics="plan-b"}},{key:"getSdpSemantics",value:function(){return e._sdpSemantics}}]),e}(),Ou=function(e){d(n,e);var t=h(n);function n(){var e;return _(this,n),(e=t.apply(this,arguments)).senders={},e._localTracks=[],e}return R(n,[{key:"addLocalTrack",value:function(e){this._localTracks.includes(e)||this._localTracks.push(e);var t=e.getStreamId(),n=e.__innerGetMediaStreamTrack(),r=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);r.getTracks().forEach((function(e){e.kind===n.kind&&r.removeTrack(e)})),r.addTrack(n);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(n):this.senders[i]=this._peer.addTrack(n,r)}},{key:"removeLocalTrack",value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var n=e.getTrackId(),r=this.senders[n];r&&(r.replaceTrack(null),this._peer.removeTrack(r),delete this.senders[n])}},{key:"updateSubRemoteTracks",value:function(e){}},{key:"updateRecvTransceiverMap",value:function(e,t){}},{key:"setBitrate",value:function(e,t,n){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=n||.7*e}},{key:"createOffer",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 2:for(r in n=t.sent,this._outboundStreams)i=this._outboundStreams[r].id,n.sdp=n.sdp.replace(new RegExp(i,"g"),r);return t.next=6,this._peer.setLocalDescription(n);case 6:return t.abrupt("return",{type:"offer",semantics:"plan-b",sdp:n.sdp});case 7:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){var t=0,r=0;this._localTracks.forEach((function(e){var n=e.getBitrate(),i=n.min,o=n.max;r+=i,t+=o})),t=this._maxBitrate&&this._maxBitrate>0?Math.min(t,this._maxBitrate):t,r=this._minBitrate&&this._minBitrate>0?Math.max(r,this._minBitrate):r;var i=this._startBitrate||Math.round(.7*t),o="b=AS:".concat(t);e=e.replace(/[\r\n]+m=video[^\r\n]+/,(function(e){return"".concat(e,"\r\n").concat(o)}));var s=[";x-google-min-bitrate=".concat(r),";x-google-max-bitrate=".concat(t),";x-google-start-bitrate=".concat(i)].join("");return e=e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,(function(e){return e+s})),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(Nu),Au=function(e){d(n,e);var t=h(n);function n(){var e;return _(this,n),(e=t.apply(this,arguments))._sendTransceiver={},e._localTracks={},e._recvAudio=[],e._recvVideo=[],e._recvTransceiver={},e._subedTracks=[],e}return R(n,[{key:"setBitrate",value:function(e,t,n){na.warn("the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}},{key:"addLocalTrack",value:function(e){var t=e.getTrackId(),n=e.getStreamId(),r=e.__innerGetMediaStreamTrack();this._localTracks[t]=e;var i=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);i.getTracks().forEach((function(e){e.kind===r.kind&&i.removeTrack(e)})),i.addTrack(r);var o=this._sendTransceiver[t];o?(o.sender.replaceTrack(r),o.direction="sendonly"):this._sendTransceiver[t]=this._peer.addTransceiver(r,{direction:"sendonly",streams:[i]})}},{key:"removeLocalTrack",value:function(e){var t=e.getTrackId(),n=e.getStreamId();e.__innerGetMediaStreamTrack(),delete this._localTracks[t];var r=this._sendTransceiver[t];if(r){r.direction="inactive",this._peer.removeTrack(r.sender),r.sender.replaceTrack(null);var i=this._outboundStreams[n];(e.isAudioTrack()?i.getAudioTracks():i.getVideoTracks()).forEach((function(e){return i.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction){o.direction="inactive";var s=o.sender,a=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(n,"_tiny")].removeTrack(a),a.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var n=Xc(e).mediaType;this._recvTransceiver[e]=t;var r=n===yc.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=r.findIndex((function(e){return e===t}));i>=0&&r.splice(i,1)}},{key:"updateSubRemoteTracks",value:function(e){var t=this,n=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(e){var t=n[e],i=r.findIndex((function(e){return e===t}));i>=0&&(n.splice(e,1),r.splice(i,1))},o=n.length-1;o>=0;o-=1)i(o);r.length&&r.forEach((function(e){var n=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var r=t._recvTransceiver[n];r&&(r.direction="inactive")}));var s={audio:0,video:0};n.length&&n.forEach((function(e){var n=e.isAudioTrack()?"audio":"video",r=t._recvTransceiver[e.getTrackId()];r?r.direction="recvonly":s[n]+=1}));for(var a=this._recvAudio.length;a<s.audio;a+=1)this._recvAudio.push(this._peer.addTransceiver("audio",{direction:"recvonly"}));for(var c=this._recvVideo.length;c<s.video;c+=1)this._recvVideo.push(this._peer.addTransceiver("video",{direction:"recvonly"}))}},{key:"createOffer",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._peer.createOffer({iceRestart:e});case 2:for(i in n=t.sent,r=n.sdp,this._outboundStreams)o=this._outboundStreams[i].id,r=r.replace(new RegExp(o,"g"),i);return r=function(e){return e.split(/\r\n(?=m=)/).map((function(e){return function(e){return/a=(recvonly|inactive)/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/g,""):e}(e)})).join("\r\n")}(r),r=r.replace(/a=ice-options:trickle/g,"a=ice-options:trickle\r\na=ice-options:renomination"),n.sdp=r,t.next=10,this._peer.setLocalDescription(n);case 10:return t.abrupt("return",{type:"offer",semantics:"unified-plan",sdp:r});case 11:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){var t=this;e=e.split(/\r\n(?=m=)/).map((function(e){var n,r=e.match(/a=mid:[^\s]+/);if(!r)return e;var i=r[0].replace("a=mid:",""),o="";for(var s in t._sendTransceiver)if(t._sendTransceiver[s].mid===i){o=s;break}if(!o)return e;var a=null===(n=t._localTracks[o])||void 0===n?void 0:n.getBitrate();if(!a)return e;var c=a.max,u=a.min,d=c&&c>0?a.start||.7*c:0,l=[];if(c&&c>0&&l.push(";x-google-max-bitrate=".concat(c)),u&&u>0&&l.push(";x-google-min-bitrate=".concat(u)),d>0&&l.push(";x-google-start-bitrate=".concat(d)),0===l.length)return e;var h=l.join("");return e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,(function(e){return e+h}))})).join("\r\n");var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(e)&&(na.warn("answer sdp invalid -> ".concat(JSON.stringify(e))),e=e.replace(r,"\r\n")),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(Nu),xu=function(e){d(n,e);var t=h(n);function n(e,r){var i;_(this,n),(i=t.call(this))._reTryExchange=e,i._polarisReport=r,i.pubLocalTracks={},i._reTryExchangeTimer=null,i._reportStatsTimer=null,i._reportListener=null;var o=Nu.getSdpSemantics(),s=i._rtcPeerConn=new RTCPeerConnection({sdpSemantics:o});return i._sdpStrategy="plan-b"===o?new Ou(s):new Au(s),i._rtcPeerConn.oniceconnectionstatechange=i._onICEConnectionStateChange.bind(p(i)),i._rtcPeerConn.onconnectionstatechange=i._onConnectionStateChange.bind(p(i)),i._rtcPeerConn.ontrack=i._onTrackReady.bind(p(i)),i.reportParser=i._sdpStrategy.getStatParsr(i._rtcPeerConn,o),i}return R(n,[{key:"getLocalTracks",value:function(){return Object.values(this.pubLocalTracks)}},{key:"_onConnectionStateChange",value:function(){na.info("onconnectionstatechange -> ".concat(this._rtcPeerConn.connectionState))}},{key:"_onICEConnectionStateChange",value:function(){var e,t;na.info("oniceconnectionstatechange -> ".concat(this._rtcPeerConn.iceConnectionState)),"connected"===this._rtcPeerConn.iceConnectionState&&(this._reportStatsTimer&&clearInterval(this._reportStatsTimer),this._reportStatsTimer=setInterval(this._reportHandle.bind(this),1e3)),"failed"!==this._rtcPeerConn.iceConnectionState&&"disconnected"!==this._rtcPeerConn.iceConnectionState||(na.warn("iceconenction state is `failed`, exchange SDP to try again."),this._reTryExchange(),this._reTryExchangeTimer=setInterval(this._reTryExchange,15e3));try{null===(t=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===t||t.call(e,this._rtcPeerConn.iceConnectionState)}catch(e){na.error("onICEConnectionStateChange error",e)}}},{key:"_onTrackReady",value:function(e){if(e.streams.length){var t=[e.streams[0].id,"audio"===e.receiver.track.kind?yc.AUDIO_ONLY:yc.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(t,e.transceiver),this.emit(n.__INNER_EVENT_TRACK_READY__,e)}}},{key:"setBitrate",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this._sdpStrategy.setBitrate(e,t,n);case 1:case"end":return r.stop()}}),r,this)})))}},{key:"createOffer",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._sdpStrategy.createOffer(e);case 2:return n=t.sent,t.abrupt("return",(na.debug("offer -> ".concat(JSON.stringify(n.sdp))),n));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(na.debug("answer -> ".concat(JSON.stringify(e))),this._sdpStrategy.setRemoteAnswer(e)));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"getLocalTrack",value:function(e){return this.pubLocalTracks[e]||null}},{key:"addLocalTrack",value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(Oc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Oc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(Oc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(Oc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}},{key:"removeLocalTrackById",value:function(e){var t=this.getLocalTrack(e);t&&this.removeLocalTrack(t)}},{key:"removeAllLocalTrack",value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}},{key:"removeLocalTrack",value:function(e){var t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(Oc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Oc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var n="".concat(t,"_tiny"),r=this.getLocalTrack(n);r&&(this._sdpStrategy.removeLocalTrack(r),delete this.pubLocalTracks[n],r.destroy())}},{key:"_updateRecvTransceiverMap",value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}},{key:"updateSubRemoteTracks",value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}},{key:"getOutboundVideoInfo",value:function(){return this._sdpStrategy.getOutboundVideoInfo()}},{key:"_onLocalTrackMuted",value:function(e){var t=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));t&&(t.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(Oc.__INNER_EVENT_MUTED_CHANGE__,e)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(Oc.__INNER_EVENT_DESTROY__,e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"_createRCRTCStateReport",value:function(e){var t=JSON.parse(JSON.stringify(e)),n=t.timestamp,r=t.iceCandidatePair,i=t.senders,o=t.receivers;for(var s in null==r||delete r.totalPacketsLost,r)du(r[s])&&delete r[s];return{timestamp:n,iceCandidatePair:r,senders:i.map((function(e){var t={};return e.trackId&&(t.trackId=e.trackId),e.kind&&(t.kind=e.kind),(e.packetsLostRate||0===e.packetsLostRate)&&(t.packetsLostRate=e.packetsLostRate),t.remoteResource=e.remoteResource,(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),(e.bitrate||0===e.bitrate)&&(t.bitrate=e.bitrate),e.jitter&&(t.jitter=e.jitter),t})),receivers:o.map((function(e){var t={};return e.trackId&&(t.trackId=e.trackId),e.kind&&(t.kind=e.kind),(e.packetsLostRate||0===e.packetsLostRate)&&(t.packetsLostRate=e.packetsLostRate),t.remoteResource=e.remoteResource,(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),(e.bitrate||0===e.bitrate)&&(t.bitrate=e.bitrate),e.jitter&&(t.jitter=e.jitter),t}))}}},{key:"_getStatsData",value:function(){var e,t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._rtcPeerConn.getStats();case 2:return r=n.sent,i=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(r),n.abrupt("return",null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(i));case 5:case"end":return n.stop()}}),n,this)})))}},{key:"getAudioLevelReportData",value:function(){var e,t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._rtcPeerConn.getStats();case 2:if(r=n.sent,i=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(r)){n.next=6;break}return n.abrupt("return",[]);case 6:return n.abrupt("return",null===(t=this.reportParser)||void 0===t?void 0:t.getAudioLevelList(i));case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_reportHandle",value:function(){var e,t,n;return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._getStatsData();case 2:if(i=r.sent){r.next=5;break}return r.abrupt("return");case 5:(i.senders.length||i.receivers.length)&&(null===(e=this._polarisReport)||void 0===e||e.sendR3R4Data(i)),o=this._createRCRTCStateReport(i),null===(n=null===(t=this._reportListener)||void 0===t?void 0:t.onStateReport)||void 0===n||n.call(t,o);case 8:case"end":return r.stop()}}),r,this)})))}},{key:"getRTCPeerConn",value:function(){return this._rtcPeerConn}},{key:"destroy",value:function(){this.clear(),this.clearReTryExchangeTimer(),this._reportStatsTimer&&(clearInterval(this._reportStatsTimer),this._reportStatsTimer=null),this.registerReportListener(null),this._rtcPeerConn.close(),this.reportParser=null}},{key:"clearReTryExchangeTimer",value:function(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}]),n}($e);xu.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(gu||(gu={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(mu||(mu={}));var Pu=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:mu.MeetingOrAnchor;_(this,e),this._context=t,this._runtime=n,this._roomId=r,this._crtRTCRoom=i,this._userRole=o}return R(e,[{key:"_send",value:function(e){this._context.getConnectionStatus()===st.CONNECTED&&this._context.setRTCState(this._roomId,e)}},{key:"_getClientID",value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=function(){var e="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)}));return e=e.replace(/-/g,"")+"0",e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e}(),this._runtime.localStorage.setItem(e,t)),t}},{key:"_getRealResourceId",value:function(e){var t=e,n=e.indexOf("_tiny");return n>-1&&(t=e.slice(0,n)),t}},{key:"_getPolarisTrackId",value:function(e){var t="",n=e.split("_");if(e.includes("_tiny")){var r=n.pop(),i=parseInt(n.pop())===yc.AUDIO_ONLY?"audio":"video",o=n.pop();t=[n.join("_"),o,r,i].join("_")}else{var s=parseInt(n.pop())===yc.AUDIO_ONLY?"audio":"video",a=n.pop();t=[n.join("_"),a,s].join("_")}return t}},{key:"sendR3R4Data",value:function(e){var t=this,n=e.iceCandidatePair,r=e.senders,i=e.receivers,o=(null==n?void 0:n.bitrateSend)||-1,s=(null==n?void 0:n.bitrateRecv)||-1,a=(null==n?void 0:n.networkType)||"unknown",c=(null==n?void 0:n.rtt)||-1,u="".concat((null==n?void 0:n.IP)||-1,":").concat(null==n?void 0:n.port),d=(null==n||n.remoteIP,null==n||n.remotePort,(null==n?void 0:n.availableIncomingBitrate)||-1),l=(null==n?void 0:n.availableOutgoingBitrate)||-1,h=(null==n?void 0:n.totalPacketsLost)||-1,f=this._context.getCurrentId(),p="R3\t".concat(o,"\t-1\t-1\t-1\t").concat(a,"\t").concat(c,"\t").concat(u,"\t").concat(d,"\t").concat(l,"\t").concat(h,"\t").concat(f,"\r"),g="R4\t".concat(s,"\t-1\t-1\t-1\t").concat(a,"\t").concat(c,"\t").concat(u,"\t").concat(d,"\t").concat(l,"\t").concat(h,"\t").concat(f,"\r"),m=r.map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,s=e.bitrate,a=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,d=e.frameHeight,l=e.googRenderDelayMs,h=e.jitter,f=e.nackCount,p=e.pliCount,g=e.rtt,m=e.googFirsSent,v=e.encoderImplementation,_=t._getPolarisTrackId(r),y=t._getRealResourceId(r);return{trackId:_,googCodecName:v||String(-1),audioLevel:i||0===i?i:-1,bitrate:s||0===s?s:-1,packetsLostRate:a||0===a?a:-1,frameRate:c||-1,resolution:u&&d?"".concat(u," * ").concat(d):"-1",jitter:h||-1,nackCount:f||0===f?f:-1,pliCount:p||0===p?p:-1,rtt:g||-1,googFirsSent:m,samplingRate:o,googRenderDelayMs:l,encoderImplementation:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getLocalTrack(y))||void 0===n?void 0:n.isLocalMuted())?gu.DISABLE:gu.ENABLE}})),v=i.filter((function(e){return!!e.trackId})).map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,s=e.bitrate,a=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,d=e.frameHeight,l=e.googRenderDelayMs,h=e.jitter,f=e.nackCount,p=e.pliCount,g=e.rtt,m=e.googFirsReceived,v=e.codecImplementationName,_=t._getPolarisTrackId(r),y=t._getRealResourceId(r);return{trackId:_,googCodecName:v||String(-1),audioLevel:i||0===i?i:-1,bitrate:s||0===s?s:-1,packetsLostRate:a||0===a?a:-1,frameRate:c||-1,resolution:u&&d?"".concat(u," * ").concat(d):"-1",jitter:h||-1,nackCount:f||0===f?f:-1,pliCount:p||0===p?p:-1,rtt:g||-1,googFirsReceived:m,samplingRate:o,googRenderDelayMs:l,codecImplementationName:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getRemoteTrack(y))||void 0===n?void 0:n.isLocalMuted())?gu.DISABLE:gu.ENABLE}}));p+=m.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)})).join("\n"),e.senders.length&&this._send(p+"\r".concat(this._userRole)),g+=v.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)})).join("\n"),e.receivers.length&&this._send(g+"\r".concat(this._userRole))}},{key:"sendR1",value:function(){var e="R1\t5.3.1\t".concat(this._context.getCoreVersion(),"\tweb\t").concat(navigator.platform,"\t-1\t").concat(ou.browser,"\t").concat(ou.version,"\t").concat(this._getClientID(),"\t").concat(this._userRole);this._send(e)}},{key:"sendR2",value:function(e,t,n){var r="R2\t".concat(e,"\t").concat(t,"\t").concat(this._getClientID(),"\r").concat(n.join("\t"),"\r").concat(this._userRole);this._send(r)}}]),e}();!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(vu||(vu={})),function(e){e.BEGIN="begin",e.END="end"}(_u||(_u={}));var Mu=function(){function e(t){_(this,e),this._room=t,this._audioLevelChangeHandler=null,this._timer=null,this._pc=this._room.__getPC()}return R(e,[{key:"_audioLevelReport",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("new"!==this._pc.getRTCPeerConn().iceConnectionState&&this._audioLevelChangeHandler){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._pc.getAudioLevelReportData();case 4:e.t0=function(e){var t=ad.parseTrackId(e.trackId).userId;return{track:n._room.getCrtUserId()===t?n._room.getLocalTrack(e.trackId):n._room.getRemoteTrack(e.trackId),audioLevel:e.audioLevel||0}},e.t1=function(e){return e.track},t=e.sent.map(e.t0).filter(e.t1),this._audioLevelChangeHandler(t);case 8:case"end":return e.stop()}}),e,this)})))}},{key:"onAudioLevelChange",value:function(e,t){t<300||t>1e3?na.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000'):e?(this._audioLevelChangeHandler=e,this._timer=setInterval(this._audioLevelReport.bind(this),t)):this._audioLevelChangeHandler=null}},{key:"clearAudioLevelReportTimer",value:function(){this._timer&&(clearInterval(this._timer),this._timer=null)}}]),e}();!function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(yu||(yu={}));var Lu,Uu,Du,Vu=function(e){return e instanceof Nc?e.getTrackId():e.track.getTrackId()},Bu=function(){function e(t,n,r,i,o,s,a,c,u,d){var l=this;_(this,e),this._context=t,this._runtime=n,this._roomId=r,this._roomMode=o,this._service=s,this._initOptions=a,this._ntfClearRoomItem=c,this._isMainRoom=d,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new ra,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=u?{}:hu(i),this._initRemoteTracks();var h=this._context.getCurrentId(),f=this._roomResources[h]=this._roomResources[h]||[];na.debug("room data -> ".concat(JSON.stringify(this._roomResources))),f.length>0&&oa((function(){return l._unpublishPrev(f)})),u&&this._afterChangedRole(i),this._pinger=new pu(r,this._roomMode,t,this._initOptions.pingGap),this._pinger.onFailed=this._kickoff.bind(this),this._pinger.onPingResult=this._handlePingResult.bind(this),this._pinger.start(),this._polarisReport=new Pu(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new xu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(xu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(Oc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(Oc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}return R(e,[{key:"_initRemoteTracks",value:function(){var e=this,t=this._context.getCurrentId();for(var n in this._roomResources){var r=this._roomResources[n];n!==t&&0!==r.length&&r.forEach((function(t){var n=Qc(t),r=Xc(n),i=r.tag,o=r.userId,s=r.mediaType===yc.AUDIO_ONLY?new Hc(i,o):new jc(i,o);s.__innerSetRemoteMuted(0===t.state),e._remoteTracks[n]=s}))}}},{key:"_handlePingResult",value:function(e){this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,n){na.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),Wt("max",e,(function(e){return Ve(e)&&e>Math.max(t||1,200)}),!0),Wt("min",t,(function(t){return Ve(t)&&t>=1&&(!Ve(e)||t<e)}),!0),Wt("start",n,(function(n){return Ve(n)&&n>t&&n<=e})),this._pc.setBitrate(e,t,n)}},{key:"_onTrackReady",value:function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?yc.AUDIO_ONLY:yc.VIDEO_ONLY].join("_"),i=this._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),this._callAppListener("onTrackReady",i)):na.warn("cannot found remote track ".concat(n.id))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){na.error(e)}}},{key:"_onUserUnpublish",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.unsubscribe(e);case 2:e.forEach((function(e){e.__innerDestroy(),delete n._remoteTracks[e.getTrackId()]})),this._onTrackUnpublish(e);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_onTrackUnpublish",value:function(e){this._callAppListener("onTrackUnpublish",e)}},{key:"_unpublishPrev",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.slice(),e.length=0,na.info("unpublish uris prev login: ".concat(JSON.stringify(n))),t.next=4,this._context.setRTCTotalRes(this._roomId,Kc(cu.UNPUBLISH,n),qc([]),cu.TOTAL_CONTENT_RESOURCE,qc([]));case 4:(r=t.sent)!==it.SUCCESS?na.error("unpublish prev uris failed -> code: ".concat(r)):na.debug("unpublish uris prev login succeed");case 6:case"end":return t.stop()}}),t,this)})))}},{key:"__parseInnerMessage",value:function(e){var t=this,n=e.targetId;if(e.conversationType!==xe.RTC_ROOM)return!1;if(n!==this._roomId)return!0;na.info("recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId));var r=e.content;switch(e.messageType){case cu.KICK:this._kickoff(!0,r);break;case cu.STATE:this.msgTaskQueue.push((function(){return t._stateHandle(r)}));break;case cu.MODIFY:case cu.PUBLISH:case cu.UNPUBLISH:case cu.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push((function(){return t._resourceHandle(r,e.messageType,e.senderUserId)}));break;case cu.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case cu.USER_NOTIFY:na.warn("TODO: ".concat(cu.USER_NOTIFY));break;case cu.PK_INVITE:case cu.PK_CANCEL_INVITE:case cu.PK_INVITE_TIMEOUT:case cu.PK_INVITE_ANSWER:case cu.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case cu.OTHER_ROOM_OFFLINE:break;default:this._callAppListener("onMessageReceive",e.messageType,e.content,e.senderUserId,e.messageUId)}return!0}},{key:"_kickoff",value:function(e,t){var n,r=this;na.warn("onKickOff -> byServer: ".concat(e)),this._ntfClearRoomItem(),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===r._context.getCurrentId()&&(n=e.type)})),this._callAppListener("onKickOff",e,n)}},{key:"_rtcpeerClosed",value:function(){this._ntfClearRoomItem(),this._leaveHandle(!0),this._callAppListener("onRTCPeerConnectionCloseByException")}},{key:"_resourceHandle",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E,T,S,I,b,w=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",void na.warn("room has been destroyed. -> roomId: ".concat(this._roomId)));case 2:if(i=e.uris,!e.ignore&&i){r.next=5;break}return r.abrupt("return");case 5:o=[],s=[],c=[],d=this._roomResources[n]||(this._roomResources[n]=[]),r.t0=t,r.next=r.t0===cu.MODIFY?10:r.t0===cu.PUBLISH?12:r.t0===cu.UNPUBLISH?14:r.t0===cu.TOTAL_CONTENT_RESOURCE?16:17;break;case 10:return c.push.apply(c,a(i)),r.abrupt("break",17);case 12:return o.push.apply(o,a(i)),r.abrupt("break",17);case 14:return s.push.apply(s,a(i)),r.abrupt("break",17);case 16:u=eu(d,i),o.push.apply(o,a(u.publishedList)),s.push.apply(s,a(u.unpublishedList)),c.push.apply(c,a(u.modifiedList));case 17:if(!(o.length>0)){r.next=28;break}if(l=d.map(Qc),h=[],f=[],o.forEach((function(e){var t=Qc(e),n=l.indexOf(t),r=Xc(t),i=r.userId,o=r.tag,s=r.mediaType;n>-1?d[n]=e:d.push(e);var a=w._remoteTracks[t];a?a.isSubscribed()&&h.push(a):(a=s===yc.AUDIO_ONLY?new Hc(o,i):new jc(o,i),w._remoteTracks[t]=a,f.push(a)),a.__innerSetRemoteMuted(0===e.state)})),!h.length){r.next=27;break}return p=h.map((function(e){return e.getTrackId()})),na.debug("resub tracks -> ".concat(JSON.stringify(p))),r.next=24,oa((function(){return w.__subscribe(h,!0)}));case 24:g=r.sent,(m=g.code)!==ea.SUCCESS&&na.error("resub tracks failed -> code: ".concat(m,", ids: ").concat(JSON.stringify(p)));case 27:this._onTrackPublish(f);case 28:if(!(s.length>0)){r.next=34;break}for(v=s.map(Qc),_=d.length-1;_>=0;_-=1)y=d[_],v.includes(Qc(y))&&d.splice(_,1);return R=s.map((function(e){var t=Qc(e);return w._remoteTracks[t]})),r.next=34,this._onUserUnpublish(R);case 34:if(c.length>0)for(C=d.map(Qc),E=0;E<c.length;E+=1)T=c[E],S=Qc(T),I=C.indexOf(S),d[I].state=T.state,(b=this._remoteTracks[S]).__innerSetRemoteMuted(0===T.state),b.isAudioTrack()?this._onAudioMuteChange(b):this._onVideoMuteChange(b);case 35:case"end":return r.stop()}}),r,this)})))}},{key:"_onTrackPublish",value:function(e){this._callAppListener("onTrackPublish",e)}},{key:"_stateHandle",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,c,u,d,l,h,f=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(0!==(r=e.users).length){n.next=3;break}return n.abrupt("return");case 3:if(i=[],o=[],s=[],c=[],r.forEach((function(e){0==+e.state?(na.debug("user joined -> ".concat(e.userId)),f._roomResources[e.userId]||(e.switchRoleType?s.push(e.userId):i.push(e.userId)),f._roomResources[e.userId]=f._roomResources[e.userId]||[]):(na.debug("user left -> ".concat(e.userId)),e.switchRoleType?c.push(e.userId):o.push(e.userId))})),u=[].concat(i,s),!(d=[].concat(o,c)).length){n.next=15;break}if(l=[],h=[],d.forEach((function(e){l.push.apply(l,a(f.getRemoteTracksByUserId(e))),h.push(e)})),n.t0=l.length,!n.t0){n.next=14;break}return n.next=13,this.unsubscribe(l);case 13:l.forEach((function(e){return delete f._remoteTracks[e.getTrackId()]}));case 14:h.length&&h.forEach((function(e){return delete f._roomResources[e]}));case 15:if(!(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)){n.next=17;break}return n.abrupt("return",(s.length&&s.forEach((function(e){return f._callAppListener("onSwitchRole",e,yu.ANCHOR)})),c.length&&c.forEach((function(e){return f._callAppListener("onSwitchRole",e,yu.AUDIENCE)})),i.length&&this._callAppListener("onUserJoin",i),void(o.length&&this._callAppListener("onUserLeave",o))));case 17:u.length&&this._callAppListener("onUserJoin",u),d.length&&this._callAppListener("onUserLeave",d);case 18:case"end":return n.stop()}}),n,this)})))}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"__getPC",value:function(){return this._pc}},{key:"getRemoteUserIds",value:function(){var e=this._context.getCurrentId();return Object.keys(this._roomResources).filter((function(t){return t!==e}))}},{key:"getRemoteTracks",value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(n){t.push.apply(t,a(e.getRemoteTracksByUserId(n)))})),t}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"sendMessage",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._context.sendMessage(xe.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 2:return r=n.sent,i=r.code,n.abrupt("return",i!==it.SUCCESS?(na.error("send message failed -> code: ".concat(i)),{code:ea.SIGNAL_ERROR}):{code:ea.SUCCESS});case 5:case"end":return n.stop()}}),n,this)})))}},{key:"setRoomAttribute",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return $s(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._context.setRTCData(this._roomId,e,t,r,Mt.ROOM,n);case 2:return o=i.sent,i.abrupt("return",o!==it.SUCCESS?(na.error("SetRoomAttributeValue Failed: ".concat(o)),{code:ea.SIGNAL_ERROR}):{code:ea.SUCCESS});case 4:case"end":return i.stop()}}),i,this)})))}},{key:"deleteRoomAttributes",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._context.removeRTCData(this._roomId,e,n,Mt.ROOM,t);case 2:return i=r.sent,r.abrupt("return",i!==it.SUCCESS?(na.error("DeleteRoomAttribute Failed: ".concat(i)),{code:ea.SIGNAL_ERROR}):{code:ea.SUCCESS});case 4:case"end":return r.stop()}}),r,this)})))}},{key:"getRoomAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._context.getRTCData(this._roomId,e,t,Mt.ROOM);case 2:return r=n.sent,i=r.code,o=r.data,n.abrupt("return",i!==it.SUCCESS?(na.error("GetRoomAttributes Failed: ".concat(i)),{code:ea.SIGNAL_ERROR}):{code:ea.SUCCESS,data:o});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"_setUserAttributeValue",value:function(e,t,n){return this._context.setRTCData(this._roomId,e,t,!1,Mt.PERSON,n)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Mt.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,Mt.PERSON)}},{key:"isDestroyed",value:function(){return this._destroyed}},{key:"__destroy",value:function(e){return this._leaveHandle(e)}},{key:"_leaveHandle",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=this._destroyed,n.t0){n.next=18;break}if(this._destroyed=!0,null===(t=this._audioLevelReport)||void 0===t||t.clearAudioLevelReportTimer(),n.t1=e,!n.t1){n.next=8;break}return n.next=8,this._context.quitRTCRoom(this._roomId);case 8:if(this._isMainRoom&&this._quitAllPKRoom(),this._pc.removeAllLocalTrack(),this._pinger.stop(),n.t2=this._isMainRoom,!n.t2){n.next=15;break}return n.next=15,this._service.exit(this._getRTCReqestHeaders());case 15:this._pc.destroy(),this._polarisReport=null,this._removeRemoteTracks();case 18:case"end":return n.stop()}}),n,this)})))}},{key:"_onLocalTrackDestroied",value:function(e){e instanceof xc&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.getTrackId(),r=this._context.getCurrentId(),i=[{resourceId:n,enabled:!e.isLocalMuted()}],o=this._roomResources[r]||[],s=[],a=function(e){var t=o[e],n=Qc(t),r=i.findIndex((function(e){return e.resourceId===n}));if(r>=0){var a=i[r].enabled;return t.state=a?1:0,s.push(t),"break"}},c=0;case 3:if(!(c<o.length)){t.next=10;break}if("break"!==a(c)){t.next=7;break}return t.abrupt("break",10);case 7:c+=1,t.next=3;break;case 10:return t.next=12,oa((function(){return d._context.setRTCTotalRes(d._roomId,Kc(cu.MODIFY,s),qc(o),cu.TOTAL_CONTENT_RESOURCE)}));case 12:(u=t.sent)!==it.SUCCESS&&na.error("notice `track.enabled` change failed -> code: "+u);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_removePubFailedTracks",value:function(e){var t=this;e.forEach((function(e){var n=e instanceof Oc?e:e.track;na.debug("remove pub failed track from peerconnection -> trackId: ".concat(n.getTrackId())),t._pc.removeLocalTrackById(n.getTrackId())}))}},{key:"publish",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n.__publish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__publish",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,f,p,g,m,v,_,y,R,C=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._isMainRoom||!(this instanceof Qu)){t.next=2;break}return t.abrupt("return",(na.error("the `publish` is disabled in PK room "),{code:ea.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){t.next=4;break}return t.abrupt("return",(na.error("publish failed, room has been destroyed. -> roomId: ".concat(this._roomId)),{code:ea.ROOM_HAS_BEEN_DESTROYED}));case 4:if(Qt("tracks",e,(function(){return Be(e)&&e.length>0&&e.every((function(e){return e instanceof Oc||e.track instanceof Oc}))}),!0)){t.next=6;break}return t.abrupt("return",(na.error("publish failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:ea.PARAMS_ERROR}));case 6:if(n=this._context.getCurrentId(),!(this._pc.getLocalTracks().length+function(e){var t=0;return e.forEach((function(e){e instanceof Oc?t++:e.pubTiny&&e.track.isVideoTrack()?t+=2:t++})),t}(e)>10)){t.next=9;break}return t.abrupt("return",(na.error("publish failed, tracks limit exceeded -> roomId: ".concat(this._roomId)),{code:ea.PUBLISH_TRACK_LIMIT_EXCEEDED}));case 9:return na.debug("publish tracks -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Vu))),e.forEach((function(e){var t=e instanceof Oc?{pubTiny:!1,track:e}:e,n=t.track,r=t.pubTiny;if(C._pc.addLocalTrack(n),n.isVideoTrack()&&r){var i;try{i=n.__innerGetMediaStreamTrack().clone();var o=r.frameRate||vc.FPS_15,s=r.resolution||_c.W176_H144,a=tu(s),c=a.width,u=a.height,d=iu(o);i.applyConstraints({width:c,height:u,frameRate:d})}catch(r){return null==i||i.stop(),void na.warn("pubTiny failed -> id: ".concat(n.getTrackId(),", msg: ").concat(r.message))}C._pc.addLocalTrack(new xc(n.getTag(),n.getUserId(),i,!0))}})),this._pc.clearReTryExchangeTimer(),t.next=12,this._createExchangeParams(this._subscribedList,!1);case 12:return r=t.sent,(i=this._getPushOtherRoomsParams())&&(r.pushOtherRooms=i),t.next=17,this._exchangeHandle(r);case 17:if((o=t.sent).code===ea.SUCCESS){t.next=20;break}return t.abrupt("return",(na.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(o.code)),this._removePubFailedTracks(e),{code:o.code}));case 20:if(s=o.data,a=s.publishList,c=s.sdp,u=s.resultCode,d=s.message,l=s.urls,h=s.mcuPublishList,u===ea.SUCCESS){t.next=23;break}return t.abrupt("return",(na.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(u,", msg: ").concat(d)),this._removePubFailedTracks(e),{code:u}));case 23:return t.next=25,this._pc.setRemoteAnswer(c.sdp);case 25:if((f=t.sent)===ea.SUCCESS){t.next=28;break}return t.abrupt("return",{code:f});case 28:return p=this._roomResources[n],g=a.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:C._getResourceState(Qc(e))},e)})),m=eu(p,g),v=m.publishedList,_=(null==h?void 0:h.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)})))||[],t.next=35,this._context.setRTCTotalRes(this._roomId,Kc(cu.PUBLISH,v),qc(g),cu.TOTAL_CONTENT_RESOURCE,qc(_));case 35:if((y=t.sent)===it.SUCCESS){t.next=38;break}return t.abrupt("return",(na.error("send publish streams notification failed: ".concat(y)),{code:ea.SIGNAL_ERROR}));case 38:return this._roomResources[n]=g,R=v.map((function(e){return Qc(e)})),t.abrupt("return",(this._polarisReport&&this._polarisReport.sendR2(vu.PUBLISH,_u.BEGIN,R),e.forEach((function(e){(e instanceof Oc?{track:e}:e).track.__innerSetPublished(!0)})),na.debug("publish success: ".concat(R.join(","))),this._roomMode===Ot.LIVE?{code:ea.SUCCESS,liveUrl:null==l?void 0:l.liveUrl}:{code:ea.SUCCESS}));case 41:case"end":return t.stop()}}),t,this)})))}},{key:"_getPushOtherRoomsParams",value:function(){if(this instanceof Qu){var e=this.getRoomPKHandler(),t=e.code,n=e.roomPKHandler,r=[];if(t===ea.SUCCESS&&n){var i=n.getJoinedPKRooms();for(var o in i){var s=i[o].getSessionId(),a=n.getPKInfo(o);if(!a)return;var c=a.inviterUserAutoMix,u=a.inviteeUserAutoMix,d=a.inviterUserId,l=this._context.getCurrentId()===d;r.push({roomId:o,sessionId:s,autoMix:l?!!c:!!u})}}return r}}},{key:"_reTryExchange",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:oa((function(){return $s(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._createExchangeParams(this._subscribedList,!0);case 2:return t=e.sent,(n=this._getPushOtherRoomsParams())&&(t.pushOtherRooms=n),e.next=7,this._exchangeHandle(t);case 7:if((r=e.sent).code===ea.SUCCESS){e.next=10;break}return e.abrupt("return",(na.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 10:if(i=r.data,o=i.sdp,(s=i.resultCode)===ea.SUCCESS){e.next=13;break}return e.abrupt("return",(na.error("reTryExchange failed: ".concat(s)),{code:s}));case 13:return this._pc.clearReTryExchangeTimer(),e.next=16,this._pc.setRemoteAnswer(o.sdp);case 16:return a=e.sent,e.abrupt("return",a!==ea.SUCCESS?{code:a}:void 0);case 18:case"end":return e.stop()}}),e,this)})))}));case 1:case"end":return e.stop()}}),e)})))}},{key:"_exchangeHandle",value:function(e){return this._service.exchange(this._getRTCReqestHeaders(),e)}},{key:"_getRTCReqestHeaders",value:function(){return{"App-Key":this._context.getAppkey(),RoomId:this._roomId,Token:this._token,RoomType:this._roomMode,UserId:this._context.getCurrentId()}}},{key:"_createExchangeParams",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._pc.createOffer(t);case 2:return n.t0=n.sent,n.t1=JSON.stringify({resolutionInfo:this._pc.getOutboundVideoInfo()}),n.t2=e.filter((function(e){var t=e.track.getTrackId(),n=Xc(t).userId;if(!r._roomResources[n])return!1;var i=r._roomResources[n].filter((function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)})).length;return i})).map((function(e){return{simulcast:e.subTiny?fu.TINY:fu.NORMAL,resolution:"",uri:r._getResourceById(e.track.getTrackId()).uri}})),n.t3=!1,n.abrupt("return",{sdp:n.t0,extend:n.t1,subscribeList:n.t2,switchstream:n.t3});case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_getResourceState",value:function(e){var t;return(null===(t=this.getLocalTrack(e))||void 0===t?void 0:t.isLocalMuted())?0:1}},{key:"unpublish",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n.__unpublish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unpublish",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,f,p,g,m,v,_,y,R=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._isMainRoom||!(this instanceof Qu)){n.next=2;break}return n.abrupt("return",(na.error("the `unpublish` is disabled in PK room "),{code:ea.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){n.next=4;break}return n.abrupt("return",(na.warn("room has been destroyed, no need to unpublish tracks -> roomId: ".concat(this._roomId)),{code:ea.SUCCESS}));case 4:if(r=this._context.getCurrentId(),Qt("tracks",e,(function(){return e.every((function(e){return e.getUserId()===r&&e instanceof Oc}))}),!0)){n.next=7;break}return n.abrupt("return",(na.warn("unpublish failed, tracks is invalid -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Vu))),{code:ea.PARAMS_ERROR}));case 7:if(i=e.map((function(e){return e.getTrackId()})),o=i.map(this._getResourceById.bind(this)).filter((function(e){return!!e})),0!==o.length){n.next=10;break}return n.abrupt("return",{code:ea.SUCCESS});case 10:return s=this._roomResources[r].filter((function(e){return!o.includes(e)})),i.forEach((function(e){return R._pc.removeLocalTrackById(e)})),null===(t=this._polarisReport)||void 0===t||t.sendR2(vu.PUBLISH,_u.END,i),this._pc.clearReTryExchangeTimer(),n.next=14,this._createExchangeParams(this._subscribedList,!1);case 14:return a=n.sent,(c=this._getPushOtherRoomsParams())&&(a.pushOtherRooms=c),n.next=19,this._exchangeHandle(a);case 19:if((u=n.sent).code===ea.SUCCESS){n.next=22;break}return n.abrupt("return",(na.error("exchange failed -> code: ".concat(u.code)),{code:u.code}));case 22:return d=u.data,l=d.publishList,h=d.sdp,f=d.resultCode,p=d.message,g=d.mcuPublishList,f!==ea.SUCCESS&&na.error("unpublish streams failed -> code: ".concat(f,", msg: ").concat(p)),m=g?g.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)})):[],n.next=27,this._context.setRTCTotalRes(this._roomId,Kc(cu.UNPUBLISH,o),qc(s),cu.TOTAL_CONTENT_RESOURCE,qc(m));case 27:if((v=n.sent)===it.SUCCESS){n.next=30;break}return n.abrupt("return",(na.error("send unpublish notification failed:",v),{code:ea.SIGNAL_ERROR}));case 30:return na.debug("unpublish success -> tracks: ".concat(i.join(","))),n.next=33,this._pc.setRemoteAnswer(h.sdp);case 33:if((_=n.sent)===ea.SUCCESS){n.next=36;break}return n.abrupt("return",{code:_});case 36:return y=l.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:R._getResourceState(Qc(e))},e)})),n.abrupt("return",(this._roomResources[r]=y,{code:ea.SUCCESS}));case 38:case"end":return n.stop()}}),n,this)})))}},{key:"_getResourceById",value:function(e){var t=Xc(e).userId;return this._roomResources[t].find((function(t){return Qc(t)===e}))}},{key:"_isValidResourceId",value:function(e){var t,n=Xc(e).userId;return!!(null===(t=this._roomResources[n])||void 0===t?void 0:t.find((function(t){return Qc(t)===e})))}},{key:"subscribe",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n.__subscribe(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__subscribe",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",(na.error("subscribe failed, room has been destroyed -> roomId: ".concat(this._roomId)),{code:ea.ROOM_HAS_BEEN_DESTROYED}));case 2:if(Qt("tracks",e,(function(){return Be(e)&&e.length>0&&e.every((function(e){return e instanceof Fc||e.track instanceof Fc}))}),!0)){r.next=4;break}return r.abrupt("return",(na.error("subscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:ea.PARAMS_ERROR}));case 4:return na.info("subscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Vu))),i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Fc?{track:e}:e})),s=!1,a=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();a.push(t);var n=i.find((function(e){return e.track.getTrackId()===t}));n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:i.push(e),s=!0)})),s||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(vu.SUBSCRIBE,_u.BEGIN,a),this._updateSubListHandle(i,!0)):{code:ea.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"unsubscribe",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._assertRoomDestroyed()){n.next=2;break}return n.abrupt("return",(na.warn("room has beed destroyed, no need to unsubscribe tracks -> roomId: ".concat(this._roomId)),{code:ea.SUCCESS}));case 2:if(Qt("tracks",e,(function(){return Be(e)&&e.length>0&&e.every((function(e){return e instanceof Fc}))}),!0)){n.next=4;break}return n.abrupt("return",(na.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:ea.PARAMS_ERROR}));case 4:return na.info("unsubscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Vu))),r=this._subscribedList.map((function(e){return Object.assign({},e)})).filter((function(t){return!e.includes(t.track)})),n.abrupt("return",(null===(t=this._polarisReport)||void 0===t||t.sendR2(vu.SUBSCRIBE,_u.END,e.map((function(e){return e.getTrackId()}))),this._updateSubListHandle(r,!1)));case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed){return na.warn("This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance."),ea.ROOM_HAS_BEEN_DESTROYED}}},{key:"getLocalTrack",value:function(e){return this._pc.getLocalTrack(e)}},{key:"getLocalTracks",value:function(){return this._pc.getLocalTracks()}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]||null}},{key:"updateSubList",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n._updateSubListHandle(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"_updateSubListHandle",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E,T=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._assertRoomDestroyed()){n.next=2;break}return n.abrupt("return",{code:ea.ROOM_HAS_BEEN_DESTROYED});case 2:if(Qt("resources",e,(function(){return Be(e)&&e.every((function(e){return e instanceof Fc||e.track instanceof Fc}))}),!0)){n.next=4;break}return n.abrupt("return",(na.error("update sublist failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:ea.PARAMS_ERROR}));case 4:if(na.info("update subscribe list -> roomId: ".concat(this._roomId,", forceReq: ").concat(t,", tracks: ").concat(e.map(Vu))),i=e.map((function(e){return e instanceof Fc?{track:e}:Object.assign({},e)})),o={},i=i.filter((function(e){var t=e.track.getTrackId();return T._remoteTracks[t]?!o[t]&&(o[t]=!0):(na.warn("track cannot found in room -> trackId: ".concat(t)),!1)})).map((function(e){return Object.assign({},e)})),s=this._subscribedList.map((function(e){return Object.assign({},e)})),t){n.next=13;break}if(c=!1,i.forEach((function(e){var t=s.findIndex((function(t){return t.track===e.track}));-1!==t?s.splice(t,1)[0].subTiny!==e.subTiny&&(c=!0):c=!0})),s.length&&(c=!0),c){n.next=13;break}return n.abrupt("return",{code:ea.SUCCESS});case 13:return this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(i.map((function(e){return e.track}))),n.next=16,this._createExchangeParams(i,!1);case 16:return u=n.sent,(d=this._getPushOtherRoomsParams())&&(u.pushOtherRooms=d),n.next=21,this._exchangeHandle(u);case 21:if(l=n.sent,h=i.map((function(e){return e.track.getTrackId()})),l.code===ea.SUCCESS){n.next=25;break}return n.abrupt("return",{code:l.code});case 25:if(f=l.data,p=f.sdp,g=f.resultCode,f.message,m=f.subscribedList,g===ea.SUCCESS){n.next=28;break}return n.abrupt("return",(na.error("change subscribe list failed: ".concat(g)),{code:g}));case 28:return na.debug("subscribe success: ".concat(h.join(","))),n.next=31,this._pc.setRemoteAnswer(p.sdp);case 31:if((v=n.sent)===ea.SUCCESS){n.next=34;break}return n.abrupt("return",{code:v});case 34:for(E in _=null==m?void 0:m.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),y=i.filter((function(e){return null==_?void 0:_.includes(e.track.getTrackId())})),R=i.filter((function(e){return!(null==_?void 0:_.includes(e.track.getTrackId()))})),C=function(e){var t=y.some((function(t){return t.track.getTrackId()===e}));T._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)C(E);return n.abrupt("return",((r=this._subscribedList).splice.apply(r,[0,this._subscribedList.length].concat(a(y))),R.length?{code:ea.SUCCESS,failedList:R}:{code:ea.SUCCESS}));case 38:case"end":return n.stop()}}),n,this)})))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"registerReportListener",value:function(e){this._pc.registerReportListener(e)}},{key:"onAudioLevelChange",value:function(e,t){var n;null===(n=this._audioLevelReport)||void 0===n||n.clearAudioLevelReportTimer(),this._audioLevelReport=new Mu(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}},{key:"__onReconnected",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E,T,S=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("closed"!==this._pc.getRTCPeerConn().connectionState){t.next=2;break}return t.abrupt("return",(na.warn("RTCPeerConnection closed. Please rejoin room to restore services."),void this._rtcpeerClosed()));case 2:return t.next=4,this._context.joinRTCRoom(this._roomId,this._roomMode,e);case 4:if(n=t.sent,r=n.code,i=n.data,r===it.SUCCESS){t.next=9;break}return t.abrupt("return",void na.error("RTC __onReconnected getRTCRoomInfo failed: ".concat(r)));case 9:na.debug("RTC __onReconnected getRTCRoomInfo success: ".concat(JSON.stringify(i))),o=[],s={},a={},c={},u=hu(i),d=Object.keys(u),l=Object.keys(this._roomResources),h=d.length-1;case 12:if(!(h>=0)){t.next=22;break}if(f=d[h],-1!==(p=l.indexOf(f))){t.next=17;break}return o.push(f),s[f]=$c(u[f]),t.abrupt("continue",19);case 17:g=this._roomResources[f],m=u[f],v=eu(g,m,!0),_=v.publishedList,y=v.modifiedList,R=v.unpublishedList,s[f]=$c(_),a[f]=$c(R),c[f]=$c(y),l.splice(p,1);case 19:h-=1,t.next=12;break;case 22:l.length&&l.forEach((function(e){delete S._roomResources[e]})),Object.assign(this._roomResources,u),l.length&&this._callAppListener("onUserLeave",l),o.length&&this._callAppListener("onUserJoin",o),t.t0=regeneratorRuntime.keys(a);case 24:if((t.t1=t.t0()).done){t.next=33;break}if(C=t.t1.value,!(E=a[C]).length){t.next=31;break}return T=E.map((function(e){return S._remoteTracks[Qc(e)]})),t.next=31,this._onUserUnpublish(T);case 31:t.next=24;break;case 33:return t.abrupt("return",(Object.keys(s).forEach((function(e){var t=s[e];if(0!==t.length){var n=t.map((function(e){var t=Qc(e),n=Xc(t),r=n.userId,i=n.tag,o=n.mediaType,s=S._remoteTracks[t]=o===yc.AUDIO_ONLY?new Hc(i,r):new jc(i,r);return s.__innerSetRemoteMuted(0===e.state),s}));S._onTrackPublish(n)}})),Object.keys(c).forEach((function(e){c[e].forEach((function(e){var t=Qc(e),n=S._remoteTracks[t];n.__innerSetRemoteMuted(0===e.state),n.isAudioTrack()?S._onAudioMuteChange(n):S._onVideoMuteChange(n)}))})),{data:i}));case 34:case"end":return t.stop()}}),t,this)})))}},{key:"_onAudioMuteChange",value:function(e){this._callAppListener("onAudioMuteChange",e)}},{key:"_onVideoMuteChange",value:function(e){this._callAppListener("onVideoMuteChange",e)}},{key:"_afterChangedRole",value:function(e){}},{key:"_removeRemoteTracks",value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}},{key:"_registerPKMsgListener",value:function(e){this._onRecvPKMsg=e}},{key:"_quitAllPKRoom",value:function(){}}]),e}();!function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Lu||(Lu={})),function(e){e[e.CUSTOMIZE=1]="CUSTOMIZE",e[e.SUSPENSION=2]="SUSPENSION",e[e.ADAPTATION=3]="ADAPTATION"}(Uu||(Uu={})),function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Du||(Du={}));var Fu,Hu,ju,Ku,qu=function(){return{version:1,mode:Uu.SUSPENSION}},Gu=function(){function e(t,n,r){_(this,e),this._onFlush=t,this._isValidTrackId=n,this._sendCDNInfoSignal=r,this._values=qu()}return R(e,[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return na.error("setHostVideoTrack failed: videoTrackId is invalid -> ".concat(e)),this;var t=Xc(e),n=t.mediaType,r=t.tag,i=t.userId;return n!==yc.VIDEO_ONLY?(na.error("setHostVideoTrack failed: kind of resource is not 'video' -> ".concat(e)),this):(this._values.host_stream_id=Zc(i,r),this)}},{key:"setMixLayoutMode",value:function(e){return[Uu.CUSTOMIZE,Uu.SUSPENSION,Uu.ADAPTATION].includes(e)?(this._values.mode=e,this):(na.error("layout mode is invalid: ".concat(e)),this)}},{key:"_addOutputValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",r=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=r.video;if("normal"!==n&&"tiny"!==n)if("backgroundColor"!==n)if("exparams"!==n){if("backgroundPicture"===n){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:Lu.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var s=i[n]||(i[n]={});Object.assign(s,t)}}else r.audio={bitrate:t};else r.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!nu(e))return na.warn("setOutputVideoResolution failed: `resolution` is invalid"),this;var t=tu(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"normal"),this}},{key:"setOutputVideoFPS",value:function(e){if(!ru(e))return na.warn("setOutputVideoFPS failed: `fps` is invalid"),this;var t=iu(e);return this._addOutputValue("video",{fps:t},"normal"),this}},{key:"setOutputVideoBitrate",value:function(e){return!Ve(e)||e<=0?na.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"normal"),this}},{key:"setOutputTinyVideoResolution",value:function(e){if(!nu(e))return na.warn("setOutputTinyVideoResolution failed: `resolution` is invalid"),this;var t=tu(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"tiny"),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!ru(e))return na.warn("setOutputTinyVideoFPS failed: `fps` is invalid"),this;var t=iu(e);return this._addOutputValue("video",{fps:t},"tiny"),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!Ve(e)||e<=0?na.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"tiny"),this}},{key:"setOutputVideoRenderMode",value:function(e){return[Du.CROP,Du.WHOLE].includes(e)?this._addOutputValue("video",e,"exparams"):na.error("renderMode is invalid: ".concat(e)),this}},{key:"setOutputAudioBitrate",value:function(e){return Ve(e)&&e>0?this._addOutputValue("audio",e):na.error("bitrate is invalid: ".concat(e)),this}},{key:"setOutputBackgroundColor",value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?this._addOutputValue("video",e,"backgroundColor"):na.error("color is invalid: ".concat(e)),this}},{key:"addOutputBackgroundPicture",value:function(e,t,n,r,i){var o,s,a;if(!Ye(e))return na.error("uri is invalid: ".concat(e)),this;if([t,n,r,i].some((function(e){return!Ve(e)||e<0||e>1})))return na.error("some attrs of (x, y, w, h) is invalid: ".concat(t,", ").concat(n,", ").concat(r,", ").concat(i)),this;var c=(null===(a=null===(s=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===s?void 0:s.backgroundPicture)||void 0===a?void 0:a.picture)||[];return c.push({uri:e,w:r,h:i,x:t,y:n}),this._addOutputValue("video",{picture:c},"backgroundPicture"),this}},{key:"removeOutputBackgroundPicture",value:function(e){var t,n,r;if(!Ye(e))return na.error("uri is invalid: ".concat(e)),this;var i=null===(r=null===(n=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===n?void 0:n.backgroundPicture)||void 0===r?void 0:r.picture;return i&&(i=i.filter((function(t){return t.uri!==e})),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this}},{key:"clearOutputBackgroundPicture",value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this}},{key:"setOutputBackgroundPictureFillMode",value:function(e){return[Lu.CROP,Lu.WHOLE].includes(e)?this._addOutputValue("video",{fillMode:e},"backgroundPicture"):na.error("fillMode is invalid: ".concat(e)),this}},{key:"addPublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!Be(e)||0===e.length||e.some((function(e){return!r.test(e)})))return na.error("urls is invalid: ".concat(e)),this;var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=!1;return e.forEach((function(e){i.some((function(t){return t.pushurl===e}))||(o=!0,i.push({pushurl:e}))})),i.length>5?(na.error("publish stream url no more than 5"),this):(o&&this._addOutputValue("cdn",i),this)}},{key:"removePublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!Be(e)||0===e.length||e.some((function(e){return!r.test(e)})))return na.error("urls is invalid: ".concat(e)),this;for(var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=i.length-1;o>=0;o-=1){var s=i[o].pushurl,a=e.indexOf(s);a>=0&&(e.splice(a,1),i.splice(o,1))}return this._addOutputValue("cdn",i),this}},{key:"clearPublishStreamUrls",value:function(){return this._addOutputValue("cdn",[]),this}},{key:"addCustomizeLayoutVideo",value:function(e,t,n,r,i){if(!this._isValidTrackId(e))return na.error("trackId is invalid: ".concat(e)),this;if(!Ve(t)||!Ve(n))return na.error("some attrs of (x, y) is invalid: ".concat(t,", ").concat(n)),this;if([r,i].some((function(e){return!Ve(e)||e<0})))return na.error("some attrs of (width, height) is invalid: ".concat(r,", ").concat(i)),this;var o=Xc(e),s=o.userId,a=o.tag;if(o.mediaType!==yc.VIDEO_ONLY)return na.error("kind of resource is not 'video': ".concat(e)),this;var c=Zc(s,a);return(this._values.input||(this._values.input={video:[]})).video.push({user_id:s,stream_id:c,x:t,y:n,width:r,height:i}),this}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return na.error("trackId is invalid: ".concat(e)),this;var t=Xc(e),n=t.userId,r=t.tag;if(t.mediaType!==yc.VIDEO_ONLY)return na.error("kind of resource is not 'video': ".concat(e)),this;var i=Zc(n,r),o=this._values.input||(this._values.input={video:[]});return o.video=o.video.filter((function(e){return e.stream_id===i})),this}},{key:"clearCustomizeLayoutVideo",value:function(){return(this._values.input||(this._values.input={video:[]})).video=[],this}},{key:"flush",value:function(){var e,t,n,r;return $s(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s,a;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=JSON.parse(JSON.stringify(this._values)),i.next=3,this._onFlush(o);case 3:return s=i.sent,a=s.code,i.abrupt("return",(a===ea.SUCCESS&&((null===(t=null===(e=this._values.output)||void 0===e?void 0:e.video.normal)||void 0===t?void 0:t.width)||(null===(r=null===(n=this._values.output)||void 0===n?void 0:n.video.normal)||void 0===r?void 0:r.fps))&&this._sendCDNInfoSignal(),this._values=qu(),{code:a}));case 6:case"end":return i.stop()}}),i,this)})))}}]),e}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(Fu||(Fu={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(Hu||(Hu={})),function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(ju||(ju={})),function(e){e[e.VIDEO=0]="VIDEO",e[e.AUDIO=1]="AUDIO"}(Ku||(Ku={}));var Yu,Ju,zu=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)}))},Wu=function(){function e(t,n,r,i,o,s,a,c){_(this,e),this._context=t,this._runtime=n,this._service=r,this._initOptions=i,this._mainLivingRoom=o,this._registerPKMsgListener=s,this._onJoinedPKRoom=a,this._onLeavePKRoom=c,this._inviteTimeout=30,this._PKInfo={},this._appListener=null,this._joinedPKRooms={},this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}return R(e,[{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){na.error(e)}}},{key:"_onInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r=t.inviterUserId,i=t.extra,o={inviterRoomId:n,inviterUserId:r};i&&Object.assign(o,{extra:i}),this._PKInfo[n]=t,this._callAppListener("onRequestJoinOtherRoom",o)}},{key:"_onCancelInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r=t.inviterUserId,i=t.extra,o={inviterRoomId:n,inviterUserId:r};i&&Object.assign(o,{extra:i}),delete this._PKInfo[n],this._callAppListener("onCancelRequestOtherRoom",o)}},{key:"_onInviteTimeout",value:function(e){}},{key:"_onInviteAnswer",value:function(e){var t=e.answerCode,n=e.inviteContent,r=e.inviteeUserAutoMix,i=n.inviterUserId,o=n.inviterRoomId,s=n.inviteeUserId,a=n.inviteeRoomId,c=(n.extra,{agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:a,inviteeUserId:s});this._PKInfo[a].inviteeUserAutoMix=r,this._callAppListener("onResponseJoinOtherRoom",c)}},{key:"_onPKEnd",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviteInfo,r=n.inviteeRoomId,i=n.inviterRoomId,o=n.userId,s=i===this._mainRoomId?r:i,a={endRoomId:s,endUserId:o},t.next=3,this.leaveOtherRoom(this._joinedPKRooms[s]);case 3:delete this._PKInfo[s],this._callAppListener("onFinishOtherRoom",a);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_onRecvPKMsg",value:function(e){e.targetId;var t=e.content;switch(e.messageType){case cu.PK_INVITE:this._onInvite(t);break;case cu.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case cu.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case cu.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case cu.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a,c;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Qt("inviteeRoomId",e,He,!0)&&Qt("inviteeUserId",t,He,!0)){r.next=2;break}return r.abrupt("return",{code:ea.PARAMS_ERROR});case 2:return na.debug("requestRoomPK -> inviteeRoomId: ".concat(e,"; inviteeUserId: ").concat(t,"; options: ").concat(JSON.stringify(n||{}))),i=zu(),o=!De(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),s={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==n?void 0:n.extra)||""},a={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:i},na.debug("requestRoomPK -> params: ".concat(JSON.stringify(a))),r.next=7,this._context.requestRoomPK(a);case 7:return c=r.sent,r.abrupt("return",c!==it.SUCCESS?(na.error("requestRoomPK failed: ".concat(c)),{code:c}):(na.debug("requestRoomPK success"),this._PKInfo[e]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e},{code:ea.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Qt("inviteeRoomId",e,He,!0)&&Qt("inviteeUserId",t,He,!0)){r.next=2;break}return r.abrupt("return",{code:ea.PARAMS_ERROR});case 2:if(this._PKInfo[e]){r.next=4;break}return r.abrupt("return",(na.error("未发起过与 ".concat(e," 房间内 ").concat(t," 连麦的请求")),{code:ea.PARAMS_ERROR}));case 4:return na.debug("canceRequestJoinPK -> inviteeRoomId: ".concat(e,"; inviteeUserId: ").concat(t,"; extra: ").concat(n)),i={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:n||""},o={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(i)},na.debug("canceRequestJoinPK -> params: ".concat(JSON.stringify(o))),r.next=9,this._context.cancelRoomPK(o);case 9:return s=r.sent,r.abrupt("return",s!==it.SUCCESS?(na.error("canceRequestJoinPK failed: ".concat(s)),{code:s}):(na.debug("canceRequestJoinPK success"),delete this._PKInfo[e],{code:ea.SUCCESS}));case 11:case"end":return r.stop()}}),r,this)})))}},{key:"responseJoinOtherRoom",value:function(e,t,n,r){return $s(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s,a,c,u,d,l,h,f;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(Qt("inviterRoomId",e,He,!0)&&Qt("inviterUserId",t,He,!0)){i.next=2;break}return i.abrupt("return",{code:ea.PARAMS_ERROR});case 2:if(this._PKInfo[e]){i.next=4;break}return i.abrupt("return",(na.error("".concat(e," 房间内的 ").concat(t," 未发起过连麦请求")),{code:ea.PARAMS_ERROR}));case 4:return na.debug("responseRoomPK -> inviterRoomId: ".concat(e,"; inviterUserId: ").concat(t,"; agree: ").concat(n,"; options: ").concat(JSON.stringify(r||{}))),o=this._PKInfo[e],s=o.inviteSessionId,a=o.inviterUserAutoMix,c=!De(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),u={inviteSessionId:s,inviterRoomId:e,inviterUserId:t,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:c},d=Object.assign(u,{inviterUserAutoMix:a}),l=n?Object.assign(u,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(d)}):u,!qe(null==r?void 0:r.extra)&&Object.assign(l,{extra:r.extra}),h={agree:n,roomId:this._mainRoomId,inviteSessionId:s,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(l),key:"".concat(e,"|").concat(t),value:JSON.stringify(u)},na.debug("responseRoomPK -> params: ".concat(JSON.stringify(h))),i.next=11,this._context.responseRoomPK(h);case 11:return f=i.sent,i.abrupt("return",f!==it.SUCCESS?(na.error("responseRoomPK failed: ".concat(f)),{code:f}):(na.debug("responseRoomPK success"),this._PKInfo[e].inviteeUserAutoMix=c,{code:ea.SUCCESS}));case 13:case"end":return i.stop()}}),i,this)})))}},{key:"_quitRoomPK",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._PKInfo[e],r=n.inviterRoomId,i=n.inviteeRoomId,o=n.inviterUserId,s={inviteeRoomId:i,inviterRoomId:r,userId:this._context.getCurrentId()},a={roomId:this._mainRoomId,endRoomId:e,sessionId:this._PKInfo[e].inviteSessionId,content:JSON.stringify(s),keys:["".concat(r,"|").concat(o)]},na.debug("quitRoomPK -> params: ".concat(JSON.stringify(a))),t.next=4,this._context.endRoomPK(a);case 4:return c=t.sent,t.abrupt("return",c!==it.SUCCESS?(na.error("quitRoomPK failed: ".concat(c)),{code:ea.SIGNAL_ERROR}):(na.debug("quitRoomPK success"),delete this._PKInfo[e],{code:ea.SUCCESS}));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"_relaseCrtRoom",value:function(){}},{key:"joinOtherRoom",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Qt("roomId",e,He,!0)){t.next=2;break}return t.abrupt("return",{code:ea.PARAMS_ERROR});case 2:if(this._context.getConnectionStatus()===st.CONNECTED){t.next=4;break}return t.abrupt("return",{code:ea.SIGNAL_DISCONNECTED});case 4:if(na.debug("joinPKRoom, roomId: ".concat(e)),!this._joinedPKRooms[e]){t.next=6;break}return t.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 6:return n=Ku.VIDEO,t.next=9,this._context.joinRTCRoom(e,Ot.LIVE,n);case 9:if(r=t.sent,i=r.code,o=r.data,i===it.SUCCESS){t.next=14;break}return t.abrupt("return",(na.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 14:return na.debug("JoinPKRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new Qu(this._context,this._runtime,e,o,this._service,this._initOptions,this._relaseCrtRoom.bind(this),n,!1,!1),t.abrupt("return",(this._joinedPKRooms[e]=s,this._onJoinedPKRoom(e,s),{room:s,code:ea.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}));case 17:case"end":return t.stop()}}),t,this)})))}},{key:"leaveOtherRoom",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",oa((function(){return $s(r,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.getRoomId(),na.debug("leavePKRoom -> userId: ".concat(this._context.getCurrentId()," , roomId: ").concat(r)),n.next=4,e.__destroy(!0);case 4:return delete this._joinedPKRooms[r],this._onLeavePKRoom(r),n.abrupt("return",this._PKInfo[r]?(t&&this._quitRoomPK(r),{code:ea.SUCCESS}):{code:ea.SUCCESS});case 7:case"end":return n.stop()}}),n,this)})))})));case 1:case"end":return n.stop()}}),n)})))}},{key:"getPKInfo",value:function(e){return this._PKInfo[e]}},{key:"getJoinedPKRooms",value:function(){return this._joinedPKRooms}}]),e}(),Qu=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s,a,u,d){var l,h,f,g=arguments.length>8&&void 0!==arguments[8]&&arguments[8],v=arguments.length>9?arguments[9]:void 0;_(this,n),(h=t.call(this,e,r,i,o,Ot.LIVE,s,a,u,g,v))._livingType=d,h._isMainRoom=v,h._CDNUris=null,h._CDNEnable=!1,h._mcuConfigBuilder=new Gu(h._onMCUConfigFlush.bind(p(h)),h._isValidResourceId.bind(p(h)),h._sendCDNInfoSignal.bind(p(h))),h._isMainRoom&&(h._roomPKHandler=new Wu(e,r,s,a,p(h),c((l=p(h),m(n.prototype)),"_registerPKMsgListener",l).bind(p(h)),h._onJoinedPKRoom.bind(p(h)),h._onLeavePKRoom.bind(p(h))));var y=null===(f=o.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===f?void 0:f.value;return y&&(h._CDNUris=JSON.parse(y)[0]),h}return R(n,[{key:"_isValidResourceId",value:function(e){var t,n,r=Xc(e).userId,i=!!(null===(t=this._roomResources[r])||void 0===t?void 0:t.find((function(t){return Qc(t)===e}))),o=this.getRoomPKHandler(),s=o.code,c=o.roomPKHandler;if(s!==ea.SUCCESS||!c)return i;var u=c.getJoinedPKRooms(),d=[];return Object.values(u).map((function(e){d.push.apply(d,a(e.getRemoteTracks()))})),n=d.some((function(t){return e===t.getTrackId()})),i||n}},{key:"getLivingType",value:function(){return this._livingType}},{key:"getMCUConfigBuilder",value:function(){return this._isMainRoom?this._mcuConfigBuilder:(na.error("the `getMCUConfigBuilder` is disabled in PK room "),{code:ea.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_onMCUConfigFlush",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={"App-Key":this._context.getAppkey(),Token:this._token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},t.next=3,this._service.setMcuConfig(n,e);case 3:return r=t.sent,i=r.code,o=r.res,t.abrupt("return",i!==ea.SUCCESS?(na.error("set MCU config failed: ".concat(i)),{code:i}):(na.info("set MCU config success"),o.pull_url&&(this._CDNUris=JSON.parse(o.pull_url)),{code:i,res:o}));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"__onReconnected",value:function(){var e,t,r=this,i=Object.create(null,{__onReconnected:{get:function(){return c(m(n.prototype),"__onReconnected",r)}}});return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.__onReconnected.call(this,this._livingType);case 2:if((r=n.sent)&&r.data){n.next=5;break}return n.abrupt("return");case 5:if(o=r.data.roomInfo,s=null===(e=o.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===e?void 0:e.value,s){n.next=8;break}return n.abrupt("return");case 8:a=JSON.parse(s),(null===(t=this._CDNUris)||void 0===t?void 0:t.enableInnerCDN)!==a.enableInnerCDN&&this._callAppListener("onCDNEnableChange",a.enableInnerCDN),this._CDNUris=a;case 10:case"end":return n.stop()}}),n,this)})))}},{key:"enableInnerCDN",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._isMainRoom){t.next=2;break}return t.abrupt("return",(na.error("the `enableInnerCDN` is disabled in PK room "),{code:ea.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(De(e)){t.next=4;break}return t.abrupt("return",(na.error("`enable` is invalid"),{code:ea.PARAMS_ERROR}));case 4:return this._CDNEnable=e,n={version:2,output:{inCDNModel:e?Fu.OPEN:Fu.STOP}},t.next=8,this._onMCUConfigFlush(n);case 8:if(r=t.sent,(i=r.code)===ea.SUCCESS){t.next=12;break}return t.abrupt("return",(na.error("enableInnerCDN failed -> code: ".concat(i)),{code:ea.SIGNAL_ERROR}));case 12:if(!this._CDNUris||this._CDNUris.broadcast===Hu.SPREAD){t.next=14;break}return t.abrupt("return",(na.info("enableInnerCDN succeed"),{code:ea.SUCCESS}));case 14:return t.next=16,oa((function(){return $s(a,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._sendCDNInfoSignal());case 1:case"end":return e.stop()}}),e,this)})))}));case 16:return o=t.sent,s=o.code,t.abrupt("return",s===ea.SUCCESS?(na.info("enableInnerCDN succeed"),{code:ea.SUCCESS}):(na.error("enableInnerCDN failed -> code: ".concat(s)),{code:s}));case 19:case"end":return t.stop()}}),t,this)})))}},{key:"_sendCDNInfoSignal",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._CDNUris=Object.assign({},this._CDNUris,{enableInnerCDN:this._CDNEnable}),e.next=3,Promise.all([this._spreadCDNInfo(this._CDNUris),this._setRoomCDNInfo(this._CDNUris)]);case 3:if(e.t0=function(e){return e.code===ea.SUCCESS},!e.sent.every(e.t0)){e.next=8;break}e.t1={code:ea.SUCCESS},e.next=9;break;case 8:e.t1={code:ea.SIGNAL_ERROR};case 9:return e.abrupt("return",e.t1);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"_spreadCDNInfo",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._context.setRTCCDNUris(this._roomId,cu.TOTAL_CONTENT_RESOURCE,JSON.stringify([e]));case 2:return n=t.sent,t.abrupt("return",n!==it.SUCCESS?(na.error("spreadCDNInfo failed -> code: ".concat(n)),{code:ea.SIGNAL_ERROR}):(na.info("spreadCDNInfo succeed"),{code:ea.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_setRoomCDNInfo",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._context.setRTCData(this._roomId,"cdn_uris",JSON.stringify([e]),!0,Mt.ROOM);case 2:return n=t.sent,t.abrupt("return",n!==it.SUCCESS?(na.error("setRoomCDNInfo failed -> code: ".concat(n)),{code:ea.SIGNAL_ERROR}):(na.info("setRoomCDNInfo succeed"),{code:ea.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_resourceHandle",value:function(e,t,r){var i,o=this,s=Object.create(null,{_resourceHandle:{get:function(){return c(m(n.prototype),"_resourceHandle",o)}}});return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:s._resourceHandle.call(this,e,t,r),e.cdn_uris&&((null===(i=this._CDNUris)||void 0===i?void 0:i.enableInnerCDN)!==e.cdn_uris[0].enableInnerCDN&&this._callAppListener("onCDNEnableChange",!this.__getCDNEnable()),this._CDNUris=e.cdn_uris[0]);case 1:case"end":return n.stop()}}),n,this)})))}},{key:"_exchangeHandle",value:function(e){var t,n,r;return $s(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._service.exchange(this._getRTCReqestHeaders(),e);case 2:return o=i.sent,s=null===(n=null===(t=o.data)||void 0===t?void 0:t.urls)||void 0===n?void 0:n.pull_url,i.abrupt("return",o.code===ea.SUCCESS&&s?(this._CDNUris=JSON.parse(s),(null===(r=this._CDNUris)||void 0===r?void 0:r.broadcast)===Hu.SPREAD&&(this._CDNEnable=!0,this._sendCDNInfoSignal()),o):o);case 5:case"end":return i.stop()}}),i,this)})))}},{key:"_afterChangedRole",value:function(e){var t=this,n=hu(e),r=this._context.getCurrentId(),i=Object.keys(n);setTimeout((function(){var o,s,a,c=i.filter((function(e){return e!==r}));for(var u in c.length>0&&t._callAppListener("onUserJoin",c),n)u!==r&&t._resourceHandle({uris:n[u]},cu.TOTAL_CONTENT_RESOURCE,u);(null===(o=e.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===o?void 0:o.value)&&(null===(s=t._CDNUris)||void 0===s?void 0:s.push_mode)===ju.MANUAL&&t._callAppListener("onCDNEnableChange",null===(a=t._CDNUris)||void 0===a?void 0:a.enableInnerCDN)}))}},{key:"__getCDNEnable",value:function(){var e;return null===(e=this._CDNUris)||void 0===e?void 0:e.enableInnerCDN}},{key:"__getCDNPushMode",value:function(){var e;return null===(e=this._CDNUris)||void 0===e?void 0:e.push_mode}},{key:"_onJoinedPKRoom",value:function(e,t){var n=this.getRoomPKHandler(),r=n.code,i=n.roomPKHandler;if(r===ea.SUCCESS&&i){if(!i.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}},{key:"_onLeavePKRoom",value:function(e){var t=this.getRoomPKHandler(),n=t.code,r=t.roomPKHandler;if(n===ea.SUCCESS&&r){if(!r.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}},{key:"_exchangeWithPushOtherRoom",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getLocalTracks().length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._createExchangeParams(this._subscribedList,!1);case 4:return t=e.sent,(n=this._getPushOtherRoomsParams())&&(t.pushOtherRooms=n),e.next=9,this._exchangeHandle(t);case 9:if((r=e.sent).code===ea.SUCCESS){e.next=12;break}return e.abrupt("return",(na.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 12:if(i=r.data,o=i.sdp,(s=i.resultCode)===ea.SUCCESS){e.next=15;break}return e.abrupt("return",(na.error("exchange with pushOtherRoom failed: ".concat(s)),{code:s}));case 15:return e.next=17,this._pc.setRemoteAnswer(o.sdp);case 17:return a=e.sent,e.abrupt("return",a!==ea.SUCCESS?{code:a}:void 0);case 19:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomPKHandler",value:function(){return this._isMainRoom?{code:ea.SUCCESS,roomPKHandler:this._roomPKHandler}:(na.error("the `getRoomPKHandler` is disabled in PK room "),{code:ea.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_quitAllPKRoom",value:function(){var e=this._roomPKHandler.getJoinedPKRooms();for(var t in e){var n=e[t];this._roomPKHandler.leaveOtherRoom(n)}}}]),n}(Bu),Xu=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s,a,c){return _(this,n),t.call(this,e,r,i,o,Ot.RTC,s,a,c,!1)}return R(n)}(Bu),Zu=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(ou.browser,"|").concat(ou.version),ClientVersion:"5.3.1","Client-Session-Id":zu(),"Request-Id":Date.now().toString()}},$u=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;_(this,e),this._runtime=t,this._context=n,this._msUrl=r,this._timeout=i,this._msInNavi=[],this._failedMs=[],this._rtcFinger=void 0,this._clusterId="",this._configUrl=""}return R(e,[{key:"getNaviMS",value:function(){var e,t;return this._msUrl?[this._msUrl]:this._clusterId?["https://".concat(this._clusterId)]:(0===this._msInNavi.length&&(0===this._failedMs.length?(e=this._msInNavi).push.apply(e,a(function(e){var t,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(t){return na.warn("parse `voipCallInfo` of navi failed: "+e.voipCallInfo),[]}if(0===n.strategy)return[];var r=null===(t=n.callEngine)||void 0===t?void 0:t.filter((function(e){return 4===e.engineType}));if(!r||0===r.length)return[];var i=r[0],o=[];return i.mediaServer&&o.push(i.mediaServer.replace(/^(https?:\/\/)?/,"https://")),i.backupMediaServer&&i.backupMediaServer.forEach((function(e){o.push(e.replace(/^(https?:\/\/)?/,"https://"))})),o}(this._context.getNaviInfo()))):((t=this._msInNavi).push.apply(t,a(this._failedMs)),this._failedMs.length=0)),this._msInNavi.map((function(e){return e.trim()})))}},{key:"_request",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,f;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==(i=this.getNaviMS()).length){r.next=3;break}return r.abrupt("return",{code:ea.NOT_OPEN_VIDEO_AUDIO_SERVER});case 3:this._rtcFinger&&(n.rtcFinger=this._rtcFinger),o=0;case 5:if(!(o<i.length)){r.next=20;break}return c="".concat(i[o]).concat(e),u=Zu(),na.debug("request -> Request-Id: ".concat(u["Request-Id"],", url: ").concat(c)),r.next=10,this._runtime.httpReq({url:c,body:JSON.stringify(n),headers:Object.assign(Object.assign({},u),t),method:Bi.POST,timeout:this._timeout});case 10:if(d=r.sent,l=d.status,h=d.data,200!==l){r.next=16;break}return f=JSON.parse(h),r.abrupt("return",(f.rtcFinger&&(this._rtcFinger=f.rtcFinger),f.clusterId&&(this._clusterId=f.clusterId),na.debug("request success -> Request-Id: ".concat(u["Request-Id"])),{code:ea.SUCCESS,data:f}));case 16:na.warn("request failed -> Request-Id: ".concat(u["Request-Id"],", status: ").concat(l,", url: ").concat(c)),(s=this._failedMs).push.apply(s,a(this._msInNavi.splice(o,1)));case 17:o+=1,r.next=5;break;case 20:return r.abrupt("return",{code:ea.REQUEST_FAILED});case 21:case"end":return r.stop()}}),r,this)})))}},{key:"exchange",value:function(e,t){var n;return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._request("/exchange",e,t);case 2:return(i=r.sent).code===ea.SUCCESS&&(null===(n=i.data)||void 0===n?void 0:n.resultCode)===ea.SUCCESS&&(o=i.data.urls)&&(this._configUrl=o.configUrl),r.abrupt("return",i);case 5:case"end":return r.stop()}}),r,this)})))}},{key:"exit",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._request("/exit",e,{});case 2:return n=t.sent,r=n.code,t.abrupt("return",r);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"broadcastSubscribe",value:function(e,t){return this._request("/broadcast/subscribe",e,t)}},{key:"broadcastExit",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._request("/broadcast/exit",e,{});case 2:return n=t.sent,r=n.code,t.abrupt("return",{code:r});case 5:case"end":return t.stop()}}),t,this)})))}},{key:"setMcuConfig",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._configUrl){n.next=2;break}return n.abrupt("return",{code:ea.MCU_SERVER_NOT_FOUND});case 2:return r="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),i=Zu(),na.debug("request -> Request-Id: ".concat(i["Request-Id"],", url: ").concat(r)),n.next=6,this._runtime.httpReq({url:r,headers:Object.assign(Object.assign({},i),e),body:JSON.stringify(t),method:Bi.POST});case 6:if(o=n.sent,s=o.status,a=o.data,200!==s){n.next=13;break}return na.debug("request success -> Request-Id: ".concat(i["Request-Id"])),c=JSON.parse(a),n.abrupt("return",{code:c.resultCode,res:c});case 13:return n.abrupt("return",{code:ea.REQUEST_FAILED});case 14:case"end":return n.stop()}}),n,this)})))}},{key:"getCDNResourceInfo",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Zu(),n.next=3,this._runtime.httpReq({url:t,headers:Object.assign(Object.assign({},r),e),method:Bi.GET});case 3:if(i=n.sent,o=i.status,s=i.data,200!==o){n.next=9;break}return a=JSON.parse(s),n.abrupt("return",{code:a.resultCode,res:a});case 9:return n.abrupt("return",(na.warn("request failed -> Request-Id: ".concat(r["Request-Id"],", status: ").concat(o,", url: ").concat(t)),{code:ea.REQUEST_FAILED}));case 10:case"end":return n.stop()}}),n,this)})))}}]),e}(),ed=function(){function e(t,n,r){_(this,e),this._context=t,this._rtcToken="",this._liveUrl="",this._subTracks=[],this._livingType=null,this._mediaType=null,this._subTiny=!1,this._fromRetry=!1,this._appListener=null,this._service=new $u(n,t,r.mediaServer)}return R(e,[{key:"_getReqHeaders",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this._context.getCurrentId(),r=n,this._rtcToken){t.next=10;break}return t.next=4,this._context.getRTCToken(r,Ot.LIVE,e);case 4:if(i=t.sent,o=i.code,s=i.data,o===it.SUCCESS){t.next=9;break}return t.abrupt("return",(na.error("getRTCToken failed: ".concat(o)),{code:ea.SIGNAL_ERROR}));case 9:this._rtcToken=s.rtcToken;case 10:return t.abrupt("return",{code:ea.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:n,RoomId:r,RoomType:Ot.LIVE,Token:this._rtcToken}});case 11:case"end":return t.stop()}}),t,this)})))}},{key:"_clearSubscribeInfo",value:function(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,null===(e=this._pc)||void 0===e||e.destroy(),this._pc=null}},{key:"_reTryExchange",value:function(){var e;return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._fromRetry=!0,t.next=3,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);case 3:n=t.sent,n.code===ea.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer());case 6:case"end":return t.stop()}}),t,this)})))}},{key:"subscribe",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return $s(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o=this;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",oa((function(){return o.__subscribe(e,t,n,r)})));case 1:case"end":return i.stop()}}),i)})))}},{key:"__subscribe",value:function(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return $s(this,void 0,void 0,regeneratorRuntime.mark((function o(){var s,a,c,u,d,l,h,f,p,g,m,v,_=this;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(s=[],!lu(this._context.getNaviInfo())){o.next=3;break}return o.abrupt("return",{code:ea.PACKAGE_ENVIRONMENT_ERROR,tracks:s});case 3:if(!this._fromRetry&&(null===(r=this._pc)||void 0===r||r.clearReTryExchangeTimer()),this._fromRetry=!1,Ue(e)){o.next=5;break}return o.abrupt("return",(na.error("liveUrl is invalid: ".concat(e)),{code:ea.PARAMS_ERROR,tracks:s}));case 5:if([Ku.AUDIO,Ku.VIDEO].includes(t)){o.next=7;break}return o.abrupt("return",(na.error("livingType is invalid: ".concat(t)),{code:ea.PARAMS_ERROR,tracks:s}));case 7:if([yc.AUDIO_ONLY,yc.VIDEO_ONLY,yc.AUDIO_VIDEO].includes(n)){o.next=9;break}return o.abrupt("return",(na.error("mediaType is invalid: ".concat(n)),{code:ea.PARAMS_ERROR,tracks:s}));case 9:if(!this._liveUrl||this._liveUrl===e){o.next=11;break}return o.abrupt("return",{code:ea.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s});case 11:return this._pc||(this._pc=new xu(this._reTryExchange.bind(this)),this._pc.on(xu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=e,o.next=14,this._getReqHeaders(t);case 14:if(a=o.sent,c=a.code,u=a.headers,c===ea.SUCCESS){o.next=19;break}return o.abrupt("return",{code:c,tracks:s});case 19:return d="rc_mcu_".concat(Date.now()),l="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new Hc(l,d),new jc(l,d)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),o.next=23,this._pc.createOffer(!0);case 23:return o.t0=o.sent,o.t1=e,o.t2=n,o.t3=i?fu.TINY:fu.NORMAL,o.t4=!1,h={sdp:o.t0,liveUrl:o.t1,mediaType:o.t2,simulcast:o.t3,switchstream:o.t4},o.next=31,this._service.broadcastSubscribe(u,h);case 31:if((f=o.sent).code===ea.SUCCESS){o.next=34;break}return o.abrupt("return",(na.error("andience subscribe failed: ".concat(f.code)),{code:f.code,tracks:s}));case 34:if((p=f.data).resultCode===ea.SUCCESS){o.next=37;break}return o.abrupt("return",(na.error("andience subscribe failed! code: ".concat(p.resultCode,"; message: ").concat(p.message)),{code:p.resultCode,tracks:s}));case 37:return na.debug("andience subscribe success: ".concat(e)),this._livingType=t,this._mediaType=n,this._subTiny=i,g=p.sdp,m=p.subscribedList,v=[],o.abrupt("return",(m.forEach((function(e){var t=e.mediaType,n=_._subTracks[t];v.push(n),n.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(g.sdp),{code:ea.SUCCESS,tracks:v}));case 40:case"end":return o.stop()}}),o,this)})))}},{key:"unsubscribe",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",oa((function(){return t.__unsubscribe()})));case 1:case"end":return e.stop()}}),e)})))}},{key:"__unsubscribe",value:function(){var e;return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl){t.next=2;break}return t.abrupt("return",{code:ea.SUCCESS});case 2:return t.next=4,this._getReqHeaders();case 4:return n=t.sent,r=n.headers,t.next=8,this._service.broadcastExit(r);case 8:return i=t.sent,o=i.code,t.abrupt("return",(o!==ea.SUCCESS?na.error("broadcast unsubscribe failed: ".concat(o)):na.debug("broadcast unsubscribe success"),this._clearSubscribeInfo(),{code:o}));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"registerReportListener",value:function(e){var t;this._reportListener=e,null===(t=this._pc)||void 0===t||t.registerReportListener(e)}},{key:"registerTrackEventListener",value:function(e){this._appListener=e}},{key:"_onTrackReady",value:function(e){var t,n,r=e.receiver.track,i="audio"===r.kind?yc.AUDIO_ONLY:yc.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(r);try{null===(n=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===n||n.call(t,o)}catch(e){na.error(e)}}}]),e}();!function(e){e.RTMP="rtmp",e.FLV="flv",e.HLS="hls"}(Yu||(Yu={})),function(e){e[e.NOT_HTTPS=0]="NOT_HTTPS",e[e.HTTPS=1]="HTTPS"}(Ju||(Ju={}));var td,nd=Object.assign(Object.assign({},tu(_c.W176_H144)),{frameRate:iu(vc.FPS_15)}),rd=function(){function e(t,n,r,i,o,s){var a=this;_(this,e),this._context=t,this._runtime=n,this._initOptions=r,this._roomId=i,this._joinResData=o,this._livingType=s,this._roomAnchorList=[],this._roomRes={},this._roomAnchorRes={},this._remoteTracks={},this._appListener=null,this._subscribedList=[],this._sessionId="",this._destroyed=!1,this._setInitData(),this._service=new $u(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new Pu(this._context,this._runtime,this._roomId,this,mu.Audience),this._polarisReport.sendR1(),this._pc=new xu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(xu.__INNER_EVENT_TRACK_READY__,(function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?yc.AUDIO_ONLY:yc.VIDEO_ONLY].join("_"),i=a._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),a._callAppListener("onTrackReady",i)):na.warn("cannot found RCRemoteTrack:",n.id)})),this._context.onrtcdatachange=this.singalDataChange.bind(this)}return R(e,[{key:"_setInitData",value:function(){var e=this,t=function(e,t){var n=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],r=n?n.value:"",i=t.filter((function(e){return"RC_ANCHOR_LIST"===e.key})).map((function(e){return JSON.parse(e.value||"[]")}))[0],o=t.filter((function(e){return e.key.includes("RC_RES_")})).map((function(e){return JSON.parse(e.value||"{}")})),s=o.length?JSON.parse(o[0].mcu_uris||"[]"):[],c=[];s.forEach((function(t){var n=t.mediaType,r=t.tag,i=n===yc.AUDIO_ONLY?new Hc(r,"",e):new jc(r,"",e);c.push(i)}));var u=[],d=[];o.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,a(t)),t.forEach((function(e){var t=e.mediaType,n=e.tag,r=e.msid.split("_")[0],i=t===yc.AUDIO_ONLY?new Hc(n,r):new jc(n,r);d.push(i)}))}));var l=t.filter((function(e){return"RC_CDN"===e.key})).map((function(e){var t=JSON.parse(e.value||"[]");return JSON.parse(t.cdn_uris)[0]}))[0];return{sessionId:r,remoteUserIds:i||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:d,remoteMCUTracks:c,remoteTracks:[].concat(d,c),CDNUris:l||{}}}(this._roomId,this._joinResData.kvEntries),n=t.sessionId,r=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,s=t.remoteTracks,c=t.CDNUris;this._sessionId=n,this._roomAnchorList=r,s.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=c,i.forEach((function(t){var n=t.msid.split("_")[0];e._roomAnchorRes[n]?e._roomAnchorRes[n].push(t):e._roomAnchorRes[n]=[t]})),o.forEach((function(t){var n=t.mediaType,r=t.tag,i=[e._roomId,r,n].join("_");e._roomRes[i]=t})),i.forEach((function(t){var n=Qc(t);e._roomRes[n]=t}))}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed){return na.warn("This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance."),ea.ROOM_HAS_BEEN_DESTROYED}}},{key:"singalDataChange",value:function(e,t){var n,r=this;if(t===this._roomId){na.debug("singalDataChange -> singalData:",JSON.stringify(e||{}));var i=[],o=null===(n=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===n?void 0:n.value;o&&this._diffCDNUris(JSON.parse(JSON.parse(o).cdn_uris)[0]),e.forEach((function(e){var t=e.key,n=e.value,o=(e.timestamp,e.uid);if(-1!==t.indexOf("RC_RES_")){var s=JSON.parse(n||"{}"),c=JSON.parse(s.mcu_uris||"[]"),u=JSON.parse(s.uris||"[]");return i.push.apply(i,a(c)),void r._diffAnchorResource(u,o)}if("RC_ANCHOR_LIST"===t){var d=JSON.parse(n||"[]"),l=r._diffAnchorList(d),h=l.joinUserIds,f=l.leftUserIds;h.length>0&&r._handleNewJoinedAnchor(h),f.length>0&&r._handleLeftedAnchor(f)}})),this._diffRoomResource(i)}else na.warn("singalDataChange -> not the current room data: data roomId: ".concat(t,", current roomId: ").concat(this._roomId))}},{key:"_diffAnchorList",value:function(e){var t=this,n=e.filter((function(e){return t._roomAnchorList.indexOf(e)<0}));return{leftUserIds:this._roomAnchorList.filter((function(t){return e.indexOf(t)<0})),joinUserIds:n}}},{key:"_handleNewJoinedAnchor",value:function(e){var t;(t=this._roomAnchorList).push.apply(t,a(e)),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._roomAnchorList=this._roomAnchorList.filter((function(t){return!(e.indexOf(t)>-1)})),n=[],e.forEach((function(e){n.push.apply(n,a(r.getRemoteTracksByUserId(e))),delete r._roomAnchorRes[e]})),t.t0=n.length,!t.t0){t.next=8;break}return t.next=7,this.unsubscribe(n);case 7:n.forEach((function(e){return delete r._remoteTracks[e.getTrackId()]}));case 8:this._callAppListener("onAnchorLeave",e);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"_diffRoomResource",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=[],r=[],i=[],e.forEach((function(e){var t=Qc(e),r=Xc(t),s=(r.userId,r.tag),a=r.mediaType,c=[o._roomId,s,a].join("_");if(!o._remoteTracks[c]){var u=a===yc.AUDIO_ONLY?new Hc(s,"",o._roomId):new jc(s,"",o._roomId);n.push(u),o._remoteTracks[c]=u,o._roomRes[u.getTrackId()]=e}i.push(c)})),Object.keys(this._remoteTracks).forEach((function(e){i.indexOf(e)<0&&o._remoteTracks[e].isMCUTrack()&&r.push(o._remoteTracks[e])})),n.length>0&&this._callAppListener("onTrackPublish",n),r.length>0&&this._onUserUnpublish(r,"onTrackUnpublish");case 2:case"end":return t.stop()}}),t,this)})))}},{key:"_diffAnchorResource",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E,T,S=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),i=eu(r,e),o=i.publishedList,s=i.unpublishedList,a=i.modifiedList,!o.length){n.next=12;break}if(c=r.map(Qc),u=[],d=[],o.forEach((function(e){var t=Qc(e),n=c.indexOf(t),i=Xc(t),o=i.userId,s=i.tag,a=i.mediaType;n>-1?r[n]=e:r.push(e);var l=S._remoteTracks[t];S._roomRes[t]=e,l?l.isSubscribed()&&u.push(l):(l=a===yc.AUDIO_ONLY?new Hc(s,o):new jc(s,o),S._remoteTracks[t]=l,d.push(l)),l.__innerSetRemoteMuted(0===e.state)})),!u.length){n.next=11;break}return l=u.map((function(e){return e.getTrackId()})),na.debug("resub tracks -> ".concat(JSON.stringify(l))),n.next=8,oa((function(){return S._subscribeHandle(u,!0)}));case 8:h=n.sent,(f=h.code)!==ea.SUCCESS&&na.error("resub tracks failed -> code: ".concat(f,", ids: ").concat(JSON.stringify(l)));case 11:this._callAppListener("onAnchorTrackPublish",d);case 12:if(!s.length){n.next=18;break}for(p=s.map(Qc),g=r.length-1;g>=0;g-=1)m=r[g],p.includes(Qc(m))&&r.splice(g,1);return v=s.map((function(e){var t=Qc(e);return S._remoteTracks[t]})),n.next=18,this._onUserUnpublish(v,"onAnchorTrackUnpublish");case 18:if(a.length)for(_=r.map(Qc),y=0;y<a.length;y++)R=a[y],C=Qc(R),E=_.indexOf(C),r[E].state=R.state,(T=this._remoteTracks[C]).__innerSetRemoteMuted(0===R.state),T.isAudioTrack()?this._callAppListener("onAudioMuteChange",T):this._callAppListener("onVideoMuteChange",T);case 19:case"end":return n.stop()}}),n,this)})))}},{key:"_onUserUnpublish",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.unsubscribe(e);case 2:e.forEach((function(e){r._subscribedList=r._subscribedList.filter((function(t){return t.track.getTrackId()!==e.getTrackId()})),delete r._roomRes[e.getTrackId()],e.__innerDestroy(),delete r._remoteTracks[e.getTrackId()]})),this._callAppListener(t,e);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){na.error(e)}}},{key:"_reTryExchange",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:oa((function(){return $s(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._createSubscribeParams(this._subscribedList,{},!0);case 2:return n=e.sent,r=n.reqBody,e.next=6,this._exchangeHandle(r);case 6:if((i=e.sent).code===ea.SUCCESS){e.next=9;break}return e.abrupt("return",(na.error("reTryExchange failed: ".concat(i.code)),{code:i.code}));case 9:if(o=i.data,s=o.sdp,(a=o.resultCode)===ea.SUCCESS){e.next=12;break}return e.abrupt("return",(na.error("reTryExchange failed: ".concat(a)),{code:a}));case 12:return this._pc.clearReTryExchangeTimer(),c=this._subscribedList.filter((function(e){return e.track.isMCUTrack()})),c.length>0&&(u=c[0].track.getTrackId(),d=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,l=[this._roomId,"RongCloudRTC"].join("_"),s.sdp=s.sdp.replace(new RegExp(d,"g"),l)),e.next=17,this._pc.setRemoteAnswer(s.sdp);case 17:return h=e.sent,e.abrupt("return",h!==ea.SUCCESS?{code:h}:void 0);case 19:case"end":return e.stop()}}),e,this)})))}));case 1:case"end":return e.stop()}}),e)})))}},{key:"_createSubscribeParams",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._pc.createOffer(n);case 2:return i=r.sent,o={resolutionInfo:[]},s={min:0,max:0},Object.keys(t).forEach((function(e){var n=t[e];[n.mediaStream,n.tinyStream].forEach((function(t,n){var r,a=1===n?[e,"tiny"].join("_"):e;i.sdp=null===(r=i.sdp)||void 0===r?void 0:r.replace(new RegExp(t.id,"g"),a);var c=t.getVideoTracks()[0];if(c){var u=0===n,d=u?zc(c):nd,l=d.width,h=d.height,f=d.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?fu.NORMAL:fu.TINY,resolution:"".concat(l,"x").concat(h)});var p=Tc(l,h),g=Ic(f);s.min+=p.minBitrate*g,s.max+=p.maxBitrate*g}}))})),r.abrupt("return",{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?fu.TINY:fu.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:s,offer:i});case 7:case"end":return r.stop()}}),r,this)})))}},{key:"_subscribeHandle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",{code:ea.ROOM_HAS_BEEN_DESTROYED});case 2:if(Qt("tracks",e,(function(){return Be(e)&&e.length>0&&e.every((function(e){return e instanceof Fc||e.track instanceof Fc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:ea.PARAMS_ERROR});case 4:return i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Fc?{track:e}:e})),s=!1,a=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();a.push(t);var n=i.find((function(e){return e.track.getTrackId()===t}));n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:i.push(e),s=!0)})),s||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(vu.SUBSCRIBE,_u.BEGIN,a),this._updateSubListHandle(i,!0)):{code:ea.SUCCESS}));case 8:case"end":return r.stop()}}),r,this)})))}},{key:"_getReqHeaders",value:function(){var e=this._context.getCurrentId();return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:Ot.LIVE,UserId:e,"Session-Id":this._sessionId}}},{key:"_exchangeHandle",value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}},{key:"_updateSubListHandle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,f,p,g,m,v,_,y,R,C,E,T,S,I,b=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",{code:ea.ROOM_HAS_BEEN_DESTROYED});case 2:if(Qt("resources",e,(function(){return Be(e)&&e.every((function(e){return e instanceof Fc||e.track instanceof Fc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:ea.PARAMS_ERROR});case 4:if(o=e.map((function(e){return e instanceof Fc?{track:e}:Object.assign({},e)})),s={},o=o.filter((function(e){var t=e.track.getTrackId();return!s[t]&&(s[t]=!0)})).map((function(e){return Object.assign({},e)})),c=this._subscribedList.map((function(e){return Object.assign({},e)})),n){r.next=12;break}if(u=!1,o.forEach((function(e){var t=c.findIndex((function(t){return t.track===e.track}));-1!==t?c.splice(t,1)[0].subTiny!==e.subTiny&&(u=!0):u=!0})),c.length&&(u=!0),u){r.next=12;break}return r.abrupt("return",{code:ea.SUCCESS});case 12:return this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(o.map((function(e){return e.track}))),r.next=15,this._createSubscribeParams(o,{},!1);case 15:return d=r.sent,l=d.reqBody,r.next=19,this._exchangeHandle(l);case 19:if(h=r.sent,c.length&&(f=[],c.forEach((function(e){f.push(e.track.getTrackId())})),null===(t=this._pc.reportParser)||void 0===t||t.clearLatestPacketsRecv(f)),h.code===ea.SUCCESS){r.next=23;break}return r.abrupt("return",{code:h.code});case 23:if(p=h.data,g=p.sdp,m=p.resultCode,v=p.message,_=p.subscribedList,m===ea.SUCCESS){r.next=26;break}return r.abrupt("return",(na.error("change subscribe list failed:",v,m),{code:m}));case 26:return o.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var n=b._roomRes[t.getTrackId()].msid,r=Xc(t.getTrackId()),i=r.tag,o=[r.userId,i].join("_");g.sdp=g.sdp.replace(new RegExp(n,"g"),o)}})),r.next=29,this._pc.setRemoteAnswer(g.sdp);case 29:if((y=r.sent)===ea.SUCCESS){r.next=32;break}return r.abrupt("return",{code:y});case 32:for(I in R=null==_?void 0:_.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),C=o.filter((function(e){if(e.track.isMCUTrack()){var t=b._roomRes[e.track.getTrackId()],n="".concat(t.msid,"_").concat(t.mediaType);return R.includes(n)}return null==R?void 0:R.includes(e.track.getTrackId())})),E=null==C?void 0:C.map((function(e){return"".concat(e.track.getTrackId())})),T=o.filter((function(e){return!(null==E?void 0:E.includes(e.track.getTrackId()))})),S=function(e){var t=C.some((function(t){return t.track.getTrackId()===e}));b._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)S(I);return r.abrupt("return",((i=this._subscribedList).splice.apply(i,[0,this._subscribedList.length].concat(a(C))),T.length?{code:ea.SUCCESS,failedList:T}:{code:ea.SUCCESS}));case 36:case"end":return r.stop()}}),r,this)})))}},{key:"_diffCDNUris",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._CDNUris.url||e.url){t.next=2;break}return t.abrupt("return",(this._callAppListener("onCDNInfoDisable"),void(this._CDNUris=e)));case 2:(!this._CDNUris||!this._CDNUris.url&&e.url)&&this._callAppListener("onCDNInfoEnable",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),n=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,r=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,i=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(n||r||i)&&this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),this._CDNUris=e;case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_getCDNPlayUrl",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.w,r=e.h,i=e.fps,o=this._initOptions.pullInnerCDNProtocol||Yu.FLV,s=this._initOptions.pullInnerCDNUseHttps===Ju.NOT_HTTPS?Ju.NOT_HTTPS:Ju.HTTPS,this._CDNUris.url){t.next=3;break}return t.abrupt("return",(na.error("cdn_uris url is empty, the anchor need to open or push CDN, code: ".concat(ea.CDN_RESOURCE_IS_EMPTY)),{code:ea.CDN_RESOURCE_IS_EMPTY}));case 3:return a={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},c=[],n&&c.push("w=".concat(n)),r&&c.push("h=".concat(r)),i&&c.push("fps=".concat(i)),c.push("kind=".concat(o)),c.push("is_https=".concat(s)),u=c.join("&"),d="".concat(this._CDNUris.url,"?"),u&&(d+=u),t.next=10,this._service.getCDNResourceInfo(a,d);case 10:return l=t.sent,h=l.code,f=l.res,t.abrupt("return",h!==ea.SUCCESS?(na.error("getCDNPlayUrl failed: ".concat(h)),{code:h}):(na.info("getCDNPlayUrl success: ".concat(null==f?void 0:f.data.pull_url)),{code:h,CDNPlayUrl:null==f?void 0:f.data.pull_url}));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"getCDNPlayUrl",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e||nu(e)){n.next=2;break}return n.abrupt("return",(na.error("`resolution` is invalid"),{code:ea.PARAMS_ERROR}));case 2:if(!t||ru(t)){n.next=4;break}return n.abrupt("return",(na.error("`fps` is invalid"),{code:ea.PARAMS_ERROR}));case 4:return r=e?tu(e):{width:null,height:null},i=r.width,o=r.height,s=t?iu(t):null,a={},n.abrupt("return",(i&&(a.w=i),o&&(a.h=o),s&&(a.fps=s),this._getCDNPlayUrl(a)));case 6:case"end":return n.stop()}}),n,this)})))}},{key:"subscribe",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n._subscribeHandle(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Qt("tracks",e,(function(){return Be(e)&&e.length>0&&e.every((function(e){return e instanceof Fc}))}),!0)){n.next=2;break}return n.abrupt("return",(na.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:ea.PARAMS_ERROR}));case 2:return r=this._subscribedList.map((function(e){return Object.assign({},e)})).filter((function(t){return!e.includes(t.track)})),n.abrupt("return",(null===(t=this._polarisReport)||void 0===t||t.sendR2(vu.SUBSCRIBE,_u.END,e.map((function(e){return e.getTrackId()}))),this._updateSubListHandle(r,!1)));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",oa((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__destroy",value:function(e){var t;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=this._destroyed,n.t0){n.next=13;break}if(this._destroyed=!0,null===(t=this._audioLevelReport)||void 0===t||t.clearAudioLevelReportTimer(),n.t1=e,!n.t1){n.next=8;break}return n.next=8,this._context.quitLivingRoomAsAudience(this._roomId);case 8:return n.next=10,this._service.broadcastExit(this._getReqHeaders());case 10:this._pc.destroy(),this._polarisReport=null,this._context.onrtcdatachange=function(){};case 13:case"end":return n.stop()}}),n,this)})))}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"__getPC",value:function(){return this._pc}},{key:"getLocalTrack",value:function(e){return{}}},{key:"__onReconnected",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._context.joinLivingRoomAsAudience(this._roomId,Ot.LIVE);case 2:t=e.sent,t.code!==it.SUCCESS&&na.error("join living room error when on reconnected");case 5:case"end":return e.stop()}}),e,this)})))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"onAudioLevelChange",value:function(e,t){var n;null===(n=this._audioLevelReport)||void 0===n||n.clearAudioLevelReportTimer(),this._audioLevelReport=new Mu(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}},{key:"registerReportListener",value:function(e){var t;null===(t=this._pc)||void 0===t||t.registerReportListener(e)}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getRemoteUserIds",value:function(){return this._roomAnchorList}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){var e=this,t=[],n=[];for(var r in this._remoteTracks){if(2===n.length)break;var i=this._remoteTracks[r];i.isMCUTrack()&&n.push(i)}return this._roomAnchorList.forEach((function(n){t.push.apply(t,a(e.getRemoteTracksByUserId(n)))})),[].concat(n,t)}},{key:"getRemoteRTCTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()||e.push(n)}return e}},{key:"getRemoteMCUTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()&&e.push(n)}return e}},{key:"getCDNInfo",value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}]),e}(),id=function(e,t){var n=[];return n[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],n[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],n},od=function(){function e(t,n,r){_(this,e),this._context=t,this._runtime=n,this._options=r,this._crtRoom=null,this._audience=null,this._crtAudienceLivingRoom=null,Nu.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new $u(this._runtime,this._context,this._options.mediaServer,this._options.timeout),this._context.onconnectionstatechange=this._onIMStatusChange.bind(this),this._context.ondisconnect=this._onIMDisconnect.bind(this),this._context.ondestroy=this._onIMUninit.bind(this),this._context.onmessage=this._handleMessage.bind(this)}return R(e,[{key:"_handleMessage",value:function(e){var t;return e.conversationType===xe.RTC_ROOM&&(this._crtRoom instanceof Qu&&this._getJoinedPKRoomList().forEach((function(t){t.__parseInnerMessage(e)})),null===(t=this._crtRoom)||void 0===t||t.__parseInnerMessage(e),!0)}},{key:"_getJoinedPKRoomList",value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,n=e.roomPKHandler;if(t===ea.SUCCESS&&n){var r=n.getJoinedPKRooms()||{};return Object.values(r)}return[]}},{key:"getCurrentId",value:function(){return this._context.getCurrentId()}},{key:"joinRTCRoom",value:function(e,t){var n=this;return oa((function(){return n._joinRTCRoom(e,t)}))}},{key:"_joinRTCRoom",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!lu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:ea.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Qt("roomId",e,He,!0)){n.next=4;break}return n.abrupt("return",{code:ea.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===st.CONNECTED){n.next=8;break}return n.abrupt("return",{code:ea.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:ea.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return na.debug("joinRoom -> roomId: ".concat(e,"; joinType: ").concat(t||Ut.KICK)),n.next=13,this._context.joinRTCRoom(e,Ot.RTC,void 0,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===it.SUCCESS){n.next=19;break}return na.error("joinRoom failed -> code: ".concat(i)),n.abrupt("return",{code:i===ta.JOIN_REFUSED?ea.SIGNAL_JOIN_RTC_ROOM_REFUSED:i});case 19:return na.debug("joinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new Xu(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this)),n.abrupt("return",(this._crtRoom=s,{room:s,code:ea.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}));case 22:case"end":return n.stop()}}),n,this)})))}},{key:"joinLivingRoom",value:function(e,t){var n=this;return oa((function(){return n._joinLivingRoom(e,t)}))}},{key:"_joinLivingRoom",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!lu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:ea.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Qt("roomId",e,He,!0)&&Qt("livingType",t,(function(e){return e===Ku.AUDIO||e===Ku.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:ea.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===st.CONNECTED){n.next=8;break}return n.abrupt("return",{code:ea.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:ea.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return na.debug("joinRoom, roomId: ".concat(e)),n.next=13,this._context.joinRTCRoom(e,Ot.LIVE,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===it.SUCCESS){n.next=18;break}return n.abrupt("return",(na.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 18:return na.debug("JoinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new Qu(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this),t,!1,!0),this._crtRoom=s,a={room:s,code:ea.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},n.abrupt("return",(s.__getCDNPushMode()===ju.MANUAL&&Object.assign(a,{CDNEnable:s.__getCDNEnable()}),a));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"getAudienceClient",value:function(){return this._audience||(this._audience=new ed(this._context,this._runtime,this._options)),this._audience}},{key:"_onIMStatusChange",value:function(e){na.debug("signal server connection state change: ".concat(e)),e===st.CONNECTED&&(this._crtRoom instanceof Qu&&this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()})),this._crtRoom&&this._crtRoom.__onReconnected())}},{key:"_onIMDisconnect",value:function(){na.debug("TODO -> on IM disconnect")}},{key:"_onIMUninit",value:function(){na.debug("TODO -> on IM client ondestroy")}},{key:"leaveRoom",value:function(e){var t=this;return oa((function(){return t._leaveRoom(e)}))}},{key:"_leaveRoom",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._crtRoom){e.next=8;break}return e.next=3,this._crtRoom.__destroy(!0);case 3:na.debug("quitRTCRoom -> userId: ".concat(this._context.getCurrentId()," , roomId: ").concat(this._crtRoom.getRoomId())),this._crtRoom=null,e.t0={code:ea.SUCCESS},e.next=9;break;case 8:e.t0={code:ea.SUCCESS};case 9:return e.abrupt("return",e.t0);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"_releaseCrtRoomObj",value:function(){this._crtRoom=null}},{key:"_getMediaStream",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"getUserMedia";return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,navigator.mediaDevices[t](e);case 3:return r=n.sent,n.abrupt("return",{code:ea.SUCCESS,stream:r});case 7:if(n.prev=7,n.t0=n.catch(0),"Permission denied"!==n.t0.message){n.next=11;break}return n.abrupt("return",{code:ea.PERMISSION_DENIED});case 11:na.error("get user media failed -> ".concat(n.t0.message));case 12:return n.abrupt("return",{code:"getUserMedia"===t?ea.GET_USER_MEDIA_FAILED:ea.GET_DISPLAY_MEDIA_FAILED});case 13:case"end":return n.stop()}}),n,null,[[0,7]])})))}},{key:"createMicrophoneAudioTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",t=arguments.length>1?arguments[1]:void 0;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Gc(e)){n.next=2;break}return n.abrupt("return",{code:ea.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:ea.INVALID_USER_ID});case 5:return n.next=7,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate}});case 7:if(i=n.sent,o=i.stream,(s=i.code)===ea.SUCCESS){n.next=12;break}return n.abrupt("return",{code:s});case 12:return a=o.getAudioTracks()[0],n.abrupt("return",{code:s,track:new Dc(e,r,a)});case 14:case"end":return n.stop()}}),n,this)})))}},{key:"createCameraVideoTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",t=arguments.length>1?arguments[1]:void 0;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Gc(e)){n.next=2;break}return n.abrupt("return",{code:ea.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:ea.INVALID_USER_ID});case 5:return i=nu(null==t?void 0:t.resolution)?t.resolution:_c.W640_H480,o=tu(i),s=o.width,a=o.height,n.next=11,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:iu((null==t?void 0:t.frameRate)||vc.FPS_15),width:s,height:a,facingMode:null==t?void 0:t.faceMode}});case 11:if(c=n.sent,u=c.stream,(d=c.code)===ea.SUCCESS){n.next=16;break}return n.abrupt("return",{code:d});case 16:return l=u.getVideoTracks()[0],n.abrupt("return",{code:d,track:new Vc(e,r,l)});case 18:case"end":return n.stop()}}),n,this)})))}},{key:"createMicrophoneAndCameraTracks",value:function(){var e,t,n,r,i,o,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",a=arguments.length>1?arguments[1]:void 0;return $s(this,void 0,void 0,regeneratorRuntime.mark((function c(){var u,d,l,h,f,p,g,m,v;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(u=[],Gc(s)){c.next=3;break}return c.abrupt("return",{code:ea.INVALID_TAGS,tracks:u});case 3:if(d=this._context.getCurrentId()){c.next=6;break}return c.abrupt("return",{code:ea.INVALID_USER_ID,tracks:u});case 6:return l=nu(null===(e=null==a?void 0:a.video)||void 0===e?void 0:e.resolution)?a.video.resolution:_c.W640_H480,h=tu(l),f=h.width,p=h.height,c.next=12,this._getMediaStream({video:{deviceId:null===(t=null==a?void 0:a.video)||void 0===t?void 0:t.cameraId,frameRate:iu((null===(n=null==a?void 0:a.video)||void 0===n?void 0:n.frameRate)||vc.FPS_15),width:f,height:p,facingMode:null===(r=null==a?void 0:a.video)||void 0===r?void 0:r.faceMode},audio:{deviceId:null===(i=null==a?void 0:a.audio)||void 0===i?void 0:i.micphoneId,sampleRate:null===(o=null==a?void 0:a.audio)||void 0===o?void 0:o.sampleRate}});case 12:return g=c.sent,m=g.stream,v=g.code,c.abrupt("return",(v!==ea.SUCCESS||m.getTracks().forEach((function(e){"video"===e.kind?u.push(new Vc(s,d,e)):u.unshift(new Dc(s,d,e))})),{code:v,tracks:u}));case 16:case"end":return c.stop()}}),c,this)})))}},{key:"createScreenVideoTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",t=arguments.length>1?arguments[1]:void 0;return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,f;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Gc(e)){n.next=2;break}return n.abrupt("return",{code:ea.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:ea.INVALID_USER_ID});case 5:if(au()){n.next=7;break}return n.abrupt("return",{code:ea.BROWSER_NOT_SUPPORT});case 7:if(!(i=/Electron/.test(navigator.userAgent))||(null==t?void 0:t.chromeMediaSourceId)){n.next=10;break}return n.abrupt("return",{code:ea.PARAMS_ERROR});case 10:return o=nu(null==t?void 0:t.resolution)?t.resolution:_c.W1280_H720,s=tu(o),a=s.width,c=s.height,u=i?{mandatory:{chromeMediaSourceId:t.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:a,maxWidth:a,minHeight:c,maxHeight:c}}:{frameRate:iu((null==t?void 0:t.frameRate)||vc.FPS_15),width:a,height:c},n.next=17,this._getMediaStream({video:u,audio:!1},i?"getUserMedia":"getDisplayMedia");case 17:if(d=n.sent,l=d.stream,(h=d.code)===ea.SUCCESS){n.next=22;break}return n.abrupt("return",{code:h});case 22:return f=l.getVideoTracks()[0],n.abrupt("return",{code:h,track:new Bc(e,r,f)});case 24:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalAudioTrack",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Gc(e)){n.next=2;break}return n.abrupt("return",{code:ea.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){n.next=4;break}return n.abrupt("return",{code:ea.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:ea.SUCCESS,track:new Ac(e,r,t)}:{code:ea.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalVideoTrack",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Gc(e)){n.next=2;break}return n.abrupt("return",{code:ea.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"video"===t.kind){n.next=4;break}return n.abrupt("return",{code:ea.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:ea.SUCCESS,track:new xc(e,r,t)}:{code:ea.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalFileTracks",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Gc(e)){r.next=2;break}return r.abrupt("return",{code:ea.INVALID_TAGS,tracks:[]});case 2:if(su()){r.next=4;break}return r.abrupt("return",{code:ea.BROWSER_NOT_SUPPORT,tracks:[]});case 4:if(i=t instanceof File?URL.createObjectURL(t):t,Ye(i)||/^blob:/.test(i)){r.next=7;break}return r.abrupt("return",(na.warn("createLocalFileTracks failed: params error -> url: ".concat(i)),{code:ea.PARAMS_ERROR,tracks:[]}));case 7:return o=this._context.getCurrentId(),r.abrupt("return",o?new Promise((function(t){var r=document.createElement("video");(null==n?void 0:n.withoutAudio)&&(r.muted=!0),r.onloadedmetadata=function(){var a,c=[];try{var u=r.mozCaptureStream?"mozCaptureStream":"captureStream";a=r[u]()}catch(e){na.error("create RCLocalFileTrack failed, captureSteam error. -> url: ".concat(i)),na.error(e),t({code:ea.CREATE_FILE_TRACK_FAILED,tracks:c})}var d=s(id(a,n),2),l=d[0],h=d[1];l&&c.push(new Uc(e,o,l,r)),h&&c.push(new Lc(e,o,h,r)),0===c.length&&(r.pause(),r.src=""),r.onerror=null,t({code:ea.SUCCESS,tracks:c})},r.onerror=function(){na.error("create RCLocalFileTrack failed -> url: ".concat(i)),t({code:ea.CREATE_FILE_TRACK_FAILED,tracks:[]})},r.src=i,r.loop=!0,r.play()})):{code:ea.INVALID_USER_ID,tracks:[]});case 9:case"end":return r.stop()}}),r,this)})))}},{key:"createLocalTracks",value:function(e,t,n){return $s(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,c,u,d;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=[],Gc(e)){r.next=3;break}return r.abrupt("return",{code:ea.INVALID_TAGS,tracks:i});case 3:if(t instanceof MediaStream){r.next=5;break}return r.abrupt("return",{code:ea.PARAMS_ERROR,tracks:i});case 5:if(o=this._context.getCurrentId()){r.next=8;break}return r.abrupt("return",{code:ea.INVALID_USER_ID,tracks:i});case 8:return a=id(t,n),c=s(a,2),u=c[0],d=c[1],r.abrupt("return",(u&&i.push(new Ac(e,o,u)),d&&i.push(new xc(e,o,d)),{code:ea.SUCCESS,tracks:i}));case 10:case"end":return r.stop()}}),r,this)})))}},{key:"joinLivingRoomAsAudience",value:function(e,t){return $s(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!lu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:ea.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Qt("roomId",e,He,!0)&&Qt("livingType",t,(function(e){return e===Ku.AUDIO||e===Ku.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:ea.PARAMS_ERROR});case 4:if(!this._crtAudienceLivingRoom){n.next=6;break}return n.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 6:if(this._service.getNaviMS().length){n.next=8;break}return n.abrupt("return",{code:ea.NOT_OPEN_VIDEO_AUDIO_SERVER});case 8:return n.next=10,this._context.joinLivingRoomAsAudience(e,Ot.LIVE,t);case 10:if(r=n.sent,i=r.code,o=r.data,i===it.SUCCESS){n.next=15;break}return n.abrupt("return",(na.error("audienceJoinLivingRoomError:",i),{code:ea.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}));case 15:return na.info("joinLivingRoomAsAudience success, room data: ".concat(JSON.stringify(o))),s=new rd(this._context,this._runtime,this._options,e,o,t),n.abrupt("return",(this._crtAudienceLivingRoom=s,{room:s,code:ea.SUCCESS,userIds:s.getRemoteUserIds(),RTCTracks:s.getRemoteRTCTracks(),MCUTracks:s.getRemoteMCUTracks(),CDNUris:s.getCDNInfo()}));case 18:case"end":return n.stop()}}),n,this)})))}},{key:"leaveLivingRoomAsAudience",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._crtAudienceLivingRoom){t.next=12;break}if(this._crtAudienceLivingRoom===e){t.next=5;break}t.t1={code:ea.PARAMS_ERROR},t.next=9;break;case 5:return t.next=7,this._crtAudienceLivingRoom.__destroy(!0);case 7:this._crtAudienceLivingRoom=null,t.t1={code:ea.SUCCESS};case 9:t.t0=t.t1,t.next=13;break;case 12:t.t0={code:ea.SUCCESS};case 13:return t.abrupt("return",t.t0);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"upgradeToAnchorRoom",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Qt("room._roomId",e._roomId,He,!0)){t.next=2;break}return t.abrupt("return",{code:ea.PARAMS_ERROR});case 2:if(!this._crtRoom){t.next=4;break}return t.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Lt.ViewerToAnchor,e._livingType);case 6:if(n=t.sent,r=n.code,i=n.data,r===it.SUCCESS){t.next=11;break}return t.abrupt("return",(na.error("change room identity error",r),{code:ea.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return t.next=13,this._crtAudienceLivingRoom.__destroy(!1);case 13:return o=new Qu(this._context,this._runtime,e._roomId,i,this._service,this._options,this._releaseCrtRoomObj.bind(this),e._livingType,!0,!0),t.abrupt("return",(this._crtRoom=o,this._crtAudienceLivingRoom=null,{room:o,code:ea.SUCCESS,userIds:e.getRemoteUserIds(),tracks:o.getRemoteTracks()}));case 15:case"end":return t.stop()}}),t,this)})))}},{key:"downgradeToAudienceRoom",value:function(e){return $s(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Qt("room._roomId",e._roomId,He,!0)){t.next=2;break}return t.abrupt("return",{code:ea.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.next=4;break}return t.abrupt("return",{code:ea.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Lt.AnchorToViewer,e.getLivingType());case 6:if(n=t.sent,r=n.code,i=n.data,r===it.SUCCESS){t.next=11;break}return t.abrupt("return",(na.error("change room identity error",r),{code:ea.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return na.info("downgradeToAudienceRoom success, room data: ".concat(JSON.stringify(i))),o=new rd(this._context,this._runtime,this._options,e._roomId,i,e.getLivingType()),t.abrupt("return",(this._crtAudienceLivingRoom=o,this._crtRoom.__destroy(!1),this._crtRoom=null,{room:o,code:ea.SUCCESS,userIds:o.getRemoteUserIds(),RTCTracks:o.getRemoteRTCTracks(),MCUTracks:o.getRemoteMCUTracks(),CDNUris:o.getCDNInfo()}));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"getJoinedRoomInfo",value:function(){return $s(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._context.getRTCJoinedUserInfo(this._context.getCurrentId());case 2:return t=e.sent,n=t.code,r=t.data,e.abrupt("return",n!==it.SUCCESS?(na.error("getJoinedUserInfo error",n),{code:ea.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:ea.SUCCESS,data:r});case 6:case"end":return e.stop()}}),e,this)})))}}]),e}();!function(e){e[e.SERVER_KICK=1]="SERVER_KICK",e[e.OTHER_KICK=2]="OTHER_KICK"}(td||(td={}));var sd={tag:"RCRTC",verify:function(e){return"browser"!==e.tag?(na.error("RCRTC Plugin is not support the runtime '".concat(e.tag,"'")),!1):Yc?(Ht.add("plugin-rtc","5.3.1"),!!Ht.validEngine("5.1.0")||(na.error("The current engine version '".concat(Ht.getInfo().engine,"' error, plugin-rtc required engine version at least '5.1.0'.")),!1)):(na.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return na.setLogLevel(n.logLevel),na.setLogStdout(n.logStdout),na.warn("RCRTC Version: 5.3.1, Commit: e1af0f5ccb06a0084c94e1219d8af54c9793c06b"),na.warn("browserInfo.browser -> ".concat(ou.browser)),na.warn("browserInfo.supportsUnifiedPlan -> ".concat(ou.supportsUnifiedPlan)),na.warn("browserInfo.version -> ".concat(ou.version)),Wt("options.mediaServer",n.mediaServer,(function(e){return!(!Ye(e)||"https:"===location.protocol&&!/^https/.test(e))})),Wt("options.timeout",n.timeout,(function(e){return Ve(e)&&e>=5e3&&e<=3e4})),Wt("options.pingGap",n.pingGap,(function(e){return Ve(e)&&e>=3e3&&e<=1e4})),new od(e,t,n)}},ad={transResolution:tu,transFrameRate:iu,parseTrackId:Xc,ifSupportLocalFileTrack:su,ifSupportScreenShare:au};var cd={"RC:Chatroom:Welcome":"Welcome","RC:TxtMsg":"Text","RC:Chatroom:Barrage":"Barrage","RC:Chatroom:Like":"Like","RC:Chatroom:SeatsCtrl":"SeatsCtrl","RC:Chatroom:ChatBan":"ChatBan","RC:Chatroom:SeatApply":"SeatApply","RC:Chatroom:SeatResponse":"SeatResponse","RM:RTC:TrackUnpublish":"TrackUnpublish","RM:RTC:SwitchRole":"SwitchRole","RM:RTC:UserLeave":"UserLeave","RC:Chatroom:Leave":"Leave"},ud=function(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}}}(),dd=f({roomUid:"LIVE-2112263-12345",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:y(null),rtcClient:null,joinedRoom:null,mediaStreamTrack:[],mediaStreams:null,videoStatus:"init",microphones:[],cameras:[],selectedCamera:null,selectedMicrophone:null,likeCount:0,lastLikeCount:0,activeTracks:{},allowSeatsCtrl:!0,allowChatCtrl:!0,deviceStatus:{microphone:"init",camera:"init",screen:"init"}}),ld=dd;!function(e){ss=ss||new as(e)}({appkey:"c9kqb3rdc451j"});var hd=Zs("RC:Chatroom:SeatsCtrl",!0,!0),fd=Zs("RC:Chatroom:ChatBan",!0,!0),pd=Zs("RC:Chatroom:SeatApply",!0,!0),gd=Zs("RC:Chatroom:SeatResponse",!0,!0),md=Po,vd=(md.MESSAGES,o(md,e));ms(md.MESSAGES,(function(e){console.log(e,"收到消息");var t,n=C(e.messages);try{for(n.s();!(t=n.n()).done;){var r=t.value;cd[r.messageType]&&ud.emit(cd[r.messageType],i(i({},r.content),{},{$EventMessage:r}))}}catch(o){n.e(o)}finally{n.f()}}));for(var _d=function(){var e=Rd[yd];ms(e,(function(t){console.log(e,t),ud.emit(e,{$EventMessage:null})}))},yd=0,Rd=Object.values(vd);yd<Rd.length;yd++)_d();ms(md.CONNECTING,(function(){console.log("connecting"),dd.imConnectStatus="connecting"})),ms(md.CONNECTED,(function(){console.log("connected"),dd.imConnectStatus="connected"})),ms(md.DISCONNECT,(function(){console.log("disconnect"),dd.imConnectStatus="disconnect"}));var Cd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,gs(t);case 3:return r=e.sent,dd.rtcClient=ps(sd,{}),console.log("connect success",null===(n=r.data)||void 0===n?void 0:n.userId),e.abrupt("return",r);case 9:throw e.prev=9,e.t0=e.catch(0),e.t0;case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),Ed=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!dd.rtcClient){e.next=9;break}return e.next=3,wd("screen");case 3:n=e.sent,r=dd.activeTracks.camera,null===(t=dd.joinedRoom)||void 0===t||t.unpublish([r]),kd([n],"screen"),dd.videoRef&&n.play(dd.videoRef),null==n||n.on(Oc.EVENT_LOCAL_TRACK_END,(function(e){dd.screenShareStatus=!1,e.destroy(),kd([r],"camera"),dd.videoRef&&r.play(dd.videoRef)}));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Td=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wc();case 2:return t=e.sent,dd.microphones=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Sd=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,bc();case 2:return t=e.sent,dd.cameras=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Id=function(e){dd.selectedCamera=e},bd=function(e){dd.selectedMicrophone=e},wd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,s,a,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null,"microphone"!==t){e.next=7;break}return e.next=4,null===(o=dd.rtcClient)||void 0===o?void 0:o.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:null===(s=dd.selectedMicrophone)||void 0===s?void 0:s.deviceId});case 4:r=e.sent,e.next=16;break;case 7:if("camera"!==t){e.next=13;break}return e.next=10,null===(a=dd.rtcClient)||void 0===a?void 0:a.createCameraVideoTrack("RongCloudRTC",{cameraId:null===(c=dd.selectedCamera)||void 0===c?void 0:c.deviceId,faceMode:"user",frameRate:vc.FPS_15,resolution:_c.W1280_H720});case 10:r=e.sent,e.next=16;break;case 13:return e.next=15,null==dd||null===(u=dd.rtcClient)||void 0===u?void 0:u.createScreenVideoTrack();case 15:r=e.sent;case 16:return i=null===(n=r)||void 0===n?void 0:n.track,r.code===ea.PERMISSION_DENIED?dd.deviceStatus[t]="denied":dd.deviceStatus[t]="granted",e.abrupt("return",i);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),kd=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,s,a,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!(c.length>2&&void 0!==c[2])||c[2],i=C(t);try{for(i.s();!(o=i.n()).done;)s=o.value,dd.activeTracks[n]=s}catch(u){i.e(u)}finally{i.f()}if(!r){e.next=6;break}return e.next=6,null===(a=dd.joinedRoom)||void 0===a?void 0:a.publish(t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Nd=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,s,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!(a.length>2&&void 0!==a[2])||a[2],i=C(t);try{for(i.s();!(o=i.n()).done;)o.value.destroy(),dd.activeTracks[n]=null}catch(c){i.e(c)}finally{i.f()}if(!r){e.next=6;break}return e.next=6,null===(s=dd.joinedRoom)||void 0===s?void 0:s.unpublish(t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Od=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var i,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vs(t,{count:-1});case 2:return e.next=4,null===(i=dd.rtcClient)||void 0===i?void 0:i.joinLivingRoom(t,n);case 4:if((null==(s=e.sent)?void 0:s.code)==ea.SUCCESS){e.next=7;break}throw Error("加入房间失败");case 7:return null===(o=s.room)||void 0===o||o.registerRoomEventListener(r),e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Ad=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("stream"===dd.videoStatus){e.next=2;break}throw Error("当前无视频流");case 2:if(!dd.joinedRoom){e.next=23;break}return e.next=6,wd("microphone");case 6:return r=e.sent,console.log(r),e.next=10,wd("camera");case 10:return i=e.sent,e.next=13,kd([i],"camera");case 13:return dd.videoStatus="liveing",e.next=16,kd([r],"microphone");case 16:return e.next=18,null===(t=dd.joinedRoom)||void 0===t?void 0:t.getMCUConfigBuilder();case 18:return o=e.sent,e.next=21,null===(n=o.setOutputVideoRenderMode)||void 0===n?void 0:n.call(o,Du.WHOLE);case 21:return e.next=23,o.flush();case 23:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xd=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.post("/api-im/user/statusImUser",{data:{os:"PC",status:2,userId:null===(t=r.user)||void 0===t?void 0:t.id}});case 2:for(n in dd.videoStatus="stopped",dd.activeTracks)Object.prototype.hasOwnProperty.call(dd.activeTracks,n)&&(i=dd.activeTracks[n])&&Nd([i],n);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Pd=function(){var e=n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dd.likeCount===dd.lastLikeCount&&0!==dd.likeCount){e.next=9;break}return e.prev=1,e.next=4,u.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:dd.likeCount,roomUid:dd.roomUid}});case 4:dd.lastLikeCount=dd.likeCount,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:setTimeout((function(){Pd()}),6e4);case 10:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}(),Md=function(){var e,t,n,i;return{id:null===(e=r.user)||void 0===e?void 0:e.speakerId,name:null===(t=r.user)||void 0===t?void 0:t.speakerName,userId:null===(n=r.user)||void 0===n?void 0:n.speakerId,userName:null===(i=r.user)||void 0===i?void 0:i.speakerName}},Ld=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>1&&void 0!==s[1]?s[1]:"text",i=null,t){e.next=4;break}return e.abrupt("return");case 4:if(o={conversationType:xe.CHATROOM,targetId:null===(n=dd.joinedRoom)||void 0===n?void 0:n._roomId},"text"===r?i=new Is({user:Md(),content:t}):"SeatsCtrl"===r?i=new hd(t):"ChatBan"===r?i=new fd(t):"SeatApply"===r?i=new pd(t):"SeatResponse"===r&&(i=new gd(t)),i){e.next=8;break}return e.abrupt("return");case 8:return console.log(i),e.next=11,Qs(o,i);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ud=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[1],"microphone"!==t||!dd.activeTracks[t]){e.next=5;break}null===(r=dd.activeTracks[t])||void 0===r||r.unmute(),e.next=11;break;case 5:return e.next=7,wd(t);case 7:return i=e.sent,e.next=10,kd([i],t,n);case 10:dd.videoRef&&i.play(dd.videoRef);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Dd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(i.length>1&&void 0!==i[1])||i[1],r=dd.activeTracks[t],"microphone"===t){e.next=8;break}return e.next=5,Nd([r],t,n);case 5:null==r||r.destroy(),e.next=9;break;case 8:null==r||r.mute();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Vd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=dd.activeTracks[t],r="liveing"===dd.videoStatus,n?Dd(t,r):Ud(t,r);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Bd=E({methods:{loginOut:function(){var e=this;return n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u.post("/api-auth/exit",{data:{}});case 3:Dd("camera"),Dd("microphone"),r.user=null,T.success("退出成功"),l(),e.$router.push({path:"/login",query:i({},e.$route.query)}),t.next=13;break;case 11:t.prev=11,t.t0=t.catch(0);case 13:case"end":return t.stop()}}),t,null,[[0,11]])})))()}},render:function(){var e,t,n,i=this;return I("div",{class:Q},[I("div",{class:Z},[I("div",{class:$},[I("img",{class:X,src:null===(e=r.user)||void 0===e?void 0:e.tenantLogo,alt:""},null),null===(t=r.user)||void 0===t?void 0:t.tenantName]),I("div",{class:ee},[b("《"),null===(n=r.user)||void 0===n?void 0:n.roomTitle,b("》")])]),I(w,{trigger:"hover"},{default:function(){var e;return[I("div",{class:te},[I("img",{class:ne,src:"/src/assets/home/placehorder-icon.png"},null),I("span",null,[null===(e=r.user)||void 0===e?void 0:e.speakerName])])]},dropdown:function(){return I(k,null,{default:function(){return[I(N,{command:"1",onClick:i.loginOut},{default:function(){return[I("span",null,[b("安全退出")])]}})]}})}})])}}),Fd="_header_22t18_1",Hd="_title_22t18_9",jd=E({name:"LiveBroadcastHeader",methods:{startLive:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,O.confirm("是否确认开始直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,Ad();case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,null,[[0,7]])})))()},closeLive:function(){return n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,O.confirm("是否确认结束直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,u.post("/api-im/user/statusImUser",{data:{os:"IOS",status:"2",userid:null===(t=r.user)||void 0===t?void 0:t.id}});case 5:return e.next=7,xd();case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}}),e,null,[[0,9]])})))()}},render:function(){var e;return I("div",{class:Fd},[I("h3",{class:Hd},[b("直播内容:"),null===(e=r.user)||void 0===e?void 0:e.liveRemark]),"liveing"===ld.videoStatus?I(A,{type:"danger",color:"#EA4132",onClick:this.closeLive},{default:function(){return[b("关闭直播")]}}):I(A,{type:"primary",color:"#01A79E",onClick:this.startLive},{default:function(){return[b("开始直播")]}})])}}),Kd="_action-bar_1akc3_1",qd="_bar-btn_1akc3_12",Gd="_bar-btn-text_1akc3_19",Yd="_volumeSlider_1akc3_71",Jd="_volumeIcon_1akc3_80",zd="_btnInner_1akc3_85",Wd={shareWrap:"_shareWrap_d61fv_1",shareBtn:"_shareBtn_d61fv_27"};var Qd=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Xd="application/font-woff",Zd="image/jpeg",$d={woff:Xd,woff2:Xd,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Zd,jpeg:Zd,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function el(e){var t=function(e){var t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return $d[t]||""}function tl(e){return-1!==e.search(/^(data:)/)}function nl(e,t){return"data:".concat(t,";base64,").concat(e)}var rl,il=(rl=0,function(){return rl+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(rl)});function ol(e){for(var t=[],n=0,r=e.length;n<r;n+=1)t.push(e[n]);return t}function sl(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}function al(e){var t=sl(e,"border-left-width"),n=sl(e,"border-right-width");return e.clientWidth+t+n}function cl(e){var t=sl(e,"border-top-width"),n=sl(e,"border-bottom-width");return e.clientHeight+t+n}function ul(){var e,t;try{t=process}catch(W){}var n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}function dl(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.crossOrigin="anonymous",r.decoding="sync",r.src=e}))}function ll(e){return Qd(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(e)})).then(encodeURIComponent).then((function(e){return"data:image/svg+xml;charset=utf-8,".concat(e)})));case 1:case"end":return t.stop()}}),t)})))}function hl(e,t,n){return Qd(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i="http://www.w3.org/2000/svg",o=document.createElementNS(i,"svg"),s=document.createElementNS(i,"foreignObject"),o.setAttribute("width","".concat(t)),o.setAttribute("height","".concat(n)),o.setAttribute("viewBox","0 0 ".concat(t," ").concat(n)),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),o.appendChild(s),s.appendChild(e),r.abrupt("return",ll(o));case 14:case"end":return r.stop()}}),r)})))}var fl={};function pl(e,t){var n=function(e){var t=e.replace(/\?.*/,"");return/ttf|otf|eot|woff2?/i.test(t)&&(t=t.replace(/.*\//,"")),t}(e);if(null!=fl[n])return fl[n];t.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());var r=window.fetch(e).then((function(e){return e.blob().then((function(t){return{blob:t,contentType:e.headers.get("Content-Type")||""}}))})).then((function(e){var t=e.blob,n=e.contentType;return new Promise((function(e,r){var i=new FileReader;i.onloadend=function(){return e({contentType:n,blob:i.result})},i.onerror=r,i.readAsDataURL(t)}))})).then((function(e){var t,n=e.blob;return{contentType:e.contentType,blob:(t=n,t.split(/,/)[1])}})).catch((function(n){var r="";if(t.imagePlaceholder){var i=t.imagePlaceholder.split(/,/);i&&i[1]&&(r=i[1])}var o="Failed to fetch resource: ".concat(e);return n&&(o="string"==typeof n?n:n.message),o&&console.error(o),{blob:r,contentType:""}}));return fl[n]=r,r}function gl(e,t,n){var r=".".concat(e,":").concat(t),i=n.cssText?function(e){var t=e.getPropertyValue("content");return"".concat(e.cssText," content: '").concat(t.replace(/'|"/g,""),"';")}(n):function(e){return ol(e).map((function(t){var n=e.getPropertyValue(t),r=e.getPropertyPriority(t);return"".concat(t,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n);return document.createTextNode("".concat(r,"{").concat(i,"}"))}function ml(e,t,n){var r=window.getComputedStyle(e,n),i=r.getPropertyValue("content");if(""!==i&&"none"!==i){var o=il();try{t.className="".concat(t.className," ").concat(o)}catch(a){return}var s=document.createElement("style");s.appendChild(gl(o,n,r)),t.appendChild(s)}}function vl(e,t){ml(e,t,":before"),ml(e,t,":after")}var _l=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};function yl(e){return _l(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("data:,"!==(n=e.toDataURL())){t.next=3;break}return t.abrupt("return",Promise.resolve(e.cloneNode(!1)));case 3:return t.abrupt("return",dl(n));case 4:case"end":return t.stop()}}),t)})))}function Rl(e,t){return _l(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",Promise.resolve(e.poster).then((function(e){return pl(e,t)})).then((function(t){return nl(t.blob,el(e.poster)||t.contentType)})).then((function(e){return dl(e)})));case 1:case"end":return n.stop()}}),n)})))}function Cl(e,t){return _l(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(e instanceof HTMLCanvasElement)){n.next=2;break}return n.abrupt("return",yl(e));case 2:if(!(e instanceof HTMLVideoElement&&e.poster)){n.next=4;break}return n.abrupt("return",Rl(e,t));case 4:return n.abrupt("return",Promise.resolve(e.cloneNode(!1)));case 5:case"end":return n.stop()}}),n)})))}function El(e,t,n){var r;return _l(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(0===(o=null!=(s=e).tagName&&"SLOT"===s.tagName.toUpperCase()&&e.assignedNodes?ol(e.assignedNodes()):ol((null!==(r=e.shadowRoot)&&void 0!==r?r:e).childNodes)).length||e instanceof HTMLVideoElement)){i.next=3;break}return i.abrupt("return",Promise.resolve(t));case 3:return i.abrupt("return",o.reduce((function(e,r){return e.then((function(){return bl(r,n)})).then((function(e){e&&t.appendChild(e)}))}),Promise.resolve()).then((function(){return t})));case 4:case"end":return i.stop()}var s}),i)})))}function Tl(e,t){var n=window.getComputedStyle(e),r=t.style;r&&(n.cssText?r.cssText=n.cssText:ol(n).forEach((function(e){r.setProperty(e,n.getPropertyValue(e),n.getPropertyPriority(e))})))}function Sl(e,t){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function Il(e,t){return _l(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t instanceof Element){n.next=2;break}return n.abrupt("return",Promise.resolve(t));case 2:return n.abrupt("return",Promise.resolve().then((function(){return Tl(e,t)})).then((function(){return vl(e,t)})).then((function(){return Sl(e,t)})).then((function(){return t})));case 3:case"end":return n.stop()}}),n)})))}function bl(e,t,n){return _l(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n||!t.filter||t.filter(e)){r.next=2;break}return r.abrupt("return",Promise.resolve(null));case 2:return r.abrupt("return",Promise.resolve(e).then((function(e){return Cl(e,t)})).then((function(n){return El(e,n,t)})).then((function(t){return Il(e,t)})));case 3:case"end":return r.stop()}}),r)})))}var wl=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},kl=/url\((['"]?)([^'"]+?)\1\)/g,Nl=/url\([^)]+\)\s*format\((["'])([^"']+)\1\)/g,Ol=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Al(e){var t=[];return e.replace(kl,(function(e,n,r){return t.push(r),e})),t.filter((function(e){return!tl(e)}))}function xl(e,t,n,r,i){var o=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}(t,n):t;return Promise.resolve(o).then((function(e){return i?i(e):pl(e,r)})).then((function(e){return"string"==typeof e?nl(e,el(t)):nl(e.blob,el(t)||e.contentType)})).then((function(n){return e.replace((r=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1"),new RegExp("(url\\(['\"]?)(".concat(r,")(['\"]?\\))"),"g")),"$1".concat(n,"$3"));var r})).then((function(e){return e}),(function(){return o}))}function Pl(e,t){var n=t.preferredFontFormat;return n?e.replace(Ol,(function(e){for(;;){var t=s(Nl.exec(e)||[],3),r=t[0],i=t[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):e}function Ml(e){return-1!==e.search(kl)}function Ll(e,t,n){return wl(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Ml(e)){r.next=2;break}return r.abrupt("return",Promise.resolve(e));case 2:return i=Pl(e,n),r.abrupt("return",Promise.resolve(i).then(Al).then((function(e){return e.reduce((function(e,r){return e.then((function(e){return xl(e,r,t,n)}))}),Promise.resolve(i))})));case 4:case"end":return r.stop()}}),r)})))}var Ul=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};function Dl(e,t){var n;return Ul(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=null===(n=e.style)||void 0===n?void 0:n.getPropertyValue("background")){r.next=3;break}return r.abrupt("return",Promise.resolve(e));case 3:return r.abrupt("return",Promise.resolve(i).then((function(e){return Ll(e,null,t)})).then((function(t){return e.style.setProperty("background",t,e.style.getPropertyPriority("background")),e})));case 4:case"end":return r.stop()}}),r)})))}function Vl(e,t){return Ul(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e instanceof HTMLImageElement&&!tl(e.src)||e instanceof SVGImageElement&&!tl(e.href.baseVal)){n.next=2;break}return n.abrupt("return",Promise.resolve(e));case 2:return r=e instanceof HTMLImageElement?e.src:e.href.baseVal,n.abrupt("return",Promise.resolve(r).then((function(e){return pl(e,t)})).then((function(e){return nl(e.blob,el(r)||e.contentType)})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=r,e instanceof HTMLImageElement?(e.srcset="",e.src=t):e.href.baseVal=t}))})).then((function(){return e}),(function(){return e})));case 4:case"end":return n.stop()}}),n)})))}function Bl(e,t){return Ul(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=ol(e.childNodes),i=r.map((function(e){return Fl(e,t)})),n.abrupt("return",Promise.all(i).then((function(){return e})));case 3:case"end":return n.stop()}}),n)})))}function Fl(e,t){return Ul(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e instanceof Element){n.next=2;break}return n.abrupt("return",Promise.resolve(e));case 2:return n.abrupt("return",Promise.resolve(e).then((function(e){return Dl(e,t)})).then((function(e){return Vl(e,t)})).then((function(e){return Bl(e,t)})));case 3:case"end":return n.stop()}}),n)})))}function Hl(e,t){var n=e.style;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width="".concat(t.width,"px")),t.height&&(n.height="".concat(t.height,"px"));var r=t.style;return null!=r&&Object.keys(r).forEach((function(e){n[e]=r[e]})),e}var jl=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Kl={};function ql(e){var t=Kl[e];if(null!=t)return t;var n=window.fetch(e).then((function(t){return{url:e,cssText:t.text()}}));return Kl[e]=n,n}function Gl(e){return jl(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.cssText.then((function(t){var n=t,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map((function(t){var i=t.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),window.fetch(i).then((function(e){return e.blob()})).then((function(e){return new Promise((function(r,i){var o=new FileReader;o.onloadend=function(){n=n.replace(t,"url(".concat(o.result,")")),r([t,o.result])},o.onerror=i,o.readAsDataURL(e)}))}))}));return Promise.all(i).then((function(){return n}))})));case 1:case"end":return t.stop()}}),t)})))}function Yl(e){if(null==e)return[];for(var t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,""),r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");;){var i=r.exec(n);if(null===i)break;t.push(i[0])}n=n.replace(r,"");for(var o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");;){var a=o.exec(n);if(null===a){if(null===(a=s.exec(n)))break;o.lastIndex=s.lastIndex}else s.lastIndex=o.lastIndex;t.push(a[0])}return t}function Jl(e){return jl(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[],r=[],e.forEach((function(t){if("cssRules"in t)try{ol(t.cssRules).forEach((function(e,n){if(e.type===CSSRule.IMPORT_RULE){var i=n+1,o=ql(e.href).then((function(e){return e?Gl(e):""})).then((function(e){return Yl(e).forEach((function(e){try{t.insertRule(e,e.startsWith("@import")?i+=1:t.cssRules.length)}catch(n){console.error("Error inserting rule from remote css",{rule:e,error:n})}}))})).catch((function(e){console.error("Error loading remote css",e.toString())}));r.push(o)}}))}catch(W){var n=e.find((function(e){return null==e.href}))||document.styleSheets[0];null!=t.href&&r.push(ql(t.href).then((function(e){return e?Gl(e):""})).then((function(e){return Yl(e).forEach((function(e){n.insertRule(e,t.cssRules.length)}))})).catch((function(e){console.error("Error loading remote stylesheet",e.toString())}))),console.error("Error inlining remote css file",W.toString())}})),t.abrupt("return",Promise.all(r).then((function(){return e.forEach((function(e){if("cssRules"in e)try{ol(e.cssRules).forEach((function(e){n.push(e)}))}catch(W){console.error("Error while reading CSS rules from ".concat(e.href),W.toString())}})),n})));case 4:case"end":return t.stop()}}),t)})))}function zl(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return Ml(e.style.getPropertyValue("src"))}))}function Wl(e){return jl(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){null==e.ownerDocument&&n(new Error("Provided element is not within a Document")),t(ol(e.ownerDocument.styleSheets))})).then((function(e){return Jl(e)})).then(zl));case 1:case"end":return t.stop()}}),t)})))}function Ql(e,t){return jl(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",Wl(e).then((function(e){return Promise.all(e.map((function(e){var n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Ll(e.cssText,n,t)})))})).then((function(e){return e.join("\n")})));case 1:case"end":return n.stop()}}),n)})))}function Xl(e,t){return jl(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(null!=t.fontEmbedCSS?Promise.resolve(t.fontEmbedCSS):Ql(e,t)).then((function(t){var n=document.createElement("style"),r=document.createTextNode(t);return n.appendChild(r),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n),e})));case 1:case"end":return n.stop()}}),n)})))}var Zl=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(W){o(W)}}function a(e){try{c(r.throw(e))}catch(W){o(W)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};function $l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.width||al(e),r=t.height||cl(e);return{width:n,height:r}}function eh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zl(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=$l(e,t),i=r.width,o=r.height,n.abrupt("return",Promise.resolve(e).then((function(e){return bl(e,t,!0)})).then((function(e){return Xl(e,t)})).then((function(e){return Fl(e,t)})).then((function(e){return Hl(e,t)})).then((function(e){return hl(e,i,o)})));case 2:case"end":return n.stop()}}),n)})))}var th=16384;function nh(e){(e.width>th||e.height>th)&&(e.width>th&&e.height>th?e.width>e.height?(e.height*=th/e.width,e.width=th):(e.width*=th/e.height,e.height=th):e.width>th?(e.height*=th/e.width,e.width=th):(e.width*=th/e.height,e.height=th))}function rh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zl(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",eh(e,t).then(dl).then((function(n){var r=document.createElement("canvas"),i=r.getContext("2d"),o=t.pixelRatio||ul(),s=$l(e,t),a=s.width,c=s.height,u=t.canvasWidth||a,d=t.canvasHeight||c;return r.width=u*o,r.height=d*o,t.skipAutoScale||nh(r),r.style.width="".concat(u),r.style.height="".concat(d),t.backgroundColor&&(i.fillStyle=t.backgroundColor,i.fillRect(0,0,r.width,r.height)),i.drawImage(n,0,0,r.width,r.height),r})));case 1:case"end":return n.stop()}}),n)})))}var ih=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},oh={"text/plain":"Text","text/html":"Url",default:"Text"};var sh=function(e,t){var n,r,i,o,s,a,c=!1;t||(t={}),n=t.debug||!1;try{if(i=ih(),o=document.createRange(),s=document.getSelection(),(a=document.createElement("span")).textContent=e,a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=oh[t.format]||oh.default;window.clipboardData.setData(i,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(a),o.selectNodeContents(a),s.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(u){n&&console.error("unable to copy using clipboardData: ",u),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(o):s.removeAllRanges()),a&&document.body.removeChild(a),i()}return c},ah=sh,ch={shareWrap:"_shareWrap_ap100_1",chioseBox:"_chioseBox_ap100_5",cell:"_cell_ap100_17",dotle:"_dotle_ap100_27",teamInfo:"_teamInfo_ap100_38",title:"_title_ap100_42",subInfo:"_subInfo_ap100_47",tableWrap:"_tableWrap_ap100_51"};var uh,dh=E({name:"LiveBroadcastGroupChat",data:function(){return{searchForm:{search:""},checkList:[],tableList:[]}},mounted:function(){var e=this;return n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.getList();case 1:case"end":return t.stop()}}),t)})))()},beforeUnmount:function(){},methods:{onReSet:function(){this.searchForm.search="",this.checkList=[],this.search()},search:function(){this.getList()},getList:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u("/api-web/imGroup/queryGroupList",{params:i({},e.searchForm)});case 3:n=t.sent,e.tableList=n.data,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()},resectCheck:function(e){var t=e;-1==this.checkList.indexOf(t)?this.checkList.push(t):this.checkList.splice(this.checkList.indexOf(t),1)}},render:function(){var e,t,n=this;return I("div",null,[I(x,{model:this.searchForm,ref:"form",inline:!0,class:ch.form},{default:function(){return[I(P,null,{default:function(){return[I(M,{clearable:!0,placeholder:"群聊名称/乐团编号",modelValue:n.searchForm.search,onInput:function(e){return n.searchForm.search=e}},null)]}}),I(P,null,{default:function(){return[I(A,{type:"primary",onClick:n.search},{default:function(){return[b("搜索")]}}),I(A,{type:"danger",onClick:n.onReSet},{default:function(){return[b("重置")]}})]}})]}}),I("div",{class:ch.tableWrap},[I(L,{modelValue:this.checkList},(t=e=this.tableList.map((function(e){return I("div",{class:ch.cell,onClick:function(){return n.resectCheck(e.id)}},[I(U,{class:ch.chioseBox,label:e.id,onChange:function(){return n.resectCheck(e.id)}},{default:function(){return[I("br",null,null)]}}),I("div",{class:ch.dotle},["MUSIC"==e.type?"乐团":"VIP"]),I("div",{class:ch.teamInfo},[I("p",{class:ch.title},[e.name]),I("p",{class:ch.subInfo},[e.memo,b("(共"),e.memberNum,b("人)")])])])})),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!D(t)?e:{default:function(){return[e]}}))])])}}),lh="_third_z0wkr_1",hh="_preCore_z0wkr_15",fh="_title_z0wkr_15",ph="_second_z0wkr_18",gh="_first_z0wkr_35",mh="_icon_z0wkr_49",vh="_teacher_z0wkr_56",_h="_start_z0wkr_73",yh="_time_z0wkr_92",Rh="_content_z0wkr_101",Ch="_pre_z0wkr_15",Eh="_end_z0wkr_121",Th="_bottom_z0wkr_128",Sh="_logo_z0wkr_134",Ih="_code_z0wkr_138",bh={},wh={},kh={},Nh=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];kh.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},kh.getSymbolTotalCodewords=function(e){return Nh[e]},kh.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},kh.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');uh=e},kh.isKanjiModeEnabled=function(){return void 0!==uh},kh.toSJIS=function(e){return uh(e)};var Oh={};function Ah(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(W){return n}}}(Oh),Ah.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var xh=Ah;function Ph(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Ph.prototype.set=function(e,t,n,r){var i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},Ph.prototype.get=function(e,t){return this.data[e*this.size+t]},Ph.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},Ph.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Mh=Ph,Lh={};!function(e){var t=kh.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];for(var n=Math.floor(e/7)+2,r=t(e),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7],s=1;s<n-1;s++)o[s]=o[s-1]-i;return o.push(6),o.reverse()},e.getPositions=function(t){for(var n=[],r=e.getRowColCoords(t),i=r.length,o=0;o<i;o++)for(var s=0;s<i;s++)0===o&&0===s||0===o&&s===i-1||o===i-1&&0===s||n.push([r[o],r[s]]);return n}}(Lh);var Uh={},Dh=kh.getSymbolSize;Uh.getPositions=function(e){var t=Dh(e);return[[0,0],[t-7,0],[0,t-7]]};var Vh={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,n=3,r=40,i=10;function o(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var n=e.size,r=0,i=0,o=0,s=null,a=null,c=0;c<n;c++){i=o=0,s=a=null;for(var u=0;u<n;u++){var d=e.get(c,u);d===s?i++:(i>=5&&(r+=t+(i-5)),s=d,i=1),(d=e.get(u,c))===a?o++:(o>=5&&(r+=t+(o-5)),a=d,o=1)}i>=5&&(r+=t+(i-5)),o>=5&&(r+=t+(o-5))}return r},e.getPenaltyN2=function(e){for(var t=e.size,r=0,i=0;i<t-1;i++)for(var o=0;o<t-1;o++){var s=e.get(i,o)+e.get(i,o+1)+e.get(i+1,o)+e.get(i+1,o+1);4!==s&&0!==s||r++}return r*n},e.getPenaltyN3=function(e){for(var t=e.size,n=0,i=0,o=0,s=0;s<t;s++){i=o=0;for(var a=0;a<t;a++)i=i<<1&2047|e.get(s,a),a>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|e.get(a,s),a>=10&&(1488===o||93===o)&&n++}return n*r},e.getPenaltyN4=function(e){for(var t=0,n=e.data.length,r=0;r<n;r++)t+=e.data[r];return Math.abs(Math.ceil(100*t/n/5)-10)*i},e.applyMask=function(e,t){for(var n=t.size,r=0;r<n;r++)for(var i=0;i<n;i++)t.isReserved(i,r)||t.xor(i,r,o(e,i,r))},e.getBestMask=function(t,n){for(var r=Object.keys(e.Patterns).length,i=0,o=1/0,s=0;s<r;s++){n(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<o&&(o=a,i=s)}return i}}(Vh);var Bh={},Fh=Oh,Hh=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],jh=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Bh.getBlocksCount=function(e,t){switch(t){case Fh.L:return Hh[4*(e-1)+0];case Fh.M:return Hh[4*(e-1)+1];case Fh.Q:return Hh[4*(e-1)+2];case Fh.H:return Hh[4*(e-1)+3];default:return}},Bh.getTotalCodewordsCount=function(e,t){switch(t){case Fh.L:return jh[4*(e-1)+0];case Fh.M:return jh[4*(e-1)+1];case Fh.Q:return jh[4*(e-1)+2];case Fh.H:return jh[4*(e-1)+3];default:return}};var Kh={},qh={},Gh=new Uint8Array(512),Yh=new Uint8Array(256);!function(){for(var e=1,t=0;t<255;t++)Gh[t]=e,Yh[e]=t,256&(e<<=1)&&(e^=285);for(var n=255;n<512;n++)Gh[n]=Gh[n-255]}(),qh.log=function(e){if(e<1)throw new Error("log("+e+")");return Yh[e]},qh.exp=function(e){return Gh[e]},qh.mul=function(e,t){return 0===e||0===t?0:Gh[Yh[e]+Yh[t]]},function(e){var t=qh;e.mul=function(e,n){for(var r=new Uint8Array(e.length+n.length-1),i=0;i<e.length;i++)for(var o=0;o<n.length;o++)r[i+o]^=t.mul(e[i],n[o]);return r},e.mod=function(e,n){for(var r=new Uint8Array(e);r.length-n.length>=0;){for(var i=r[0],o=0;o<n.length;o++)r[o]^=t.mul(n[o],i);for(var s=0;s<r.length&&0===r[s];)s++;r=r.slice(s)}return r},e.generateECPolynomial=function(n){for(var r=new Uint8Array([1]),i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}}(Kh);var Jh=Kh;function zh(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}zh.prototype.initialize=function(e){this.degree=e,this.genPoly=Jh.generateECPolynomial(this.degree)},zh.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=new Uint8Array(e.length+this.degree);t.set(e);var n=Jh.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){var i=new Uint8Array(this.degree);return i.set(n,r),i}return n};var Wh=zh,Qh={},Xh={},Zh={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},$h={},ef="[0-9]+",tf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",nf="(?:(?![A-Z0-9 $%*+\\-./:]|"+(tf=tf.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";$h.KANJI=new RegExp(tf,"g"),$h.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),$h.BYTE=new RegExp(nf,"g"),$h.NUMERIC=new RegExp(ef,"g"),$h.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var rf=new RegExp("^"+tf+"$"),of=new RegExp("^[0-9]+$"),sf=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");$h.testKanji=function(e){return rf.test(e)},$h.testNumeric=function(e){return of.test(e)},$h.testAlphanumeric=function(e){return sf.test(e)},function(e){var t=Zh,n=$h;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(W){return n}}}(Xh),function(e){var t=kh,n=Bh,r=Oh,i=Xh,o=Zh,s=t.getBCHDigit(7973);function a(e,t){return i.getCharCountIndicator(e,t)+4}function c(e,t){var n=0;return e.forEach((function(e){var r=a(e.mode,t);n+=r+e.getBitsLength()})),n}e.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,s){if(!o.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=i.BYTE);var c=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(s===i.MIXED)return c;var u=c-a(s,e);switch(s){case i.NUMERIC:return Math.floor(u/10*3);case i.ALPHANUMERIC:return Math.floor(u/11*2);case i.KANJI:return Math.floor(u/13);case i.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,n){var o,s=r.from(n,r.M);if(Array.isArray(t)){if(t.length>1)return function(t,n){for(var r=1;r<=40;r++)if(c(t,r)<=e.getCapacity(r,n,i.MIXED))return r}(t,s);if(0===t.length)return 1;o=t[0]}else o=t;return function(t,n,r){for(var i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}(o.mode,o.getLength(),s)},e.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var n=e<<12;t.getBCHDigit(n)-s>=0;)n^=7973<<t.getBCHDigit(n)-s;return e<<12|n}}(Qh);var af={},cf=kh,uf=cf.getBCHDigit(1335);af.getEncodedBits=function(e,t){for(var n=e.bit<<3|t,r=n<<10;cf.getBCHDigit(r)-uf>=0;)r^=1335<<cf.getBCHDigit(r)-uf;return 21522^(n<<10|r)};var df={},lf=Xh;function hf(e){this.mode=lf.NUMERIC,this.data=e.toString()}hf.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},hf.prototype.getLength=function(){return this.data.length},hf.prototype.getBitsLength=function(){return hf.getBitsLength(this.data.length)},hf.prototype.write=function(e){var t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);var i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))};var ff=hf,pf=Xh,gf=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function mf(e){this.mode=pf.ALPHANUMERIC,this.data=e}mf.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},mf.prototype.getLength=function(){return this.data.length},mf.prototype.getBitsLength=function(){return mf.getBitsLength(this.data.length)},mf.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var n=45*gf.indexOf(this.data[t]);n+=gf.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(gf.indexOf(this.data[t]),6)};var vf=mf,_f=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=e.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer},yf=Xh;function Rf(e){this.mode=yf.BYTE,this.data=new Uint8Array(_f(e))}Rf.getBitsLength=function(e){return 8*e},Rf.prototype.getLength=function(){return this.data.length},Rf.prototype.getBitsLength=function(){return Rf.getBitsLength(this.data.length)},Rf.prototype.write=function(e){for(var t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var Cf=Rf,Ef=Xh,Tf=kh;function Sf(e){this.mode=Ef.KANJI,this.data=e}Sf.getBitsLength=function(e){return 13*e},Sf.prototype.getLength=function(){return this.data.length},Sf.prototype.getBitsLength=function(){return Sf.getBitsLength(this.data.length)},Sf.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var n=Tf.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}};var If=Sf,bf={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,n,r){var i={},o={};o[n]=0;var s,a,c,u,d,l,h,f=t.PriorityQueue.make();for(f.push(n,0);!f.empty();)for(c in a=(s=f.pop()).value,u=s.cost,d=e[a]||{})d.hasOwnProperty(c)&&(l=u+d[c],h=o[c],(void 0===o[c]||h>l)&&(o[c]=l,f.push(c,l),i[c]=a));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),r=e[r];return n.reverse(),n},find_path:function(e,n,r){var i=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,i={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(bf),function(e){var t=Xh,n=ff,r=vf,i=Cf,o=If,s=$h,a=kh,c=bf.exports;function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){for(var r,i=[];null!==(r=e.exec(n));)i.push({data:r[0],index:r.index,mode:t,length:r[0].length});return i}function l(e){var n,r,i=d(s.NUMERIC,t.NUMERIC,e),o=d(s.ALPHANUMERIC,t.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(n=d(s.BYTE,t.BYTE,e),r=d(s.KANJI,t.KANJI,e)):(n=d(s.BYTE_KANJI,t.BYTE,e),r=[]),i.concat(o,n,r).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function h(e,s){switch(s){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function f(e,s){var c,u=t.getBestModeForData(e);if((c=t.from(s,u))!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||a.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new o(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e}),[])},e.fromString=function(n,r){for(var i=function(e){for(var n=[],r=0;r<e.length;r++){var i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:u(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:u(i.data)}])}}return n}(l(n,a.isKanjiModeEnabled())),o=function(e,n){for(var r={},i={start:{}},o=["start"],s=0;s<e.length;s++){for(var a=e[s],c=[],u=0;u<a.length;u++){var d=a[u],l=""+s+u;c.push(l),r[l]={node:d,lastCount:0},i[l]={};for(var f=0;f<o.length;f++){var p=o[f];r[p]&&r[p].node.mode===d.mode?(i[p][l]=h(r[p].lastCount+d.length,d.mode)-h(r[p].lastCount,d.mode),r[p].lastCount+=d.length):(r[p]&&(r[p].lastCount=d.length),i[p][l]=h(d.length,d.mode)+4+t.getCharCountIndicator(d.mode,n))}}o=c}for(var g=0;g<o.length;g++)i[o[g]].end=0;return{map:i,table:r}}(i,r),s=c.find_path(o.map,"start","end"),d=[],f=1;f<s.length-1;f++)d.push(o.table[s[f]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(d))},e.rawSplit=function(t){return e.fromArray(l(t,a.isKanjiModeEnabled()))}}(df);var wf=kh,kf=Oh,Nf=xh,Of=Mh,Af=Lh,xf=Uh,Pf=Vh,Mf=Bh,Lf=Wh,Uf=Qh,Df=af,Vf=Xh,Bf=df;function Ff(e,t,n){var r,i,o=e.size,s=Df.getEncodedBits(t,n);for(r=0;r<15;r++)i=1==(s>>r&1),r<6?e.set(r,8,i,!0):r<8?e.set(r+1,8,i,!0):e.set(o-15+r,8,i,!0),r<8?e.set(8,o-r-1,i,!0):r<9?e.set(8,15-r-1+1,i,!0):e.set(8,15-r-1,i,!0);e.set(o-8,8,1,!0)}function Hf(e,t,n){var r=new Nf;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),Vf.getCharCountIndicator(t.mode,e)),t.write(r)}));var i=8*(wf.getSymbolTotalCodewords(e)-Mf.getTotalCodewordsCount(e,t));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);for(var o=(i-r.getLengthInBits())/8,s=0;s<o;s++)r.put(s%2?17:236,8);return function(e,t,n){for(var r=wf.getSymbolTotalCodewords(t),i=Mf.getTotalCodewordsCount(t,n),o=r-i,s=Mf.getBlocksCount(t,n),a=s-r%s,c=Math.floor(r/s),u=Math.floor(o/s),d=u+1,l=c-u,h=new Lf(l),f=0,p=new Array(s),g=new Array(s),m=0,v=new Uint8Array(e.buffer),_=0;_<s;_++){var y=_<a?u:d;p[_]=v.slice(f,f+y),g[_]=h.encode(p[_]),f+=y,m=Math.max(m,y)}var R,C,E=new Uint8Array(r),T=0;for(R=0;R<m;R++)for(C=0;C<s;C++)R<p[C].length&&(E[T++]=p[C][R]);for(R=0;R<l;R++)for(C=0;C<s;C++)E[T++]=g[C][R];return E}(r,e,t)}function jf(e,t,n,r){var i;if(Array.isArray(e))i=Bf.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var o=t;if(!o){var s=Bf.rawSplit(e);o=Uf.getBestVersionForData(s,n)}i=Bf.fromString(e,o||40)}var a=Uf.getBestVersionForData(i,n);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<a)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+a+".\n")}else t=a;var c=Hf(t,n,i),u=wf.getSymbolSize(t),d=new Of(u);return function(e,t){for(var n=e.size,r=xf.getPositions(t),i=0;i<r.length;i++)for(var o=r[i][0],s=r[i][1],a=-1;a<=7;a++)if(!(o+a<=-1||n<=o+a))for(var c=-1;c<=7;c++)s+c<=-1||n<=s+c||(a>=0&&a<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===a||6===a)||a>=2&&a<=4&&c>=2&&c<=4?e.set(o+a,s+c,!0,!0):e.set(o+a,s+c,!1,!0))}(d,t),function(e){for(var t=e.size,n=8;n<t-8;n++){var r=n%2==0;e.set(n,6,r,!0),e.set(6,n,r,!0)}}(d),function(e,t){for(var n=Af.getPositions(t),r=0;r<n.length;r++)for(var i=n[r][0],o=n[r][1],s=-2;s<=2;s++)for(var a=-2;a<=2;a++)-2===s||2===s||-2===a||2===a||0===s&&0===a?e.set(i+s,o+a,!0,!0):e.set(i+s,o+a,!1,!0)}(d,t),Ff(d,n,0),t>=7&&function(e,t){for(var n,r,i,o=e.size,s=Uf.getEncodedBits(t),a=0;a<18;a++)n=Math.floor(a/3),r=a%3+o-8-3,i=1==(s>>a&1),e.set(n,r,i,!0),e.set(r,n,i,!0)}(d,t),function(e,t){for(var n=e.size,r=-1,i=n-1,o=7,s=0,a=n-1;a>0;a-=2)for(6===a&&a--;;){for(var c=0;c<2;c++)if(!e.isReserved(i,a-c)){var u=!1;s<t.length&&(u=1==(t[s]>>>o&1)),e.set(i,a-c,u),-1==--o&&(s++,o=7)}if((i+=r)<0||n<=i){i-=r,r=-r;break}}}(d,c),isNaN(r)&&(r=Pf.getBestMask(d,Ff.bind(null,d,n))),Pf.applyMask(r,d),Ff(d,n,r),{modules:d,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}wh.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var n,r,i=kf.M;return void 0!==t&&(i=kf.from(t.errorCorrectionLevel,kf.M),n=Uf.from(t.version),r=Pf.from(t.maskPattern),t.toSJISFunc&&wf.setToSJISFunction(t.toSJISFunc)),jf(e,n,i,r)};var Kf={},qf={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var n=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,n){var r=e.getScale(t,n);return Math.floor((t+2*n.margin)*r)},e.qrToImageData=function(t,n,r){for(var i=n.modules.size,o=n.modules.data,s=e.getScale(i,r),a=Math.floor((i+2*r.margin)*s),c=r.margin*s,u=[r.color.light,r.color.dark],d=0;d<a;d++)for(var l=0;l<a;l++){var h=4*(d*a+l),f=r.color.light;if(d>=c&&l>=c&&d<a-c&&l<a-c)f=u[o[Math.floor((d-c)/s)*i+Math.floor((l-c)/s)]?1:0];t[h++]=f.r,t[h++]=f.g,t[h++]=f.b,t[h]=f.a}}}(qf),function(e){var t=qf;e.render=function(e,n,r){var i=r,o=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(o=function(){try{return document.createElement("canvas")}catch(W){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);var s=t.getImageWidth(e.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return t.qrToImageData(c.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,o,s),a.putImageData(c,0,0),o},e.renderToDataURL=function(t,n,r){var i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});var o=e.render(t,n,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}}(Kf);var Gf={},Yf=qf;function Jf(e,t){var n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function zf(e,t,n){var r=e+t;return void 0!==n&&(r+=" "+n),r}Gf.render=function(e,t,n){var r=Yf.getOptions(t),i=e.modules.size,o=e.modules.data,s=i+2*r.margin,a=r.color.light.a?"<path "+Jf(r.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",c="<path "+Jf(r.color.dark,"stroke")+' d="'+function(e,t,n){for(var r="",i=0,o=!1,s=0,a=0;a<e.length;a++){var c=Math.floor(a%t),u=Math.floor(a/t);c||o||(o=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(r+=o?zf("M",c+n,.5+u+n):zf("m",i,0),i=0,o=!1),c+1<t&&e[a+1]||(r+=zf("h",s),s=0)):i++}return r}(o,i,r.margin)+'"/>',u='viewBox="0 0 '+s+" "+s+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+a+c+"</svg>\n";return"function"==typeof n&&n(null,d),d};var Wf=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},Qf=wh,Xf=Kf,Zf=Gf;function $f(e,t,n,r,i){var o=[].slice.call(arguments,1),s=o.length,a="function"==typeof o[s-1];if(!a&&!Wf())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(n=t,t=r=void 0):2!==s||t.getContext||(r=n,n=t,t=void 0),new Promise((function(i,o){try{var s=Qf.create(n,r);i(e(s,t,r))}catch(W){o(W)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(i=n,n=t,t=r=void 0):3===s&&(t.getContext&&void 0===i?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0));try{var c=Qf.create(n,r);i(null,e(c,t,r))}catch(W){i(W)}}bh.create=Qf.create,bh.toCanvas=$f.bind(null,Xf.render),bh.toDataURL=$f.bind(null,Xf.renderToDataURL),bh.toString=$f.bind(null,(function(e,t,n){return Zf.render(e,n)}));var ep=bh,tp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAmCAYAAACyAQkgAAAAAXNSR0IArs4c6QAAA7pJREFUWEftmF1oHFUUx8+5k2yhIVILUosSv0AtrYKiSO2DaB9E1EIfUpBiQaxLqybM3hkCfqBBq+JmzrkLiwuNWCOUolBEFFREqgiiVkQUg5FiaWkrwopIoiZNsvfILK2kde98RZ/ceVr2nvOf3/zvOXfuXAQACMOwr9Vq3RT/LnDNGmMOJ+UNDw8PeJ53RQFtUEodI6LjGCdXKpXrEPHbIkIAcJSZr0rK1Vo/AQB7iuiLyNPGmGe6oEvd6zqas5a6NRob1m2mTmXTbaZuM+V0oNtMLsP+F80EAE8x87P/xqZkkpk3/Ie7pxFjzFgbdHBw0BsYGLjQdTMReQgAnneMf87MG5NAy+Xyyv7+/pUJ+u8BgGs/vIuZ97ZB064wDLdaa990xH3AzHemaSSNB0Hwtojc2ylGRLYbYw5kBd1mrX2jkxAiHiSiweWAaq0/BIDNDtAtxph3MoEGQbBTRF52wDAzB8sBDYLgGxG53mHEbUT0SSbQlOXlQWbetxxQrfXPALCmk0ZPT88l1Wr1p6ygBwDgPsfU3JL2cZf0ECMjI5cuLi6ecMT8wswXxWNZQb8HgGs7iFml1AVRFP1R1NEgCLaLyH7HtB8ionbtpoL6vn+lUupHh9BnRHRrUcg4T2sd1/5Oh0aNmSuZQLXWIQCMOYQeZ+YXioLG5wnW2pMAsMphxFYieisVdHR0tGd6evoIAFzuqM8NxpjJoqBa690A0HDk/7awsHBxvV4/nQoahuED1lpXR08x87qikENDQytKpVK8LF3j0HiFmf8uCWeN+r6/Vin1HQCsdgi1X21FQbXWdQB41JWvlNocRdGhs+MdQSuVympEfB8AbnYINUXkMmPMbBHQIAjuF5HXXM2MiB8T0e1Ltf8B6vv+RqVU3InrXRBnP2HzQpbL5d6+vr4xRBx2QYpIy/O8G6MoOucsrA16pvt2AMA9InIXIjpLQkR+AIAb8riptb5aRB5GxG0AsDbpARGxQUSPnB+Tdz+6gIibiOjLPG5m3eEj4hczMzN3jI+P/7lc0CeZ+bk8kGcW9dRjR0Q8Mj8/v6lerzc7rqnxnxnORy0iPkZE1byQGUGnrLV312q1oy79LFM/i4g7iOhgEcgMoPvn5uZ2NxqN3xNrN8HR04j4aqvVerFWqx0rCpkAOqmU2hNF0etZtM93NH5dfQ0AH4nIS8aYU1lE0mKWNNOvIvKp53l7oyh6Nz6sS8s9Z8H3fX9Vb2/v+maz+dXExMRc1uSscb7vryuVSlCtVqfywC3V/ws13CRFlZXvUwAAAABJRU5ErkJggg==",np="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAoCAYAAACIC2hQAAAAAXNSR0IArs4c6QAAA/dJREFUWEftmF9oHUUUxr9zbwgqmJAo/kET6luMKCoo1KAIIv6hoYpESkEIiD7UJu7MXGLUQhatKNe7Z3OTglp9UEECKlJC7YMKFdqCgloQBAsSUR9UEB9iija5mSNzzY2x7uxuNlgQ7jzunPPNb7+ZM7OzhP9JoyKcQRBcXi6Xh0RkO4BPmPmdIjpJOWEYlpaWlgattU77lkajMTUzM/P9pkCDIBgqlUoTAHYAKLmBiOiJKIqqWwUdGxvr6uzs3CsijwO4pKVHRFdHUfR1LtDx8fH+crn8BhHdfjbQVkFHRkbKfX19TwFQAHoS9POBaq13ENHrInJRkmtbAZ2YmLiw0Wi8DeBu34zkclQptQfAASLyOl8UVCl1BYAjRHRd2rLJBDXG3Cci7wIoZwhteo266e7v7z+2VoypyzsVVCl1MxF9DOD8rCIRkbE4jg9kxW3s11o/DWB/jpwz1trB6enphX9N6drbfiEiaVPyB4BYRN6K4/irHAOuh2itb3BbGoDOlLyTRPQMEX1Yq9VON3eXs4O11o+5dZki8g2AB5n55GYAW7HGmHkRGfblishUd3f3/jAM7caYf4BOTk72LC8vO5Bej9BPq6ur19fr9Z8LQg6IiJuB5h6csBU9GUXRC4l9Gx8qpfYS0awHworIPXEcf1AE0uUYY14RkUc9+UeZ+Q4AkgmqtT7hji2P0Bwz7y4KGYbhBYuLi794CtQS0TXuBPLpr099EATbiGghZc/czsyuCAq1SqWy01p7yJM8z8w704TXQY0xRkRqnuDPmPmmQoRrSVrr1wA87NEYZubDeUHnRGSXJ3gfMz+3BVDSWv8I4NIEjdNdXV0Xh2HotjxvW3dUa+2qcTApUkRui+P4WFHQSqVylbV2waP9URzHd2ZpN0FHR0fP6+3t/Q1AR0LC7ysrKz2zs7NnssR8/UqpYSKa9/RPM7P7ckptTdAgCG4slUqfJ0US0akoigayhNL6jTGTIvK8J2YPM7+Upd8E1VrfC+B9T/BxZr41SyitXyn1JhE95DFidxRFc1n6TVCl1C4i8gUfYub7s4QyHD3iDgtPTGbFu7yWo48AOOgROszM3rM5zwtorY8DGPI4+kAURe9l6bQcNUTk20O/I6KXfUKNRuNovV7/NG0grfWXAK71GUFE7kRMbNbag3Ec/9pydApAmPVWHkcyP5y11t8C2FZQ/+87kzHmWRHZV0TI3UprtdqLGcX0AxFdWUS/o6NjoFqtnmo62gZds1Ap1XY093Jqr9E1q9rFlLRm2sWUu5Lcvbe94f9lV7uY/tNi0loHANw/pyKtysyvZnzmuYvhZUXErbV3Jf7NKyJ2LnJy/cM/FyBZY/wJeqwNR6eju2QAAAAASUVORK5CYII=",rp="./assets/logo.6e1120ae.png",ip="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB2CAYAAAA+/DbEAAAAAXNSR0IArs4c6QAADDRJREFUeF7tnXtwHXUVx7/f3aRNSqE8hkcRkbZJ7oYGqpSRljJIEWxxHHGqWKkjomJ5yKPFNvemKF4HaO6mD0BsoQgoIFaLDI4ODx9UdAaUl1htm5ublOIUseUhBZomTe7d4+zeNDQ1j737unvvZv9qJ+d3zvl9P/vbu4/f7/yI0SNUCjBU2QSUjLQnDwPeBmvveC+gkLbDRBNI69JPoLIiy5rmZ2wrFZBhNIGkGxeBSg9jqbUB6Ww7TFSBPACii7GWy20rFZBhNIG0JbZApJOa/vGAdLYdJnJApGPJMcgqOwFmka0+kg3JPbbVCsAwekDS8S8C+IWlrWAu6/XfBqCz7RDRA5JJ3AlDrrAUIpYzpt9gW60ADKMHpDXeDqImry3/Qi11ZgA62w4RKSCydUkDFPWfB6hjIGt8iA0rdtpWzGfDaAFpbfweyOQATRVcwTp9nc8623YfLSBtiU0QOXWgOnySWuoC24r5bBgZILIlPhUqNg+iZw9U5QTWNr/ps9a23EcHSCZxOwy5dlBVFGUp65pX2lLMZ6NIAJEdi6vRWfk6wMOH0DNDTY/5rLUt99EAkmn6GgzjvuEV4SeppTbaUs1Ho7IHIpJU0Na9BRBtWB0Fv2e9/ikftbbluvyBZOILYOAhW2qoMpO1LX+1ZeuTUVkDsUZHpmszBPW29COeYEz/tC1bn4zKG0g6fiWAwj5CCeewPvU7n/Qe0W3ZApFNS47BWDUN4IgRVRhokIG691TW3rGvwHaemJcvkNb4/SAucajSd6npNzts66pZWQKRTOM8CH8JgdP+7YNwFutTL7lS10Fjpwk7CBVME2lNnATK3xxcqgYmSHZA6Zwe9FShsgIi25NV6Ol+GiJneINfHkasZT4J8cbfyF7KBojIRSoyk83L1OdG7nYBFsRqxvRvF9DClWn5AGlLrIPIQldqDNmYjdRSK/zxfdCVMoggfsboGxl3QvBNH+MIyBsYSzX7GMNyXdIjRJ5dXI0jx6wHcKHfQvWpdQfWVy9iMmn4Fa9kgciWRA1U+TmA6X6JM7hfeRyqeqlfH7RKEoikG78MKmshcliwMPqjmd9WvuLH6/qSAiIdiRrkcCtEPlMkEAeGNUD8GGpuGWtWvuFVPiUBRFqbjoJiLIFgMYCxXnXeIz/vgrwJh1bdyeOTe936DDUQ66lbkesh+DqAQ9x21tf2xFsA1wC9P2Rs1VtOY4UOiLW6SbrnQWQBRM4FqDrtXJHadQN4DArXo7LqMU5Kmv+3fRQdSP45YtJ0gOdCMBvA2QCqbPcg3IbvgXgKIk9D+Edo+uaRXsMEAkTarxmL3jHHAepEqMpEgJMgRgOABgimghgXbl09yo7YDeEWiLEFxBYAr4LYiV7uxNTqnWSyJyAg5iLLzo/BUE+DyGkAzgJwkkfdLDU35keBbRA+Z0FRjHYYbEd3roPTVnYGAmQwxaxb2KycD2IOROYCDNvdk3egia0QPA5iIwzledY3vz2U86IBOTAh2RafgJwyDzljAYhzASjeqVEkT8TLEHkAovyK9alX7WYRCiAD4LQ21UExroXgqwDG2+1ISOw6QZgT8u5lTN/kJKfQAdnfCdm+6HD0VC+GGNeHH4zsBrAGzN3m5hnE7HtogfSDeWXZsegxbrS+dRAVTs46/9pIDlTWoQrf4UdS73gRJ/RA+sFsXXoaFN4L8KNedNwDHy9A5eWsTb3sga9+FyUDxMxYJFmBTFej+Q+AlV4KYdsXYUBkFfbsvoGn391ru51Nw5IC0j9a0ktnAcoGAMfb7KdXZu+igl9iTepJrxwe7KckgVijxfxt2ZfbAFqvWoI4XscY9QJOXv4PP4OVLBALivlKJjfOnNn+eT9Fsp6sDZ5XyPOE03xKGogFZcNFKqZN9m+SA7ELSuUs1t68zanIhbQreSD9vyv+TAN6H6p6DmuXmzMhAznKB4i1UqrLrGHyBQ+Vm09NN28eAjvKBoh1+dqcHIOKLrOYzDkeKLiOmp6viRLgUVZALChm+aWc+hIEJzjWkdyKMVXTC/3a5zjeAQ3LDkj+7qtpJnLG0wDGFC6SCFSZzdoVfyq8rfsWZQnEgpJOxAFJFS6RPEitxelCn8LDHdSifIGY3+rbJj9X4MzGPehVa3jK8l2ulXXooGyBWKOkLT4NghcA2H3v1UJNjzvU0pNmZQ2k79J1OzBEjZOBEu4BqycxlnQ8p8oLIuUPpL3paBjSYWMe8Epq+lIvRHXjo+yB9F26boTg+8MIZQC5Gmort7sR04u20QDSfs1hyI3bAWCo2fJPUCtuBYf9MCMBJP9bEr8NwHWDn8VyIbWWX3txhrv1ER0g7UunwFDaIBg4V9icJP169UTOTmbdiulF+8gAyY+SxicAzh0gHHkPYyk/1ycWxClaQLbGL4GC+wcopHIOa4tXbOZgWtECkm48FOQuCKotIQTvQKs+hgzH5cpMKVJA+m6BH4FgXt+Z+Qg13cvvJwVdngYzjiCQxEKI5AsnK7ySdam7XKvooYPoAckkJsOQ/Pdxw6jjySvaPdTTtavIAem7bG0DpJKxlhNdK+ixA1+BWPVydwA889Yuj/N25U7yxc3GUdMvcuXIh8b+AtnaOANjK7OccsuLPuTu2KWYm4JBGUstpTt24lNDf4GYRSjJXsZS9/iUvyO3komfDYMVflRicJTQAY38BdKWeACQbsZ0n8omOeu+tfRa6SKn6O868+BfK5+BxHdAsDcsddX9k9E7z74BkbYmDWK0wiyP1y0nclrLa96lXb6efATS2AThcks68lth3FUzjFj9A5KOm3dW+2tZPUVNPy+MAoQtJ1+ASHrZqUDug1WoRA657BSevOpfYRMgbPn4A6QtsQYiVw3sLG+ilroxbAKELR/PgeS3NlVf+b9ySsSbmJCbxONWdoZNhDDl4z2QdKIFkMGn0yhsZF0w5VbDJHIhuXgKpK8wpblx41Dlld5BRU7zsiReIZ0tBVtvgaTj5urUOcN3nA9SSxVtMnPYoXgGRNJxc4qNOdVm5IO4mDHdLPE6ehykgCdApC1+FgR/KKBA5XuoUGexZvlgGz1GGpJrINKxrAHZ3J8dbA/xb4ypmMXJt4w+mxxwCroCIq1LZoLqbwAc5fC0fg05zOVU3Sx3N3q4mXUi6aZvAMYPALf1EmU3RLmM9alHRok4mAYk2+InImtWl+6fSuNeR/ONMPETdOUSnOZdlWj3iQXvwfYlS15dNhHduUUQXO1bFdF81c7VEK4dri5h8DIFF3FYINYkhb2VcyBYAPCzBdxFue1BJ0hzQtt6ZKs2siHZ49ZhqbS3gOTrUPUeC+SOh0gMChtgYAYgMwKEMJRmeyF4FuRzEKvWbQY0/oPYuDfCNAXUK+B5IOZIeL9yGlROh1hVEMzKoEd6FcS1H8L89v0swOch8jIUyYBdrxRr80fX/RnGwaCXrHyFnUnnALwYgvlFKkL5FhT+DDk8is7/PuNH9TY/hXXqe8Qfdas6aG/1ZRBru4hjnQay346boSKFfVUPR+m3Y78+IwLZbyibk+NR2b0EIuY6bj+K5e8EEUed/uBIBevtwy09S9tA+sFYs0nkPkBmetZdhQ+jsnshJ91m1r+N9FEwEOsm4MWFlRh/RAuI61zsN2u6MrcNWsqYvjrSFA7ovCMgH4yWxEJA1v7fQko76poTHwSXUtN/asc8KjaugFijpS0xH2I8VPBOOMTVjOlroiK03X66BmJBaU0shCJ32b58ET8K23xfu4L5becJkDyU+GrQ2kVtpKMVh/RM54fDtWZkpKSD+rt3QMzXL21dZhW2M4dJXqAqs1nbXJRqbUGJ6iaOZ0CsUbKtqQ5Z4+/9y44PzozYwJhuPvmPHkMo4CmQ/I98fKjKOwZU5RTWNm8dpTG0At4D2bTkEIxVOwAcNyCs4FHW6/vXh48yCWqE9I0Sc3fOVQNiKjyfdSlzZsroMYwCno8QC8iL8QkYb66/xaF9sbcjpk+J8jsqu2ehL0D6RsndEPRV2ZEV1Foa7SYVZTv/gHQsm41sbqMlrpKbwbqVZsnW0WMEBfwDki+Ob+4zTsSqjyaTxiiNkRXwDYh12Uo3bgCohK3izsiyFM/CXyBtjVeBrGSdfnvxulhakf0Fkmk6A0a2gtqKZ0pLluJl6y8QczbLrgnk6cm9xetiaUX2FUhpSRGObP8HG0q4pBQy2GYAAAAASUVORK5CYII=",op=E({name:"LiveBroadcastSharePreview",props:["form","url"],data:function(){return{detail:{roomTitle:"",liveStartTime:"",liveRemark:""}}},mounted:function(){var e=document.getElementById("canvas"),t=this.url;ep.toCanvas(e,t,{width:80},(function(e){e&&console.error(e),console.log("QRCode success!")}))},methods:{copyText:function(){},shareImage:function(){}},render:function(){return I("div",{id:"preview"},["1"===this.form.preTemplate?I("div",{class:gh},[I("h2",null,[this.form.roomTitle]),I("p",{class:vh},[b(" 主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon1.ef6bbd86.png",class:mh,alt:""},null),I("div",{class:hh},[I("img",{src:ip,class:_h,alt:""},null),I("p",{class:fh},[b("开播时间")]),I("p",{class:yh},[this.form.liveStartTime]),I("p",{class:fh},[b("直播内容")]),I("div",{class:Rh},[I("img",{class:Ch,src:np,alt:""},null),I("img",{class:Eh,src:tp,alt:""},null),this.form.liveRemark])]),I("div",{class:Th},[I("img",{class:Sh,src:rp,alt:""},null),I("div",{class:Ih},[I("div",null,[I("canvas",{id:"canvas",height:"80",width:"80",style:"width: 80px; margin:0"},null)])])])]):null,"2"===this.form.preTemplate?I("div",{class:ph},[I("h2",null,[this.form.roomTitle]),I("p",{class:vh},[b("主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon2.e7f0fa2e.png",class:mh,alt:""},null),I("div",{class:hh},[I("img",{src:ip,class:_h,alt:""},null),I("p",{class:fh},[b("开播时间")]),I("p",{class:yh},[this.form.liveStartTime]),I("p",{class:fh},[b("直播内容")]),I("div",{class:Rh},[I("img",{class:Ch,src:np,alt:""},null),I("img",{class:Eh,src:tp,alt:""},null),this.form.liveRemark])]),I("div",{class:Th},[I("img",{class:Sh,src:rp,alt:""},null),I("div",{class:Ih},[I("div",null,[I("canvas",{id:"canvas",height:"80",width:"80",style:"width: 80px; margin:0"},null)])])])]):null,"3"===this.form.preTemplate?I("div",{class:lh},[I("h2",null,[this.form.roomTitle]),I("p",{class:vh},[b("主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon3.0d23bbac.png",class:mh,alt:""},null),I("div",{class:hh},[I("img",{src:ip,class:_h,alt:""},null),I("p",{class:fh},[b("开播时间")]),I("p",{class:yh},[this.form.liveStartTime]),I("p",{class:fh},[b("直播内容")]),I("div",{class:Rh},[I("img",{class:Ch,src:np,alt:""},null),I("img",{class:Eh,src:tp,alt:""},null),this.form.liveRemark])]),I("div",{class:Th},[I("img",{class:Sh,src:rp,alt:""},null),I("div",{class:Ih},[I("div",null,[I("canvas",{id:"canvas",height:"80",width:"80",style:"width: 80px; margin:0"},null)])])])]):null])}}),sp=y(null),ap=E({name:"LiveBroadcastShare",props:{onClose:{type:Function,default:function(){}}},data:function(){return{form:{shareType:"1"},detail:{roomTitle:"",liveStartTime:"",liveRemark:"",roomUid:""},url:""}},mounted:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n,r,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=JSON.parse(sessionStorage.getItem("details")||"")){t.next=10;break}return r=sessionStorage.getItem("roomUid"),t.next=5,u.get("/api-web/imLiveBroadcastRoom/queryRoom",{params:{roomUid:r}});case 5:o=t.sent,sessionStorage.setItem("details",o.data),e.detail=i({},o.data),t.next=11;break;case 10:e.detail=i({},n);case 11:e.url=(s=void 0,s=window.location.href,(/online/.test(s)?"https://mstuonline.dayaedu.com":/dev/.test(s)?"http://mstudev.dayaedu.com":/test/.test(s)?"http://mstutest.dayaedu.com":"http://mstudev.dayaedu.com")+"/#/liveClassTransfer?roomUid=".concat(e.detail.roomUid));case 12:case"end":return t.stop()}var s}),t)})))()},methods:{copyText:function(){var e="乐团老师邀请您参与直播课!\n".concat(this.detail.roomTitle||"","\n直播时间:").concat(this.detail.liveStartTime||"","\n直播内容:").concat(this.detail.liveRemark||"","\n直播地址:").concat(this.url,"\n");e&&(ah(e),T.success("复制成功"),this.onClose())},shareImage:function(){var e=this,t=document.getElementById("preview");t&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zl(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",rh(e,t).then((function(e){return e.toDataURL()})));case 1:case"end":return n.stop()}}),n)})))}(t).then((function(t){(new Image).src=t;var n=document.createElement("a"),r=e.detail.roomTitle||"分享图片文件.png";n.href=t,n.setAttribute("download",r),document.body.appendChild(n),n.click(),e.onClose()})).catch((function(e){console.error("oops, something went wrong!",e)}))},shareChat:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n,r,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((r=(null===(n=sp.value)||void 0===n?void 0:n.checkList)||[]).length>0){t.next=4;break}return T.error("请至少选择一个群聊"),t.abrupt("return");case 4:return t.prev=4,o={groupIds:r.join(","),roomUid:e.detail.roomUid},t.next=8,u.get("/api-web/imLiveBroadcastRoom/shareGroup",{params:i({},o)});case 8:t.sent,T.success("分享成功"),e.onClose(),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(4),console.log(t.t0);case 16:case"end":return t.stop()}}),t,null,[[4,13]])})))()},changeRafdio:function(e){this.form.shareType=e}},render:function(){var e=this;return I("div",null,[I(x,{model:this.form,ref:"form",class:Wd.form},{default:function(){return[I(P,{label:"分享方式"},{default:function(){return[I(V,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("1")},label:"1"},{default:function(){return[b("链接分享")]}}),I(V,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("2")},label:"2"},{default:function(){return[b("二维码分享")]}}),I(V,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("3")},label:"3"},{default:function(){return[b("群聊分享")]}})]}})]}}),I("div",null,["1"===this.form.shareType?I("div",{class:"linkWrap"},[I("div",{class:Wd.shareWrap},[I("h2",null,[b("乐团老师邀请您参与直播课!")]),I("h4",null,[this.detail.roomTitle]),I("p",null,[b("直播时间:"),this.detail.liveStartTime]),I("p",null,[b("直播内容:"),this.detail.liveRemark]),I("p",null,[b("直播地址:"),this.url])]),I("div",{class:Wd.shareBtn,onClick:this.copyText},[b("复制分享内容")])]):null]),"2"===this.form.shareType?I("div",{class:Wd.codeWrap},[I("div",{class:Wd.shareWrap},[I(op,{form:this.detail,url:this.url},null)]),I("div",{class:Wd.shareBtn,onClick:this.shareImage},[b("复制分享内容")])]):null,"3"==this.form.shareType?I("div",{class:Wd.shareWrap},[I("div",{class:Wd.groupWrap},[I(dh,{ref:sp},null)]),I("div",{class:Wd.shareBtn,onClick:this.shareChat},[b("发送分享信息")])]):null])}});function cp(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!D(e)}var up,dp,lp=E({name:"LiveBroadcast-ActionBar",data:function(){return{volume:30,barStatus:{camera:!1,volume:!1,microphone:!1,screen:!1,share:!1},shareVisiable:!1}},computed:{isCameraDisabled:function(){return this.barStatus.camera&&"denied"!==ld.deviceStatus.camera&&ld.cameras.length},isMicrophoneDisabled:function(){return this.barStatus.microphone&&"denied"!==ld.deviceStatus.microphone&&ld.microphones.length},isVolumeDisabled:function(){return this.barStatus.volume&&0===this.volume}},methods:{startShare:function(){console.log("调用"),this.shareVisiable=!0},volumeChange:function(e){this.volume=e,function(e){dd.videoRef&&(dd.videoRef.volume=e/100)}(e)}},render:function(){var e=this;return I("div",{class:Kd,id:"action-bar"},[I("div",{style:{display:"flex"}},[I("div",{class:qd},[I("div",{class:zd},[I(B("SvgIcon"),{onClick:function(){e.barStatus.camera=!e.barStatus.camera,Vd("camera")},name:this.isCameraDisabled?"bar-camera-disabled":"bar-camera",style:{width:"22px",cursor:"pointer"}},null),I(w,{placement:"top",disabled:0===ld.cameras.length,onCommand:Id},{default:function(){return[I("div",{class:qd,style:{height:"32px"}},[I(B("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(k,null,cp(e=ld.cameras.map((function(e){return I(N,{disabled:e===ld.selectedCamera,command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:Gd},[b("摄像头")])]),I("div",{class:qd},[I("div",{class:zd},[I(B("SvgIcon"),{onClick:function(){e.barStatus.volume=!e.barStatus.volume,e.barStatus.volume?(sessionStorage.setItem("volume",e.volume.toString()),e.volumeChange(0)):sessionStorage.getItem("volume")&&e.volumeChange(Number(sessionStorage.getItem("volume")))},name:this.isVolumeDisabled?"bar-volume-disabled":"bar-volume",style:{width:"22px",cursor:"pointer"}},null),I(w,{placement:"top-start","popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1}},{default:function(){return[I("div",{class:qd,style:{height:"32px"}},[I(B("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){return I("div",{class:Yd},[I(B("SvgIcon"),{class:Jd,name:"message-voice",color:"#fff"},null),I(F,{modelValue:e.volume,onInput:e.volumeChange,size:"small"},null)])}})]),I("span",{class:Gd},[b("音量调节")])]),I("div",{class:qd,onClick:Ed},[I("div",{class:zd},[I(B("SvgIcon"),{name:"bar-screen-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:Gd},[b("屏幕共享")])]),I("div",{class:qd},[I("div",{class:zd},[I(B("SvgIcon"),{onClick:function(){var t="liveing"===ld.videoStatus;e.barStatus.microphone=!e.barStatus.microphone,e.barStatus.microphone?Dd("microphone",t):Ud("microphone",t)},name:this.isMicrophoneDisabled?"bar-mike-disabled":"bar-mike",style:{width:"22px",cursor:"pointer"}},null),I(w,{placement:"top-start",disabled:0===ld.microphones.length,"popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1},onCommand:bd},{default:function(){return[I("div",{class:qd,style:{height:"32px"}},[I(B("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(k,null,cp(e=ld.microphones.map((function(e){return I(N,{disabled:e===ld.selectedMicrophone,command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:Gd},[b("麦克风")])])]),I("div",{style:{display:"flex"},onClick:this.startShare},[I("div",{class:qd},[I("div",{class:zd},[I(B("SvgIcon"),{name:"bar-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:Gd},[b("分享")])])]),I(H,{width:"510px","destroy-on-close":!0,"append-to-body":!0,modelValue:this.shareVisiable,title:"分享","before-close":function(){e.shareVisiable=!1}},{default:function(){return[I(ap,{onClose:function(){return e.shareVisiable=!1}},null)]}})])}}),hp={container:"_container_19awp_1",title:"_title_19awp_21",tips:"_tips_19awp_25"},fp=E({name:"VideoStatus",render:function(){return I("div",{class:hp.container},["denied"===ld.deviceStatus.camera?I("div",{class:hp.denied},[I(B("SvgIcon"),{name:"camera-status",class:hp.icon},null),I("p",{class:hp.title},[b("摄像头被禁用")]),I("p",{class:hp.tips},[b("请授权允许访问摄像头")])]):null,"init"===ld.deviceStatus.camera?I("div",{class:hp.init},[I(B("SvgIcon"),{name:"camera-status",class:hp.icon},null),I("p",{class:hp.title},[b("请完成摄像头授权")]),I("p",{class:hp.tips},[b("请授权允许访问摄像头")])]):null])}}),pp=function(){var e=n(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator){e.next=2;break}throw new Error("浏览器版本过低");case 2:if(t){e.next=4;break}return e.abrupt("return",[]);case 4:return e.abrupt("return",(n||[]).map((function(e){return t.removeTrack(e)})));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),gp="_main_1b4ip_1",mp="_video_1b4ip_12",vp=y(null),_p=E({name:"LiveBroadcast",mounted:function(){var e=this;return n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.initializeRoom(),Pd(),ud.on(cd["RC:Chatroom:Like"],e.onLikeMessage);case 3:case"end":return t.stop()}}),t)})))()},beforeUnmount:function(){ud.off(cd["RC:Chatroom:Like"],this.onLikeMessage)},methods:{onLikeMessage:function(e){ld.likeCount+=e.counts},initializeRoom:function(){return n(regeneratorRuntime.mark((function e(){var t,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.user){e.next=2;break}throw Error("请先登录");case 2:return e.prev=2,e.next=5,Cd(null===(t=r.user)||void 0===t?void 0:t.imToken);case 5:return ld.videoRef=vp.value,e.next=8,Td();case 8:return e.next=10,Sd();case 10:return Id(ld.cameras[0]),bd(ld.microphones[0]),e.next=14,wd("camera");case 14:return dp=e.sent,ld.videoRef&&dp.play(ld.videoRef),e.next=18,kd([dp],"camera");case 18:return e.next=20,wd("microphone");case 20:return up=e.sent,ld.videoRef&&up.play(ld.videoRef),console.log(ld.deviceStatus),ld.videoStatus="stream",e.next=26,Od(null===(i=r.user)||void 0===i?void 0:i.roomUid,Ku.VIDEO,{onMessageReceive:function(e,t){console.log(e,t)},onKickOff:function(e){console.log(e)},onTrackPublish:function(e){return n(regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==o||null===(n=o.room)||void 0===n?void 0:n.subscribe(e);case 2:r=t.sent,console.log(r),null!=r&&r.code&&r.code!==ea.SUCCESS&&console.log("资源订阅失败 ->",r.code);case 5:case"end":return t.stop()}}),t)})))()},onTrackUnpublish:function(e){console.log(e),ud.emit(cd["RM:RTC:TrackUnpublish"],e)},onSwitchRole:function(e,t){ud.emit(cd["RM:RTC:SwitchRole"],{userId:e,role:t})},onTrackReady:function(e){e.isAudioTrack()&&e.play()},onUserJoin:function(e){console.log("onUserJoin",e)},onUserLeave:function(e){ud.emit(cd["RM:RTC:UserLeave"],e),console.log("onUserLeave",e)}});case 26:(o=e.sent).room&&o.code===ea.SUCCESS&&(ld.joinedRoom=o.room),e.next=34;break;case 30:e.prev=30,e.t0=e.catch(2),ld.videoStatus="error",console.log(e.t0);case 34:case"end":return e.stop()}}),e,null,[[2,30]])})))()},closeLive:function(){pp(ld.mediaStreams,ld.mediaStreamTrack),ld.videoStatus="stopped"}},render:function(){return I("div",{class:gp},[I(jd,null,null),I("div",{class:mp},[I("video",{ref:vp},null),I(fp,null,null)]),I(lp,null,null)])}}),yp="_container_jmhhf_1",Rp="_dataCount_jmhhf_6",Cp="_num_jmhhf_17",Ep="_text_jmhhf_22",Tp="_dataIcon_jmhhf_26",Sp="_tabContainer_jmhhf_31",Ip="_tabIcon_jmhhf_31",bp="_tabContent_jmhhf_58",wp="_tabList_jmhhf_64",kp="_message_4zab7_1",Np="_buttonGroup_4zab7_1",Op=E({name:"message",data:function(){return{options:"ALL"}},methods:{SeatsCtrl:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ld(i({seatBan:ld.allowSeatsCtrl},Md()),"SeatsCtrl");case 2:ld.allowSeatsCtrl=!ld.allowSeatsCtrl;case 3:case"end":return e.stop()}}),e)})))()},ChatBan:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ld(i({chatBan:ld.allowChatCtrl},Md()),"ChatBan");case 2:ld.allowChatCtrl=!ld.allowChatCtrl;case 3:case"end":return e.stop()}}),e)})))()}},render:function(){return I("div",{class:kp},[I("div",{class:Np},[I(A,{type:ld.allowChatCtrl?"info":"primary",onClick:this.ChatBan},{default:function(){return[ld.allowChatCtrl?"全体禁言":"关闭全体禁言"]}}),I(A,{type:ld.allowSeatsCtrl?"info":"primary",onClick:this.SeatsCtrl},{default:function(){return[ld.allowSeatsCtrl?"禁止连麦":"关闭禁止连麦"]}})])])}}),Ap="_sendMessage_p2cnx_1",xp="_form_p2cnx_10",Pp=f({messageList:[],joinList:{},lookList:{}}),Mp=Pp,Lp=function(e){Pp.messageList.push(e)},Up=function(e,t){Pp.joinList[e]=t},Dp=function(e){delete Pp.joinList[e]},Vp=function(e,t){Pp.lookList[e]=t},Bp=E({data:function(){return{message:""}},methods:{onKeyDown:function(e){13===e.keyCode&&""!==this.message.trim()&&this.sendMessage()},sendMessage:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Ld(e.message);case 3:n=Md(),Lp({id:n.id,name:n.name,content:e.message,isSelf:!0,sendTime:j(new Date).format("HH:mm:ss")}),e.message="",e.scrollToBottom(),t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,9]])})))()},scrollToBottom:function(){this.$nextTick((function(){var e,t;null===(e=document.querySelector("#tabList"))||void 0===e||e.scrollTo(0,(null===(t=document.querySelector("#messageList"))||void 0===t?void 0:t.scrollHeight)||0)}))}},render:function(){var e=this;return I("div",{class:Ap},[I("div",{class:xp},[I(M,{modelValue:this.message,onKeydown:this.onKeyDown,onInput:function(t){return e.message=t},placeholder:"请输入消息"},null),I(A,{disabled:!this.message,onClick:this.sendMessage,round:!0,type:"primary"},{default:function(){return[b("发送")]}})])])}}),Fp="_itemContent_1wo39_1",Hp="_itemInfo_1wo39_11",jp="_itemName_1wo39_14",Kp="_userName_1wo39_20",qp="_name-style_1wo39_26",Gp="_rightTime_1wo39_30",Yp="_itemText_1wo39_38",Jp="_active_1wo39_42",zp="_joinText_1wo39_45",Wp="_join_1wo39_45",Qp="_btn_1wo39_54",Xp="_downBtn_1wo39_66",Zp="_loadingStyle_1wo39_71",$p={"empty-container":"_empty-container_1svqd_1",icon:"_icon_1svqd_9"},eg=E({props:{text:{type:String,default:"暂无数据"},icon:{type:String,default:"noData-no-message"}},render:function(){return I("div",{class:$p["empty-container"]},[I(B("SvgIcon"),{name:this.icon,class:[$p.icon]},null),I("p",{class:$p["empty-text"]},[this.text])])}}),tg=E({data:function(){return{joinList:{},loadingJoin:!1}},computed:{count:function(){var e=0;for(var t in Mp.joinList){if(Object.prototype.hasOwnProperty.call(Mp.joinList,t))if(3===Mp.joinList[t].type&&(e+=1),e>3)break}return e}},mounted:function(){ud.on(cd["RC:Chatroom:SeatApply"],this.onSeatApply),ud.on(cd["RC:Chatroom:SeatResponse"],this.onSeatApply),ud.on(cd["RM:RTC:UserLeave"],this.onSeatApply),ud.on(cd["RM:RTC:SwitchRole"],this.onSwitchRole),ud.on(cd["RC:Chatroom:Leave"],this.onLeave)},methods:{onLeave:function(e){var t;Dp(e.userId),t=e.userId,delete Pp.lookList[t]},onSeatApply:function(e){if(console.log(e,"onSeatApply joinModel"),Array.isArray(e)){var t,n=C(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;console.log("onSeatApply",r),Dp(r)}}catch(a){n.e(a)}finally{n.f()}}else{var i="RC:Chatroom:SeatResponse"===e.$EventMessage.messageType?4:3;if(3===e.type){var o={name:e.audienceName,id:e.audienceId,userRoomType:i,type:e.type};Up(e.audienceId,o),Vp(e.audienceId,o)}if(4===e.type&&(console.log(e,"取消连麦"),Mp.joinList[e.audienceId]&&Dp(e.audienceId),Mp.lookList[e.audienceId])){var s=Mp.lookList[e.audienceId];s.userRoomType=1,Vp(e.audienceId,s)}}},agree:function(e){var t,n;if(!(this.count>3)){var o=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,userRoomType:4,type:1});Up(e.id,o),Vp(e.id,o),Ld(o,"SeatResponse")}},refuse:function(e){var t,n,o=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,userRoomType:4,type:5});Up(e.id,o),Ld(o,"SeatApply")},onSwitchRole:function(e){if(console.log(e,"onSwitchRole"),Mp.joinList[e.userId]&&2===e.role&&Dp(e.userId),Mp.lookList[e.userId]&&2===e.role){var t=Mp.lookList[e.userId];t.userRoomType=1,Vp(e.userId,t)}}},render:function(){var e=this,t=Object.values(Mp.joinList);return I("div",{style:{minHeight:"100%",position:"relative"}},[t.length>0?t.map((function(t){return I("div",{class:Fp},[I("div",{class:Hp},[I("div",{class:jp},[I("p",{class:Kp},[I("span",{class:qp},[t.name]),4!==t.userRoomType?I("span",{style:{paddingLeft:"10px"}},[b("申请连麦")]):I("span",{style:{paddingLeft:"10px",color:"var(--live-text-color)"}},[b("正在连麦")])]),4!==t.userRoomType?I("div",{class:zp},[I("div",{class:Wp},null),I(A,{size:"small",type:"primary",disabled:e.count>3,class:Qp,onClick:function(){return e.agree(t)}},{default:function(){return[b("上麦")]}})]):I("div",{class:zp},[I("div",{class:Wp},null),I(A,{size:"small",plain:!0,class:[Qp,Xp],onClick:function(){return e.refuse(t)}},{default:function(){return[b("下麦")]}})])])])])})):this.loadingJoin?I("div",{class:Zp},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(eg,{style:{paddingTop:"120px"},text:"暂无学员发起连麦!",icon:"noData-no-join"},null)])}}),ng=E({data:function(){return{loadingLook:!1}},computed:{count:function(){var e=0;for(var t in Mp.joinList){if(Object.prototype.hasOwnProperty.call(Mp.joinList,t))if(3===Mp.joinList[t].type&&(e+=1),e>3)break}return e}},mounted:function(){var e=this;this.loadingLook=!0,ud.on(cd["RC:Chatroom:Welcome"],this.onWelcome),setTimeout((function(){e.loadingLook=!1}))},methods:{_init:function(){return n(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=sessionStorage.getItem("roomUid"),e.next=4,u.get("/api-web/imLiveBroadcastRoom/queryRoomUserInfo",{params:{roomUid:t}});case 4:n=e.sent,console.log("_init",n),e.next=10;break;case 8:e.prev=8,e.t0=e.catch(0);case 10:case"end":return e.stop()}}),e,null,[[0,8]])})))()},onSeatResponse:function(e){if(console.log(e,"onSeatResponse"),3==e.type){Mp.lookList.forEach((function(t){t.id==e.audienceId&&(t.type=1)}));var t,n,i=Mp.joinList[e.audienceId];if(console.log(Mp.joinList),i)Mp.joinList[e.audienceId].type=1;else Up(e.audienceId,{id:e.audienceId,name:e.audienceName,audienceId:e.audienceId,audienceName:e.audienceName,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,type:1})}},onWelcome:function(e){if(console.log(e),e&&e.user){var t=j(e.$EventMessage.sentTime||new Date).format("HH:mm:ss"),n={name:e.user.name,id:e.user.id,sendTime:t,userRoomType:1,type:3};!!Mp.lookList[n.id]||Vp(n.id,n),this.loadingLook=!1}},onUpLook:function(e){return n(regeneratorRuntime.mark((function t(){var n,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o={audienceName:e.name,audienceId:e.id,teacherId:null===(n=r.user)||void 0===n?void 0:n.id,teacherName:null===(i=r.user)||void 0===i?void 0:i.speakerName,userRoomType:2,type:1},t.next=4,Ld(o,"SeatApply");case 4:t.next=8;break;case 6:t.prev=6,t.t0=t.catch(0);case 8:case"end":return t.stop()}}),t,null,[[0,6]])})))()},onDownLook:function(e){return n(regeneratorRuntime.mark((function t(){var n,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{s=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(n=r.user)||void 0===n?void 0:n.id,teacherName:null===(o=r.user)||void 0===o?void 0:o.speakerName,type:5}),Up(e.id,s),Ld(s,"SeatApply")}catch(a){}case 1:case"end":return t.stop()}}),t)})))()}},render:function(){var e=this,t=Object.values(Mp.lookList);return I("div",null,[t.length>0?t.map((function(t){return I("div",{class:Fp},[I("div",{class:Hp},[I("div",{class:jp},[I("p",{class:Kp},[I("span",{class:qp},[t.name])]),4!==t.userRoomType?I(A,{size:"small",type:"primary",disabled:e.count>3,class:Qp,onClick:function(){return e.onUpLook(t)}},{default:function(){return[b("上麦")]}}):I(A,{size:"small",plain:!0,class:[Qp,Xp],onClick:function(){return e.onDownLook(t)}},{default:function(){return[b("下麦")]}})])])])})):this.loadingLook?I("div",{class:Zp},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(eg,{style:{paddingTop:"120px"},text:"暂无学员观看!",icon:"noData-no-user"},null)])}}),rg=E({data:function(){return{messageList:[],loadingMessage:!1}},mounted:function(){var e=this;this.loadingMessage=!0,ud.on(cd["RC:TxtMsg"],this.onMessage),ud.on(cd["RC:Chatroom:Like"],this.onLike),setTimeout((function(){e.loadingMessage=!1}),2e3),this.scrollToBottom()},beforeUnmount:function(){ud.off(cd["RC:TxtMsg"],this.onMessage),ud.off(cd["RC:Chatroom:Like"],this.onLike)},methods:{onLike:function(e){if(e&&e.user){var t,n=j(e.$EventMessage.sentTime||new Date).format("HH:mm:ss");console.log(e,"like");var r={name:null===(t=e.user)||void 0===t?void 0:t.name,id:e.user.id,isSelf:!1,content:"给您点了"+e.counts+"个赞",sendTime:n};Lp(r),this.loadingMessage=!1}this.scrollToBottom()},onMessage:function(e){if(e&&e.user){var t,n=j(e.$EventMessage.sentTime||new Date).format("HH:mm:ss"),i={name:null===(t=e.user)||void 0===t?void 0:t.name,id:e.user.id,isSelf:!1,content:e.content,sendTime:n};e.user.id===r.user.speakerId&&(i.isSelf=!0),Lp(i),this.loadingMessage=!1}this.scrollToBottom()},scrollToBottom:function(){this.$nextTick((function(){var e,t;null===(e=document.querySelector("#tabList"))||void 0===e||e.scrollTo(0,(null===(t=document.querySelector("#messageList"))||void 0===t?void 0:t.scrollHeight)||0)}))}},render:function(){return I("div",{style:{minHeight:"100%",position:"relative"},id:"messageList"},[Mp.messageList.length>0?Mp.messageList.map((function(e){return I("div",{class:Fp},[I("div",{class:Hp},[I("div",{class:jp},[I("div",{class:Kp},[e.isSelf?I(K,{effect:"dark",color:"#01A79E"},{default:function(){return[b("主讲人")]}}):null,I("span",{class:qp},[e.name,b(":")]),I("span",{class:[Yp,e.isSelf?Jp:null]},[e.content])]),I("p",{class:Gp},[e.sendTime])])])])})):this.loadingMessage?I("div",{class:Zp},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(eg,{style:{paddingTop:"120px"},text:"暂无学员互动!",icon:"noData-no-message"},null)])}}),ig=E({name:"LiveMessage",data:function(){return{modelIndex:"message"}},mounted:function(){var e;ld.likeCount=(null===(e=r.user)||void 0===e?void 0:e.likeNum)||0},methods:{tabChange:function(e){this.modelIndex=e.props.name}},render:function(){var e,t=this;return I("div",{class:yp},[I("div",{class:Rp},[I("div",null,[I("p",{class:Cp},[null===(e=r.user)||void 0===e?void 0:e.likeNum]),I("p",{class:Ep},[I(B("SvgIcon"),{name:"message-look",color:"#fff",class:Tp},null),b("当前观看")])]),I("div",null,[I("p",{class:Cp},[ld.likeCount]),I("p",{class:Ep},[I(B("SvgIcon"),{name:"message-giveUp",color:"#fff",class:Tp},null),b("累计点赞")])])]),I(q,{modelValue:this.modelIndex,"onTab-click":this.tabChange,class:Sp},{default:function(){return[I(G,{name:"message"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(B("SvgIcon"),{name:"message-message",color:"message"===t.modelIndex?"#00FFF0":"#fff",class:Ip},null),b("聊天")])}}),I(G,{name:"join"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(B("SvgIcon"),{name:"message-evenEtc",color:"join"===t.modelIndex?"#00FFF0":"#fff",class:Ip},null),b("连麦")])}}),I(G,{name:"look"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(B("SvgIcon"),{name:"message-look",color:"look"===t.modelIndex?"#00FFF0":"#fff",class:Ip},null),b("观看")])}})]}}),I("div",{class:bp},[I(Op,null,null),I("div",{class:wp,id:"tabList"},[Y(I(rg,null,null),[[J,"message"===this.modelIndex]]),Y(I(tg,null,null),[[J,"join"===this.modelIndex]]),Y(I(ng,null,null),[[J,"look"===this.modelIndex]])]),I(Bp,null,null)])])}}),og="_container_13n1h_1",sg="_home_13n1h_4";t("default",E({render:function(){return I("div",{class:sg},[I(Bd,null,null),I("div",{class:og},[I(_p,null,null),I(ig,null,null)])])}}))}}}))}();