index-legacy.06f406e2.js 766 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. !function(){var e=["MESSAGES"];function t(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void n(u)}s.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 a=e.apply(n,r);function s(e){t(a,i,o,s,c,"next",e)}function c(e){t(a,i,o,s,c,"throw",e)}s(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 a(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=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(c){s=!0,i=c}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||C(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 s(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(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 l(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&&d(e,t)}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(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"===T(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 b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=C(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,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function C(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}function E(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 T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}var S=document.createElement("style");S.innerHTML='._liveHeader_turek_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_turek_1 ._liveLogo_turek_12{height:36px;width:36px;padding-right:10px}._liveHeader_turek_1 ._liveHeaderLeft_turek_17{display:flex;align-items:center;font-weight:700;font-size:22px}._liveHeader_turek_1 ._liveHeaderLeft_turek_17 ._liveHeaderLeftIcon_turek_23{display:inherit;align-items:inherit}._liveHeader_turek_1 ._liveHeaderLeft_turek_17 ._liveHeaderLeftText_turek_27{padding-left:20px}._avatarWrapper_turek_30{display:flex;align-items:center;color:var(--live-color);font-weight:500;font-size:18px}._avatarWrapper_turek_30 ._userAvatar_turek_37{width:34px;height:34px;border-radius:50%}._avatarWrapper_turek_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_a6fb3_1{position:relative;background:linear-gradient(135deg,#8d8cff 0%,#9664ec 100%);padding:43px 20px 54px}._third_a6fb3_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;min-height:80px;display:flex;flex-direction:row;align-items:center}._third_a6fb3_1 ._preCore_a6fb3_19 ._title_a6fb3_19{background:#fa912c}._second_a6fb3_22{position:relative;background:linear-gradient(135deg,#ff9d9d 0%,#ff6d6d 100%);padding:43px 20px 54px}._second_a6fb3_22 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;min-height:80px;display:flex;flex-direction:row;align-items:center}._second_a6fb3_22 ._preCore_a6fb3_19 ._title_a6fb3_19{background:#fa502c}._first_a6fb3_43{position:relative;background:linear-gradient(135deg,#4f8dff 0%,#0055ee 100%);padding:43px 20px 54px}._first_a6fb3_43 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;min-height:80px;display:flex;flex-direction:row;align-items:center}._icon_a6fb3_61{width:231px;height:223px;position:absolute;right:3px;top:36px}._teacher_a6fb3_68{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_a6fb3_19{position:relative;z-index:100;padding:12px;background:#ffffff;border-radius:11px;border-image:linear-gradient(180deg,#ffffff,#ffffff) 1 1}._preCore_a6fb3_19 ._start_a6fb3_85{width:50px;height:59px;position:absolute;top:24px;right:-11px}._preCore_a6fb3_19 ._title_a6fb3_19{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_a6fb3_19 ._time_a6fb3_104{font-size:18px;font-family:PingFangSC-Medium,PingFang SC;font-weight:600;color:#000;line-height:25px;margin:15px 0 15px 4px}._preCore_a6fb3_19 ._content_a6fb3_113{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_a6fb3_19 ._content_a6fb3_113 ._pre_a6fb3_19{width:20px;height:20px;position:absolute;left:-3px;top:-4px}._preCore_a6fb3_19 ._content_a6fb3_113 ._end_a6fb3_133{width:20px;height:20px;position:absolute;bottom:-4px;right:10px}._bottom_a6fb3_140{display:flex;flex-direction:row;justify-content:space-between;margin:30px 8px 0}._bottom_a6fb3_140 ._logo_a6fb3_146{width:202px;height:84px}._bottom_a6fb3_140 ._code_a6fb3_150{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}.ball-pulse-sync>div,.ball-pulse>div{width:15px;height:15px;margin:2px;display:inline-block}.ball-pulse-sync>div,.ball-pulse>div,.ball-scale>div{background-color:#fff;border-radius:100%}@-webkit-keyframes scale{0%,80%{-webkit-transform:scale(1);transform:scale(1);opacity:1}45%{-webkit-transform:scale(.1);transform:scale(.1);opacity:.7}}@keyframes scale{0%,80%{-webkit-transform:scale(1);transform:scale(1);opacity:1}45%{-webkit-transform:scale(.1);transform:scale(.1);opacity:.7}}.ball-pulse>div:nth-child(0){-webkit-animation:scale .75s -.36s infinite cubic-bezier(.2,.68,.18,1.08);animation:scale .75s -.36s infinite cubic-bezier(.2,.68,.18,1.08)}.ball-pulse>div:nth-child(1){-webkit-animation:scale .75s -.24s infinite cubic-bezier(.2,.68,.18,1.08);animation:scale .75s -.24s infinite cubic-bezier(.2,.68,.18,1.08)}.ball-pulse>div:nth-child(2){-webkit-animation:scale .75s -.12s infinite cubic-bezier(.2,.68,.18,1.08);animation:scale .75s -.12s infinite cubic-bezier(.2,.68,.18,1.08)}.ball-pulse>div:nth-child(3){-webkit-animation:scale .75s 0s infinite cubic-bezier(.2,.68,.18,1.08);animation:scale .75s 0s infinite cubic-bezier(.2,.68,.18,1.08)}.ball-pulse>div{-webkit-animation-fill-mode:both;animation-fill-mode:both}@-webkit-keyframes ball-pulse-sync{33%{-webkit-transform:translateY(10px);transform:translateY(10px)}66%{-webkit-transform:translateY(-10px);transform:translateY(-10px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes ball-pulse-sync{33%{-webkit-transform:translateY(10px);transform:translateY(10px)}66%{-webkit-transform:translateY(-10px);transform:translateY(-10px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.ball-pulse-sync>div:nth-child(0){-webkit-animation:ball-pulse-sync .6s -.21s infinite ease-in-out;animation:ball-pulse-sync .6s -.21s infinite ease-in-out}.ball-pulse-sync>div:nth-child(1){-webkit-animation:ball-pulse-sync .6s -.14s infinite ease-in-out;animation:ball-pulse-sync .6s -.14s infinite ease-in-out}.ball-pulse-sync>div:nth-child(2){-webkit-animation:ball-pulse-sync .6s -.07s infinite ease-in-out;animation:ball-pulse-sync .6s -.07s infinite ease-in-out}.ball-pulse-sync>div:nth-child(3){-webkit-animation:ball-pulse-sync .6s 0s infinite ease-in-out;animation:ball-pulse-sync .6s 0s infinite ease-in-out}.ball-pulse-sync>div{-webkit-animation-fill-mode:both;animation-fill-mode:both}@-webkit-keyframes ball-scale{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes ball-scale{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}.ball-scale>div{height:60px;width:60px;animation:ball-scale 1s 0s ease-in-out infinite}.ball-scale-random>div,.ball-scale>div{display:inline-block;margin:2px;-webkit-animation:ball-scale 1s 0s ease-in-out infinite}.ball-scale-random{width:37px;height:40px}.ball-scale-random>div{background-color:#fff;border-radius:100%;position:absolute;height:30px;width:30px;animation:ball-scale 1s 0s ease-in-out infinite}.ball-rotate>div,.ball-rotate>div:after,.ball-rotate>div:before{background-color:#fff;width:15px;height:15px;border-radius:100%}.ball-rotate,.ball-rotate>div{position:relative}.ball-scale-random>div:nth-child(1){margin-left:-7px;-webkit-animation:ball-scale 1s .2s ease-in-out infinite;animation:ball-scale 1s .2s ease-in-out infinite}.ball-scale-random>div:nth-child(3){margin-left:-2px;margin-top:9px;-webkit-animation:ball-scale 1s .5s ease-in-out infinite;animation:ball-scale 1s .5s ease-in-out infinite}@-webkit-keyframes rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ball-rotate>div{margin:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both}.ball-rotate>div:first-child{-webkit-animation:rotate 1s 0s cubic-bezier(.7,-.13,.22,.86) infinite;animation:rotate 1s 0s cubic-bezier(.7,-.13,.22,.86) infinite}.ball-rotate>div:after,.ball-rotate>div:before{margin:2px;content:"";position:absolute;opacity:.8}.ball-rotate>div:before{top:0;left:-28px}.ball-rotate>div:after{top:0;left:25px}.ball-clip-rotate>div{border-radius:100%;margin:2px;border:2px solid #fff;border-bottom-color:transparent;height:25px;width:25px;background:0 0!important;display:inline-block;-webkit-animation:rotate .75s 0s linear infinite;animation:rotate .75s 0s linear infinite}@keyframes rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes scale{30%{-webkit-transform:scale(.3);transform:scale(.3)}to{-webkit-transform:scale(1);transform:scale(1)}}.ball-clip-rotate-pulse{position:relative;-webkit-transform:translateY(-15px);-ms-transform:translateY(-15px);transform:translateY(-15px)}.ball-clip-rotate-pulse>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute;top:0;left:0;border-radius:100%}.ball-clip-rotate-pulse>div:first-child{background:#fff;height:16px;width:16px;top:7px;left:-7px;-webkit-animation:scale 1s 0s cubic-bezier(.09,.57,.49,.9) infinite;animation:scale 1s 0s cubic-bezier(.09,.57,.49,.9) infinite}.ball-clip-rotate-pulse>div:last-child{position:absolute;width:30px;height:30px;left:-16px;top:-2px;background:0 0;border:2px solid;border-color:#fff transparent;-webkit-animation:rotate 1s 0s cubic-bezier(.09,.57,.49,.9) infinite;animation:rotate 1s 0s cubic-bezier(.09,.57,.49,.9) infinite;-webkit-animation-duration:1s;animation-duration:1s}@keyframes rotate{0%{-webkit-transform:rotate(0) scale(1);transform:rotate(0) scale(1)}50%{-webkit-transform:rotate(180deg) scale(.6);transform:rotate(180deg) scale(.6)}to{-webkit-transform:rotate(360deg) scale(1);transform:rotate(360deg) scale(1)}}.ball-clip-rotate-multiple{position:relative}.ball-clip-rotate-multiple>div{position:absolute;left:-20px;top:-20px;border:2px solid #fff;border-bottom-color:transparent;border-top-color:transparent;border-radius:100%;height:35px;width:35px;-webkit-animation:rotate 1s 0s ease-in-out infinite;animation:rotate 1s 0s ease-in-out infinite}.ball-clip-rotate-multiple>div:last-child{display:inline-block;top:-10px;left:-10px;width:15px;height:15px;-webkit-animation-duration:.5s;animation-duration:.5s;border-color:#fff transparent;-webkit-animation-direction:reverse;animation-direction:reverse}@-webkit-keyframes ball-scale-ripple{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}to{opacity:0}}@keyframes ball-scale-ripple{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}to{opacity:0}}.ball-scale-ripple>div{height:50px;width:50px;border-radius:100%;border:2px solid #fff;-webkit-animation:ball-scale-ripple 1s 0s infinite cubic-bezier(.21,.53,.56,.8);animation:ball-scale-ripple 1s 0s infinite cubic-bezier(.21,.53,.56,.8)}@-webkit-keyframes ball-scale-ripple-multiple{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}to{opacity:0}}@keyframes ball-scale-ripple-multiple{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}to{opacity:0}}.ball-scale-ripple-multiple{position:relative;-webkit-transform:translateY(-25px);-ms-transform:translateY(-25px);transform:translateY(-25px)}.ball-scale-ripple-multiple>div:nth-child(0){-webkit-animation-delay:-.8s;animation-delay:-.8s}.ball-scale-ripple-multiple>div:nth-child(1){-webkit-animation-delay:-.6s;animation-delay:-.6s}.ball-scale-ripple-multiple>div:nth-child(2){-webkit-animation-delay:-.4s;animation-delay:-.4s}.ball-scale-ripple-multiple>div:nth-child(3){-webkit-animation-delay:-.2s;animation-delay:-.2s}.ball-scale-ripple-multiple>div{position:absolute;top:-2px;left:-26px;width:50px;height:50px;border-radius:100%;border:2px solid #fff;-webkit-animation:ball-scale-ripple-multiple 1.25s 0s infinite cubic-bezier(.21,.53,.56,.8);animation:ball-scale-ripple-multiple 1.25s 0s infinite cubic-bezier(.21,.53,.56,.8)}@-webkit-keyframes ball-beat{50%{opacity:.2;-webkit-transform:scale(.75);transform:scale(.75)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes ball-beat{50%{opacity:.2;-webkit-transform:scale(.75);transform:scale(.75)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.ball-beat>div{background-color:#fff;width:15px;height:15px;border-radius:100%;margin:2px;display:inline-block;-webkit-animation:ball-beat .7s 0s infinite linear;animation:ball-beat .7s 0s infinite linear}.ball-beat>div:nth-child(2n-1){-webkit-animation-delay:-.35s!important;animation-delay:-.35s!important}@-webkit-keyframes ball-scale-multiple{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0}5%{opacity:1}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes ball-scale-multiple{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0}5%{opacity:1}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}.ball-scale-multiple{position:relative;-webkit-transform:translateY(-30px);-ms-transform:translateY(-30px);transform:translateY(-30px)}.ball-scale-multiple>div:nth-child(2){-webkit-animation-delay:-.4s;animation-delay:-.4s}.ball-scale-multiple>div:nth-child(3){-webkit-animation-delay:-.2s;animation-delay:-.2s}.ball-scale-multiple>div{background-color:#fff;border-radius:100%;position:absolute;left:-30px;top:0;opacity:0;margin:0;width:60px;height:60px;-webkit-animation:ball-scale-multiple 1s 0s linear infinite;animation:ball-scale-multiple 1s 0s linear infinite}@-webkit-keyframes ball-triangle-path-1{33%{-webkit-transform:translate(25px,-50px);transform:translate(25px,-50px)}66%{-webkit-transform:translate(50px,0);transform:translate(50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-triangle-path-1{33%{-webkit-transform:translate(25px,-50px);transform:translate(25px,-50px)}66%{-webkit-transform:translate(50px,0);transform:translate(50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@-webkit-keyframes ball-triangle-path-2{33%{-webkit-transform:translate(25px,50px);transform:translate(25px,50px)}66%{-webkit-transform:translate(-25px,50px);transform:translate(-25px,50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-triangle-path-2{33%{-webkit-transform:translate(25px,50px);transform:translate(25px,50px)}66%{-webkit-transform:translate(-25px,50px);transform:translate(-25px,50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@-webkit-keyframes ball-triangle-path-3{33%{-webkit-transform:translate(-50px,0);transform:translate(-50px)}66%{-webkit-transform:translate(-25px,-50px);transform:translate(-25px,-50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-triangle-path-3{33%{-webkit-transform:translate(-50px,0);transform:translate(-50px)}66%{-webkit-transform:translate(-25px,-50px);transform:translate(-25px,-50px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}.ball-triangle-path{position:relative;-webkit-transform:translate(-29.99px,-37.51px);-ms-transform:translate(-29.99px,-37.51px);transform:translate(-29.99px,-37.51px)}.ball-triangle-path>div:nth-child(1){-webkit-animation-name:ball-triangle-path-1;animation-name:ball-triangle-path-1;-webkit-animation-delay:0;animation-delay:0;-webkit-animation-duration:2s;animation-duration:2s;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.ball-triangle-path>div:nth-child(2){-webkit-animation-name:ball-triangle-path-2;animation-name:ball-triangle-path-2;-webkit-animation-delay:0;animation-delay:0;animation-duration:2s;animation-timing-function:ease-in-out;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.ball-triangle-path>div:nth-child(2),.ball-triangle-path>div:nth-child(3){-webkit-animation-duration:2s;-webkit-animation-timing-function:ease-in-out}.ball-triangle-path>div:nth-child(3){-webkit-animation-name:ball-triangle-path-3;animation-name:ball-triangle-path-3;-webkit-animation-delay:0;animation-delay:0;animation-duration:2s;animation-timing-function:ease-in-out;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.ball-triangle-path>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute;width:10px;height:10px;border-radius:100%;border:1px solid #fff}.ball-grid-beat>div,.ball-pulse-rise>div{background-color:#fff;height:15px;border-radius:100%;margin:2px}.ball-triangle-path>div:nth-of-type(1){top:50px}.ball-triangle-path>div:nth-of-type(2){left:25px}.ball-triangle-path>div:nth-of-type(3){top:50px;left:50px}@-webkit-keyframes ball-pulse-rise-even{0%{-webkit-transform:scale(1.1);transform:scale(1.1)}25%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}50%{-webkit-transform:scale(.4);transform:scale(.4)}75%{-webkit-transform:translateY(30px);transform:translateY(30px)}to{-webkit-transform:translateY(0);transform:translateY(0);-webkit-transform:scale(1);transform:scale(1)}}@keyframes ball-pulse-rise-even{0%{-webkit-transform:scale(1.1);transform:scale(1.1)}25%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}50%{-webkit-transform:scale(.4);transform:scale(.4)}75%{-webkit-transform:translateY(30px);transform:translateY(30px)}to{-webkit-transform:translateY(0);transform:translateY(0);-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes ball-pulse-rise-odd{0%{-webkit-transform:scale(.4);transform:scale(.4)}25%{-webkit-transform:translateY(30px);transform:translateY(30px)}50%{-webkit-transform:scale(1.1);transform:scale(1.1)}75%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}to{-webkit-transform:translateY(0);transform:translateY(0);-webkit-transform:scale(.75);transform:scale(.75)}}@keyframes ball-pulse-rise-odd{0%{-webkit-transform:scale(.4);transform:scale(.4)}25%{-webkit-transform:translateY(30px);transform:translateY(30px)}50%{-webkit-transform:scale(1.1);transform:scale(1.1)}75%{-webkit-transform:translateY(-30px);transform:translateY(-30px)}to{-webkit-transform:translateY(0);transform:translateY(0);-webkit-transform:scale(.75);transform:scale(.75)}}.ball-pulse-rise>div{width:15px;-webkit-animation-fill-mode:both;animation-fill-mode:both;display:inline-block;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:cubic-bezier(.15,.46,.9,.6);animation-timing-function:cubic-bezier(.15,.46,.9,.6);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-delay:0;animation-delay:0}.ball-pulse-rise>div:nth-child(2n){-webkit-animation-name:ball-pulse-rise-even;animation-name:ball-pulse-rise-even}.ball-pulse-rise>div:nth-child(2n-1){-webkit-animation-name:ball-pulse-rise-odd;animation-name:ball-pulse-rise-odd}@-webkit-keyframes ball-grid-beat{50%{opacity:.7}to{opacity:1}}@keyframes ball-grid-beat{50%{opacity:.7}to{opacity:1}}.ball-grid-beat{width:57px}.ball-grid-beat>div:nth-child(1){-webkit-animation-delay:.44s;animation-delay:.44s;-webkit-animation-duration:1.27s;animation-duration:1.27s}.ball-grid-beat>div:nth-child(2){-webkit-animation-delay:.2s;animation-delay:.2s;-webkit-animation-duration:1.52s;animation-duration:1.52s}.ball-grid-beat>div:nth-child(3){-webkit-animation-delay:.14s;animation-delay:.14s;-webkit-animation-duration:.61s;animation-duration:.61s}.ball-grid-beat>div:nth-child(4){-webkit-animation-delay:.15s;animation-delay:.15s;-webkit-animation-duration:.82s;animation-duration:.82s}.ball-grid-beat>div:nth-child(5){-webkit-animation-delay:-.01s;animation-delay:-.01s;-webkit-animation-duration:1.24s;animation-duration:1.24s}.ball-grid-beat>div:nth-child(6){-webkit-animation-delay:-.07s;animation-delay:-.07s;-webkit-animation-duration:1.35s;animation-duration:1.35s}.ball-grid-beat>div:nth-child(7){-webkit-animation-delay:.29s;animation-delay:.29s;-webkit-animation-duration:1.44s;animation-duration:1.44s}.ball-grid-beat>div:nth-child(8){-webkit-animation-delay:.63s;animation-delay:.63s;-webkit-animation-duration:1.19s;animation-duration:1.19s}.ball-grid-beat>div:nth-child(9){-webkit-animation-delay:-.18s;animation-delay:-.18s;-webkit-animation-duration:1.48s;animation-duration:1.48s}.ball-grid-beat>div{width:15px;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:ball-grid-beat;animation-name:ball-grid-beat;animation-iteration-count:infinite;-webkit-animation-delay:0;animation-delay:0}.ball-grid-beat>div,.ball-grid-pulse>div{display:inline-block;float:left;-webkit-animation-iteration-count:infinite}@-webkit-keyframes ball-grid-pulse{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5);opacity:.7}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes ball-grid-pulse{0%{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5);opacity:.7}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.ball-grid-pulse{width:57px}.ball-grid-pulse>div,.ball-spin-fade-loader>div{background-color:#fff;width:15px;height:15px;border-radius:100%;margin:2px}.ball-grid-pulse>div:nth-child(1){-webkit-animation-delay:.58s;animation-delay:.58s;-webkit-animation-duration:.9s;animation-duration:.9s}.ball-grid-pulse>div:nth-child(2){-webkit-animation-delay:.01s;animation-delay:.01s;-webkit-animation-duration:.94s;animation-duration:.94s}.ball-grid-pulse>div:nth-child(3){-webkit-animation-delay:.25s;animation-delay:.25s;-webkit-animation-duration:1.43s;animation-duration:1.43s}.ball-grid-pulse>div:nth-child(4){-webkit-animation-delay:-.03s;animation-delay:-.03s;-webkit-animation-duration:.74s;animation-duration:.74s}.ball-grid-pulse>div:nth-child(5){-webkit-animation-delay:.21s;animation-delay:.21s;-webkit-animation-duration:.68s;animation-duration:.68s}.ball-grid-pulse>div:nth-child(6){-webkit-animation-delay:.25s;animation-delay:.25s;-webkit-animation-duration:1.17s;animation-duration:1.17s}.ball-grid-pulse>div:nth-child(7){-webkit-animation-delay:.46s;animation-delay:.46s;-webkit-animation-duration:1.41s;animation-duration:1.41s}.ball-grid-pulse>div:nth-child(8){-webkit-animation-delay:.02s;animation-delay:.02s;-webkit-animation-duration:1.56s;animation-duration:1.56s}.ball-grid-pulse>div:nth-child(9){-webkit-animation-delay:.13s;animation-delay:.13s;-webkit-animation-duration:.78s;animation-duration:.78s}.ball-grid-pulse>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:ball-grid-pulse;animation-name:ball-grid-pulse;animation-iteration-count:infinite;-webkit-animation-delay:0;animation-delay:0}@-webkit-keyframes ball-spin-fade-loader{50%{opacity:.3;-webkit-transform:scale(.4);transform:scale(.4)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes ball-spin-fade-loader{50%{opacity:.3;-webkit-transform:scale(.4);transform:scale(.4)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.ball-spin-fade-loader{position:relative;top:-10px;left:-10px}.ball-spin-fade-loader>div:nth-child(1){top:25px;left:0;-webkit-animation:ball-spin-fade-loader 1s -.96s infinite linear;animation:ball-spin-fade-loader 1s -.96s infinite linear}.ball-spin-fade-loader>div:nth-child(2){top:17.05px;left:17.05px;-webkit-animation:ball-spin-fade-loader 1s -.84s infinite linear;animation:ball-spin-fade-loader 1s -.84s infinite linear}.ball-spin-fade-loader>div:nth-child(3){top:0;left:25px;-webkit-animation:ball-spin-fade-loader 1s -.72s infinite linear;animation:ball-spin-fade-loader 1s -.72s infinite linear}.ball-spin-fade-loader>div:nth-child(4){top:-17.05px;left:17.05px;-webkit-animation:ball-spin-fade-loader 1s -.6s infinite linear;animation:ball-spin-fade-loader 1s -.6s infinite linear}.ball-spin-fade-loader>div:nth-child(5){top:-25px;left:0;-webkit-animation:ball-spin-fade-loader 1s -.48s infinite linear;animation:ball-spin-fade-loader 1s -.48s infinite linear}.ball-spin-fade-loader>div:nth-child(6){top:-17.05px;left:-17.05px;-webkit-animation:ball-spin-fade-loader 1s -.36s infinite linear;animation:ball-spin-fade-loader 1s -.36s infinite linear}.ball-spin-fade-loader>div:nth-child(7){top:0;left:-25px;-webkit-animation:ball-spin-fade-loader 1s -.24s infinite linear;animation:ball-spin-fade-loader 1s -.24s infinite linear}.ball-spin-fade-loader>div:nth-child(8){top:17.05px;left:-17.05px;-webkit-animation:ball-spin-fade-loader 1s -.12s infinite linear;animation:ball-spin-fade-loader 1s -.12s infinite linear}.ball-spin-fade-loader>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute}@-webkit-keyframes ball-spin-loader{75%{opacity:.2}to{opacity:1}}@keyframes ball-spin-loader{75%{opacity:.2}to{opacity:1}}.ball-spin-loader{position:relative}.ball-spin-loader>span:nth-child(1){top:45px;left:0;-webkit-animation:ball-spin-loader 2s .9s infinite linear;animation:ball-spin-loader 2s .9s infinite linear}.ball-spin-loader>span:nth-child(2){top:30.68px;left:30.68px;-webkit-animation:ball-spin-loader 2s 1.8s infinite linear;animation:ball-spin-loader 2s 1.8s infinite linear}.ball-spin-loader>span:nth-child(3){top:0;left:45px;-webkit-animation:ball-spin-loader 2s 2.7s infinite linear;animation:ball-spin-loader 2s 2.7s infinite linear}.ball-spin-loader>span:nth-child(4){top:-30.68px;left:30.68px;-webkit-animation:ball-spin-loader 2s 3.6s infinite linear;animation:ball-spin-loader 2s 3.6s infinite linear}.ball-spin-loader>span:nth-child(5){top:-45px;left:0;-webkit-animation:ball-spin-loader 2s 4.5s infinite linear;animation:ball-spin-loader 2s 4.5s infinite linear}.ball-spin-loader>span:nth-child(6){top:-30.68px;left:-30.68px;-webkit-animation:ball-spin-loader 2s 5.4s infinite linear;animation:ball-spin-loader 2s 5.4s infinite linear}.ball-spin-loader>span:nth-child(7){top:0;left:-45px;-webkit-animation:ball-spin-loader 2s 6.3s infinite linear;animation:ball-spin-loader 2s 6.3s infinite linear}.ball-spin-loader>span:nth-child(8){top:30.68px;left:-30.68px;-webkit-animation:ball-spin-loader 2s 7.2s infinite linear;animation:ball-spin-loader 2s 7.2s infinite linear}.ball-spin-loader>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute;width:15px;height:15px;border-radius:100%;background:green}.ball-zig-zag-deflect>div,.ball-zig-zag>div{background-color:#fff;width:15px;height:15px;border-radius:100%;margin:2px 2px 2px 15px;top:4px;left:-7px}@-webkit-keyframes ball-zig{33%{-webkit-transform:translate(-15px,-30px);transform:translate(-15px,-30px)}66%{-webkit-transform:translate(15px,-30px);transform:translate(15px,-30px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-zig{33%{-webkit-transform:translate(-15px,-30px);transform:translate(-15px,-30px)}66%{-webkit-transform:translate(15px,-30px);transform:translate(15px,-30px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@-webkit-keyframes ball-zag{33%{-webkit-transform:translate(15px,30px);transform:translate(15px,30px)}66%{-webkit-transform:translate(-15px,30px);transform:translate(-15px,30px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-zag{33%{-webkit-transform:translate(15px,30px);transform:translate(15px,30px)}66%{-webkit-transform:translate(-15px,30px);transform:translate(-15px,30px)}to{-webkit-transform:translate(0,0);transform:translate(0)}}.ball-zig-zag{position:relative;-webkit-transform:translate(-15px,-15px);-ms-transform:translate(-15px,-15px);transform:translate(-15px,-15px)}.ball-zig-zag>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute}.ball-zig-zag>div:first-child{-webkit-animation:ball-zig .7s 0s infinite linear;animation:ball-zig .7s 0s infinite linear}.ball-zig-zag>div:last-child{-webkit-animation:ball-zag .7s 0s infinite linear;animation:ball-zag .7s 0s infinite linear}@-webkit-keyframes ball-zig-deflect{17%,84%{-webkit-transform:translate(-15px,-30px);transform:translate(-15px,-30px)}34%,67%{-webkit-transform:translate(15px,-30px);transform:translate(15px,-30px)}to,50%{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-zig-deflect{17%,84%{-webkit-transform:translate(-15px,-30px);transform:translate(-15px,-30px)}34%,67%{-webkit-transform:translate(15px,-30px);transform:translate(15px,-30px)}to,50%{-webkit-transform:translate(0,0);transform:translate(0)}}@-webkit-keyframes ball-zag-deflect{17%,84%{-webkit-transform:translate(15px,30px);transform:translate(15px,30px)}34%,67%{-webkit-transform:translate(-15px,30px);transform:translate(-15px,30px)}to,50%{-webkit-transform:translate(0,0);transform:translate(0)}}@keyframes ball-zag-deflect{17%,84%{-webkit-transform:translate(15px,30px);transform:translate(15px,30px)}34%,67%{-webkit-transform:translate(-15px,30px);transform:translate(-15px,30px)}to,50%{-webkit-transform:translate(0,0);transform:translate(0)}}.ball-zig-zag-deflect{position:relative;-webkit-transform:translate(-15px,-15px);-ms-transform:translate(-15px,-15px);transform:translate(-15px,-15px)}.ball-zig-zag-deflect>div{-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute}.ball-zig-zag-deflect>div:first-child{-webkit-animation:ball-zig-deflect 1.5s 0s infinite linear;animation:ball-zig-deflect 1.5s 0s infinite linear}.ball-zig-zag-deflect>div:last-child{-webkit-animation:ball-zag-deflect 1.5s 0s infinite linear;animation:ball-zag-deflect 1.5s 0s infinite linear}@-webkit-keyframes line-scale{0%,to{-webkit-transform:scaley(1);transform:scaley(1)}50%{-webkit-transform:scaley(.4);transform:scaley(.4)}}@keyframes line-scale{0%,to{-webkit-transform:scaley(1);transform:scaley(1)}50%{-webkit-transform:scaley(.4);transform:scaley(.4)}}.line-scale>div:nth-child(1){-webkit-animation:line-scale 1s -.4s infinite cubic-bezier(.2,.68,.18,1.08);animation:line-scale 1s -.4s infinite cubic-bezier(.2,.68,.18,1.08)}.line-scale>div:nth-child(2){-webkit-animation:line-scale 1s -.3s infinite cubic-bezier(.2,.68,.18,1.08);animation:line-scale 1s -.3s infinite cubic-bezier(.2,.68,.18,1.08)}.line-scale>div:nth-child(3){-webkit-animation:line-scale 1s -.2s infinite cubic-bezier(.2,.68,.18,1.08);animation:line-scale 1s -.2s infinite cubic-bezier(.2,.68,.18,1.08)}.line-scale>div:nth-child(4){-webkit-animation:line-scale 1s -.1s infinite cubic-bezier(.2,.68,.18,1.08);animation:line-scale 1s -.1s infinite cubic-bezier(.2,.68,.18,1.08)}.line-scale>div:nth-child(5){-webkit-animation:line-scale 1s 0s infinite cubic-bezier(.2,.68,.18,1.08);animation:line-scale 1s 0s infinite cubic-bezier(.2,.68,.18,1.08)}.line-scale>div{animation-fill-mode:both;display:inline-block}.line-scale-party>div,.line-scale>div{background-color:#fff;border-radius:2px;margin:2px;width:4px;height:35px;-webkit-animation-fill-mode:both}@-webkit-keyframes line-scale-party{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5)}}@keyframes line-scale-party{0%,to{-webkit-transform:scale(1);transform:scale(1)}50%{-webkit-transform:scale(.5);transform:scale(.5)}}.line-scale-party>div:nth-child(1){-webkit-animation-delay:-.09s;animation-delay:-.09s;-webkit-animation-duration:.83s;animation-duration:.83s}.line-scale-party>div:nth-child(2){-webkit-animation-delay:.33s;animation-delay:.33s;-webkit-animation-duration:.64s;animation-duration:.64s}.line-scale-party>div:nth-child(3){-webkit-animation-delay:.32s;animation-delay:.32s;-webkit-animation-duration:.39s;animation-duration:.39s}.line-scale-party>div:nth-child(4){-webkit-animation-delay:.47s;animation-delay:.47s;-webkit-animation-duration:.52s;animation-duration:.52s}.line-scale-party>div{animation-fill-mode:both;display:inline-block;-webkit-animation-name:line-scale-party;animation-name:line-scale-party;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-delay:0;animation-delay:0}@-webkit-keyframes line-scale-pulse-out{0%,to{-webkit-transform:scaley(1);transform:scaley(1)}50%{-webkit-transform:scaley(.4);transform:scaley(.4)}}@keyframes line-scale-pulse-out{0%,to{-webkit-transform:scaley(1);transform:scaley(1)}50%{-webkit-transform:scaley(.4);transform:scaley(.4)}}.line-scale-pulse-out>div{background-color:#fff;width:4px;height:35px;border-radius:2px;margin:2px;display:inline-block;-webkit-animation:line-scale-pulse-out .9s -.6s infinite cubic-bezier(.85,.25,.37,.85);animation:line-scale-pulse-out .9s -.6s infinite cubic-bezier(.85,.25,.37,.85)}.line-scale-pulse-out>div:nth-child(2),.line-scale-pulse-out>div:nth-child(4){-webkit-animation-delay:-.4s!important;animation-delay:-.4s!important}.line-scale-pulse-out>div:nth-child(1),.line-scale-pulse-out>div:nth-child(5){-webkit-animation-delay:-.2s!important;animation-delay:-.2s!important}@-webkit-keyframes line-scale-pulse-out-rapid{0%,90%{-webkit-transform:scaley(1);transform:scaley(1)}80%{-webkit-transform:scaley(.3);transform:scaley(.3)}}@keyframes line-scale-pulse-out-rapid{0%,90%{-webkit-transform:scaley(1);transform:scaley(1)}80%{-webkit-transform:scaley(.3);transform:scaley(.3)}}.line-scale-pulse-out-rapid>div{background-color:#fff;width:4px;height:35px;border-radius:2px;margin:2px;display:inline-block;-webkit-animation:line-scale-pulse-out-rapid .9s -.5s infinite cubic-bezier(.11,.49,.38,.78);animation:line-scale-pulse-out-rapid .9s -.5s infinite cubic-bezier(.11,.49,.38,.78)}.line-scale-pulse-out-rapid>div:nth-child(2),.line-scale-pulse-out-rapid>div:nth-child(4){-webkit-animation-delay:-.25s!important;animation-delay:-.25s!important}.line-scale-pulse-out-rapid>div:nth-child(1),.line-scale-pulse-out-rapid>div:nth-child(5){-webkit-animation-delay:0s!important;animation-delay:0s!important}@-webkit-keyframes line-spin-fade-loader{50%{opacity:.3}to{opacity:1}}@keyframes line-spin-fade-loader{50%{opacity:.3}to{opacity:1}}.line-spin-fade-loader{position:relative;top:-10px;left:-4px}.line-spin-fade-loader>div:nth-child(1){top:20px;left:0;-webkit-animation:line-spin-fade-loader 1.2s -.84s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.84s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(2){top:13.64px;left:13.64px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-animation:line-spin-fade-loader 1.2s -.72s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.72s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(3){top:0;left:20px;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);-webkit-animation:line-spin-fade-loader 1.2s -.6s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.6s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(4){top:-13.64px;left:13.64px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:line-spin-fade-loader 1.2s -.48s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.48s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(5){top:-20px;left:0;-webkit-animation:line-spin-fade-loader 1.2s -.36s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.36s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(6){top:-13.64px;left:-13.64px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-animation:line-spin-fade-loader 1.2s -.24s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.24s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(7){top:0;left:-20px;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);-webkit-animation:line-spin-fade-loader 1.2s -.12s infinite ease-in-out;animation:line-spin-fade-loader 1.2s -.12s infinite ease-in-out}.line-spin-fade-loader>div:nth-child(8){top:13.64px;left:-13.64px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:line-spin-fade-loader 1.2s 0s infinite ease-in-out;animation:line-spin-fade-loader 1.2s 0s infinite ease-in-out}.line-spin-fade-loader>div{background-color:#fff;border-radius:2px;margin:2px;-webkit-animation-fill-mode:both;animation-fill-mode:both;position:absolute;width:5px;height:15px}@-webkit-keyframes triangle-skew-spin{25%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(0);transform:perspective(100px) rotateX(180deg) rotateY(0)}50%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(180deg);transform:perspective(100px) rotateX(180deg) rotateY(180deg)}75%{-webkit-transform:perspective(100px) rotateX(0) rotateY(180deg);transform:perspective(100px) rotateX(0) rotateY(180deg)}to{-webkit-transform:perspective(100px) rotateX(0) rotateY(0);transform:perspective(100px) rotateX(0) rotateY(0)}}@keyframes triangle-skew-spin{25%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(0);transform:perspective(100px) rotateX(180deg) rotateY(0)}50%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(180deg);transform:perspective(100px) rotateX(180deg) rotateY(180deg)}75%{-webkit-transform:perspective(100px) rotateX(0) rotateY(180deg);transform:perspective(100px) rotateX(0) rotateY(180deg)}to{-webkit-transform:perspective(100px) rotateX(0) rotateY(0);transform:perspective(100px) rotateX(0) rotateY(0)}}.triangle-skew-spin>div{width:0;height:0;border-left:20px solid transparent;border-right:20px solid transparent;border-bottom:20px solid #fff;-webkit-animation:triangle-skew-spin 3s 0s cubic-bezier(.09,.57,.49,.9) infinite;animation:triangle-skew-spin 3s 0s cubic-bezier(.09,.57,.49,.9) infinite}@-webkit-keyframes square-spin{25%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(0);transform:perspective(100px) rotateX(180deg) rotateY(0)}50%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(180deg);transform:perspective(100px) rotateX(180deg) rotateY(180deg)}75%{-webkit-transform:perspective(100px) rotateX(0) rotateY(180deg);transform:perspective(100px) rotateX(0) rotateY(180deg)}to{-webkit-transform:perspective(100px) rotateX(0) rotateY(0);transform:perspective(100px) rotateX(0) rotateY(0)}}@keyframes square-spin{25%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(0);transform:perspective(100px) rotateX(180deg) rotateY(0)}50%{-webkit-transform:perspective(100px) rotateX(180deg) rotateY(180deg);transform:perspective(100px) rotateX(180deg) rotateY(180deg)}75%{-webkit-transform:perspective(100px) rotateX(0) rotateY(180deg);transform:perspective(100px) rotateX(0) rotateY(180deg)}to{-webkit-transform:perspective(100px) rotateX(0) rotateY(0);transform:perspective(100px) rotateX(0) rotateY(0)}}.square-spin>div{width:50px;height:50px;background:#fff;border:1px solid red;-webkit-animation:square-spin 3s 0s cubic-bezier(.09,.57,.49,.9) infinite;animation:square-spin 3s 0s cubic-bezier(.09,.57,.49,.9) infinite}.pacman>div:first-of-type,.pacman>div:nth-child(2){width:0;height:0;border-right:25px solid transparent;border-top:25px solid #fff;border-left:25px solid #fff;border-bottom:25px solid #fff;border-radius:25px;position:relative;left:-30px}@-webkit-keyframes rotate_pacman_half_up{0%,to{-webkit-transform:rotate(270deg);transform:rotate(270deg)}50%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate_pacman_half_up{0%,to{-webkit-transform:rotate(270deg);transform:rotate(270deg)}50%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes rotate_pacman_half_down{0%,to{-webkit-transform:rotate(90deg);transform:rotate(90deg)}50%{-webkit-transform:rotate(0);transform:rotate(0)}}@keyframes rotate_pacman_half_down{0%,to{-webkit-transform:rotate(90deg);transform:rotate(90deg)}50%{-webkit-transform:rotate(0);transform:rotate(0)}}@-webkit-keyframes pacman-balls{75%{opacity:.7}to{-webkit-transform:translate(-100px,-6.25px);transform:translate(-100px,-6.25px)}}@keyframes pacman-balls{75%{opacity:.7}to{-webkit-transform:translate(-100px,-6.25px);transform:translate(-100px,-6.25px)}}.pacman{position:relative}.pacman>div:nth-child(3){-webkit-animation:pacman-balls 1s -.66s infinite linear;animation:pacman-balls 1s -.66s infinite linear}.pacman>div:nth-child(4){-webkit-animation:pacman-balls 1s -.33s infinite linear;animation:pacman-balls 1s -.33s infinite linear}.pacman>div:nth-child(5){-webkit-animation:pacman-balls 1s 0s infinite linear;animation:pacman-balls 1s 0s infinite linear}.pacman>div:first-of-type{-webkit-animation:rotate_pacman_half_up .5s 0s infinite;animation:rotate_pacman_half_up .5s 0s infinite}.pacman>div:nth-child(2){-webkit-animation:rotate_pacman_half_down .5s 0s infinite;animation:rotate_pacman_half_down .5s 0s infinite;margin-top:-50px}.pacman>div:nth-child(3),.pacman>div:nth-child(4),.pacman>div:nth-child(5),.pacman>div:nth-child(6){background-color:#fff;border-radius:100%;margin:2px;width:10px;height:10px;position:absolute;-webkit-transform:translate(0,-6.25px);-ms-transform:translate(0,-6.25px);transform:translateY(-6.25px);top:25px;left:70px}@-webkit-keyframes cube-transition{25%{-webkit-transform:translateX(50px) scale(.5) rotate(-90deg);transform:translate(50px) scale(.5) rotate(-90deg)}50%{-webkit-transform:translate(50px,50px) rotate(-180deg);transform:translate(50px,50px) rotate(-180deg)}75%{-webkit-transform:translateY(50px) scale(.5) rotate(-270deg);transform:translateY(50px) scale(.5) rotate(-270deg)}to{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}@keyframes cube-transition{25%{-webkit-transform:translateX(50px) scale(.5) rotate(-90deg);transform:translate(50px) scale(.5) rotate(-90deg)}50%{-webkit-transform:translate(50px,50px) rotate(-180deg);transform:translate(50px,50px) rotate(-180deg)}75%{-webkit-transform:translateY(50px) scale(.5) rotate(-270deg);transform:translateY(50px) scale(.5) rotate(-270deg)}to{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}.cube-transition{position:relative;-webkit-transform:translate(-25px,-25px);-ms-transform:translate(-25px,-25px);transform:translate(-25px,-25px)}.cube-transition>div{width:10px;height:10px;position:absolute;top:-5px;left:-5px;background-color:#fff;-webkit-animation:cube-transition 1.6s 0s infinite ease-in-out;animation:cube-transition 1.6s 0s infinite ease-in-out}.cube-transition>div:last-child{-webkit-animation-delay:-.8s;animation-delay:-.8s}@-webkit-keyframes spin-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.semi-circle-spin{position:relative;width:35px;height:35px;overflow:hidden}.semi-circle-spin>div{position:absolute;border-width:0;border-radius:100%;-webkit-animation:spin-rotate .6s 0s infinite linear;animation:spin-rotate .6s 0s infinite linear;background-image:-webkit-linear-gradient(transparent 0,transparent 70%,#fff 30%,#fff 100%);background-image:linear-gradient(transparent 0,transparent 70%,#fff 30%,#fff 100%);width:100%;height:100%}@-webkit-keyframes bar-progress{0%,to{-webkit-transform:scaleY(20%);transform:scaleY(.2);opacity:1}25%,75%{-webkit-transform:translateX(6%) scaleY(10%);transform:translate(6%) scaleY(.1);opacity:.7}50%{-webkit-transform:translateX(20%) scaleY(20%);transform:translate(20%) scaleY(.2);opacity:1}}@keyframes bar-progress{0%,to{-webkit-transform:scaleY(20%);transform:scaleY(.2);opacity:1}25%,75%{-webkit-transform:translateX(6%) scaleY(10%);transform:translate(6%) scaleY(.1);opacity:.7}50%{-webkit-transform:translateX(20%) scaleY(20%);transform:translate(20%) scaleY(.2);opacity:1}}.bar-progress{width:30%;height:12px}.bar-progress>div{position:relative;width:20%;height:12px;border-radius:10px;background-color:#fff;-webkit-animation:bar-progress 3s cubic-bezier(.57,.1,.44,.93) infinite;animation:bar-progress 3s cubic-bezier(.57,.1,.44,.93) infinite;opacity:1}.bar-swing,.bar-swing>div{height:8px;width:30%}@-webkit-keyframes bar-swing{0%,to{left:0}50%{left:70%}}@keyframes bar-swing{0%,to{left:0}50%{left:70%}}.bar-swing>div{position:relative;border-radius:10px;background-color:#fff;-webkit-animation:bar-swing 1.5s infinite;animation:bar-swing 1.5s infinite}@-webkit-keyframes bar-swing-container{0%,to{left:0;-webkit-transform:translateX(0);transform:translate(0)}50%{left:70%;-webkit-transform:translateX(-4px);transform:translate(-4px)}}@keyframes bar-swing-container{0%,to{left:0;-webkit-transform:translateX(0);transform:translate(0)}50%{left:70%;-webkit-transform:translateX(-4px);transform:translate(-4px)}}.bar-swing-container{width:20%;height:8px;position:relative}.bar-swing-container div:nth-child(1){position:absolute;width:100%;background-color:rgba(255,255,255,.2);height:12px;border-radius:10px}.bar-swing-container div:nth-child(2){position:absolute;width:30%;height:8px;border-radius:10px;background-color:#fff;-webkit-animation:bar-swing-container 2s cubic-bezier(.91,.35,.12,.6) infinite;animation:bar-swing-container 2s cubic-bezier(.91,.35,.12,.6) infinite;margin:2px 2px 0}._time_1c1wd_1{position:absolute;left:20px;top:20px;display:flex;color:var(--white);border-radius:4px;overflow:hidden;height:36px;line-height:36px;box-sizing:border-box;font-size:18px}._time_1c1wd_1 ._status_1c1wd_14{display:flex;align-items:center;background-color:var(--live-time-status-background-color);padding:10px}._time_1c1wd_1 ._status_1c1wd_14>div{margin-right:5px;height:20px}._time_1c1wd_1 ._status_1c1wd_14>div>div{height:20px}._time_1c1wd_1 ._text_1c1wd_27{background-color:var(--live-time-background-color);display:flex;align-items:center;padding:10px}._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_1cod9_1{width:385px!important;height:calc(100vh - var(--header-bar-height));background-color:var(--live-main-color)}._dataCount_1cod9_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_1cod9_6 ._num_1cod9_17{font-size:24px;font-weight:700;padding-bottom:16px}._dataCount_1cod9_6 ._text_1cod9_22{display:flex;font-size:14px}._dataCount_1cod9_6 ._dataIcon_1cod9_26{padding-right:5px;width:20px;height:20px}._tabContainer_1cod9_31 ._tabIcon_1cod9_31{margin-right:6px;width:20px;height:20px}._tabContainer_1cod9_31 ._point_1cod9_36{width:8px;height:8px;border-radius:50%;background-color:var(--live-time-status-background-color);position:absolute;right:-10px;top:5px}._tabContainer_1cod9_31 .el-tabs__header{margin-bottom:0}._tabContainer_1cod9_31 .el-tabs__nav-wrap:after{background-color:var(--message-color)}._tabContainer_1cod9_31 .el-tabs__nav{padding:12px 0;width:100%;text-align:center}._tabContainer_1cod9_31 .el-tabs__item{color:var(--live-color);font-size:16px;padding:0 31px}._tabContainer_1cod9_31 .el-tabs__item.is-active{color:#00fff0}._tabContainer_1cod9_31 .el-tabs__active-bar{background-color:#00fff0}._tabContent_1cod9_67{--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_1cod9_67 ._tabList_1cod9_73{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(S),System.register(["./index-legacy.58b62919.js","./vendor-legacy.bab3818d.js"],(function(t){"use strict";var r,u,d,f,y,C,E,S,I,w,k,x,O,N,A,P,M,L,U,D,V,B,F,H,j,K,q,Y,G,z,J,W,Q;return{setters:[function(e){r=e.s,u=e.r,d=e.a},function(e){f=e.j,y=e.n,C=e.i,E=e.p,S=e.d,I=e.f,w=e.l,k=e.t,x=e.u,O=e.v,N=e.x,A=e.y,P=e.z,M=e.A,L=e.B,U=e.C,D=e.D,V=e.F,B=e.G,F=e.H,H=e.r,j=e.I,K=e.J,e.K,q=e.L,Y=e.M,G=e.N,z=e.O,J=e.P,W=e.Q,Q=e.R}],execute:function(){var X,Z,$="_liveHeader_turek_1",ee="_liveLogo_turek_12",te="_liveHeaderLeft_turek_17",ne="_liveHeaderLeftIcon_turek_23",re="_liveHeaderLeftText_turek_27",ie="_avatarWrapper_turek_30",oe="_userAvatar_turek_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"}(Z||(Z={}));var ae,se,ce=Z,ue=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],le=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],de=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],he={"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}},fe=["RC:TypSts","RC:InterceptMsg"];!function(e){e.WEBSOCKET="websocket",e.COMET="comet"}(ae||(ae={}));var pe=function(e){return se||(se={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}}),se},me=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}(),ge=function(){function e(e,t){var n,r=t?"RCV4-"+t:"RCV4-";this._rootStorage=pe(e);var i=this._rootStorage.get(r)||{};this._cache=new me(((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}(),ve=function(e,t){return(ve=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 _e(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}ve(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var ye,Re,be=function(){return(be=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 Ce(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(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(a,s)}c((r=r.apply(e,t||[])).next())}))}function Ee(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}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,s])}}}function Te(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}_e(t,e)}(Error);var Se=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()}))},Ie=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},we=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},ke=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"}(ye||(ye={})),function(e){e.IM="IM",e.RTC="RTC"}(Re||(Re={}));var xe="RC_Logs";var Oe,Ne=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(xe),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=be({},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,xe,{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 a=e._db.transaction([t],"readwrite").objectStore(t),s=IDBKeyRange.bound(r,i),c=a.index(n),u=[],l=c.openCursor(s);l.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},l.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}(),Ae=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)}))},Pe=function(){var e=Ae();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"}(Oe||(Oe={}));var Me,Le=Oe;!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"}(Me||(Me={}));var Ue,De,Ve=Me,Be=function(e){return"string"==typeof e},Fe=function(e){return"boolean"==typeof e},He=function(e){return"number"==typeof e&&!isNaN(e)},je=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ke=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},qe=function(e){return Be(e)&&e.length>0},Ye=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ge=function(e){return"[object Function]"===Object.prototype.toString.call(e)},ze=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Je=function(e){return"[object Null]"===Object.prototype.toString.call(e)},We=function(e){return Be(e)&&/https?:\/\//.test(e)},Qe=function(e){for(var t in e)return!0;return!1},Xe=function(e){return He(e)&&Object.prototype.hasOwnProperty.call(Ve,e)},Ze=((Ue={})[ye.DEBUG]=console.debug.bind(console),Ue[ye.INFO]=console.info.bind(console),Ue[ye.WARN]=console.warn.bind(console),Ue[ye.ERROR]=console.error.bind(console),Ue[ye.FATAL]=console.log.bind(console),Ue),$e=function(e){return Be(e)||He(e)||ze(e)||Fe(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},et=function(){function e(e,t,n){this.tag=e,this.type=t,this.initiator=n,this._outLevel=ye.WARN,this.debug=this.log.bind(this,ye.DEBUG),this.info=this.log.bind(this,ye.INFO),this.warn=this.log.bind(this,ye.WARN),this.error=this.log.bind(this,ye.ERROR),this.fatal=this.log.bind(this,ye.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];Ze[e].apply(Ze,Te([t+":"],n))},e.prototype.__pushLocalLog=function(t,n,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?Re.RTC:Re.IM;var o=Date.now();Ie(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,a="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?i+=r:i++,i>1e3)return a;a+=e.charAt(o)}return e}(n));var a=JSON.stringify({message:n,userId:e.userId}).replace(/"/g,'""'),s=/^[\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)+","+s+',"'+a+'"\n',userId:e.userId};e.databaseLogList.push(c),(e.databaseLogList.length>=100||t===ye.FATAL)&&this.__insertLogIntoDatabase()},e.prototype.__insertLogIntoDatabase=function(){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return t=Te([],e.databaseLogList),e.databaseLogList=[],(n=Ne.getInstance())?[4,n.addList(xe,t)]:[3,3];case 1:return r=i.sent(),[4,n.getCount(xe,"time")];case 2:return i.sent()>1e5&&n.removeFirstData(xe,"time",2e3),[2,r];case 3:return[2,!1]}}))}))},e.prototype.setLogLevel=function(e){this._outLevel="number"!=typeof e?ye.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>ye.DEBUG&&this.__pushLocalLog(e,t.map($e).join(" "),this.tag),!(e<this._outLevel)){var r=(new Date).toISOString()+"["+this.tag+"]["+ye[e]+"]",i=r+" - "+t.map($e).join(" ");this._logStdout?this._logStdout(e,i):this._stdout?this._stdout(e,i):this._defaultStdout.apply(this,Te([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=Pe(),e.userId="",e}(),nt=new et("RCLog"),rt=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],a=o.target,s=o.once,c=o.listener;s&&r.splice(i,1);try{c.call.apply(c,Te([a],t))}catch(e){nt.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"}(De||(De={}));var it,ot=De;!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"}(it||(it={}));var at,st=it;!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"}(at||(at={}));var ct,ut=at,lt=0,dt=3,ht=4,ft=6,pt=8,mt=9,gt=10,vt=12,_t=13,yt=16,Rt=17,bt=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"}(ct||(ct={}));var Ct,Et=ct;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Ct||(Ct={}));var Tt,St=Ct;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Tt||(Tt={}));var It,wt=Tt;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(It||(It={}));var kt,xt=It;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(kt||(kt={}));var Ot,Nt=kt;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Ot||(Ot={}));var At,Pt,Mt,Lt,Ut=Ot;!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"}(At||(At={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(Pt||(Pt={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Mt||(Mt={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Lt||(Lt={}));var Dt,Vt,Bt,Ft={"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"}(Dt||(Dt={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Vt||(Vt={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Bt||(Bt={}));var Ht,jt,Kt={engine:"5.1.1"},qt=function(){function e(){}return e.add=function(e,t){Kt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return nt.warn("The validation engine version '"+e+"' is invalid!"),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Kt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Kt},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"}(jt||(jt={}));var Yt,Gt,zt,Jt,Wt,Qt=((Ht={})[jt.STRING]=qe,Ht[jt.ONLY_STRING]=Be,Ht[jt.NUMBER]=He,Ht[jt.BOOLEAN]=function(e){return"boolean"==typeof e},Ht[jt.OBJECT]=Ye,Ht[jt.ARRAY]=je,Ht[jt.CALLBACK]=function(e){var t=!0;return Ye(e)||(t=!1),(e=e||{}).onSuccess&&!Ge(e.onSuccess)&&(t=!1),e.onError&&!Ge(e.onError)&&(t=!1),t},Ht[jt.CHANNEL_ID]=function(e){var t=!1;return Be(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Ht),Xt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return _e(t,e),t}(Error),Zt=function(e,t,n,r){if(void 0===r&&(r=!1),!$t(e,t,n,r))throw new Xt("'"+e+"' is invalid: "+JSON.stringify(t))},$t=function(e,t,n,r){void 0===r&&(r=!1),n=Qt[n]||n;var i=r&&!n(t)||!r&&!(ze(t)||null===t||n(t));return i&&nt.error("'"+e+"' is invalid: "+JSON.stringify(t)),!i},en=function(e){if(!Ye(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)},tn=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,a,s=Object.keys(e);if(0!==s.length){var c=s[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===(a=e[c])||void 0===a?void 0:a.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){nt.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},nn=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&n<=128&&n>=1},rn=function(e){var t=e.length;return t<=4096&&t>=1},on=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Ye(e)&&function(){for(var n in e)t(e[n],n,e)}(),(je(e)||Be(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)}()},an=function(e,t){return on(e,(function(n,r){e[r]=t(n,r)})),e},sn=function(e,t){var n=[];return on(e,(function(e){n.push(e)})),-1!==function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return on(e,(function(e,r){t===e&&(n=r)})),n}(n,t)},cn=function(e){return JSON.parse(JSON.stringify(e))},un=function(){return"undefined"!=typeof RCCppEngine},ln=function(e){switch(e){case dt:return st.SERVER_UNAVAILABLE;case ht:return st.RC_CONN_USER_OR_PASSWD_ERROR;case ft:return st.RC_CONN_REDIRECTED;case pt:return st.RC_CONN_APP_BLOCKED_OR_DELETED;case mt:return st.RC_CONN_USER_BLOCKED;case gt:return st.RC_CONN_USER_OR_PASSWD_ERROR;case vt:return st.HOSTNAME_ERROR;case _t:return st.HAS_OHTER_SAME_CLIENT_ON_LINE;case yt:return st.RC_APP_AUTH_NOT_PASS;case Rt:return st.RC_OTP_USED;case bt:return st.RC_PLATFORM_ERROR;default:return st.RC_NET_UNAVAILABLE}},dn=function(e){var t={},n=JSON.parse(e);return on(n,(function(e,n){t[n]=e.v})),t},hn={_delayTime:0,setTime:function(e){var t=(new Date).getTime();hn._delayTime=t-e},getTime:function(){var e=hn._delayTime;return(new Date).getTime()-e}},fn=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"}(Yt||(Yt={})),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"}(Gt||(Gt={})),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"}(zt||(zt={})),function(e){e.PUB="pub",e.QUERY="qry"}(Jt||(Jt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Wt||(Wt={}));var pn,mn=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=Yt.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=Yt.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}(),gn=function(){function e(){}return e.writeUTF=function(e,t){var n=[],r=0;if(Be(e))for(var i=0,o=e.length;i<o;i++){var a=e.charCodeAt(i);a>=0&&a<=127?(r+=1,n.push(a)):a>=128&&a<=2047?(r+=2,n.push(192|31&a>>6),n.push(128|63&a)):a>=2048&&a<=65535&&(r+=3,n.push(224|15&a>>12),n.push(128|63&a>>6),n.push(128|63&a))}for(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,a="";++i<o.length;){var s=Number(o[i]);if(s===(127&s)||(240==(240&s)?s=(s=(s=(s^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&s)?s=(s=(s^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&s)&&(s=(s^=192)<<6|128^o[++i])),!isFinite(s)||s<0||s>1114111||Math.floor(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(t=(s-=65536)>>10|55296,n=s%1024|56320,r.push(t,n)),(i+1===o.length||r.length>16384)&&(a+=String.fromCharCode.apply(null,r),r.length=0)}return a},e}(),vn=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 gn.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),_n=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=gn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),yn="UpStreamMessage",Rn="PushExtra",bn="DownStreamMessage",Cn="DownStreamMessages",En="SessionsAttQryInput",Tn="SessionsAttOutput",Sn="SyncRequestMsg",In="ChrmPullMsg",wn="NotifyMsg",kn="HistoryMsgInput",xn="HistoryMsgOuput",On="RelationQryInput",Nn="RelationsOutput",An="DeleteSessionsInput",Pn="SessionInfo",Mn="DeleteSessionsOutput",Ln="RelationsInput",Un="DeleteMsgInput",Dn="CleanHisMsgInput",Vn="SessionMsgReadInput",Bn="ChrmInput",Fn="ChrmOutput",Hn="QueryChatRoomInfoInput",jn="QueryChatRoomInfoOutput",Kn="RtcInput",qn="RtcUserListOutput",Yn="SetUserStatusInput",Gn="RtcSetDataInput",zn="RtcUserSetDataInput",Jn="RtcDataInput",Wn="RtcSetOutDataInput",Qn="MCFollowInput",Xn="RtcTokenOutput",Zn="RtcQryOutput",$n="RtcQryUserOutDataInput",er="RtcUserOutDataOutput",tr="RtcQueryListInput",nr="RtcRoomInfoOutput",rr="RtcValueInfo",ir="RtcKeyDeleteInput",or="GetQNupTokenInput",ar="GetQNupTokenOutput",sr="GetQNdownloadUrlInput",cr="GetDownloadUrlInput",ur="GetQNdownloadUrlOutput",lr="GetDownloadUrlOutput",dr="SetChrmKV",hr="SetChrmKVS",fr="DeleteChrmKVS",pr="ChrmKVOutput",mr="ChrmKVSOutput",gr="ChrmKVSOutputEntity",vr="QueryChrmKV",_r="SetUserSettingInput",yr="SetUserSettingOutput",Rr="PullUserSettingInput",br="PullUserSettingOutput",Cr="UserSettingNotification",Er="SessionReq",Tr="SessionStates",Sr="SessionState",Ir="SessionStateItem",wr="SessionStateModifyReq",kr="SessionStateModifyResp",xr="GrpReadReceiptMsg",Or="GrpReadReceiptQryReq",Nr="GrpReadReceiptQryResp",Ar="GrpMsgReadUser",Pr="SessionTagAddInput",Mr="SessionTagItem",Lr="SessionTagDelInput",Ur="SessionDisTagReq",Dr="ReportSDKInput",Vr="ReportSDKOutput",Br="RtcNotifyMsg",Fr="RtcPullKV",Hr="RtcKVOutput",jr="RtcQueryUserJoinedInput",Kr="RtcQueryUserJoinedOutput",qr="RtcViewerJoinedOutput",Yr="RtcInviteInput",Gr="RtcCancelInviteInput",zr="RtcInviteAnswerInput",Jr="RtcEndInviteInput",Wr=((pn={})[yn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],pn[Cn]=["list","syncTime","finished"],pn[bn]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"],pn[Rn]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],pn[En]=["nothing"],pn[Tn]=["inboxTime","sendboxTime","totalUnreadCount"],pn[Sn]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"],pn[In]=["syncTime","count"],pn[wn]=["type","time","chrmId"],pn[kn]=["targetId","time","count","order","busChannel"],pn[xn]=["list","syncTime","hasMsg"],pn[On]=["type","count","startTime","order"],pn[Nn]=["info"],pn[An]=["sessions"],pn[Pn]=["type","channelId","busChannel"],pn[Mn]=["nothing"],pn[Ln]=["type","msg","count","busChannel","startTime","endTime"],pn[Un]=["type","conversationId","msgs","busChannel"],pn[Dn]=["targetId","dataTime","conversationType","busChannel"],pn[Vn]=["type","msgTime","channelId"],pn[Bn]=["nothing"],pn[Fn]=["nothing","sessionId","joinTime"],pn[Hn]=["count","order"],pn[jn]=["userTotalNums","userInfos"],pn[or]=["type","key","httpMethod","queryString"],pn[sr]=["type","key","fileName"],pn[cr]=["type","key","fileName"],pn[ar]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],pn[ur]=["downloadUrl"],pn[lr]=["downloadUrl"],pn[dr]=["entry","bNotify","notification","type"],pn[hr]=["entry","bNotify","notification","type"],pn[fr]=["entry","bNotify","notification","type"],pn[pr]=["entries","bFullUpdate","syncTime"],pn[mr]=["timestamp","errorKeys"],pn[gr]=["key","errorCode"],pn[vr]=["timestamp"],pn[_r]=["version","value"],pn[yr]=["version","reserve"],pn[Rr]=["version","reserve"],pn[br]=["items","version"],pn.UserSettingItem=["targetId","type","key","value","version","status","tags"],pn[Er]=["time"],pn[Tr]=["version","state"],pn[Sr]=["type","channelId","time","stateItem","busChannel"],pn[Ir]=["sessionStateType","value","tags"],pn[wr]=["version","state"],pn[kr]=["version"],pn[xr]=["msgId","busChannel"],pn[Or]=["msgId","busChannel"],pn[Nr]=["totalMemberNum","list"],pn[Ar]=["readTime","userId"],pn[Pr]=["version","tags"],pn[Mr]=["tagId","name","createdTime","isTop"],pn[Lr]=["version","tags"],pn[Ur]=["tagId"],pn[Cr]=["version","reserve"],pn[Dr]=["sdkInfo"],pn[Vr]=["nothing"],pn[Kn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],pn[qn]=["users","token","sessionId","roomInfo"],pn[Yn]=["status"],pn[Gn]=["interior","target","key","value","objectName","content"],pn[zn]=["valueInfo","objectName","content"],pn[Jn]=["interior","target","key","objectName","content"],pn[Wn]=["target","valueInfo","objectName","content"],pn[Qn]=["state"],pn[Xn]=["rtcToken"],pn[Zn]=["outInfo"],pn[$n]=["userId"],pn[er]=["user"],pn[tr]=["order"],pn[nr]=["roomId","roomData","userCount","list"],pn[rr]=["key","value"],pn[ir]=["key"],pn[Br]=["type","time","roomId"],pn[Fr]=["timestamp","roomId"],pn[Hr]=["entries","bFullUpdate","syncTime"],pn[jr]=["userId"],pn[Kr]=["info"],pn[Yr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],pn[Gr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],pn[zr]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],pn[Jr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],pn),Qr={},Xr=function(e){var t=Wr[e];Qr[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],o="set"+Se(i,0,1);n[o]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Qr[e].decode=function(e){var t={};Be(e)&&(e=JSON.parse(e));var n=function(n){var r="get"+Se(n,0,1);t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Zr in Wr)Xr(Zr);Qr.getModule=function(e){return Qr[e]()};var $r,ei,ti,ni,ri,ii="\npackage Modules;\nmessage probuf {\n message "+Yn+"\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 "+wn+" {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message "+Sn+" {\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 "+yn+" {\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 "+Rn+" {\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 "+Cn+" {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message "+bn+" {\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 = "+Ve.IMAGE+";\n audio = "+Ve.AUDIO+";\n video = "+Ve.VIDEO+";\n file = "+Ve.FILE+";\n }\n message "+or+" {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message "+sr+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+cr+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+ar+" {\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 "+ur+" {\n required string downloadUrl = 1;\n }\n message "+lr+" {\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 "+Bn+" {\n required int32 nothing = 1;\n }\n message "+Fn+" {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message "+In+" {\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 "+On+"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message "+Ln+"\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 "+Nn+"\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 "+Dn+"\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 "+Hn+"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message "+jn+"\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 "+Qn+"\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 "+kn+"\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 "+xn+"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message "+tr+"{\n optional int32 order=1;\n }\n\n message "+ir+"{\n repeated string key=1;\n }\n\n message "+rr+"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated "+rr+" userData=2; //用户资源信息\n }\n\n message "+qn+"{\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 "+rr+" roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message "+Kn+"{\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 "+Zn+"{\n repeated "+rr+" outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message "+Jn+"{\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 "+Gn+"{\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 "+zn+" {\n repeated "+rr+" valueInfo = 1;\n required string objectName = 2;\n repeated "+rr+" content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message "+Xn+"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message "+Wn+"{\n required targetType target=1;\n repeated "+rr+" valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message "+$n+"{\n repeated string userId = 1;\n }\n message "+er+"{\n repeated RtcUserInfo user = 1;\n }\n message "+En+"{\n required int32 nothing = 1;\n }\n message "+Tn+"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message "+Vn+"\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 "+An+"\n {\n repeated SessionInfo sessions = 1;\n }\n message "+Pn+"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message "+Mn+"\n {\n optional int32 nothing=1;\n }\n message "+Un+"\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 "+dr+" {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+hr+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+fr+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+pr+" {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message "+mr+" {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message "+gr+"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message "+vr+" {\n required int64 timestamp = 1;\n }\n message "+_r+" {\n required int64 version=1;\n required string value=2;\n }\n message "+yr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Rr+" {\n required int64 version=1;\n optional bool reserve=2;\n }\n message "+br+" {\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 "+Er+" {\n required int64 time = 1;\n }\n message "+Tr+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Sr+" {\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 "+Ir+" {\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 "+wr+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+kr+" {\n required int64 version=1;\n }\n message "+xr+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+Or+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+Nr+" {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message "+Ar+" {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message "+Pr+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Mr+" {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message "+Lr+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Ur+" {\n repeated string tagId=1;\n }\n message "+Cr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Dr+' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message '+Vr+"\n {\n optional int32 nothing=1; //占位\n }\n message "+Br+" \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message "+Fr+"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message "+Hr+"\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 "+jr+"\n {\n required string userId = 1;\n }\n message "+Kr+"\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 "+qr+"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message "+Yr+"\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 "+Gr+"\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 "+zr+"\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 "+Jr+"\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",oi=($r=ii,function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var e={};return e.IS_NODE=!("object"!=("undefined"==typeof process?"undefined":T(process))||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,a,s={},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+")"},s.Tokenizer=c,(a=(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()},a._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},a._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},a._parseOption=function(e,n){var r,i=this.tn.next(),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(";")},a._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},a._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},a._parseServiceRPC=function(e){var n,r,i="rpc",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},a._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),a={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(a.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),a.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(a,o);else if("oneof"===o)this._parseMessageOneOf(a);else if("enum"===o)this._parseEnum(a);else if("message"===o)this._parseMessage(a);else if("option"===o)this._parseOption(a);else if("service"===o)this._parseService(a);else if("extensions"===o)a.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(a);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(a,"optional",o)}return this.tn.omit(";"),e.messages.push(a),a},a._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(e,r,i){var o,a,s;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("<"),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field type: "+a);if(o.keytype=a,this.tn.skip(","),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field: "+a);if(o.type=a,this.tn.skip(">"),a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);o.name=a,this.tn.skip("="),o.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(s=this._parseMessage(e,o),!/^[A-Z]/.test(s.name))throw Error("illegal group name: "+s.name);o.type=s.name,o.name=s.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,a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);o.name=a,this.tn.skip("="),o.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},a._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},a._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},a._parseEnum=function(e){var r,i={name:"",values:[],options:{}},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)},a._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},a._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},a.toString=function(){return"Parser at line "+this.tn.line},s.Parser=o,s}(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,a=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(a,n);break;case t.WIRE_TYPES.ENDGROUP:if(a===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+a+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,a,s,c,u,l,d,h,f,p,m,g,v,_,y,R,b={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},E=C.prototype;return E.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},E.toString=function(e){return(e?this.className+" ":"")+this.fqn()},E.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},b.T=C,(a=(o=function(e,t,n,r,i){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(C.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},a.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)},a.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},a.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 b.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof b.T&&(!t||n instanceof b.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},a.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 b.Namespace))return n.join(".");return e.fqn()},a.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},a.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},a.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},b.Namespace=o,c=(s=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,s.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,a,s=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)&&s(T(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&s(T(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){s(T(n),e.message)}else s(T(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){s(T(n),e.message)}else s(T(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&s(T(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&s(T(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||s(T(n),"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),a=0;a<i.length;a++){if(i[a].name==n)return i[a].id;if(i[a].id==n)return i[a].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&s(T(n),"not an integer"),(n>4294967295||n<0)&&s(T(n),"not in range for uint32"),n;s(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"==T(n)||s(T(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(a in o={},n)n.hasOwnProperty(a)&&(o[a]=n[a]);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,a;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");o=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:a=(new n).LE(),this.resolvedType.encode(r,a),i.writeVarint32(a.offset),i.append(a.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},c.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,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()},b.Element=s,(l=(u=function(e,t,n,r,i,a){o.call(this,e,t,n,r,a),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,a,s;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,o,a){var s,c,u,l,d,h,f;if(null===e||"object"!=T(e))return a&&a instanceof t.Reflect.Enum&&null!==(s=t.Reflect.Enum.getName(a.object,e))?s: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,a)})),c;if(c={},e instanceof t.Map){for(l=(u=e.entries()).next();!l.done;l=u.next())c[e.keyElem.valueToString(l.value[0])]=i(l.value[1],r,o,e.valueElem.resolvedType);return c}for(f in d=e.$type,h=void 0,e)e.hasOwnProperty(f)&&(c[f]=d&&(h=d.getChild(f))?i(e[f],r,o,h.resolvedType):i(e[f],r,o));return c}var o,a,s=r.getChildren(t.Reflect.Message.Field),c=r.getChildren(t.Reflect.Message.OneOf),u=function e(i){var o,a,u,l;for(t.Builder.Message.call(this),o=0,a=c.length;a>o;++o)this[c[o].name]=null;for(o=0,a=s.length;a>o;++o)this[(u=s[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"!=T(i)||!("function"!=typeof i.encode||i instanceof e)||Array.isArray(i)||i instanceof t.Map||n.isByteBuffer(i)||i instanceof ArrayBuffer||t.Long&&i instanceof t.Long)for(o=0,a=arguments.length;a>o;++o)void 0!==(l=arguments[o])&&this.$set(s[o].name,l);else this.$set(i)},l=u.prototype=Object.create(t.Builder.Message.prototype);for(l.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},l.$add=l.add,l.set=function(e,n,i){var o,a,s;if(e&&"object"==T(e)){for(o in i=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,i);return this}if(a=r._fieldsByName[e],i)this[e]=n;else{if(!a)throw Error(this+"#"+e+" is not a field: undefined");if(!(a instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+a.toString(!0));this[a.name]=n=a.verifyValue(n)}return a&&a.oneof&&(s=this[a.oneof.name],null!==n?(null!==s&&s!==a.name&&(this[s]=null),this[a.oneof.name]=a.name):s===e&&(this[a.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,o=0;o<s.length;o++)(a=s[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)&&(l["set"+o]=n),null===r.getChild("set_"+t)&&(l["set_"+t]=n),null===r.getChild("get"+o)&&(l["get"+o]=i),null===r.getChild("get_"+t)&&(l["get_"+t]=i)}(a);return l.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)},l.calculate=function(){return r.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},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,a;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 a=r.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,a}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))},l.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:r.buildOpt()}),Object.defineProperty(l,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:r}),Object.defineProperty(l,"$type",{value:r})),u}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},a=0,s=this.children.length;s>a;a++)if((o=this.children[a])instanceof m||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[a].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,o,a,s,c=null;for(o=0,a=this._fields.length;a>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(s=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,s;return t},l.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},l.decode=function(e,n,r){var o,a,s,c,u,l,d,h,f,p,m,g;for(n="number"==typeof n?n:-1,u=e.offset,l=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(s=(o=e.readVarint32())>>>3,(a=7&o)===t.WIRE_TYPES.ENDGROUP){if(s!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+s+" ("+(r?r+" expected":"not a group")+")");break}if(c=this._fieldsById[s])c.repeated&&!c.options.packed?l[c.name].push(c.decode(a,e)):c.map?(h=c.decode(a,e),l[c.name].set(h[0],h[1])):(l[c.name]=c.decode(a,e),c.oneof&&(null!==(f=l[c.oneof.name])&&f!==c.name&&(l[f]=null),l[c.oneof.name]=c.name));else switch(a){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:d=e.readVarint32(),e.offset+=d;break;case t.WIRE_TYPES.STARTGROUP:for(;i(s,e););break;default:throw Error("Illegal wire type for unknown field "+s+" in "+this.toString(!0)+"#decode: "+a)}}for(p=0,m=this._fields.length;m>p;++p)if(null===l[(c=this._fields[p]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(g=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,g;t.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},b.Message=u,(h=(d=function(e,n,r,i,o,a,s,c,l,d){C.call(this,e,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=s,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=d||"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(C.prototype)).build=function(){this.element=new s(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new s(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=s.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(T(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(T(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),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(T(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(T(e),"no array expected"),this.element.verifyValue(e))},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,a,s,c,u;if(null===this.type||"object"!=T(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),a=r.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],r);s=r.offset-a,(c=n.calculateVarint32(s))>1&&(u=r.slice(a,r.offset),a+=c-1,r.offset=a,r.append(u)),r.writeVarint32(s,a-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,a;if(e=this.verifyValue(e),null===this.type||"object"!=T(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),a=0,o=0;o<e.length;o++)a+=this.element.calculateLength(this.id,e[o]);i+=n.calculateVarint32(a),i+=a}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,a,c,u,l,d;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,a=[];n.offset<o;)a.push(this.decode(this.type.wireType,n,!0));return a}if(this.map){if(c=s.defaultFieldValue(this.keyType),i=s.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&(l=u.readVarint32()),1==(d=l>>>3))c=this.keyElement.decode(u,e,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,e,d)}return[c,i]}return this.element.decode(n,e,this.id)},b.Message.Field=d,(f=function(e,t,n,r,i,o,a){d.call(this,e,t,n,null,r,i,o,a),this.extension}).prototype=Object.create(d.prototype),b.Message.ExtensionField=f,p=function(e,t,n){C.call(this,e,t,n),this.fields=[]},b.Message.OneOf=p,(m=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},(m.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(m.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},b.Enum=m,(g=function(e,t,n,r){C.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(C.prototype),b.Enum.Value=g,(v=function(e,t,n,r){C.call(this,e,t,n),this.field=r}).prototype=Object.create(C.prototype),b.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),a=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<a.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"!=T(r))throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(a[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)},b.Service=_,((y=function(e,t,n,r){C.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(C.prototype)).buildOpt=a.buildOpt,b.Service.Method=y,(R=function(e,t,n,r,i,o,a,s){y.call(this,e,t,n,s),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=a,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(y.prototype),b.Service.RPCMethod=R,b}(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"!=T(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,a,s,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(a=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),s={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){a.addChild(s[e]=new n.Message.OneOf(this,a,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==a.getChild(0|e.id))throw Error("duplicate or invalid field id in "+a.name+": "+e.id);if(e.options&&"object"!=T(e.options))throw Error("illegal field options in "+a.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=s[e.oneof]))throw Error("illegal oneof in "+a.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,a,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),a.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&&(a.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(a),c.length>0){r.push(t),t=c,c=null,this.ptr=a,a=null;continue}c=null}else if(i.isEnum(o))a=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){a.addChild(new n.Enum.Value(this,a,e.name,e.id))}),this),this.ptr.addChild(a);else if(i.isService(o))a=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];a.addChild(new n.Service.RPCMethod(this,a,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(a);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(a=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,s;if(null!==a.getChild(0|t.id))throw Error("duplicate extended field id in "+a.name+": "+t.id);if(a.extensions&&(r=!1,a.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+a.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,a,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),s=new n.Extension(this,this.ptr,t.name,o),o.extension=s,this.ptr.addChild(s),a.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,a=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,a,s,c,u,l,d,h="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==T(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(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(s=!1,"object"==T(n)?(this.importRoot=n.root,s=!0,a=this.importRoot,n=n.file,(a.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?a=this.importRoot:n.indexOf("/")>=0?""===(a=n.replace(/\/[^\/]*$/,""))&&(a="/"):n.indexOf("\\")>=0?(a=n.replace(/\\[^\\]*$/,""),h="\\"):a=".":a=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!a)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=a+h+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(l+""),u):this.import(e.DotProto.Parser.parse(l),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]);s&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),d=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){d.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=d),t.enums&&(this.create(t.enums),this.ptr=d),t.services&&(this.create(t.services),this.ptr=d),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var r;if(null==this.ptr||"object"==T(this.ptr.type))return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+T(this.ptr)+": "+this.ptr);return this.reset()},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,a;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),a=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:a}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==T(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==T(e)?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==T(t)||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==T(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==T(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=$r,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("")+s.apply(String,e):(e.length+arguments.length>1024&&(t.push(s.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=u}return(f?-1:1)*a*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var a,s,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[n+f]=255&a,f+=p,a/=256,u-=8);e[n+f-p]|=128*m}var o,a,s,c,u,l=function e(t,n,r){if(void 0===t&&(t=e.DEFAULT_CAPACITY),void 0===n&&(n=e.DEFAULT_ENDIAN),void 0===r&&(r=e.DEFAULT_NOASSERT),!r){if((t|=0)<0)throw RangeError("Illegal capacity");n=!!n,r=!!r}this.buffer=0===t?a:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=n,this.noAssert=r};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),a=new ArrayBuffer(0),s=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,o,a,s,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,a=0,s=e.length;s>a;++a)l.isByteBuffer(e[a])||(e[a]=l.wrap(e[a],t)),(o=e[a].limit-e[a].offset)>0&&(i+=o);if(0===i)return new l(0,n,r);for(u=new l(i,n,r),a=0;s>a;)(o=(c=e[a++]).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},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,a;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=T(e))throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new l(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new l(e.length,n,r)).limit=e.length,a=0;a<e.length;++a)i.view[a]=e[a]}return i},o.writeBitSet=function(e,t){var n,r,i,o,a,s,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,a=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(n,t++);if(i>a){for(s=0,n=0;i>a;)n|=(1&!!e[a++])<<s++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,a,s,c=void 0===e;for(c&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,a=[],e+=n.length;i--;)t=this.readByte(e++),a[o++]=!!(1&t),a[o++]=!!(2&t),a[o++]=!!(4&t),a[o++]=!!(8&t),a[o++]=!!(16&t),a[o++]=!!(32&t),a[o++]=!!(64&t),a[o++]=!!(128&t);if(r>o)for(s=0,t=this.readByte(e++);r>o;)a[o++]=!!(1&t>>s++);return c&&(this.offset=e),a},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,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,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),a&&(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,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,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),a&&(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,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},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=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.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"==T(t)?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,i,o,a,s,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=l.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,a=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=r,r){case 10:this.view[n+9]=1&a>>>7;case 9:this.view[n+8]=9!==r?128|a:127&a;case 8:this.view[n+7]=8!==r?128|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(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,a,s,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,a=0,r=127&(a=this.view[t++]),128&a&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(i=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");return s=e.fromBits(r|i<<28,i>>>4|o<<24,!1),c?(this.offset=t,s):{value:s,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,a=void 0===n;if(a&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=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,a?(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,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=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 a?(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,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=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)),a?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},l.calculateString=l.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},o.readUTF8String=function(e,t,r){var i,o,a,s,c;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(a=0,s=r,t===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>a&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,u.UTF8toUTF16(e,o)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-s}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(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-s}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,a,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(o=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,a=this.buffer.byteLength,n>a&&this.resize((a*=2)>n?a:n),n-=i+r,n+=this.writeVarint32(r,n),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 s?(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,l.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 l||(e=l.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 l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},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=a,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 l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,a;if(!this.noAssert&&!l.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==(a=r-n)?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),o&&(e.offset+=a),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return 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,a,s;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(a=new ArrayBuffer(this.buffer.byteLength+o),(s=new Uint8Array(a)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=s,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?a:(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,a;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(a=i[r])&&n(r),t(o<<2>>>0|(48&a)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&a)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(a=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|a)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),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()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},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)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new l(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="",a="";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+=" ";a+=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+=" ";a+=i+o+"\n"}return e?a:i},l.fromDebug=function(e,t,n){for(var r,i,o=e.length,a=new l(0|(o+1)/3,t,n),s=0,c=0,u=!1,d=!1,h=!1,f=!1,p=!1;o>s;){switch(r=e.charAt(s++)){case"!":if(!n){if(d||h||f){p=!0;break}d=h=f=!0}a.offset=a.markedOffset=a.limit=c,u=!1;break;case"|":if(!n){if(d||f){p=!0;break}d=f=!0}a.offset=a.limit=c,u=!1;break;case"[":if(!n){if(d||h){p=!0;break}d=h=!0}a.offset=a.markedOffset=c,u=!1;break;case"<":if(!n){if(d){p=!0;break}d=!0}a.offset=c,u=!1;break;case"]":if(!n){if(f||h){p=!0;break}f=h=!0}a.limit=a.markedOffset=c,u=!1;break;case">":if(!n){if(f){p=!0;break}f=!0}a.limit=c,u=!1;break;case"'":if(!n){if(h){p=!0;break}h=!0}a.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){p=!0;break}if(i=parseInt(r+e.charAt(s++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=i,u=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+s)}if(!n){if(!d||!f)throw TypeError("Illegal str: Missing offset or limit");if(c<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return a},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("")},l.fromHex=function(e,t,n){var r,i,o,a,s;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 l(0|i/2,t),a=0,s=0;i>a;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[s++]=r}return o.limit=s,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,a=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&a([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&a([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&a([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()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(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},l}(ei=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=s[e])?r:(n=i(e,e<0?-1:0,!1),o&&(s[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?m:p;if(t){if(e<0)return m;if(e>=d)return R}else{if(-h>=e)return b;if(e+1>=h)return y}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,a,s,c,l,d,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(a=r(u(n,8)),s=p,c=0;c<e.length;c+=8)l=Math.min(8,e.length-c),d=parseInt(e.substring(c,c+l),n),l<8?(h=r(u(n,l)),s=s.mul(h).add(r(d))):s=(s=s.mul(a)).add(r(d));return s.unsigned=t,s}function a(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var s,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,s={},c={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,u=Math.pow,e.fromString=o,e.fromValue=a,h=(d=(l=4294967296)*l)/2,f=n(16777216),p=n(0),e.ZERO=p,m=n(0,!0),e.UZERO=m,g=n(1),e.ONE=g,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,b=i(0,-2147483648,!1),e.MIN_VALUE=b,(C=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},C.toString=function(e){var t,n,i,o,a,s,c,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(b)?(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),a=this,s="";;){if(c=a.div(o),l=(a.sub(c.mul(o)).toInt()>>>0).toString(e),(a=c).isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(b)?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},C.isZero=function(){return 0===this.high&&0===this.low},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(e){return t(e)||(e=a(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.lessThan=function(e){return this.comp(e)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(e){if(t(e)||(e=a(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(b)?b:this.not().add(g)},C.neg=C.negate,C.add=function(e){var n,r,o,s,c,u,l,d,h,f,p;return t(e)||(e=a(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,s=65535&this.low,c=e.high>>>16,u=65535&e.high,l=e.low>>>16,d=0,h=0,f=0,p=0,f+=(p+=s+(65535&e.low))>>>16,h+=(f+=o+l)>>>16,d+=(h+=r+u)>>>16,d+=n+c,i((f&=65535)<<16|(p&=65535),(d&=65535)<<16|(h&=65535),this.unsigned)},C.subtract=function(e){return t(e)||(e=a(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){var n,o,s,c,u,l,d,h,m,g,v,_;return this.isZero()?p:(t(e)||(e=a(e)),e.isZero()?p:this.eq(b)?e.isOdd()?b:p:e.eq(b)?this.isOdd()?b: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,s=this.low>>>16,c=65535&this.low,u=e.high>>>16,l=65535&e.high,d=e.low>>>16,m=0,g=0,v=0,_=0,v+=(_+=c*(h=65535&e.low))>>>16,g+=(v+=s*h)>>>16,v&=65535,g+=(v+=c*d)>>>16,m+=(g+=o*h)>>>16,g&=65535,m+=(g+=s*d)>>>16,g&=65535,m+=(g+=c*l)>>>16,m+=n*h+o*d+s*l+c*u,i((v&=65535)<<16|(_&=65535),(m&=65535)<<16|(g&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,i,o,s,c,l,d;if(t(e)||(e=a(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return v;o=m}else{if(this.eq(b))return e.eq(g)||e.eq(_)?b:e.eq(b)?g:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?g:_:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(b))return this.unsigned?m: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=(s=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,s-48),d=(l=r(n)).mul(e);d.isNegative()||d.gt(i);)d=(l=r(n-=c,this.unsigned)).mul(e);l.isZero()&&(l=g),o=o.add(l),i=i.sub(d)}return o},C.div=C.divide,C.modulo=function(e){return t(e)||(e=a(e)),this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.not=function(){return i(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=a(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=a(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=a(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},C.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)},C.shl=C.shiftLeft,C.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)},C.shr=C.shiftRight,C.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))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},C.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},C.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]},C.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}()),ei));oi.getModule=function(e){var t=new oi[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return Ke(e)?[].slice.call(new Int8Array(e)):e},t};var ai,si={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ci="qryRelationR",ui="cleanPMsg",li="cleanGMsg",di="cleanCMsg",hi="cleanSMsg",fi="qryPMsg",pi="qryCHMsg",mi=((ti={}).ppMsgP=Le.PRIVATE,ti.pgMsgP=Le.GROUP,ti.chatMsg=Le.CHATROOM,ti.pcMsgP=Le.CUSTOMER_SERVICE,ti),gi=((ni={})[Le.PRIVATE]=fi,ni[Le.GROUP]="qryGMsg",ni[Le.CHATROOM]=pi,ni[Le.CUSTOMER_SERVICE]="qryCMsg",ni[Le.SYSTEM]="qrySMsg",ni),vi=((ri={})[Le.PRIVATE]=ui,ri[Le.GROUP]=li,ri[Le.CUSTOMER_SERVICE]=di,ri[Le.SYSTEM]=hi,ri),_i=function(){function e(e){this._codec="websocket"===e?oi:Qr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,a=((r={})[Cn]=i._formatSyncMessages,r[bn]=i._formatReceivedMessage,r[yn]=i._formatSentMessage,r[xn]=i._formatHistoryMessages,r[Nn]=i._formatConversationList,r[jn]=i._formatChatRoomInfos,r[qn]=i._formatRTCUserList,r[Zn]=i._formatRTCData,r[pr]=i._formatChatRoomKVList,r[br]=i._formatUserSetting,r[Tr]=i._formatConversationStatus,r[Nr]=i._formatGrpReadReceiptQryResp,r[yr]=i._formatSetUserSettingOutput,r[Cr]=i._formatUserSettingNotification,r[Hr]=i._formatRTCRoomKVList,r[Xn]=i._formatRTCAuidenceJoinRoomData,r[Kr]=i._formatRTCJoinedUserInfo,r)[t];try{o=e.length>0&&i._codec[t].decode(e),Ye(o)&&(o=function(e){for(var t in e)Ye(e[t])&&(e[t]=en(e[t]));return e}(o)),Ge(a)&&(o=a.call(this,o,n))}catch(n){nt.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=Ke(n)?new Uint8Array(n):n;return gn.readUTF(i.subarray(t,r))}catch(e){nt.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){nt.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(ze(o)||null===o)&&(e.finished=!0),e.syncTime=en(i),e.list=an(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,a=e.type,s=e.groupId,c=e.status,u=e.dataTime,l=e.classname,d=e.msgId,h=e.extraContent,f=e.pushContent,p=e.pushExt,m=e.configFlag,g=(e.direction||ot.RECEIVE)===ot.SEND,v=function(e){var t=ce.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?ce.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(c),_=v.isPersited,y=v.isCounted,R=v.isMentioned,b=v.disableNotification,C=v.receivedStatus,E=v.canIncludeExpansion,T=[Le.GROUP,Le.CHATROOM,Le.RTC_ROOM].indexOf(a)>-1?s:o,S=g?n:o,I=en(u),w=I<r,k=a===Le.CHATROOM,x=this._formatBytes(i),O={};if(p&&(O=tn(p.pushConfigs,p.pushId)),x.user){var N=x.user,A=N.portrait,P=N.portraitUri,M=A||P;M&&(x.user.portrait=x.user.portraitUri=M)}var L,U=be(be({},O),{pushTitle:null==p?void 0:p.title,pushContent:f,pushData:f,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==p?void 0:p.templateId}),D=g?ot.SEND:ot.RECEIVE;return k&&o===n&&(D=ot.SEND),h&&(L={},L=dn(h)),{conversationType:a,targetId:T,senderUserId:S,messageType:l,messageUId:d,isPersited:_,isCounted:y,isMentioned:R,sentTime:I,isOffLineMessage:w,messageDirection:D,receivedTime:hn.getTime(),disableNotification:b,receivedStatus:C,canIncludeExpansion:E,content:x,expansion:L,configFlag:m,pushConfig:U,channelId:e.busChannel||""}},e.prototype._formatSentMessage=function(e,t){var n,r=e.content,i=e.classname,o=e.sessionId,a=e.msgId,s=e.extraContent,c=e.pushExt,u=e.pushContent,l=e.configFlag,d=t.signal,h=t.currentUserId,f=d.date,p=d.topic,m=d.targetId,g=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=g.isPersited,_=g.isCounted,y=g.disableNotification,R=g.canIncludeExpansion,b=mi[p]||Le.PRIVATE,C=sn(si,p),E=this._formatBytes(r),T=m;i===Et.RECALL&&(b=E.conversationType||b,T=E.targetId||m),s&&(n={},n=dn(s));var S={};c&&(S=tn(c.pushConfigs,c.pushId));var I=be(be({},S),{pushTitle:null==c?void 0:c.title,pushContent:u,pushData:u,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==c?void 0:c.templateId});return{conversationType:b,targetId:T,messageType:i,messageUId:a,isPersited:v,isCounted:_,isStatusMessage:C,senderUserId:h,content:this._formatBytes(r),sentTime:1e3*f,receivedTime:hn.getTime(),messageDirection:ot.SEND,isOffLineMessage:!1,disableNotification:y,canIncludeExpansion:R,expansion:n,pushConfig:I,channelId:e.busChannel||""}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,a=r.targetId,s=en(e.syncTime),c=[];return on(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=a,c.push(r)}),{isReverse:!0}),{syncTime:s,list:c,hasMore:!!o}},e.prototype._formatConversationList=function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=an(r,(function(e){var r=e.msg,o=e.userId,a=e.type,s=e.unreadCount,c=e.busChannel,u=null;r&&((u=n._formatReceivedMessage(r,t)).targetId=o);var l={targetId:o,conversationType:a,unreadMessageCount:s,latestMessage:u,channelId:c||""};return i(l)||l})))||[]},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:an(n,(function(e){var t=e.id,n=e.time;return{id:t,time:en(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=an(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?Nt.DELETE:Nt.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:en(i)}})),isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return on(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=en(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=en(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return on(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,a=e.busChannel,s=St.CLOSE,c=!1,u=[];on(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case 1:s="1"===n?St.OPEN:St.CLOSE;break;case 2:c="1"===n;break;case 3:u=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:s,isTop:c,updatedTime:en(i),tags:u,channelId:a||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,o=e.entries,a={};return on(t,(function(e){var t=e.userId,n=e.userData,r={};on(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:o}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return on(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 on(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=en(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:en(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:en(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(En);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,r,i,o="comet"===this._connectType,a=(e.conversationType,t.messageType),s=t.isMentioned,c=t.mentionedType,u=t.mentionedUserIdList,l=t.content,d=t.pushContent,h=t.pushData,f=t.directionalUserIdList,p=t.isFilerWhiteBlacklist,m=t.isVoipPush,g=t.canIncludeExpansion,v=t.expansion,_=t.pushConfig,y=t.channelId;Le.GROUP;var R=this._codec.getModule(yn),b=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),C=_||{},E=C.pushTitle,T=C.pushContent,S=C.pushData,I=C.iOSConfig,w=C.androidConfig,k=C.templateId,x=C.disablePushTitle,O=C.forceShowDetailContent,N=0;R.setSessionId(b),s&&l&&(l.mentionedInfo={userIdList:(null===(n=l.mentionedInfo)||void 0===n?void 0:n.userIdList)||u||[],type:(null===(r=l.mentionedInfo)||void 0===r?void 0:r.type)||c||wt.ALL,mentionedContent:(null===(i=l.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""});var A=T||d||"",P=S||h||"";if(A&&R.setPushText(A),P&&R.setAppData(P),f&&R.setUserId(f),N|=m?1:0,N|=p?2:0,N|=x?4:0,N|=O?8:0,R.setConfigFlag(N),R.setClassname(a),l.user&&l.user.portraitUri&&(l.user.portrait=l.user.portraitUri),R.setContent(JSON.stringify(l)),g&&v){var M={};on(v,(function(e,t){M[t]={v:e}})),R.setExtraContent(JSON.stringify(M))}if(_){var L=this._codec.getModule(Rn);if(E&&L.setTitle(E),I&&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,a=t.channelIdMi,s=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,l=t.googleConfig,d={};d["thread-id"]=n||"",d["apns-collapse-id"]=r||"",d.category=i||"",d.richMediaUri=o||"";var h={};h.collapse_key=null==l?void 0:l.collapseKey,h.imageUrl=null==l?void 0:l.imageUrl;var f=null==l?void 0:l.priority;f&&!["high","normal"].includes(f)&&(f="normal"),h.priority=f;var p=[{HW:{channelId:s||""}},{MI:{channelId:a||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:d},{FCM:h}];return JSON.stringify(p)}(I,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 ze(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(Sn);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(In);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,a=this._codec.getModule(kn);return a.setTargetId(e),a.setTime(i),a.setCount(n),a.setOrder(r),a.setBusChannel(o||""),a.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(On);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(On);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(Ln);return r.setType(t),r.setBusChannel(n),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(An),r=[];return on(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(Pn);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(Un),o=[];return on(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(Dn);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(Vn);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(Bn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Hn);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(or);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(dr),o=t.key,a=t.value,s=t.notificationExtra,c=t.isSendNotification,u=t.type||Nt.UPDATE,l=fn(t,u),d={key:o,value:a||"",uid:n};if(ze(l)||(d.status=l),i.setEntry(d),c){var h={conversationType:Le.CHATROOM,targetId:e},f={key:o,value:a,extra:s,type:u},p=this._getUpMsgModule(h,{messageType:Et.CHRM_KV_NOTIFY,content:f,isPersited:!1,isCounted:!1});r?i.setNotification(p.getArrayData()):i.setNotification(p),i.setBNotify(!0),i.setType(Le.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var r=this._codec.getModule(hr),i=t.entries,o=t.type||Nt.UPDATE,a=fn(t,o),s=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};ze(a)||(t.status=a),s.push(t)})),r.setEntry(s),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(vr);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Rr);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Er);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(wr),i=hn.getTime(),o=[];return on(e,(function(e){var r=t._codec.getModule(Sr),a=e.conversationType,s=e.targetId,c=e.notificationStatus,u=e.isTop,l=e.channelId,d=[];r.setType(a),r.setChannelId(s),r.setTime(i),r.setBusChannel(l);var h=c===St.OPEN,f={};ze(c)||(f[1]=h),ze(u)||(f[2]=u),on(f,(function(e,r){if(!ze(e)){var i=t._codec.getModule(Ir);e=e?"1":"0",i.setSessionStateType(Number(r)),i.setValue(e);var o=n?i.getArrayData():i;d.push(o)}})),r.setStateItem(d);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(xr);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(Pr),o=[];return e.forEach((function(e){var t=n._codec.getModule(Mr);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(xr);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(Lr),o=[];return e.forEach((function(e){var t=n._codec.getModule(Mr);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(Ur);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(wr),o=[];return t.forEach((function(t){var i=n._codec.getModule(Sr),a=n._codec.getModule(Ir),s=[];e.forEach((function(e){var t=n._codec.getModule(Mr);t.setTagId(e.tagId),ze(e.isTop)||t.setIsTop(e.isTop),s.push(r?t.getArrayData():t)})),a.setSessionStateType(3),a.setValue(JSON.stringify(s)),a.setTags(s),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?a.getArrayData():a]),o.push(r?i.getArrayData():i)})),i.setState(o),i.setVersion(hn.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Dr);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n){var r=this._codec.getModule(Kn);return e=e||0,r.setRoomType(e),ze(t)||r.setBroadcastType(t),ze(n)||r.setJoinType(n),r.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(Yn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,r,i){var o=this._codec.getModule(Gn);if(o.setInterior(n),o.setTarget(r),o.setKey(e),o.setValue(t),i){i.name&&o.setObjectName(i.name);var a=i.content;a&&(Ye(a)&&(a=JSON.stringify(a)),o.setContent(a))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,r){var i=this,o="comet"===this._connectType,a=this._codec.getModule(zn);a.setObjectName(n);var s=this._codec.getModule(rr);s.setKey(e.name),s.setValue(e.content),o?a.setContent([s.getArrayData()]):a.setContent(s);var c=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(rr);n.setKey(e);var a="uris"===e?t:r;n.setValue(a),o?c.push(n.getArrayData()):c.push(n)})),a.setValueInfo(c),a.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(zn);n.setObjectName(e);var r=this._codec.getModule(rr);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(Jn);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(Jn);i.setInterior(t),i.setTarget(n),i.setKey(e);var o=(r=r||{}).name,a=r.content;return!ze(o)&&i.setObjectName(o),ze(a)||(Ye(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var r=this._codec.getModule(Wn);r.setTarget(t),je(e)||(e=[e]),on(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!ze(i)&&r.setObjectName(i),ze(o)||(Ye(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule($n);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Qn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(tr);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(rr);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(ir);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var r=this._codec.getModule(Kn);return r.setRoomType(Pt.LIVE),t&&r.setBroadcastType(t),r.setIdentityChangeType(e),r.setNeedSysChatroom(n),r.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(Fr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(jr);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,a=this._codec.getModule(Yr);return a.setInvitedRoomId(t),a.setInvitedUserId(n),a.setInviteSessionId(r),a.setTimeoutTime(i),a.setInviteInfo(o),a.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=this._codec.getModule(Gr);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,a=e.value,s=e.agree?1:0,c=this._codec.getModule(zr);return c.setInviteUserId(t),c.setInviteRoomId(n),c.setInviteSessionId(r),c.setContent(i),c.setKey(o),c.setValue(a),c.setAnswerCode(s),c.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=this._codec.getModule(Jr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(r),o.setInviteRoomKeys(i),o.getArrayData()},e}(),yi=function(e,t){this._watcher=t,this.codec=new _i(e)},Ri=function(e,t){return e&&t?t+"_"+e:e||Date.now()},bi=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 Ri(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}(),Ci=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new mn(e,!1,Yt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Ri(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 _n;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),Ei=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=zt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return _e(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===Wt.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();nt.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(bi),Ti=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=zt.DISCONNECT,t.status=0,t}return _e(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(bi),Si=function(e){function t(){var t=e.call(this,Gt.PING_REQ)||this;return t._name=zt.PING_REQ,t}return _e(t,e),t.prototype.writeMessage=function(e){},t}(Ci),Ii=function(e){function t(t){var n=e.call(this,t)||this;return n._name=zt.PING_RESP,n}return _e(t,e),t}(bi),wi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return _e(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}(bi),ki=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return _e(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}(Ci),xi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=zt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Jt.PUB,t}return _e(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}(wi),Oi=function(e){function t(t,n,r){var i=e.call(this,Gt.PUBLISH)||this;return i._name=zt.PUBLISH,i.syncMsg=!1,i.identifier=Jt.PUB,i.topic=t,i.data=Be(n)?gn.writeUTF(n):n,i.targetId=r,i}return _e(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}(ki),Ni=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=zt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=Jt.PUB,t.topic="",t.targetId="",t}return _e(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}(wi),Ai=function(e){function t(t){var n=e.call(this,Gt.PUB_ACK)||this;return n._name=zt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return _e(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(ki),Pi=function(e){function t(t,n,r){var i=e.call(this,Gt.QUERY)||this;return i.name=zt.QUERY,i.identifier=Jt.QUERY,i.topic=t,i.data=Be(n)?gn.writeUTF(n):n,i.targetId=r,i}return _e(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}(ki),Mi=function(e){function t(t){var n=e.call(this,Gt.QUERY_CONFIRM)||this;return n._name=zt.QUERY_CON,n.messageId=t,n}return _e(t,e),t}(ki),Li=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=zt.QUERY_ACK,t.status=0,t.identifier=Jt.QUERY,t.topic="",t.targetId="",t}return _e(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}(wi),Ui=function(e){var t,n=e.type;switch(n){case Gt.CONN_ACK:t=new Ei(e);break;case Gt.PUBLISH:(t=new xi(e)).syncMsg=e.syncMsg;break;case Gt.PUB_ACK:t=new Ni(e);break;case Gt.QUERY_ACK:t=new Li(e);break;case Gt.SUB_ACK:case Gt.UNSUB_ACK:case Gt.PING_RESP:t=new Ii(e);break;case Gt.DISCONNECT:t=new Ti(e);break;default:t=new bi(e),nt.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"}(ai||(ai={}));var Di,Vi=ai,Bi=function(e,t,n,r){return Ce(void 0,void 0,void 0,(function(){var i;return Ee(this,(function(o){return i=0,e.forEach((function(o){return Ce(void 0,void 0,void 0,(function(){var a,s;return Ee(this,(function(c){switch(c.label){case 0:return a=t+"://"+o+"/ping?r="+(9999,1e3+Math.floor(8999*Math.random())),nt.debug("start ping",a),[4,n.httpReq({url:a,timeout:5e3})];case 1:return s=c.sent(),nt.debug("end ping",i,a,s.status),i++,r({finished:i===e.length,code:s.status,host:o}),[2]}}))}))})),[2]}))}))},Fi=function(e,t,n,r,i,o,a,s){return e+"://"+t+"/websocket?appId="+n+"&token="+encodeURIComponent(r)+"&sdkVer="+o+"&pid="+a+"&apiVer="+(i.isFromUniapp?"uniapp":"normal")+(i.connectPlatform?"&platform="+i.connectPlatform:"")+(s?"&protocolVer="+s:"")},Hi=function(e){return[Vi.ppMsgS,Vi.pgMsgS,Vi.chatMsgS].map((function(e){return Vi[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"}(Di||(Di={}));var ji,Ki=function(e,t){nt.info("websocket send -> messageId: "+e.messageId);var n=e.getBufferData();t.send(n.buffer)},qi=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 _e(t,e),t.prototype.connect=function(e,t,n,r,i,o){return Ce(this,void 0,void 0,(function(){var a=this;return Ee(this,(function(s){return[2,new Promise((function(s){var c=[],u=0,l=!1,d=!1,h=function n(){return Ce(a,void 0,void 0,(function(){var a;return Ee(this,(function(u){switch(u.label){case 0:return 0===c.length||l?[2]:(l=!0,[4,this._connect(e,t,c.shift(),r,i,o)]);case 1:if((a=u.sent())===st.SUCCESS)this._checkAlive(),s(a);else if(a===ft)s(a);else{if(d&&0===c.length)return s(ln(a)),[2];l=!1,n()}return[2]}}))}))};i=ke(i),a._watcher.status(ut.CONNECTING),Bi(n,r,a._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;d=n,200===t&&(c.push(r),u++,h()),n&&0===u&&(nt.error("No valid websocket server hosts!"),s(st.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i,o){return Ce(this,void 0,void 0,(function(){var a,s,c,u,l,d=this;return Ee(this,(function(h){switch(h.label){case 0:return a=r.replace("http","ws"),s=Fi(a,n,e,t,this._runtime,i,"",o),nt.debug("conenct start -> "+s),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(s),u=function(e){d._timer&&(clearTimeout(d._timer),d._timer=null),d._socket===c&&(d._socket=null,d._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 vn(n),i=r.readByte(),o=new mn(i),a=Ui(o);return a.read(r,n.length-1,t),a}(t,o);if(n instanceof Ii&&d._pingResolve)return d._pingResolve(st.SUCCESS),void(d._pingResolve=void 0);if(n instanceof Ei)return nt.debug("recv connect ack -> "+n.status),n.status!==lt?(nt.warn("connect failed: "+n.status),void e(n.status)):(nt.info("connect success -> "+s),d.connectedTime=n.timestamp,d.userId=n.userId||"",d._idCount=n.messageId,void e(st.SUCCESS));if(n instanceof Ti){var r=n.status;switch(nt.warn("recv disconnect signal -> status: "+r),r){case Di.BLOCK:d._watcher.status(ut.BLOCKED);break;case Di.OTHER_DEVICE_LOGIN:d._watcher.status(ut.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Di.REDIRECT_NEW:case Di.REDIRECT:d._watcher.status(ut.REDIRECT);break;default:d._watcher.status(ut.DISCONNECT_BY_SERVER)}}else d._onReceiveSignal(n)}else nt.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in nt.warn("websocket closed! code:",t,"reason:",n),u(ut.CONNECTION_CLOSED),d._messageIds){var i=d._messageIds[r];delete d._messageIds[r],i(st.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){var n;for(var r in nt.error("websocket error!",null===(n=t)||void 0===n?void 0:n.stack),u(ut.WEBSOCKET_ERROR),d._messageIds){var i=d._messageIds[r];delete d._messageIds[r],i(st.RC_NET_CHANNEL_INVALID)}e(st.NETWORK_ERROR)})),c.onOpen((function(){return nt.debug("websocket open =>",s)})),setTimeout((function(){e(st.TIMEOUT)}),5e3)}))];case 1:return(l=h.sent())===st.SUCCESS?this._socket=c:(nt.warn("connect result -> code: "+l+", url: "+s),c.close()),[2,l]}}))}))},t.prototype._checkAlive=function(){var e;return Ce(this,void 0,void 0,(function(){var t,n=this;return Ee(this,(function(r){switch(r.label){case 0:return this._socket?(nt.debug("send ping ->"),this.sendOnly(new Si),[4,new Promise((function(e){n._pingResolve=e,n._timer&&clearTimeout(n._timer),n._timer=setTimeout((function(){n._pingResolve=void 0,e(st.TIMEOUT)}),15e3)}))]):[2];case 1:return(t=r.sent())!==st.SUCCESS?(this._failedCount+=1,nt.warn("ping failed count: "+this._failedCount+", code: "+t),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,nt.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._watcher.status(ut.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(nt.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return n._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s=this;return Ee(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==Yt.AT_MOST_ONCE&&(e instanceof xi&&!e.syncMsg&&(nt.debug("send pubAck -> "+t),this.sendOnly(new Ai(t))),e instanceof Li&&(nt.debug("send queryCon -> "+t),this.sendOnly(new Mi(t)))),t>0&&(e instanceof Ni||e instanceof Li)&&(nt.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 xi?(i=e.syncMsg,(o=e.topic)===Vi[Vi.userSetData]?[2]:!i||Hi(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){s._syncMessageIds[t]=e}))]):[3,2];case 1:a=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,a),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&Ki(e,this._socket)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),Ce(this,void 0,void 0,(function(){var i,o,a,s=this;return Ee(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,Ki(e,this._socket),[4,new Promise((function(e){s._messageIds[i]=e,setTimeout((function(){s._messageIds[i]&&delete s._messageIds[i],e()}),r)}))]):[3,2];case 1:return(o=c.sent())?o instanceof Li||o instanceof Ni?(a=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(nt.warn("send failed -> message: "+i+", respPBName: "+t+", status: "+o.status),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:st.SUCCESS,data:a}]):[2,{code:o}]:(nt.warn("send timeout -> message: "+i+", respPBName: "+t+", timeout: "+r),[2,{code:st.TIMEOUT}]);case 2:return[2,{code:st.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(ut.DISCONNECTED))},t}(yi);!function(e){e.GET="GET",e.POST="POST"}(ji||(ji={}));var Yi=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 _e(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Be(e.data)?JSON.parse(e.data):e.data;return n?!je(n)||(on(n,(function(e){return Ce(t,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l,d,h=this;return Ee(this,(function(f){switch(f.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new mn(t),r=Ui(n);for(var i in e)r[i]=e[i];return r}(e),r=n.messageId,i=n._header,o=n.status,n.identifier,a=i&&i.qos!==Yt.AT_MOST_ONCE,r&&n.getIdentifier&&((s=this._messageIds[r])&&s(n),this._syncMessageIds[r]&&this._syncMessageIds[r](n)),a&&(n instanceof xi&&!n.syncMsg&&(c=new Ai(r),this.sendOnly(c)),n instanceof Li&&(c=new Mi(r),this.sendOnly(c))),n instanceof Ti){switch(o){case Di.OTHER_DEVICE_LOGIN:this._watcher.status(ut.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Di.BLOCK:this._watcher.status(ut.BLOCKED);break;case Di.REDIRECT_NEW:case Di.REDIRECT:this._watcher.status(ut.REDIRECT);break;default:this._watcher.status(ut.DISCONNECT_BY_SERVER)}return[2]}return n instanceof xi?(u=n.syncMsg,l=n.topic,!u||Hi(l)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){h._syncMessageIds[r]=e}))]):[3,2];case 1:d=f.sent(),delete this._syncMessageIds[r],this._watcher.signal(n,d),f.label=2;case 2:return[2]}}))}))})),!0):(nt.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i;return Ee(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(ut.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,r,i,o){return Ce(this,void 0,void 0,(function(){var o,a,s,c,u=this;return Ee(this,(function(l){return i=ke(i),this._protocol=r,this._isDisconnected=!1,this._watcher.status(ut.CONNECTING),o=[],a=0,s=!1,c=!1,[2,new Promise((function(l){var d=function n(){return Ce(u,void 0,void 0,(function(){var a;return Ee(this,(function(u){switch(u.label){case 0:return 0===o.length||s?[2]:(s=!0,[4,this._connect(e,t,o.shift(),r,i)]);case 1:if((a=u.sent())===st.SUCCESS)this._startPullSignal(r),l(a);else if(a===ft)l(a);else{if(c&&0===o.length)return l(ln(a)),[2];s=!1,n()}return[2]}}))}))};u._watcher.status(ut.CONNECTING),Bi(n,r,u._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;c=n,200===t&&(o.push(r),a++,d()),n&&0===a&&(nt.error("No valid websocket server hosts!"),l(st.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i){return Ce(this,void 0,void 0,(function(){var o,a,s,c;return Ee(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(nt.error("handle comet res -> res: "+JSON.stringify(e||{})),!1):!!e.data&&(function(e){if(Ye(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)?Ye(e.data)?e.data:JSON.parse(e.data):(nt.error("received data is not a validJson",e.data),!1))},a=Fi(r,n,e,t,this._runtime,i,this._pid),this.sendConnectTime=Date.now(),nt.debug("conenct start -> "+a),[4,this._runtime.httpReq({url:a,body:{pid:this._pid},timeout:5e3})];case 1:return s=u.sent(),c=o(s),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):nt.warn("connect result -> code: "+(null==c?void 0:c.status)+", url: "+a),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l;return Ee(this,(function(d){switch(d.label){case 0:return n=(t=this)._domain,r=t._sessionid,i=t._pid,o=e.messageId,a=e.topic,s=e.targetId,e.identifier,c=e.getHeaderFlag(),u=a?this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&topic="+a+"&targetid="+s+"&pid="+i:this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&pid="+i,[4,this._runtime.httpReq({url:u,method:ji.POST,body:e.getCometData()})];case 1:return l=d.sent(),this.handleCometRes(l),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),Ce(this,void 0,void 0,(function(){var i,o,a,s=this;return Ee(this,(function(c){switch(c.label){case 0:return i=this._generateMessageId(),e.messageId=i,this.sendCometData(e),[4,new Promise((function(e){s._messageIds[i]=e,setTimeout((function(){delete s._messageIds[i],e()}),r)}))];case 1:return(o=c.sent())?(a=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:st.SUCCESS,data:a}]):[2,{code:st.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(ut.DISCONNECTED)},t}(yi),Gi=function(e){return["navi",e].join("_")},zi=function(){function e(e,t){this._runtime=e,this._options=t,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=ke(this._options.apiVersion)}return e.prototype.getInfo=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o;return Ee(this,(function(a){switch(a.label){case 0:return n&&this._clear(e),(i=function(e,t,n){var r,i,o=Gi(e);try{var a=n.getItem(o);i=a?JSON.parse(a):[]}catch(e){i=[]}var s=Date.now();return i.length>0&&(i=i.filter((function(e){return s-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=a.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=Gi(e);try{var a=r.getItem(o);i=a?JSON.parse(a):[]}catch(e){i=[]}var s=Date.now();i.length>0&&(i=i.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),i.push({timestamp:s,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=Gi(e);try{var o=n.getItem(i);r=o?JSON.parse(o):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-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}(),Ji=function(e,t,n){return[e,t,n].join("_")},Wi=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=Ji("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=Ji("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=Ji("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=Ji("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),Qi={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Xi=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,a=this._getSetUserId(n),s=r===Nt.DELETE,c=a===o,u=!this._isExisted(n),l=s?this._remove:this._add;(t||i||c||u)&&l.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)})),nt.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Zi=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return Ce(this,void 0,void 0,(function(){var e,t,n,r,i,o,a;return Ee(this,(function(s){switch(s.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=Qi.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=s.sent(),o=i.code,a=i.data,this._isPulling=!1,o===st.SUCCESS?(Qi.set(t,a.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Qi.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];Qe(r)||(r=new Xi(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}(),$i=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(se){nt.error("parse rejoined chrm infos error -> "+t),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],Qe(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}(),eo="converStatusChanged",to=function(){function e(e,t,n){this._eventEmitter=new rt,this._pullQueue=[],this._isPulling=!1,this._storage=pe(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(!ze(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(eo,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return Ce(this,void 0,void 0,(function(){var e,t,n,r;return Ee(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===st.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(eo,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(eo,(function(e){}))},e}(),no={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}},ro={};for(var io in no){var oo=no[io].keyName;ro[oo]=io}var ao,so=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var r="con-"+t+"-"+n;this.storage=new ge(e,r),this._localStore=new ge(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:Le.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,r=e.targetId,i=e.messageType,o=e.isMentioned,a=e.content,s=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,r,c),l=this._localStore.get(u)||{},d=ro.mentionedInfo,h=ro.hasMentioned,f=l[d]||{},p=f.userIdList||[],m=a.mentionedInfo;if(m){if(o&&n===Le.GROUP&&((m.userIdList||[]).forEach((function(e){e===t._currentUserId&&p.indexOf(s)<0&&p.push(s)})),m.type===wt.ALL&&p.indexOf(s)<0&&p.push(s)),i===Et.RECALL&&n===Le.GROUP){var g=p.indexOf(s);g>=0&&p.splice(g,1)}m={userIdList:p,type:(null==m?void 0:m.type)||f.type},0!==p.length?(l[d]=m,l[h]=!0):(delete l[d],delete l[h]),Qe(l)?this._localStore.set(u,l):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 a in n){var s=ro[a],c=n[a];if(!ze(s)&&!ze(c)&&"hasMentioned"!==a&&"MentionedInfo"!==a){if(c===no[s].defaultVal||"tags"===a&&!Qe(c))delete o[s];else if("tags"===a){var u=c;for(var l in u)u[l].isTop||delete u[l].isTop;o[s]=c}else o[s]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}Qe(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 a in no){var s=no[a],c=s.keyName,u=s.defaultVal;o[c]=i[a]||cn(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},a=t[r];for(var s in a){var c=no[s],u=c.keyName,l=c.defaultVal;o[u]=a[s]||cn(l)}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,a={},s=e[n];for(var c in s){var u=no[c],l=u.keyName,d=u.defaultVal;a[l]=s[c]||cn(d)}for(var h in a.tags){ze(t[h])&&(t[h]=[]);var f=Object.assign({},a,{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){nt.error("adaptOldStore error: "+e.message)}},e}(),co=[Le.PRIVATE,Le.GROUP,Le.SYSTEM,Le.PUBLIC_SERVICE,Le.APP_PUBLIC_SERVICE],uo="conversationChanged",lo="conTagStatusChanged",ho=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new rt,this._draftMap={},this._appkey=t,this._loginUserId=n,this._store=new so(e.runtime,t,n),this._statusManager=new to(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(uo,(function(e){r(e)})),this._eventEmitter.on(lo,(function(){i()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,a=e.messageDirection,s=e.senderUserId,c=a===ot.SEND&&s===this._loginUserId,u=r===Et.RECALL,l=Ye(n),d=!1,h={},f=t.lastUnreadTime||0,p=t.unreadMessageCount||0;return f>i||c||(o&&(t.unreadMessageCount=p+1,t.lastUnreadTime=i,d=!0),u&&l&&f>=n.sentTime&&p&&(t.unreadMessageCount=p-1,d=!0),d&&(h.unreadMessageCount={val:t.unreadMessageCount,time:i})),{hasChanged:d,localConversation:t,updateItems:h}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;ot.SEND;var o=Ye(n),a=!1,s={};return r&&o&&n.mentionedInfo&&(t.hasMentioned=!0,a=!0,s.hasMentioned={val:!0,time:i},s.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:a,localConversation:t,updateItems:s}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===ot.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,a=o.type,s=o.userIdList;if(a===wt.ALL||(s||[]).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(Ye(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,a=e.isTop,s=e.tags,c=e.channelId,u={},l={};ze(o)||(l.notificationStatus={time:i,val:o}),ze(a)||(l.isTop={time:i,val:a}),ze(s)||(l.tags={time:i,val:s},null==s||s.forEach((function(e){u[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,u,c),this._store.set(n,r,{notificationStatus:o,isTop:a,tags:u},c),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,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(uo,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(lo),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,a=e.channelId;if(co.indexOf(r)>=0){var s=!1,c=this._store.get(r,o,a),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),i=r.hasChanged,o=r.localConversation,a=r.updateItems;s=s||i,u=be(be({},u),a),c=cn(o)})),s&&this._store.set(r,o,c,a),this._store.updateMentionedData(e),i){var l=this._store.get(r,o,a);l.updatedItems=be({latestMessage:{time:e.sentTime,val:e}},u),l.latestMessage=e;var d=Object.assign(l,{conversationType:r,targetId:o,channelId:a});this._setUpdatedConversation(d)}(s||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,a=e.conversationType;r=r||0,(n||1!==o)&&(t.length>0?t.includes(Number(a))&&(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,a=i.hasMentioned,s={};if(o&&(i.unreadMessageCount=0,s.unreadMessageCount={val:0,time:Date.now()}),a&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,s.hasMentioned={val:!1,time:Date.now()},s.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(s).length){var c=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:s});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===St.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}(),fo=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=pe(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 Ce(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s;return Ee(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!==st.SUCCESS||ze(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,a=i.version,s=o.Tag,ze(s)||this._updateTag(s),this._storage.set(this._storagePullTimeKey,a),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}(),po=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._miniConnectUrl="",r._connectType=n.connectionType,r}return _e(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 Ce(this,void 0,void 0,(function(){var o;return Ee(this,(function(a){return this._runtime.useNavi||(void 0,o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?le.join(","):de.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 Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d;return Ee(this,(function(h){switch(h.label){case 0:r="getServerEndpoint",i=0,o=e.length,h.label=1;case 1:return i<o?(a=this._formatJSONPUrl(e[i],n,t,r),nt.debug("req navi => "+a),[4,this._runtime.httpReq({url:a,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(200!==(s=h.sent()).status)return 403===s.status?nt.error("request navi error: "+st.RC_CONN_USER_OR_PASSWD_ERROR):401===s.status&&nt.error("request navi error: "+st.RC_CONN_APP_BLOCKED_OR_DELETED),[3,3];try{return c=s.data.match(/{[\d\D]+}/),0===(u=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(u=JSON.parse('"'+u+'"')),d=JSON.parse(u),l=/^https/.test(a)?"https":"http",d.protocol=l,this._runtime.useNavi||(d.server="",d.backupServer=this._miniConnectUrl,d.logSwitch=0),[2,d]}catch(e){nt.error("parse navi err =>",e)}h.label=3;case 3:return i+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:[2,d={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl}]}}))}))},t}(zi),mo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return Ce(this,void 0,void 0,(function(){var e,t,n,r,i,o,a;return Ee(this,(function(s){switch(s.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=s.sent(),o=i.code,a=i.data,o===st.SUCCESS?(this._isPulling=!1,this._pullTime=a.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}(),go=function(e,t){return["send_msg",e,t].join("_")},vo=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=go(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=go(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=go(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}(),_o=function(e){var t="RCDeviceId",n=pe(e),r="",i=n.get(t);return i?r=i:(r=Pe(),n.set(t,r)),r};(ao={})[Le.PRIVATE]=Vi.qryPMsg,ao[Le.GROUP]=Vi.qryGMsg,ao[Le.CHATROOM]=Vi.qryCHMsg,ao[Le.CUSTOMER_SERVICE]=Vi.qryCMsg,ao[Le.SYSTEM]=Vi.qrySMsg;var yo=[Vi[Vi.recallMsg],Vi[Vi.ppMsgS],Vi[Vi.pgMsgS],Vi[Vi.ppMsgP],Vi[Vi.pgMsgP],Vi[Vi.chatMsg],Vi[Vi.pcMsgP],Vi[Vi.prMsgS]],Ro=function(e,t,n,r,i,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:ot.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:ce.UNREAD,pushConfig:n.pushConfig,channelId:n.channelId}},bo=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 Wi(t,r.appkey),i._sendMessageStore=new vo(t,r.appkey),i._chrmEntryHandler=new Zi(i),i}return _e(t,e),t.prototype._createNavi=function(){return new po(this.runtime,this._options)},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s=this;return Ee(this,(function(c){switch(c.label){case 0:return n=[],this._naviInfo=t,t.server?n.push(t.server):nt.warn("navi.server is invalid"),(r=t.backupServer)&&r.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(nt.error("navi invaild.",n),[2,st.UNKNOWN]):(i=this.runtime.createDataChannel({status:function(r){s._connectionStatusHandler(r,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=Wt.V3,1===t.openAnti&&(o=Wt.V4),[4,i.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(a=c.sent())===st.SUCCESS?(this._channel=i,this.currentUserId=i.userId,this._connectedTime=i.connectedTime,this._localConnectedTime=Math.floor((Date.now()+i.sendConnectTime)/2),this._watcher.status(ut.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new ho(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new fo(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new mo(this),this._joinedChrmManager=new $i(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval()):i.close(),[2,a]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,r){if(nt.warn("connection status changed:",e),e!==ut.CONNECTING)if(e!==ut.CONNECTED){if(this._channel&&e!==ut.DISCONNECTED)return e===ut.BLOCKED||e===ut.KICKED_OFFLINE_BY_OTHER_CLIENT||e===ut.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==ut.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 Ce(this,void 0,void 0,(function(){var r,i=this;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=Wt.V3,1===this._naviInfo.openAnti&&(r=Wt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,r)]):[2];case 1:return o.sent()===st.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(ut.CONNECTED),this._rejoinChrm(),nt.__insertLogIntoDatabase(),[2]):(this._watcher.status(ut.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=Vi[r];if(i)switch(i){case Vi.s_ntf:nt.info("recv s_ntf -> signal.messageId: "+e.messageId),this._pullMsg(e);break;case Vi.s_msg:this._receiveMsg(e);break;case Vi.s_cmd:this._receiveStateNotify(e);break;case Vi.s_us:this._receiveSettingNotify(e);break;case Vi.rtc_ntf:this._receiveRtcKv(e)}else nt.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,wn),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,Cr)).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,Br),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(yo.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,yn,{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!==Et.EXPANSION_NOTIFY?(r.messageType===Et.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,wn),n=t.type,r=t.chrmId,i=t.time;if(nt.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 Ce(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,c,u,l,d,h,f,p=this;return Ee(this,(function(m){switch(m.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),nt.info("pullMsg -> sendboxTime: "+e+", inboxTime: "+t),n=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t}),r=new Pi(Vi[Vi.pullMsg],n,this.currentUserId),[4,this._channel.send(r,Cn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return i=m.sent(),o=i.code,a=i.data,this._latestSyncTimestamp=Date.now(),o===st.SUCCESS&&a?(s=a.list,c=a.finished,u=a.syncTime,nt.info("pullMsg success -> syncTime: "+u+", finished: "+c),l=0,d=[],s.forEach((function(e){if(e.messageDirection===ot.SEND&&(l=Math.max(e.sentTime,l),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==Et.EXPANSION_NOTIFY){if(e.messageType===Et.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=p._handleMsgProperties(e);p._conversationManager.setConversationCacheByMessage(t,!0),d.push(t)}else p._receiveMessageExpansion(e)})),this._watcher.batchMessage(d),this._letterbox.setInboxTime(u,this.currentUserId),this._letterbox.setOutboxTime(l,this.currentUserId),this._sendMessageStore.removeByTimestamp(l),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]):(nt.warn("pullMsg failed -> code:",o,", data: ",a),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,bn,{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!==Et.EXPANSION_NOTIFY?t.messageType===Et.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,a=e.isStatusMessage,s=r in he,c=r in this._customMessageType;if(n=s?he[r]:c?this._customMessageType[r]:{isCounted:!Je(i)&&i,isPersited:!Je(o)&&o},Object.assign(e,{isCounted:n.isCounted,isPersited:n.isPersited,isStatusMessage:fe.includes(r)}),t&&(e.isStatusMessage=a),!t){var u=e.content.user;if(u){var l=u.portrait,d=u.portraitUri,h=l||d;h&&(u.portrait=u.portraitUri=h)}}return e},t.prototype.getHistoryMessage=function(e,t,n,r,i,o){return void 0===o&&(o=""),Ce(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,f,p;return Ee(this,(function(m){switch(m.label){case 0:return s=(a=this).currentUserId,c=a._channel,u=gi[e]||fi,l=1===r&&0===n,c?(d=c.codec.encodeGetHistoryMsg(t,{timestamp:n,count:l?2:r,order:i,channelId:o}),[4,c.send(new Pi(u,d,s),xn,{currentUserId:s,connectedTime:c.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return h=m.sent(),(f=h.code)!==st.SUCCESS?[2,{code:f}]:(p=h.data,l&&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:st.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){nt.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Pi(Vi[Vi.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==st.SUCCESS&&nt.warn("reportSDKInfo failed -> code: "+t)}))}},t.prototype.deleteRemoteMessage=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u,l;return Ee(this,(function(d){switch(d.label){case 0:return o=(i=this).currentUserId,(a=i._channel)?(s=a.codec.encodeDeleteMessages(e,t,n,r),c=new Pi("delMsg",s,o),[4,a.send(c)]):[3,2];case 1:return u=d.sent(),l=u.code,st.SUCCESS,[2,l];case 2:return[2,st.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d;return Ee(this,(function(h){switch(h.label){case 0:return o=(i=this).currentUserId,(a=i._channel)?(s=a.codec.encodeClearMessages(t,n,r),c=vi[e],u=new Pi(c,s,o),[4,a.send(u)]):[3,2];case 1:return l=h.sent(),d=l.code,st.SUCCESS,[2,d];case 2:return[2,st.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d,h=this;return Ee(this,(function(f){switch(f.label){case 0:return o=(i=this).currentUserId,a=i._channel,t=t||Le.PRIVATE,a?(s=a.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),c=new Pi(ci,s,o),[4,a.send(c,Nn,{currentUserId:o,connectedTime:a.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(),l=u.code,d=u.data,l!==st.SUCCESS?[2,{code:l}]:[2,{code:l,data:d}];case 2:return[2,{code:st.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return(r=this._channel)?(i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Pi("delRelation",i,t),[4,r.send(o)]):[3,2];case 1:return a=c.sent(),nt.info("RemoveConversation =>",a),s=a.code,st.SUCCESS,[2,s];case 2:return[2,st.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c;return Ee(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:st.CONVER_GET_ERROR}];case 1:return i=u.sent(),o=i.code,a=i.data,o!==st.SUCCESS?[2,{code:st.CONVER_GET_ERROR}]:(s=(null==a?void 0:a.list[0])||null,c={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:s,notificationStatus:r.notificationStatus||St.CLOSE,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},[2,{code:st.SUCCESS,data:c}])}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:st.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:st.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(st.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(st.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(st.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:st.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(st.SUCCESS)},t.prototype.pullConversationStatus=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c;return Ee(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeGetConversationStatus(e),o=new Pi(Vi[Vi.pullSeAtts],i,r),[4,n.send(o,Tr)]):[3,2];case 1:return a=u.sent(),s=a.code,c=a.data,s!==st.SUCCESS?[2,{code:s}]:[2,{code:s,data:c}];case 2:return[2,{code:st.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l=this;return Ee(this,(function(d){switch(d.label){case 0:return n=(t=this).currentUserId,(r=t._channel)?(i=r.codec.encodeSetConversationStatus(e),o=new Pi("setSeAtt",i,n),[4,r.send(o,kr)]):[3,2];case 1:return a=d.sent(),s=a.code,c=a.data,s===st.SUCCESS?(u=c,e.forEach((function(e){l._conversationManager.addStatus(be(be({},e),{updatedTime:u.version}),!0)})),[2,s]):[2,s];case 2:return[2,st.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u;return Ee(this,(function(l){switch(l.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new Pi(n?"joinChrmR":"joinChrm",i,e),[4,r.send(o,Fn)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return a=l.sent(),s=a.code,c=a.data,s===st.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,s]}}))}))},t.prototype._rejoinChrm=function(){return Ce(this,void 0,void 0,(function(){var e,t,n,r,i,o;return Ee(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,a.label=1;case 1:return r<t.length?(i=t[r],[4,this._joinChrm(i,e[i]||10,!0)]):[3,4];case 2:(o=a.sent())===st.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:o}}),a.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),Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d,h,f,p;return Ee(this,(function(m){switch(m.label){case 0:return this._channel?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,a=this._channel.codec.encodeChrmSyncMsg(o,t),s=new Pi(Vi[Vi.chrmPull],a,e),[4,this._channel.send(s,Cn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return c=m.sent(),u=c.code,l=c.data,r.pulling=!1,u===st.SUCCESS&&l?(d=l.list,h=l.syncTime,f=l.finished,r.timestamp=n?Math.max(h,n):h,r.queue=r.queue.filter((function(e){return e>h})),p=[],d.forEach((function(e){e.sentTime<o||p.push(e)})),this._watcher.batchMessage(p),(!f||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(nt.warn("pull chatroom msg failed, code:",u,", data:",l),[2])}}))}))},t.prototype.joinChatroom=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._joinChrm(e,t,!1)]}))}))},t.prototype.joinExistChatroom=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._joinChrm(e,t,!0)]}))}))},t.prototype.quitChatroom=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o;return Ee(this,(function(a){switch(a.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),r=new Pi("exitChrm",n,e),[4,t.send(r)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return i=a.sent(),(o=i.code)===st.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c;return Ee(this,(function(u){switch(u.label){case 0:return(r=this._channel)?(i=r.codec.encodeGetChatRoomInfo(t,n),o=new Pi(Vi[Vi.queryChrmI],i,e),[4,r.send(o,jn)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return a=u.sent(),s=a.code,c=a.data,s!==st.SUCCESS?[2,{code:s}]:[2,{code:s,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Ee(this,(function(l){switch(l.label){case 0:return(i=this._channel)?(o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),a=new Pi(pi,o,e),[4,i.send(a,xn,{conversation:{targetId:e}})]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return s=l.sent(),c=s.code,u=s.data,c!==st.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,u;return Ee(this,(function(l){switch(l.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===Nt.UPDATE?"setKV":"delKV",s=new Pi(a,o,e),[4,r.send(s)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return c=l.sent(),(u=c.code)===st.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},i),[2,u]):[2,u]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,u,l,d,h,f;return Ee(this,(function(p){switch(p.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKVS(e,t,i),a=t.type===Nt.UPDATE?"setKVS":"delKVS",s=new Pi(a,o,e),[4,r.send(s,mr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return c=p.sent(),u=c.code,-1!==[st.SUCCESS,st.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(d=[],delete(h=Object.assign({},t)).entries,t.entries.forEach((function(e){d.push(Object.assign({},e,h))})),u===st.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,nt.warn("设置失败的属性:",f.errorKeys),l=f.errorKeys,f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=d.findIndex((function(t){return e.key===t.key}));-1!==t&&d.splice(t,1)}))),nt.warn("设置成功的属性:",d),this._chrmEntryHandler.setLocal(e,{kvEntries:d,syncTime:(new Date).getTime()},i)),[2,{code:u,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.type=Nt.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s,c;return Ee(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:st.SUCCESS,data:n})]:[3,1];case 1:return(r=this._channel)?(i=r.codec.encodePullChatRoomKV(0),o=new Pi(Vi[Vi.pullKV],i,e),[4,r.send(o,pr)]):[2,Promise.reject({code:st.RC_NET_CHANNEL_INVALID})];case 2:return a=u.sent(),(s=a.data||{})&&s.kvEntries&&s.kvEntries.length&&void 0!==(c=s.kvEntries.find((function(e){return e.key===t})))?[2,Promise.resolve({code:st.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:st.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:st.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(r={},i=n.codec.encodePullChatRoomKV(0),o=new Pi(Vi[Vi.pullKV],i,e),[4,n.send(o,pr)]):[2,Promise.reject({code:st.RC_NET_CHANNEL_INVALID})];case 2:return a=c.sent(),(s=a.data||{})&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(e){e.key&&(r[e.key]=e.value||"")})),[2,Promise.resolve({code:st.SUCCESS,data:r})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,u,l,d;return Ee(this,(function(h){switch(h.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodePullChatRoomKV(t),a=new Pi(Vi[Vi.pullKV],o,e),[4,r.send(a,pr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),c=s.code,u=s.data,c===st.SUCCESS?(nt.info("Pull success ChrmKV, "+JSON.stringify(s)),this._chrmEntryHandler.setLocal(e,u,i),nt.info("Save into cache success!"),l=u.kvEntries,d=[],l.length>0&&(l.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp;d.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:d})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype.sendMessage=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d,h;return Ee(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=!![Le.PRIVATE,Le.GROUP].includes(e)&&n.isStatusMessage,i=r?function(e){var t;return(t={},t[Le.PRIVATE]=Vi.ppMsgS,t[Le.GROUP]=Vi.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[Le.PRIVATE]=Vi.ppMsgP,t[Le.GROUP]=Vi.pgMsgP,t[Le.CHATROOM]=Vi.chatMsg,t[Le.CUSTOMER_SERVICE]=Vi.pcMsgP,t[Le.RTC_ROOM]=Vi.prMsgS,t)[e]}(e)||Vi.ppMsgP,r&&(n.isPersited=!1,n.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(a=new Oi(Vi[i],o,t)).setHeaderQos(Yt.AT_LEAST_ONCE),r?(this._channel.sendOnly(a),[2,{code:st.SUCCESS,data:Ro(e,t,be({},n),"",0,this.currentUserId)}]):(s=Date.now()-this._localConnectedTime+this._connectedTime,c=Ro(e,t,be({},n),"",s,this.currentUserId),[4,this._channel.send(a)])):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),l=u.code,d=u.data,l!==st.SUCCESS?[2,{code:l,data:c}]:(h=d,this._sendMessageStore.setMessage(h.messageUId,h.timestamp),c.sentTime=h.timestamp,c.messageUId=h.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),[2,{code:st.SUCCESS,data:c}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return Ce(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,f,p,m;return Ee(this,(function(g){switch(g.label){case 0:return this._channel?(a=i.user,s={content:{conversationType:e,targetId:t,messageUId:n,sentTime:r,user:a},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=Vi[Vi.recallMsg],u=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},s),(l=new Oi(c,u,this.currentUserId)).setHeaderQos(Yt.AT_LEAST_ONCE),[4,this._channel.send(l)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return d=g.sent(),h=d.code,f=d.data,h!==st.SUCCESS?[2,{code:h}]:(p=f,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),m=Ro(e,t,be(be({},s),{isPersited:!0}),p.messageUId,p.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(m,!0),[2,{code:st.SUCCESS,data:m}])}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeReadReceipt(t,n),i=new Pi(Vi[Vi.rrMsg],r,e),[4,this._channel.send(i)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeMessageReader(t,n),i=new Pi(Vi[Vi.rrList],r,e),[4,this._channel.send(i,Nr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return Ce(this,void 0,void 0,(function(){var t,n;return Ee(this,(function(r){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new Pi(Vi[Vi.pullUS],t,this.currentUserId),[2,this._channel.send(n,br)]):[2,{code:st.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Ee(this,(function(l){switch(l.label){case 0:return this._channel?(i=r&&"uploads"!==r?t||"":function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Ae(),i=function(e){e=e||"-";var t=new Date;return""+t.getFullYear()+e+(t.getMonth()+1)+e+t.getDate()}(),o=(new Date).getTime(),a="";if(t){var s=t.split(".");a="."+s[s.length-1]}return e+"__RC-"+i+"_"+n+"_"+o+r+a}(e,t),o=this._channel.codec.encodeGetFileToken(e,i,n||"",r||""),a=new Pi(Vi[Vi.qnTkn],o,this.currentUserId),[4,this._channel.send(a,ar)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return s=l.sent(),c=s.code,u=s.data,u=Object.assign(u,{fileName:i}),c===st.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d,h;return Ee(this,(function(f){switch(f.label){case 0:return this._channel?("",o="",a="",t===xt.QINIU?(o=sr,a=ur):(o=cr,a=lr),i=t===xt.QINIU?Vi[Vi.qnUrl]:t===xt.AWS?Vi[Vi.s3Url]:t===xt.STC?Vi[Vi.stcUrl]:Vi[Vi.aliUrl],s=this._channel.codec.encodeGetFileUrl(o,e,n,r),c=new Pi(i,s,this.currentUserId),[4,this._channel.send(c,a)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),l=u.code,d=u.data,h=d,l===st.SUCCESS?[2,{code:l,data:h}]:[2,{code:l}]}}))}))},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 Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new Pi(Vi[Vi.addSeTag],n,this.currentUserId),[4,this._channel.send(r,yr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,a=i.data,o!==st.SUCCESS?[2,{code:o}]:(s=a.version,this._userSettingManager.addTag([be(be({},e),{createdTime:s})],s),[2,{code:st.SUCCESS,data:a}])}}))}))},t.prototype.removeTag=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),r=new Pi(Vi[Vi.delSeTag],n,this.currentUserId),[4,this._channel.send(r,yr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,a=i.data,o!==st.SUCCESS?[2,{code:o}]:(s=a.version,this._userSettingManager.deleteTag([e],s),[2,{code:st.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new Pi(Vi[Vi.addSeTag],n,this.currentUserId),[4,this._channel.send(r,yr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,a=i.data,o!==st.SUCCESS?[2,{code:o}]:(s=a.version,this._userSettingManager.addTag([e],s),[2,{code:st.SUCCESS,data:a}])}}))}))},t.prototype.getTagList=function(){return Ce(this,void 0,void 0,(function(){var e,t;return Ee(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:st.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a=this;return Ee(this,(function(s){switch(s.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Pi(Vi[Vi.addTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:st.TAG_NOT_EXIST}]:[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return(i=s.sent().code)!==st.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){a._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:st.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o=this;return Ee(this,(function(a){switch(a.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Pi(Vi[Vi.delTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return(i=a.sent().code)!==st.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:st.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s,c;return Ee(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}})),a=this._channel.codec.encodeUpdateConversationTag(o,[e]),s=new Pi(Vi[Vi.delTag],a,this.currentUserId),[4,this._channel.send(s)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==st.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:st.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d;return Ee(this,(function(h){switch(h.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(a=o.codec.encodeOldConversationList({count:n,type:Le.PRIVATE,startTime:t}),s=new Pi(ci,a,i),[4,o.send(s,Nn,{currentUserId:i,connectedTime:o.connectedTime})]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return c=h.sent(),u=c.code,l=c.data,d=this._conversationHasTagFilter(e,l),nt.info("GetConversationListByTag",d),u!==st.SUCCESS?[2,{code:u}]:[2,{code:u,data:d}]}}))}))},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,a=t.targetId,s=t.channelId,c=n._conversationManager.get(o,a,s),u=c.hasMentioned,l=c.mentionedInfo,d=c.lastUnreadTime,h=c.notificationStatus,f=c.isTop,p=c.tags,m=c.unreadMessageCount,g=p&&p[e];if(g){var v=be(be({},t),{hasMentioned:u,mentionedInfo:l,lastUnreadTime:d,notificationStatus:h,isTop:f,unreadMessageCount:m});g.isTop?r.push(be(be({},v),{isTopInTag:!0})):i.push(be(be({},v),{isTopInTag:!1}))}})),Te(Te([],r.sort(o)),i.sort(o))},t.prototype.getUnreadCountByTag=function(e,t){return Ce(this,void 0,void 0,(function(){var n;return Ee(this,(function(r){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:st.SUCCESS,data:n}]):[2,{code:st.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d,h;return Ee(this,(function(f){switch(f.label){case 0:return this._channel?(r=t.targetId,i=t.conversationType,o=t.channelId,a=n.isTop,s=[{tagId:e,isTop:a}],(c=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(s,[t]),l=new Pi(Vi[Vi.addTag],u,this.currentUserId),[4,this._channel.send(l)]):[2,{code:st.NO_TAG_IN_CONVER}]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return(d=f.sent().code)!==st.SUCCESS?[2,{code:d}]:((h={})[e]={},a&&(h[e].isTop=!0),this._conversationManager.addTagStatus(i,r,h,o),[2,{code:st.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return Ce(this,void 0,void 0,(function(){var n,r,i,o;return Ee(this,(function(a){if(!this._channel)return[2,{code:st.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:st.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:st.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:st.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:st.SUCCESS,data:t})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:st.SUCCESS,data:e})},t.prototype.joinRTCRoom=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){var i,o;return Ee(this,(function(a){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n,r),o=new Pi(Vi[Vi.rtcRJoin_data],i,e),[2,this._channel.send(o,qn)]):[2,{code:st.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return Ce(this,void 0,void 0,(function(){var t,n;return Ee(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Pi(Vi[Vi.rtcRExit],t,e),[4,this._channel.send(n)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Pi(Vi[Vi.rtcPing],r,e),[4,this._channel.send(i)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return Ce(this,void 0,void 0,(function(){var t,n;return Ee(this,(function(r){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Pi(Vi[Vi.rtcRInfo],t,e),[2,this._channel.send(n,nr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o;return Ee(this,(function(a){switch(a.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Pi(Vi[Vi.rtcUData],t,e),[4,this._channel.send(n,qn)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return r=a.sent(),i=r.code,o=r.data,[2,{code:i,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeSetRTCUserInfo(t,n),i=new Pi(Vi[Vi.rtcUPut],r,e),[4,this._channel.send(i)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),r=new Oi(Vi[Vi.rtcUDel],n,e),[4,this._channel.send(r)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return Ce(this,void 0,void 0,(function(){var a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._channel?(a=this._channel.codec.encodeSetRTCData(t,n,r,i,o),s=new Oi(Vi[Vi.rtcSetData],a,e),[4,this._channel.send(s)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return Ce(this,void 0,void 0,(function(){var o,a;return Ee(this,(function(s){switch(s.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,r,i),a=new Pi(Vi[Vi.userSetData],o,e),[4,this._channel.send(a)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeUserSetRTCCDNUris(t,n),i=new Pi(Vi[Vi.userSetData],r,e),[4,this._channel.send(i)]):[2,st.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:st.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),o=new Pi(Vi[Vi.rtcQryData],i,e);return this._channel.send(o,Zn)},t.prototype.removeRTCData=function(e,t,n,r,i){return Ce(this,void 0,void 0,(function(){var o,a;return Ee(this,(function(s){switch(s.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,r,i),a=new Oi(Vi[Vi.rtcDelData],o,e),[4,this._channel.send(a)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,s.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 Ce(this,void 0,void 0,(function(){var r,i;return Ee(this,(function(o){return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Pi(Vi[Vi.rtcToken],r,e),[2,this._channel.send(i,Xn)]):[2,{code:st.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return Ce(this,void 0,void 0,(function(){var n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),r=new Pi(Vi[Vi.rtcUserState],n,e),[4,this._channel.send(r)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:st.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Pi(Vi[Vi.rtcUList],t,e);return this._channel.send(n,qn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=Pt.LIVE),Ce(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l;return Ee(this,(function(d){switch(d.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new Pi(Vi[Vi.viewerJoinR],r,e),[4,this._channel.send(i,qr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return o=d.sent(),a=o.code,s=o.data,a!==st.SUCCESS?[2,{code:a}]:(u=(c=s).rtcToken,l=c.entries,[2,{code:a,data:{token:u,kvEntries:l}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Pi(Vi[Vi.viewerExitR],t,e),[4,this._channel.send(n)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._channel?(r=this._channel.codec.encodeIdentityChangeInfo(t,n),i=new Pi(Vi[Vi.rtcIdentityChange],r,e),[4,this._channel.send(i,qn)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),a=o.code,s=o.data,a!==st.SUCCESS?[2,{code:a}]:[2,{code:a,data:s}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u;return Ee(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(nt.info("audience in room start pull KV"),i=n.codec.encodePullRTCRoomKV(e,0),o=new Pi(Vi[Vi.rtcPullKv],i,r),[4,n.send(o,Hr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return a=l.sent(),s=a.code,c=a.data,nt.info("audience in room end pull KV, code: "+s+", data: "+JSON.stringify(c||{})),s===st.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c;return Ee(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeQueryUserJoinedInfo(e),o=new Pi(Vi[Vi.rtcQueryJoined],i,r),[4,n.send(o,Kr)]):[2,{code:st.RC_NET_CHANNEL_INVALID}];case 1:return a=u.sent(),s=a.code,c=a.data,s===st.SUCCESS?[2,{code:s,data:c}]:[2,{code:s}]}}))}))},t.prototype.getDeviceId=function(){return _o(this.runtime)},t.prototype.requestRoomPK=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new Pi(Vi[Vi.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.cancelRoomPK=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new Pi(Vi[Vi.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.responseRoomPK=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new Pi(Vi[Vi.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,st.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.endRoomPK=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r;return Ee(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new Pi(Vi[Vi.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,st.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:st.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:st.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:st.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()})),Co=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}(),Eo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _e(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}(Co),To=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=[],a=[],s=function(){if(a.length>0){var e=a.join("");if(a=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);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)a.push(e.charAt(c++));else if(u.length<4)a.push(e.substr(c,u.length)),c+=u.length;else{var l=t.numberEncode(c-u.offset),d=t.numberEncode(u.length);if(l.length+d.length>=u.length)a.push(e.substr(c,u.length)),c+=u.length;else{s();var h=String.fromCharCode(t.dataType.Compressed|l.length<<2|d.length);o.push(h+l+d),c+=u.length}}}s();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,a=15&i,s=void 0;switch(o){case t.dataType.Compressed:var c=a>>2,u=3&a;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,c)),d=t.numberDecode(e.substr(n+=c,u));if((l=r.length-l)+d>r.length)throw new Error("Data parsing error,at "+n);n+=u,r+=r.substr(l,d);break;case t.dataType.Tail:if((s=t.numberDecode(e.substr(n,a)))!==r.length)throw console.log(r.length),console.log(s),new Error("Data parsing error,at "+n);n+=a;break e;case t.dataType.NormalExt:s=t.numberDecode(e.substr(n,a)),r+=e.substr(n+=a,s),n+=s;break;case t.dataType.Normal:r+=e.substr(n,a),n+=a;break;case t.dataType.Mark:if(a>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+a),n+=16+a;break;default:throw new Error("Data parsing error,at "+n+" header:"+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,a=0,s=i.length;a<s;a++){var c=i[a],u=n-c;if(!(u>this.max)){var l=Math.min(o,u);if(l<=r.length)break;if(!(r.length>2&&t.charAt(c+r.length-1)!==t.charAt(n+r.length-1))){for(var d=2,h=d;h<l&&t.charAt(c+h)===t.charAt(n+h);h++)d++;d>=r.length&&(r.length=d,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}(),So=1,Io=!1,wo="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",ko=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=_o(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 a=r.match(i[o]);if(a){n=o,t=a[1]||a[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}}(e.runtime);this.deviceInfo=t.type+"|"+t.version+"|"+et.sessionId,this.startReport()}return e.init=function(t){return Io=!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&&Io){var t=this.itv*Math.pow(2,So-1);So<this.times&&So++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}},e.prototype.reportRealtimeLog=function(){var e=this,t=et.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=To.compress(t.map((function(e){return e.content})).join("")),r=""+wo+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){nt.__clearRealTimeLog(),nt.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,So=1),e.startReport()})).catch((function(t){nt.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()},e.prototype.reportFullLog=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l,d=this;return Ee(this,(function(h){switch(h.label){case 0:return t=e.startTime,n=e.endTime,r=e.platform,i=e.logId,o=e.uri,a=Ne.getInstance(),nt.debug("received report log msg, "+r.toLowerCase(),a),"web"===r.toLowerCase()&&a?t>n?(nt.warn("report error: The start time("+t+") cannot be greater than the end time("+t+")"),[2]):[4,nt.__insertLogIntoDatabase()]:[2];case 1:return h.sent(),[4,a.getRangeData(xe,"time",t,n)];case 2:return s=(s=h.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),c=To.compress(s.map((function(e){return e.content})).join("")||"no data"),u=1,(l=function(){if(!(u>3)&&Io){var e=o||d.logUrl,t=""+wo+e+"?version="+d.info.version+"&appkey="+d.info.appkey+"&userId="+d.info.userId+"&logId="+i+"&deviceId="+d.deviceId+"&deviceInfo="+d.deviceInfo+"&platform=Web",n=5e3*(u-1);u++,setTimeout((function(){Io&&d.info.runtime.httpReq({url:t,method:"POST",body:c}).then((function(){nt.debug("report full log success!")})).catch((function(e){l(),nt.warn("report full log error -> "+e)}))}),n)}})(),[2]}}))}))},e.prototype.distroy=function(){So=1,Io=!1},e}();function xo(e){return Object.assign({},e)}var Oo,No=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=ut.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,ue);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=un()?new RCCppEngine(e,r,this._options):new bo(e,r,this._options)}return e.init=function(t,n){return nt.setLogLevel(n.logLevel),nt.setLogStdout(n.logStdout),(n.indexDBSwitch||ze(n.indexDBSwitch))&&Ne.init(),nt.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(nt.error("Repeat initialize!"),this._context):(nt.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new e(t,n),nt.__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 nt.warn("Repeat install plugin: "+e.tag),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new Eo(this):new Co(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){nt.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 Ce(this,void 0,void 0,(function(){var e=this;return Ee(this,(function(t){switch(t.label){case 0:return nt.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return t.sent().code!==st.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){e._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return e===ut.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):e===ut.BLOCKED||e===ut.KICKED_OFFLINE_BY_OTHER_CLIENT||e===ut.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):e===ut.CONNECTING?this._handleConnecting():e===ut.CONNECTED?this._handleConnected():e===ut.DISCONNECTED?this._handleDisconnect():e===ut.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===Le.RTC_ROOM||Object.prototype.hasOwnProperty.call(Ft,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(xo(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Et.TYPING_STATUS||(this._addTypingInfo(xo(e)),!this._watcher.typingState))if(e.messageType!==Et.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Et.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(xo(e))}catch(e){return nt.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(xo(e),t,n),e;var a=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic;a&&Array.isArray(a[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,a[this._engine.currentUserId])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var s=e.content,c=s.startTime,u=s.endTime,l=s.platform,d=s.logId,h=s.uri,f=s.packageName,p={startTime:parseInt(c),endTime:parseInt(u),platform:l,logId:d,uri:h,packageName:f};null===(i=ko.getInstance())||void 0===i||i.reportFullLog(p)}}else if("function"==typeof this._watcher.chatroomState){var m={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){m[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:m,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(r={},r[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?Ut.QUIT:Ut.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]=Ge(r)||Ye(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,a=i.typingContentType,s=n+"#"+r+"#"+(o||"");this._typingInfo[s]||(this._typingInfo[s]=[]);var c=this._typingInfo[s].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[s][c].messageType===a?this._typingInfo[s][c].timestamp=Date.now():(c>=0&&this._typingInfo[s].splice(c,1),this._typingInfo[s].push({userId:t,messageType:a,timestamp:Date.now()}),this._typingChangedList.includes(s)||this._typingChangedList.push(s),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),Ce(this,void 0,void 0,(function(){var n,r,i,o,a,s;return Ee(this,(function(c){switch(c.label){case 0:return this._connectionStatus===ut.CONNECTED?[2,{code:st.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===ut.CONNECTING?[2,{code:st.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:st.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:st.PACKAGE_ENVIRONMENT_ERROR}]:(a=qt.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),o)]):[2,{code:st.RC_NAVI_RESOURCE_ERROR}];case 2:return s=c.sent(),nt.__insertLogIntoDatabase(),s!==ft?[3,4]:(this._connectionStatus=ut.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,c.sent()];case 4:return s===st.SUCCESS&&(nt.info("connect success, userId: "+this._engine.currentUserId),1!==(null==o?void 0:o.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(a),ko.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}),et.init(this._engine.currentUserId),this._isInternalConnected=!0),s!==st.SUCCESS||un()||1===o.openUS&&this._pullUserSettings(),s!==st.SUCCESS&&(this._connectionStatus=ut.CONNECTION_CLOSED),[2,{code:s,userId:this._engine.currentUserId}]}}))}))},e.prototype._pullUserSettings=function(){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=ko.getInstance())||void 0===e||e.distroy(),nt.__insertLogIntoDatabase(),et.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){nt.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(){return this._isInternalConnected?Promise.resolve({code:st.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===Et.READ_RECEIPT_RESPONSE)return Promise.resolve({code:st.READ_RECEIPT_ERROR});var o=JSON.stringify(n.content);return Ie(o)>131072?Promise.resolve({code:st.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)},e.prototype.sendExpansionMessage=function(e){return Ce(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l,d,h,f,p;return Ee(this,(function(m){switch(m.label){case 0:if(t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,a=e.expansion,s=e.removeAll,!e.canIncludeExpansion)return[2,{code:st.MESSAGE_KV_NOT_SUPPORT}];if(c=!1,u=!1,l=!1,Ye(a))for(h in d=Object.keys(a).length,c=d>20,a)if(f=a[h],u=Be(h)&&!/^[A-Za-z0-9_=+-]+$/.test(h),(l=h.length>32||f.length>64)||u)break;return c||l?[2,{code:st.EXPANSION_LIMIT_EXCEET}]:u?[2,{code:st.BIZ_ERROR_INVALID_PARAMETER}]:(p={mid:i},a&&(p.put=a),o&&(p.del=o),s&&(p.removeAll=1),[4,this._engine.sendMessage(n,r,{content:p,messageType:Et.EXPANSION_NOTIFY,channelId:t})]);case 1:return[2,{code:m.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return Ce(this,void 0,void 0,(function(){var r;return Ee(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:st.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 Ce(this,void 0,void 0,(function(){var r;return Ee(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:st.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){nt.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=ko.getInstance())||void 0===e||e.distroy(),et.reset()},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,a){return void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===a&&(a=""),this._engine.getHistoryMessage(e,t,n,r,i,o,a||"")},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:[Le.PRIVATE,Le.GROUP,Le.SYSTEM,Le.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 nn(n)&&rn(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(st.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(!nn(i)||!rn(o))return Promise.resolve({code:st.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return nn(n)&&rn(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(st.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return nn(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(st.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(!nn(r))return Promise.resolve({code:st.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return nn(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(st.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 Ce(this,void 0,void 0,(function(){var i,o,a,s,c,u,l;return Ee(this,(function(d){switch(d.label){case 0:return i=this.getInfoFromCache(),o=(null==i?void 0:i.bosAddr)||"",a=(null==i?void 0:i.uploadServer)||"",s=(null==i?void 0:i.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r)];case 1:return c=d.sent(),u=c.code,l=c.data,u===st.SUCCESS?[2,Promise.resolve(Object.assign(l,{bos:o,qiniu:a,ossConfig:s}))]:[2,Promise.reject(u)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=xt.QINIU),Ce(this,void 0,void 0,(function(){var o,a,s;return Ee(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(),a=o.code,s=o.data,a===st.SUCCESS?[2,Promise.resolve(s)]:[2,Promise.reject(a)]}}))}))},e.prototype.createTag=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return t.length>1e3?[2,Promise.reject(st.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return Ce(this,void 0,void 0,(function(){return Ee(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,Te([e],n))},e.prototype.clearConversations=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(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){nt.error(e)}}))},e.prototype.addToBlacklist=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(r){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),Ce(this,void 0,void 0,(function(){return Ee(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=""),Ce(this,void 0,void 0,(function(){return Ee(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setUserStatus=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return Ce(this,void 0,void 0,(function(){return Ee(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return Ce(this,void 0,void 0,(function(){return Ee(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=""),Ce(this,void 0,void 0,(function(){return Ee(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,a){return void 0===a&&(a=""),Ce(this,void 0,void 0,(function(){return Ee(this,(function(s){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,a)]}))}))},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"}(Oo||(Oo={}));
  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 Ao=function(e,t){return Ao=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])},Ao(e,t)},Po=function(){return Po=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},Po.apply(this,arguments)};function Mo(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(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(a,s)}c((r=r.apply(e,t||[])).next())}))}function Lo(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}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,s])}}}var Uo,Do=new et("RCIM"),Vo=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))},Bo=Vo(),Fo={tag:"browser",httpReq:function(e){var t=e.method||ji.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=we(e.url,i);return new Promise((function(e){var i,s=(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(s);if(s.open(t,a),r&&s.setRequestHeader)for(var u in r)s.setRequestHeader(u,r[u]);if(c){s.timeout=n,s.onload=function(){e({data:s.responseText,status:s.status||200})},s.onerror=function(){e({status:s.status||0})},s.ontimeout=function(){e({status:s.status||0})};var l="object"==T(o)?JSON.stringify(o):o;s.send(l)}else s.onreadystatechange=function(){4===s.readyState&&e({data:s.responseText,status:s.status})},s.onerror=function(){e({status:s.status||0})},setTimeout((function(){return e({status:s.status||0})}),n),s.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||Do.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:Bo,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 qi(this,e):new Yi(this,e)}},Ho=Vo(),jo=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){Do.error(e)}}},Ko={setItem:jo("setStorageSync"),getItem:jo("getStorageSync"),removeItem:jo("removeStorageSync"),clear:jo("clearStorageSync")},qo={tag:"wechat",httpReq:function(e){var t=e.method||ji.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=we(e.url,i);return new Promise((function(e){wx.request({url:a,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:st.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:Ko,sessionStorage:Ko,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Ho,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 qi(this,e):new Yi(this,e)}},Yo=Vo(),Go=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){Do.error(e)}}},zo={setItem:Go("setStorageSync"),getItem:Go("getStorageSync"),removeItem:Go("removeStorageSync"),clear:Go("clearStorageSync")},Jo={tag:"alipay",httpReq:function(e){var t=e.method||ji.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=we(e.url,i),s=e.dataType||"json";return new Promise((function(e){my.request({url:a,method:t,headers:r,timeout:n,data:o,dataType:s,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:st.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:zo,sessionStorage:zo,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Yo,createDataChannel:function(e,t){return"websocket"===t?new qi(this,e):new Yi(this,e)}},Wo=Vo(),Qo=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){Do.error(e)}}},Xo={setItem:Qo("setStorageSync"),getItem:Qo("getStorageSync"),removeItem:Qo("removeStorageSync"),clear:Qo("clearStorageSync")},Zo={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Wo,localStorage:Xo,sessionStorage:Xo,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 qi(this,e):new Yi(this,e)}},$o=Vo(),ea=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){Do.error(e)}}},ta={setItem:ea("setStorageSync"),getItem:ea("getStorageSync"),removeItem:ea("removeStorageSync"),clear:ea("clearStorageSync")},na={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:$o,localStorage:ta,sessionStorage:ta,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 qi(this,e):new Yi(this,e)}},ra=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){Do.error(e)}}},ia={setItem:ra("setStorageSync"),getItem:ra("getStorageSync"),removeItem:ra("removeStorageSync"),clear:ra("clearStorageSync")},oa={tag:"uniapp",httpReq:function(e){var t=e.method||ji.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=we(e.url,i);return new Promise((function(e){uni.request({url:a,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:st.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:ia,sessionStorage:ia,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 qi(this,e):new Yi(this,e)}},aa=function(e){return e&&e.canIUse&&e.getSystemInfo},sa="undefined"!=typeof uni&&aa(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return oa;case"mp-baidu":return na;case"mp-toutiao":return Zo;case"mp-alipay":return Jo;case"mp-weixin":return qo;default:return Fo}}():"undefined"!=typeof wx&&aa(wx)?qo:"undefined"!=typeof my&&aa(my)?Jo:"undefined"!=typeof tt&&aa(tt)?Zo:"undefined"!=typeof swan&&aa(swan)?na:Fo;function ca(e){var t=e.conversationType,n=e.channelId,r=e.messageType,i=e.content,o=e.senderUserId,a=e.targetId,s=e.sentTime,c=e.receivedTime,u=e.messageUId,l=e.messageDirection,d=e.isPersited,h=e.isCounted,f=e.isOffLineMessage,p=e.canIncludeExpansion,m=e.expansion,g=e.receivedStatus,v=e.disableNotification,_=e.isMentioned,y=e.isStatusMessage,R=e.readReceiptInfo,b=e.pushConfig,C=e.messageId;return g||(g=ce.UNREAD),{messageType:r,channelId:n||"",content:i,senderUserId:o,targetId:a,conversationType:t,sentTime:s,receivedTime:c,messageUId:u,messageDirection:l,isPersited:d,isCounted:h,isOffLineMessage:f,isMentioned:_,disableNotification:v,isStatusMessage:y,canIncludeExpansion:p,expansion:m,receivedStatus:g,readReceiptInfo:R,pushConfig:b,messageId:C}}!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"}(Uo||(Uo={}));var ua,la=function(e){function t(n){var r=e.call(this)||this;if(t.imClient)return Do.error("Please do not repeatedly perform the init method"),t.imClient;Zt("options.navigators",n.navigators,(function(e){return je(e)&&(0===e.length||e.every(We))}));var i=null==n?void 0:n.connectType;return i?ae.WEBSOCKET!==i&&ae.COMET!==i&&(Do.warn("RongIMLib connectionType must be "+ae.WEBSOCKET+" or "+ae.COMET),i=ae.WEBSOCKET):i=ae.WEBSOCKET,r._context=No.init(sa,{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}Ao(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(Uo.CONNECTING)},onConnected:function(){e.emit(Uo.CONNECTED)},onDisconnect:function(){e.emit(Uo.DISCONNECT)},onSuspend:function(){e.emit(Uo.SUSPEND)},batchMessage:function(t){e.emit(Uo.MESSAGES,{messages:t.map((function(e){return ca(e)}))})},typingState:function(t){e.emit(Uo.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,r){e.emit(Uo.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:r})},messageReceiptRequest:function(t,n,r){e.emit(Uo.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:r})},messageReceiptResponse:function(t,n,r){e.emit(Uo.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?ca(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(Uo.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(Uo.CHATROOM,t)},expansion:function(t){e.emit(Uo.EXPANSION,t)},pullFinished:function(){e.emit(Uo.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(Uo.TAG)},conversationTagChanged:function(){e.emit(Uo.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(Uo.MESSAGE_BLOCKED,t)}};this.context.assignWatcher(t)},t}(rt),da={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:st.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},ha={},fa={};for(var pa in da){var ma=da[pa],ga=ma.code;ha[ga]=pa,fa[ga]=ma}da.ROAMING_SERVICE_UNAVAILABLE.code;function va(e,t){return null==ua?void 0:ua.context.install(e,t)}function _a(e){return Mo(this,void 0,void 0,(function(){var t;return Lo(this,(function(n){switch(n.label){case 0:return Zt("token",e,jt.STRING,!0),Do.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,ua.context.connect(e,!0)];case 1:return(t=n.sent()).code===st.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:ha[t.code]}]}}))}))}function ya(e,t,n){ua.on(e,t,n)}function Ra(e,t){return Mo(this,void 0,void 0,(function(){var n,r;return Lo(this,(function(i){switch(i.label){case 0:return Zt("options.count",t.count,jt.NUMBER,!0),n="id:"+e,Do.debug("join chatroom ->"+n),[4,la.imClient.context.joinChatroom(e,t.count)];case 1:return(r=i.sent())!==st.SUCCESS?(Do.warn("join chatroom fail ->code+:"+ha[r]+","+n),[2,{code:r,msg:ha[r]}]):[2,{code:r}]}}))}))}var ba=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 Ca(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=!0),function(r){return new ba(e,r,t,n)}}var Ea,Ta,Sa=Ca("RC:ImgMsg"),Ia=Ca("RC:HQVCMsg"),wa=Ca("RC:SightMsg"),ka=Ca("RC:TxtMsg"),xa=Ca("RC:CombineMsg"),Oa=Ca("RC:FileMsg");Ca("RC:GIFMsg"),Ca("RC:VcMsg"),Ca("RC:LBSMsg"),Ca("RC:ReferenceMsg"),Ca("RC:ImgTextMsg");var Na={qiniu:function(e,t,n,r){var i,o="https://"+t.uploadHost.qiniu;i=La()+Aa[0][1]||o,Aa.shift();var a=new XMLHttpRequest;a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),a.onreadystatechange=function(){if(4===a.readyState){var i=a.responseText||"{}";(i=JSON.parse(i)).filename=t.uniqueValue,i.uploadMethod=xt?xt.QINIU:"",200===a.status?n.onCompleted(i):Aa.length?Na[Aa[0][0]](e,t,n,r):n.onError("upload fail")}},t.isChunk&&(i=function(e,t){var n="";return Ma(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)),a.open(t.method,i,!0),n.onOpen(a),t.stream&&a.setRequestHeader("authorization","UpToken "+t.multi_parmas.token),Ma(t.headers,(function(e,t){a.setRequestHeader(e,t)})),a.send(e)},baidu:function(e,t,n,r){if(console.log(r,t),r.size>Pa)throw new Error("the file size is over 5GB!");var i=t||{};t=t||Ta;var o=new XMLHttpRequest,a=La();if(i.uploadHost.bos||i.bosUploadPath){var s=a+Aa[0][1]+i.bosUploadPath;Aa.shift();var c=i.bosHeader||{},u={filename:t.uniqueValue||r.uniqueName,name:r.name,downloadUrl:s,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):Aa.length?Na[Aa[0][0]](e,t,n,r):n.onError("upload fail")}},o.open(t.method,s,!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>Pa)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=Aa[0][1];Aa.shift(),e=e||Ea,t=(t=t||{})||Ta;var a=new XMLHttpRequest,s=La()+t.ossBucketName+"."+o;a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),a.onreadystatechange=function(){if(4===a.readyState){var e=a.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=xt?xt.ALI:"",200===a.status?n.onCompleted(e):Aa.length?Na[Aa[0][0]](i,t,n,r):n.onError("upload fail")}},a.open(t.method,s,!0),console.log("ali:url",s);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),a.send(e)},s3:function(e,t,n,r){var i=new FormData,o=new XMLHttpRequest,a=La(),s=Aa[0][1],c=a+t.s3BucketName+"."+s;console.log("uploadS3:url",c),Aa.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=xt.AWS,console.log("UploadMethod:",xt),200===o.status||204===o.status)n.onCompleted(i);else if(Aa.length){var a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Na[Aa[0][0]](a,t,n,r)}else n.onError("upload fail")}},o.open(t.method,c,!0);var u=t?t.s3Header:{},l=r&&r.type;"text/html"===l?i.set("Content-Disposition","inline;"):i.set("Content-Disposition","attachment;"),i.set("Content-Type",l),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;La();var o="https://"+Aa[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;Aa.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=xt?xt.STC:"",200===i.status||204===i.status)n.onCompleted(o);else if(Aa.length){var a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Na[Aa[0][0]](a,t,n,r)}else n.onError("upload fail")}},i.open("PUT",o,!0);var a=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",a.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",a.stcContentSha256),i.setRequestHeader("x-amz-date",a.stcDate),i.send(r)}},Aa=[],Pa=5368709120;function Ma(e,t){for(var n in e)t(n,e[n])}function La(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}var Ua={form:function(e,t){var n=new FormData;if(t.unique_key){var r=e.name.substr(e.name.lastIndexOf(".")),i=Da()+r;n.append(t.unique_key,i),t.uniqueValue=i}return n.append(t.file_data_name,e),Va(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=Da()+r;n[t.unique_key]=i,t.uniqueValue=i}return n[t.file_data_name]=e,Va(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Da(){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 Va(e,t){for(var n in e)t(n,e[n])}var Ba,Fa=0;function Ha(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:Ua.form,genUId:Da};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;Va(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(Ea=e,Ta=t,Aa=[],t.ossConfig){var r,i,o=JSON.parse(t.ossConfig),a="",s=[];o.forEach((function(e){var t=Number(e.p)-1;for(var n in e)"aliyun"===n&&(a=e[n]),"s3"===n&&(r=e[n]),"stc"===n&&(i=e[n]),"p"!==n&&(s[t]=[n,e[n]])})),s.forEach((function(e){e&&Aa.push(e)})),o.length!==Aa.length&&(Aa=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",r],["stc",i]])}else Aa=[["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",a=o.indexOf("image")>-1?1:4,s=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")})),l="uploads";la.imClient.getFileToken(a,r,"POST",l).then((function(e){r=e.fileName,i="https://"+u.stc+"/"+t.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var a=new XMLHttpRequest;a.open("POST",i+"?"+l,!0),"text/html"===o?a.setRequestHeader("Content-Disposition","inline;"):a.setRequestHeader("Content-Disposition","attacshment;"),a.setRequestHeader("Authorization",e&&e.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),a.setRequestHeader("x-amz-date",e&&e.stcDate),a.setRequestHeader("Content-Type",o),a.send(),a.onreadystatechange=function(e){if(4===a.readyState){var t=a.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===a.status||204===a.status?function(e){for(var t=[],n=1;n<=s;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 d=[],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===s)la.imClient.context.getFileToken(a,r,"POST",u).then((function(r){console.log("onSuccess",r),console.log("onSuccess:uploadId",c);var a=new XMLHttpRequest;a.open("POST",i+"?"+u,!0),a.setRequestHeader("Authorization",r&&r.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",r&&r.stcContentSha256),a.setRequestHeader("x-amz-date",r&&r.stcDate),a.setRequestHeader("Content-Type",o);var s="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",l=Array.from(h.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",l),l.map((function(e){s+="<Part><ETag>".concat(h.get(e),"</ETag><PartNumber>").concat(e,"</PartNumber></Part>")})),s+="</CompleteMultipartUpload>",a.send(s),console.log("xml",s),a.onreadystatechange=function(){if(4===a.readyState)if(200===a.status||204===a.status){var r={};r.name=e.name,r.filename=t.uploadFileName,r.uploadMethod=xt.STC,n.onCompleted(r)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var l,m=[],g=b(d);try{for(g.s();!(l=g.n()).done;){var v=l.value;m.push(p(c,v))}}catch(_){g.e(_)}finally{g.f()}f(c,m)}}),(function(e){console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t,r=[],i=b(d);try{for(i.s();!(t=i.n()).done;){var o=t.value;r.push(p(c,o))}}catch(a){i.e(a)}finally{i.f()}f(c,r)}))}function p(n,s){return new Promise((function(c,u){var l="partNumber="+s+"&uploadId="+n;la.imClient.context.getFileToken(a,r,"PUT",l).then((function(n){console.log("signature "+s+" onSuccess",n);var r=e&&e.slice((s-1)*t.stc_chunk_size,s*t.stc_chunk_size);console.log("fileChunk:size",r.size);var a=new XMLHttpRequest;a.open("PUT",i+"?"+l,!0),a.setRequestHeader("Authorization",n&&n.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),a.setRequestHeader("x-amz-date",n&&n.stcDate),a.setRequestHeader("Content-Type",o),a.send(r),a.onreadystatechange=function(){if(4===a.readyState)if(200===a.status||204===a.status){var e=a.getResponseHeader("etag");console.log("etag:"+s,e),h.set(s,e),c(e)}else d.includes(s)||d.push(s),u(s)}}),(function(e){console.log("getETags:签名验证失败"),d.includes(s)||d.push(s),u(s)}))}))}}(e,t,n);else{var l=t.data(e,t);Na[Aa[0][0]](l,t,n,e)}}(e,this.options,{onProgress:function(e,n,r){Ba=e,r?Ba=Fa+e/n*(n-Fa):Fa=Ba,t.onProgress(Ba,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 ja,Ka,qa=function(e){return new Ha(e)},Ya=function(e,t){!function(e,t,n){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image;o.onload=function(){var a=function(e,t,n){var r,i,o,a=e<t,s=0,c=0;return(a?t/e:e/t)>n.scale?(a?(i=100,c=((o=t/(r=e/100))-n.maxHeight)/2):(o=100,s=((i=e/(r=t/100))-n.maxWidth)/2),{w:i,h:o,x:-s,y:-c}):(a?(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:-s,y:-c})}(o.width,o.height,t);r.width=a.w>t.maxWidth?t.maxWidth:a.w,r.height=a.h>t.maxHeight?t.maxHeight:a.h,i.drawImage(o,a.x,a.y,a.w,a.h);try{var s=r.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");s=s.replace(c,""),n(s)}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)},Ga=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=qa(e);t(i)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=qa(e);t(n)}},za=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||Ya;e.compress?r(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Ja=function(e){var t=this;this.instance=e,this.upload=function(e,n){za({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Wa=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var r={file:e,compress:n.cfg};za(r,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Qa=function(e,t){Ga(e,(function(e){var n=new Ja(e);t(n)}))},Xa=function(e,t){Ga(e,(function(n){var r={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},i=new Wa(n,r);t(i)}))};function Za(e){return ja=ja||new AudioContext,new Promise((function(t,n){ja.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function $a(e,t,n){return Mo(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d;return Lo(this,(function(h){switch(h.label){case 0:return n=n||{},t instanceof ba==0?(Do.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,da.ILLGAL_PARAMS]):(Zt("conversation.channelId",null==e?void 0:e.channelId,jt.CHANNEL_ID),r=e.conversationType,i=e.targetId,o=e.channelId,a="conversationType:"+r+",targetId:"+i,Do.debug("send message ->"+a),(s=Object.assign(n,t)).channelId=o||"",[4,la.imClient.context.sendMessage(r,i,s)]);case 1:return c=h.sent(),u=c.code,l=c.data,u===st.SUCCESS?(d=ca(l),[2,{code:u,data:d}]):(Do.warn("send message fail ->"+u+":"+ha[u]+","+a),[2,{code:u,msg:ha[u],data:ca({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:la.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:ot.SEND,isOffLineMessage:!1,sentTime:(null==l?void 0:l.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:ce.UNREAD})}])}}))}))}function es(e,t){return function(n,r,i,o){return new Promise((function(a){var s;!function(e,t,n,r){var i,o=this;if(void 0===t&&(t=Ve.FILE),i=t===Ve.IMAGE?Ve.IMAGE:Ve.FILE,!Ka){Ka="upload.qiniup.com";var a=la.imClient.context.getInfoFromCache();if(a&&a.ossConfig)try{var s=JSON.parse(a.ossConfig).find((function(e){return void 0!==e.qiniu}));s&&(Ka=s.qiniu)}catch(e){}}var c=Po({domain:Ka,getToken:function(e){la.imClient.context.getFileToken(i).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},r);(i===Ve.IMAGE?Xa:Qa)(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 Mo(o,void 0,void 0,(function(){var o=this;return Lo(this,(function(a){return function(e,t,n,r,i){return Zt("fileType",e,Xe,!0),Zt("filename",t,jt.STRING),Zt("saveName",n,jt.STRING),Zt("serverType",i,jt.NUMBER),new Promise((function(o){la.imClient.context.getFileUrl(e,t,n,r,i).then((function(e){o({code:st.SUCCESS,data:e})})).catch((function(e){o({code:e})}))}))}(i,r.filename,r.name,r,r.uploadMethod).then((function(a){return Mo(o,void 0,void 0,(function(){var o,s;return Lo(this,(function(c){return 0!==a.code?(n.onFail(a),[2]):((o=a.data).type=e.type,o.name=r.name||r.filename,t===Ve.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Za).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):((s=new FileReader).onload=function(){s.result?Za(s.result).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):n.onSuccess(o)},s.onerror=function(){o.duration=0,n.onSuccess(o)},s.readAsArrayBuffer(e)),[2]):(i===Ve.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 s,c=(null===(s=null==i?void 0:i.onComplete)||void 0===s?void 0:s.call(i,{url:e.downloadUrl}))||t(e,r);$a(n,c,o).then(a)},onFail:function(e){a({code:st.UPLOAD_FILE_FAILED,msg:e||st[st.UPLOAD_FILE_FAILED]})}},(null===(s=o)||void 0===s?void 0:s.thumbnailConfig)||{})}))}}function ts(e,t,n,r){return Zt("messageType",e,jt.STRING,!0),Zt("isPersited",t,jt.BOOLEAN,!0),Zt("isCounted",n,jt.BOOLEAN,!0),la.imClient.context.registerMessageType(e,t,n,r),Ca(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 ns(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(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(a,s)}c((r=r.apply(e,t||[])).next())}))}es(Ve.FILE,(function(e,t){return new Oa({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),es(Ve.IMAGE,(function(e,t){return new Sa({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),es(Ve.AUDIO,(function(e,t){return new Ia({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),es(Ve.SIGHT,(function(e,t){return new wa({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})})),es(Ve.COMBINE_HTML,(function(e,t){return new xa({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})})),qt.add("imlib","5.1.1"),qt.validEngine("~5.1.1")||Do.error("The current engine version '"+qt.getInfo().engine+"' error,imlib required engine version at least '~5.1.1'.");var rs,is,os=new et("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"}(rs||(rs={})),function(e){e[e.JOIN_REFUSED=40032]="JOIN_REFUSED"}(is||(is={}));var as=function(){function e(){_(this,e),this.queue=[],this.locked=!1}return R(e,[{key:"checkToStart",value:function(){return ns(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}(),ss=new as,cs=function(e){return ss.push(e)},us=!0,ls=!0;function ds(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function hs(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 fs(e){return"boolean"!=typeof e?new Error("Argument type: "+T(e)+". Please use a boolean."):(us=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function ps(e){return"boolean"!=typeof e?new Error("Argument type: "+T(e)+". Please use a boolean."):(ls=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ms(){if("object"==("undefined"==typeof window?"undefined":T(window))){if(us)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function gs(e,t){ls&&console.warn(e+" is deprecated, please use "+t+" instead.")}function vs(e){return"[object Object]"===Object.prototype.toString.call(e)}function _s(e){return vs(e)?Object.keys(e).reduce((function(t,n){var r=vs(e[n]),i=r?_s(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,v({},n,i))}),{}):e}function ys(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?ys(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((function(t){ys(e,e.get(t),n)}))})))}function Rs(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&&ys(e,n,i)}))})),i}var bs=ms;function Cs(e,t){var n=e&&e.navigator;if(n.mediaDevices){var r=function(e){if("object"!=T(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"==T(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"==T(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"==T(e.video)){var a=e.video.facingMode;a=a&&("object"==T(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&s.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=a.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=r(e.video),bs("chrome: "+JSON.stringify(e)),i(e)}));e.video=r(e.video)}return bs("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 a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(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 Es(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ts(e){if("object"==T(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 hs(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ss(e){if("object"==T(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"==T(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.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 Is(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 a=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},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(n,r){t.apply(e,[function(e){n(s(a(e)))},r])})).then(i,o)}}}function ws(e){if("object"==T(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 Rs(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}),hs(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 Rs(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 ks(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 xs(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return ks(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 a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[n.id]=s,this._reverseStreams[s.id]=n,this.addStream(s)}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=s(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 s(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 a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(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 s(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 Os(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 Ns(e,t){hs(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 As,Ps,Ms=Object.freeze({__proto__:null,shimMediaStream:Es,shimOnTrack:Ts,shimGetSendersWithDtmf:Ss,shimGetStats:Is,shimSenderReceiverGetStats:ws,shimAddTrackRemoveTrackWithNative:ks,shimAddTrackRemoveTrack:xs,shimPeerConnection:Os,fixNegotiationNeeded:Ns,shimGetUserMedia:Cs,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"))}}),Ls=(As=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"==T(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],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.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"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[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:a?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=l}))),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 a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[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 a="msid:"+i.id+" "+e.rtpSender.track.id+"\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:"+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},As(Ps={exports:{}}),Ps.exports);function Us(e,t,n,r,i){var o=Ls.writeRtpDescription(e.kind,t);if(o+=Ls.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=Ls.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 a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(r?r.id:"-")+" "+a+"\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:"+Ls.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+Ls.localCName+"\r\n"),o}function Ds(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),a=r(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(r){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(r.name.toLowerCase()===a.name.toLowerCase()&&r.clockRate===a.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&a.parameters.apt&&!i(r,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(r.numChannels,a.numChannels),n.codecs.push(a),a.rtcpFeedback=a.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 Vs(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 Bs(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 Fs(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 Hs(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 js(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 Ks(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 Fs("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=Ls.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 Fs("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw Fs("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 Fs("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 Fs("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 a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=Ls.writeCandidate(a);o.candidate=Object.assign(o.candidate,Ls.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=Ls.getMediaSections(r._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r._localDescription.sdp=Ls.getDescription(r._localDescription.sdp)+u.join("");var l=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",o),l&&(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=Ds(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:Ls.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(Fs("TypeError",'Unsupported type "'+e.type+'"'));if(!Vs("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(Fs("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=Ls.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=Ls.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=Ls.splitSections(r._remoteDescription.sdp),n=t.shift();var i=Ls.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var o=r.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(Ls.isRejected(e)&&0===Ls.matchPrefix(e,"a=bundle-only").length||o.rejected)){var d=Ls.getIceParameters(e,n),h=Ls.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===s.state&&s.start(a,d,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var f=Ds(u,l);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(Fs("TypeError",'Unsupported type "'+i.type+'"'));if(!Vs("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(Fs("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=Ls.splitSections(i.sdp),u=c.shift(),l=Ls.matchPrefix(u,"a=ice-lite").length>0,d=Ls.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var h=Ls.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=Ls.splitLines(r),f=Ls.getKind(r),p=Ls.isRejected(r)&&0===Ls.matchPrefix(r,"a=bundle-only").length,m=h[0].substr(2).split(" ")[2],g=Ls.getDirection(r,u),v=Ls.parseMsid(r),_=Ls.getMid(r)||Ls.generateIdentifier();if(p||"application"===f&&("DTLS/SCTP"===m||"UDP/DTLS/SCTP"===m))o.transceivers[c]={mid:_,kind:f,protocol:m,rejected:!0};else{var y,R,b,C,E,T,S,I,w;!p&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(f,!0));var k,x,O=Ls.parseRtpParameters(r);p||(k=Ls.getIceParameters(r,u),(x=Ls.getDtlsParameters(r,u)).role="client"),S=Ls.parseRtpEncodingParameters(r);var N=Ls.parseRtcpParameters(r),A=Ls.matchPrefix(r,"a=end-of-candidates",u).length>0,P=Ls.matchPrefix(r,"a=candidate:").map((function(e){return Ls.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!p&&d&&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,b=y.iceTransport,C=y.dtlsTransport,E=y.rtpReceiver,T=y.sendEncodingParameters,I=y.localCapabilities,o.transceivers[c].recvEncodingParameters=S,o.transceivers[c].remoteCapabilities=O,o.transceivers[c].rtcpParameters=N,P.length&&"new"===b.state&&(!l&&!A||d&&0!==c?P.forEach((function(e){Bs(y.iceTransport,e)})):b.setRemoteCandidates(P)),d&&0!==c||("new"===b.state&&b.start(R,k,"controlling"),"new"===C.state&&C.start(x)),!Ds(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"===g||"recvonly"===g,"sendrecv"===g||"sendonly"===g),!E||"sendrecv"!==g&&"sendonly"!==g?delete y.rtpReceiver:(w=E.track,v?(a[v.stream]||(a[v.stream]=new e.MediaStream),n(w,a[v.stream]),s.push([w,E,a[v.stream]])):(a.default||(a.default=new e.MediaStream),n(w,a.default),s.push([w,E,a.default]))));else{(y=o.transceivers[c]||o._createTransceiver(f)).mid=_,y.iceGatherer||(y.iceGatherer=o._createIceGatherer(c,d)),P.length&&"new"===y.iceTransport.state&&(!A||d&&0!==c?P.forEach((function(e){Bs(y.iceTransport,e)})):y.iceTransport.setRemoteCandidates(P)),I=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(I.codecs=I.codecs.filter((function(e){return"rtx"!==e.name}))),T=y.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var M,L=!1;"sendrecv"===g||"sendonly"===g?(L=!y.rtpReceiver,E=y.rtpReceiver||new e.RTCRtpReceiver(y.dtlsTransport,f),L&&(w=E.track,v&&"-"===v.stream||(v?(a[v.stream]||(a[v.stream]=new e.MediaStream,Object.defineProperty(a[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(w,"id",{get:function(){return v.track}}),M=a[v.stream]):(a.default||(a.default=new e.MediaStream),M=a.default)),M&&(n(w,M),y.associatedRemoteMediaStreams.push(M)),s.push([w,E,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=I,y.remoteCapabilities=O,y.rtpReceiver=E,y.rtcpParameters=N,y.sendEncodingParameters=T,y.recvEncodingParameters=S,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(a).forEach((function(t){var n=a[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)}))}s.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(o,t,i,[n])}))}})),s.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(Fs("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 a=Ls.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var o=r.track,a=r.kind,s=r.mid||Ls.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);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"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,a)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(a+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){a+=Us(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+Ls.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(Fs("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(Fs("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=Ls.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=Ls.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 a;e.stream&&("audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var s=Ds(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=Us(e,s,"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(Fs("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<n.transceivers.length;a++)if(n.transceivers[a].mid===e.sdpMid){o=a;break}var s=n.transceivers[o];if(!s)return i(Fs("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?Ls.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&&s.iceTransport!==n.transceivers[0].iceTransport)&&!Bs(s.iceTransport,c))return i(Fs("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=Ls.getMediaSections(n._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=Ls.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var l=0;l<n.transceivers.length&&(n.transceivers[l].rejected||(n.transceivers[l].iceTransport.addRemoteCandidate({}),(t=Ls.getMediaSections(n._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=Ls.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));l++);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 Fs("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&&gs("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),ms("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function qs(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Ys=Object.freeze({__proto__:null,shimPeerConnection:Ks,shimReplaceTrack:qs,shimGetUserMedia:Hs,shimGetDisplayMedia:js});function Gs(e,t){var n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){gs("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"==T(e)&&"object"==T(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 a=r.prototype.getSettings;r.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==T(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function zs(e){"object"==T(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 Js(e,t){if("object"==T(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],a=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,a)}}}function Ws(e){if("object"==T(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 Qs(e){if("object"==T(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}),hs(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Xs(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;gs("removeStream","removeTrack"),this.getSenders().forEach((function(n){n.track&&e.getTracks().includes(n.track)&&t.removeTrack(n)}))})}function Zs(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function $s(e){if("object"==T(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 ec(e){if("object"==T(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 tc(e){if("object"==T(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 nc(e){if("object"==T(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 rc=Object.freeze({__proto__:null,shimOnTrack:zs,shimPeerConnection:Js,shimSenderGetStats:Ws,shimReceiverGetStats:Qs,shimRemoveStream:Xs,shimRTCDataChannel:Zs,shimAddTransceiver:$s,shimGetParameters:ec,shimCreateOffer:tc,shimCreateAnswer:nc,shimGetUserMedia:Gs,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 ic(e){if("object"==T(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 oc(e){if("object"==T(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 ac(e){if("object"==T(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=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 s=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){var r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){var r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}}function sc(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(cc(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function cc(e){return e&&void 0!==e.video?Object.assign({},e,{video:_s(e.video)}):e}function uc(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")?(gs("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 lc(e){"object"==T(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 dc(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 hc(e){"object"!=T(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var fc=Object.freeze({__proto__:null,shimLocalStreamsAPI:ic,shimRemoteStreamsAPI:oc,shimCallbacksAPI:ac,shimGetUserMedia:sc,shimConstraints:cc,shimRTCIceServerUrls:uc,shimTrackEventTransceiver:lc,shimCreateOfferLegacy:dc,shimAudioContext:hc});function pc(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==T(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=Ls.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,hs(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function mc(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=Ls.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Ls.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=Ls.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},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&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]),l=i(u),d=o(arguments[0],u);c=0===l&&0===d?Number.POSITIVE_INFINITY:0===l||0===d?Math.max(l,d):Math.min(l,d);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function gc(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},hs(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 vc(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 _c(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 yc(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 Rc,bc,Cc,Ec=Object.freeze({__proto__:null,shimRTCIceCandidate:pc,shimMaxMessageSize:mc,shimSendThrowTypeError:gc,shimConnectionState:vc,removeExtmapAllowMixed:_c,shimAddIceCandidateNullOrEmpty:yc}),Tc=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=ms,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=ds(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=ds(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=ds(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=ds(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(t),o={browserDetails:i,commonShim:Ec,extractVersion:ds,disableLog:fs,disableWarnings:ps};switch(i.browser){case"chrome":if(!Ms||!Os||!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=Ms,yc(t,i),Cs(t,i),Es(t),Os(t,i),Ts(t),xs(t,i),Ss(t),Is(t),ws(t),Ns(t,i),pc(t),vc(t),mc(t,i),gc(t),_c(t,i);break;case"firefox":if(!rc||!Js||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=rc,yc(t,i),Gs(t,i),Js(t,i),zs(t),Xs(t),Ws(t),Qs(t),Zs(t),$s(t),ec(t),tc(t),nc(t),pc(t),vc(t),mc(t,i),gc(t);break;case"edge":if(!Ys||!Ks||!n.shimEdge)return r("MS edge shim is not included in this adapter release."),o;r("adapter.js shimming edge."),o.browserShim=Ys,Hs(t),js(t),Ks(t,i),qs(t),mc(t,i),gc(t);break;case"safari":if(!fc||!n.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=fc,yc(t,i),uc(t),dc(t),ac(t),ic(t),oc(t),lc(t),sc(t),hc(t),pc(t),mc(t,i),gc(t),_c(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"}(Rc||(Rc={})),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"}(bc||(bc={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(Cc||(Cc={}));var Sc=(v(X={},bc.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),v(X,bc.W176_H144,{width:176,height:144,maxBitrate:160,minBitrate:80}),v(X,bc.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),v(X,bc.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),v(X,bc.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),v(X,bc.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),v(X,bc.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),v(X,bc.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),v(X,bc.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),v(X,bc.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),v(X,bc.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),v(X,bc.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),v(X,bc.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),X),Ic=function(e,t){var n=e*t,r=Number.MAX_VALUE,i=null;for(var o in Sc){var a=Sc[o],s=Math.abs(a.width*a.height-n);s<r&&(i=a,r=s)}return i},wc={10:1,15:1,24:1.5,30:1.5},kc=function(e){var t=Number.MAX_VALUE,n=1;for(var r in wc){var i=Math.abs(e-parseInt(r));i<t&&(t=i,n=wc[r])}return n},xc=function(){return ns(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)})))},Oc=function(){return ns(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)})))},Nc=function(){return ns(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)})))},Ac=function(e){l(n,e);var t=h(n);function n(e,r,i,o,a){var s;return _(this,n),(s=t.call(this))._tag=e,s._userId=r,s._kind=i,s._isLocalTrack=o,s._roomId=a,s._localMuted=!1,s._remoteMuted=!1,s._streamId=[s._userId||s._roomId,s._tag].join("_"),s._id=[s._streamId,s.isAudioTrack()?0:1].join("_"),s}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(){os.info("set ".concat(this._id," enabled: false")),this._setLocalMuted(!0)}},{key:"unmute",value:function(){os.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 ns(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",(os.warn("the track is not ready to play -> id: ".concat(this._id)),{code:rs.TRACK_NOT_READY}));case 2:if("ended"===this._msTrack.readyState&&os.warn("the track's readyState is 'ended' -> id: ".concat(this._id)),!(null==t?void 0:t.volume)){n.next=6;break}if(He(null==t?void 0:t.volume)){n.next=5;break}return n.abrupt("return",(os.error("".concat(null==t?void 0:t.volume," is not a number, the valid range of options.volume is 0-100")),{code:rs.PARAMS_ERROR}));case 5:(null==t?void 0:t.volume)<0&&(t.volume=0,os.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,os.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,Nc();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",(os.error("the options.audioDeviceId is invalid --\x3e ".concat(t.audioDeviceId)),{code:rs.PARAMS_ERROR}));case 13:if(!(r=this.isVideoTrack())||e&&e instanceof HTMLVideoElement){n.next=16;break}return n.abrupt("return",(os.error("the video track need an <video> to play -> id: ".concat(this._id)),{code:rs.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;os.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;os.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;os.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;os.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;os.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;os.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));os.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?(os.error("setSinkId failed -> ".concat(n.t2.message)),{code:rs.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(os.error(n.t2),{code:rs.TRACK_PLAY_ERROR}));case 29:return n.abrupt("return",{code:rs.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}(rt),Pc=function(e){l(n,e);var t=h(n);function n(e,r,i,o){var a;return _(this,n),(a=t.call(this,e,r,i,!0))._isPublished=!1,a.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,a.emit(n.EVENT_LOCAL_TRACK_END,p(a)),a.removeAll(n.EVENT_LOCAL_TRACK_END)},a}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;os.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;!He(e)||!He(t)||!He(n)||e<=0||t<=0||e<t?os.error("setBitrate params error ->"):this._bitrateInfo={max:e,min:t,start:n}}},{key:"getBitrate",value:function(){var e,t,n=this._msTrack?Zc(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}(Ac);Pc.EVENT_LOCAL_TRACK_END="local-track-end",Pc.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",Pc.__INNER_EVENT_DESTROY__="inner-destroy";var Mc=function(e){l(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){os.warn("`setBitrate` invalid for audio track")}},{key:"getBitrate",value:function(){return{start:32,max:32,min:32}}}]),n}(Pc),Lc=function(e){l(n,e);var t=h(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _(this,n),(o=t.call(this,e,r,"video",i))._isTiny=a,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}(Pc),Uc=function(e){l(n,e);var t=h(n);function n(e,r,i,o,a){var s;return _(this,n),(s=t.call(this,e,r,i,o))._resource=a,n.__innerSetMapping(s.getTrackId(),a),s}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}(Pc);Uc._mapping=new Map;var Dc,Vc=function(e){l(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)}(Uc),Bc=function(e){l(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:rs.SUCCESS})}}]),n}(Uc),Fc=function(e){l(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Mc),Hc=function(e){l(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Lc),jc=function(e){l(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Lc),Kc=function(e){l(n,e);var t=h(n);function n(e,r,i,o){var a;return _(this,n),(a=t.call(this,e,r,i,!1,o))._isSubscribed=!1,a}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}(Ac),qc=function(e){l(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"audio",i)}return R(n)}(Kc),Yc=function(e){l(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"video",i)}return R(n)}(Kc),Gc=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},zc=function(e){return JSON.stringify(e)},Jc=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Wc="http:"!==location.protocol||["localhost","127.0.0.1"].includes(location.hostname),Qc=function(e){if(void 0===e)return 0;if(He(e))return e;var t=e;return t.exact||t.ideal||t.max||0},Xc=function(e){var t=e.getConstraints();return{width:Qc(t.width),height:Qc(t.height),frameRate:Qc(t.frameRate)}},Zc=function(e){var t=Xc(e),n=t.width,r=t.height,i=t.frameRate,o=Ic(n,r),a=kc(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},$c=function(e){return[e.msid,e.mediaType].join("_")},eu=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},tu=function(e,t){return[e,t].join("_")},nu=function(e){return e.map((function(e){return Object.assign({},e)}))},ru=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=$c(t),a=e.findIndex((function(e){return $c(e)===i}));if(n&&(a=e.findIndex((function(e){return e.uri===t.uri}))),-1!==a){var s=e[a];s.uri!==t.uri?r.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else r.push(t)})),i.push.apply(i,s(e)),{publishedList:r,unpublishedList:i,modifiedList:o}},iu=function(e){var t=e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),n=a(t,2);return{width:n[0],height:n[1]}},ou=function(e){return!!bc[e]},au=function(e){return!!Rc[e]},su=function(e){return parseInt(e.replace("FPS_",""))},cu={browser:(Dc=Tc.browserDetails).browser,version:Dc.version,supportsUnifiedPlan:!1!==Dc.supportsUnifiedPlan};function uu(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function lu(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var du,hu,fu=function(e){return"[object Null]"===Object.prototype.toString.call(e)},pu=function(e){return 1===e.type},mu=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,s(JSON.parse(i.uris)))}catch(e){os.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"}(du||(du={})),function(e){e.SUCCESS="Success",e.FAIL="Fail"}(hu||(hu={}));var gu,vu=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 ns(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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,new Promise((function(e){a._context.rtcPing(a._roomId,a._roomMode).then(e).catch((function(t){os.error("rtcping receive unknown error -> ".concat(t)),e(st.UNKNOWN)})),setTimeout(e,1e4,st.TIMEOUT)}));case 2:if(i=r.sent,o=Date.now(),i!==st.SUCCESS){r.next=6;break}return r.abrupt("return",(this._latestTimestamp=o,void(null===(e=this.onPingResult)||void 0===e||e.call(this,hu.SUCCESS))));case 6:null===(t=this.onPingResult)||void 0===t||t.call(this,hu.FAIL),os.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"}(gu||(gu={}));var _u,yu,Ru,bu,Cu,Eu=function(e,t){return Math.round(8*t/e)},Tu=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},Su=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)},Iu=function(e,t,n,r){if(0===t)return 0;if(!n||!r)return Tu(e/t,3);var i=t-r;if(0===i)return 0;var o=e-n;return o<0||i<0?0:Tu(o/i,3)},wu=function(e){var t=e.jitter,n=e.rtt,r=e.packetsLostRate;return!fu(t)||!fu(n)||0!==r},ku=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 Eu(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 Eu(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,a=i.packetsSent;r=Iu(t,n,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:n}else r=Iu(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,a=i.packetsRecv;r=Iu(t,n+t,o,a+o)}else r=Iu(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())===Cc.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,a=null===(t=this._rtcPeerConn.currentLocalDescription)||void 0===t?void 0:t.sdp,s=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==a?void 0:a.split("\r\nm="),u=null==c?void 0:c.filter((function(e){return e.includes("a=ssrc:".concat(i))}))[0],l=null==u?void 0:u.match(r),d=l?l[1]:"";if(d)return"".concat(d,"_").concat("video"===o?1:0);var h=null==s?void 0:s.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 d=p?p[1]:"","".concat(d,"_").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}(),xu=function(e){l(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,a=0;i.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var s=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidSender(s)){var c=s.id,u=s.kind,l=(s.transportId,s.mediaSourceId),d=s.remoteId,h=s.packetsSent,f=s.bytesSent,p=s.trackId,m=s.encoderImplementation,g=s.pliCount,v=s.nackCount;s.firCount;if(p){var _=s.framesPerSecond,y=s.frameWidth,R=s.frameHeight;"video"!==u||y||R||_||(y=e[p].frameWidth,R=e[p].frameHeight,_=l?e[l].framesPerSecond:null);var b=e[d],C=null,E=null,T=0;b&&(C=b.jitter,E=b.roundTripTime,T=b.packetsLost),o+=T;var S=t.getResourceIdByParseSdp(s),I=l?e[l].audioLevel:e[p].audioLevel,w=null;!t._latestPacketsSent[S]&&(t._latestPacketsSent[S]={}),b?w=t.updateSenderPacketsLost(S,T,h):t._latestPacketsSent[S].crtPacketsSent=h;var k=t.updateBytesSent(S,f,r);k<0&&(k=0),a+=k,n.senders.push({id:c,trackId:S,kind:u,packetsLostRate:w,remoteResource:!1,audioLevel:I||0===I?Su(I):null,frameWidth:y,frameHeight:R,frameRate:_,bitrate:k,jitter:C?Math.round(1e3*C):C,rtt:E,encoderImplementation:m,pliCount:g,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,a=i.jitter,s=i.roundTripTime,c=i.packetsLost,u=n.senders.filter((function(e){return e.id===o}))[0];if(u&&!wu(u)){var l=t.getResourceIdByParseSdp(e[u.id]);u.jitter=Math.round(1e3*a),u.rtt=s;var d=t._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=t.updateSenderPacketsLost(l,c,d)}}));var s=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var a=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(a)){var c=a.trackId,u=a.packetsLost,l=a.packetsReceived,d=a.jitter,h=a.bytesReceived,f=a.framesPerSecond,p=a.kind,m=a.codecImplementationName,g=a.nackCount,v=a.pliCount;if(c){var _=a.frameWidth,y=a.frameHeight,R=a.audioLevel;"video"===p?_||y||(_=e[c].frameWidth,y=e[c].frameHeight):R||(R=e[c].audioLevel),o+=u;var b=t.getResourceIdByParseSdp(a),C=t.updateReceiverPacketsLost(b,u,l),E=t.updateBytesRecv(b,h,r);E<0&&(E=0),s+=E,n.receivers.push({trackId:b,kind:p,packetsLostRate:C,remoteResource:!0,audioLevel:R||0===R?Su(R):null,frameWidth:_,frameHeight:y,frameRate:f,bitrate:E,jitter:d?Math.round(1e3*d):0,codecImplementationName:m,nackCount:g,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 l=e[u],d=l.availableOutgoingBitrate,h=l.availableIncomingBitrate,f=l.currentRoundTripTime,p=l.localCandidateId,m=l.remoteCandidateId,g=e[p],v=g.ip,_=g.port,y=g.networkType,R=e[m],b=R.ip,C=R.port,E=R.protocol;n.iceCandidatePair={IP:v,port:_,networkType:y,remoteIP:b,remotePort:C,protocol:E,bitrateRecv:s,bitrateSend:a,rtt:1e3*f,availableOutgoingBitrate:d,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 a=o.mediaSourceId,s=o.trackId,c=t.getResourceIdByParseSdp(o),u=a&&e[a]?e[a].audioLevel:(null===(i=e[s])||void 0===i?void 0:i.audioLevel)||null;n.push({trackId:c,audioLevel:u||0===u?Su(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,a=i.audioLevel||e[o].audioLevel,s=t.getResourceIdByParseSdp(i);n.push({trackId:s,audioLevel:a||0===a?Su(a):null})}})),n}}]),n}(ku),Ou=function(e){l(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,a=0;for(var s in e){var c=e[s],u=c.type;if("outbound-rtp"===u){if("unified-plan"===this._sdpSemantics&&!this.isValidSender(c))continue;c.id;var l=c.kind,d=c.bytesSent,h=c.packetsSent,f=c.bitrateMean,p=c.framerateMean,m=c.nackCount,g=c.pliCount,v=c.remoteId,_=v?e[v]:{jitter:null,roundTripTime:null,packetsLost:0},y=_.jitter,R=_.roundTripTime,b=_.packetsLost,C=this.getResourceIdByParseSdp(c);i+=b;var E=null;!this._latestPacketsSent[C]&&(this._latestPacketsSent[C]={}),v?E=this.updateSenderPacketsLost(C,b,h):this._latestPacketsSent[C].crtPacketsSent=h;var T=0;"video"===l?f&&(T=Math.floor(f/1e3)):T=this.updateBytesSent(C,d,n),T<0&&(T=0),o+=T,r.senders.push({trackId:C,kind:l,packetsLostRate:E,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(p),bitrate:T,jitter:y?Math.round(1e3*y):null,rtt:R,encoderImplementation:null,pliCount:g,nackCount:m,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&&wu(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 S=c.packetsLost,I=c.bytesReceived,w=c.packetsReceived,k=c.jitter,x=c.framerateMean,O=c.kind,N=c.bitrateMean,A=c.nackCount,P=c.pliCount,M=this.getResourceIdByParseSdp(c);i+=S;var L=this.updateReceiverPacketsLost(M,S,w),U=0;"video"===O?N&&(U=Math.floor(N/1e3)):U=this.updateBytesRecv(M,I,n),U<0&&(U=0),a+=U,r.receivers.push({trackId:M,kind:O,packetsLostRate:L,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(x),bitrate:U,jitter:k?Math.round(1e3*k):null,codecImplementationName:null,nackCount:A,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:a,bitrateSend:o,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:i}}}return r.iceCandidatePair&&(r.iceCandidatePair.bitrateSend=o),r.iceCandidatePair&&(r.iceCandidatePair.bitrateRecv=a),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 a=this.getResourceIdByParseSdp(r);t.push({trackId:a,audioLevel:null})}}return t}}]),n}(ku),Nu=function(e){l(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,a=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 s=t.getResourceIdByParseSdp(o),c=o.mediaType,u=(o.transportId,o.remoteId,o.packetsSent,o.bytesSent),l=o.trackId,d=o.encoderImplementation,h=o.pliCount,f=o.nackCount;o.firCount;if(l){var p=e[l],m=p.audioLevel,g=p.frameHeight,v=p.frameWidth,_=t.updateBytesSent(s,u,r);_<0&&(_=0),a+=_,n.senders.push({trackId:s,kind:c,packetsLostRate:null,remoteResource:!1,audioLevel:m||0===m?Su(m):null,frameWidth:v,frameHeight:g,frameRate:null,bitrate:_,jitter:null,rtt:null,encoderImplementation:d,pliCount:h,nackCount:f,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}}}));var s=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var a=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(a)){var c=a.trackId,u=a.packetsLost,l=a.packetsReceived,d=a.jitter,h=a.bytesReceived,f=a.mediaType,p=a.nackCount,m=a.pliCount,g=t.getResourceIdByParseSdp(a);if(c){var v=e[c],_=v.frameHeight,y=v.frameWidth,R=v.audioLevel;o+=u;var b=t.updateReceiverPacketsLost(g,u,l),C=t.updateBytesRecv(g,h,r);C<0&&(C=0),s+=C,n.receivers.push({trackId:g,kind:f,packetsLostRate:b,remoteResource:!0,audioLevel:R||0===R?Su(R):null,frameWidth:y,frameHeight:_,frameRate:null,bitrate:C,jitter:d,codecImplementationName:null,nackCount:p,pliCount:m,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 l=e[u],d=l.availableOutgoingBitrate,h=l.availableIncomingBitrate,f=l.currentRoundTripTime,p=l.localCandidateId,m=l.remoteCandidateId,g=e[p],v=g.address,_=g.port,y=e[m],R=y.address,b=y.port,C=y.protocol;n.iceCandidatePair={IP:v||null,port:_,networkType:null,remoteIP:R,remotePort:b,protocol:C,bitrateRecv:s,bitrateSend:a,rtt:1e3*f,availableOutgoingBitrate:d,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 a=t.getResourceIdByParseSdp(i),s=e[o];n.push({trackId:a,audioLevel:s||0===s?Su(s):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,a=i.mediaType;if(o&&"video"!==a){var s=e[o].audioLevel,c=t.getResourceIdByParseSdp(i);n.push({trackId:c,audioLevel:s||0===s?Su(s):null})}}})),n}}]),n}(ku),Au=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=Xc(n),o=i.width,a=i.height;e.push({trackId:n.id,simulcast:r?gu.TINY:gu.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}},{key:"setRemoteAnswer",value:function(e){return ns(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",(os.error(t.t0),rs.SET_REMOTE_DESCRIPTION_FAILED));case 9:return t.abrupt("return",rs.SUCCESS);case 10:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"getStatParsr",value:function(e,t){return/chrome/i.test(cu.browser)?new xu(e,t):/Firefox/i.test(cu.browser)?new Ou(e,t):/Safari/i.test(cu.browser)?new Nu(e,t):null}}],[{key:"setSdpSemantics",value:function(e){var t=cu.browser,n=cu.version;cu.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}(),Pu=function(e){l(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 ns(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 a=[";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+a})),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(Au),Mu=function(e){l(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){os.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 a=o.sender,s=a.track;this._peer.removeTrack(a),a.replaceTrack(null),this._outboundStreams["".concat(n,"_tiny")].removeTrack(s),s.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var n=eu(e).mediaType;this._recvTransceiver[e]=t;var r=n===Cc.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 a={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":a[n]+=1}));for(var s=this._recvAudio.length;s<a.audio;s+=1)this._recvAudio.push(this._peer.addTransceiver("audio",{direction:"recvonly"}));for(var c=this._recvVideo.length;c<a.video;c+=1)this._recvVideo.push(this._peer.addTransceiver("video",{direction:"recvonly"}))}},{key:"createOffer",value:function(e){return ns(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 a in t._sendTransceiver)if(t._sendTransceiver[a].mid===i){o=a;break}if(!o)return e;var s=null===(n=t._localTracks[o])||void 0===n?void 0:n.getBitrate();if(!s)return e;var c=s.max,u=s.min,l=c&&c>0?s.start||.7*c:0,d=[];if(c&&c>0&&d.push(";x-google-max-bitrate=".concat(c)),u&&u>0&&d.push(";x-google-min-bitrate=".concat(u)),l>0&&d.push(";x-google-start-bitrate=".concat(l)),0===d.length)return e;var h=d.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)&&(os.warn("answer sdp invalid -> ".concat(JSON.stringify(e))),e=e.replace(r,"\r\n")),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(Au),Lu=function(e){l(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=Au.getSdpSemantics(),a=i._rtcPeerConn=new RTCPeerConnection({sdpSemantics:o});return i._sdpStrategy="plan-b"===o?new Pu(a):new Mu(a),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(){os.info("onconnectionstatechange -> ".concat(this._rtcPeerConn.connectionState))}},{key:"_onICEConnectionStateChange",value:function(){var e,t;os.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||(os.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){os.error("onICEConnectionStateChange error",e)}}},{key:"_onTrackReady",value:function(e){if(e.streams.length){var t=[e.streams[0].id,"audio"===e.receiver.track.kind?Cc.AUDIO_ONLY:Cc.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(t,e.transceiver),this.emit(n.__INNER_EVENT_TRACK_READY__,e)}}},{key:"setBitrate",value:function(e,t,n){return ns(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 ns(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",(os.debug("offer -> ".concat(JSON.stringify(n.sdp))),n));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){return ns(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",(os.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(Pc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Pc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(Pc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(Pc.__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(Pc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Pc.__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(Pc.__INNER_EVENT_MUTED_CHANGE__,e)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(Pc.__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 a in null==r||delete r.totalPacketsLost,r)fu(r[a])&&delete r[a];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 ns(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 ns(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 ns(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}(rt);Lu.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(_u||(_u={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(yu||(yu={}));var Uu=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:yu.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()===ut.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())===Cc.AUDIO_ONLY?"audio":"video",o=n.pop();t=[n.join("_"),o,r,i].join("_")}else{var a=parseInt(n.pop())===Cc.AUDIO_ONLY?"audio":"video",s=n.pop();t=[n.join("_"),s,a].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,a=(null==n?void 0:n.bitrateRecv)||-1,s=(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),l=(null==n||n.remoteIP,null==n||n.remotePort,(null==n?void 0:n.availableIncomingBitrate)||-1),d=(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(s,"\t").concat(c,"\t").concat(u,"\t").concat(l,"\t").concat(d,"\t").concat(h,"\t").concat(f,"\r"),m="R4\t".concat(a,"\t-1\t-1\t-1\t").concat(s,"\t").concat(c,"\t").concat(u,"\t").concat(l,"\t").concat(d,"\t").concat(h,"\t").concat(f,"\r"),g=r.map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,a=e.bitrate,s=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,l=e.frameHeight,d=e.googRenderDelayMs,h=e.jitter,f=e.nackCount,p=e.pliCount,m=e.rtt,g=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:a||0===a?a:-1,packetsLostRate:s||0===s?s:-1,frameRate:c||-1,resolution:u&&l?"".concat(u," * ").concat(l):"-1",jitter:h||-1,nackCount:f||0===f?f:-1,pliCount:p||0===p?p:-1,rtt:m||-1,googFirsSent:g,samplingRate:o,googRenderDelayMs:d,encoderImplementation:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getLocalTrack(y))||void 0===n?void 0:n.isLocalMuted())?_u.DISABLE:_u.ENABLE}})),v=i.filter((function(e){return!!e.trackId})).map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,a=e.bitrate,s=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,l=e.frameHeight,d=e.googRenderDelayMs,h=e.jitter,f=e.nackCount,p=e.pliCount,m=e.rtt,g=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:a||0===a?a:-1,packetsLostRate:s||0===s?s:-1,frameRate:c||-1,resolution:u&&l?"".concat(u," * ").concat(l):"-1",jitter:h||-1,nackCount:f||0===f?f:-1,pliCount:p||0===p?p:-1,rtt:m||-1,googFirsReceived:g,samplingRate:o,googRenderDelayMs:d,codecImplementationName:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getRemoteTrack(y))||void 0===n?void 0:n.isLocalMuted())?_u.DISABLE:_u.ENABLE}}));p+=g.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)),m+=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(m+"\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(cu.browser,"\t").concat(cu.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"}(Ru||(Ru={})),function(e){e.BEGIN="begin",e.END="end"}(bu||(bu={}));var Du=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 ns(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=ll.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?os.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"}(Cu||(Cu={}));var Vu,Bu,Fu,Hu=function(e){return e instanceof Ac?e.getTrackId():e.track.getTrackId()},ju=function(){function e(t,n,r,i,o,a,s,c,u,l){var d=this;_(this,e),this._context=t,this._runtime=n,this._roomId=r,this._roomMode=o,this._service=a,this._initOptions=s,this._ntfClearRoomItem=c,this._isMainRoom=l,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new as,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=u?{}:mu(i),this._initRemoteTracks();var h=this._context.getCurrentId(),f=this._roomResources[h]=this._roomResources[h]||[];os.debug("room data -> ".concat(JSON.stringify(this._roomResources))),f.length>0&&cs((function(){return d._unpublishPrev(f)})),u&&this._afterChangedRole(i),this._pinger=new vu(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 Uu(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new Lu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(Lu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(Pc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(Pc.__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=$c(t),r=eu(n),i=r.tag,o=r.userId,a=r.mediaType===Cc.AUDIO_ONLY?new qc(i,o):new Yc(i,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[n]=a}))}}},{key:"_handlePingResult",value:function(e){this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,n){os.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),Zt("max",e,(function(e){return He(e)&&e>Math.max(t||1,200)}),!0),Zt("min",t,(function(t){return He(t)&&t>=1&&(!He(e)||t<e)}),!0),Zt("start",n,(function(n){return He(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?Cc.AUDIO_ONLY:Cc.VIDEO_ONLY].join("_"),i=this._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),this._callAppListener("onTrackReady",i)):os.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){os.error(e)}}},{key:"_onUserUnpublish",value:function(e){return ns(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 ns(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,os.info("unpublish uris prev login: ".concat(JSON.stringify(n))),t.next=4,this._context.setRTCTotalRes(this._roomId,Gc(du.UNPUBLISH,n),zc([]),du.TOTAL_CONTENT_RESOURCE,zc([]));case 4:(r=t.sent)!==st.SUCCESS?os.error("unpublish prev uris failed -> code: ".concat(r)):os.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!==Le.RTC_ROOM)return!1;if(n!==this._roomId)return!0;os.info("recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId));var r=e.content;switch(e.messageType){case du.KICK:this._kickoff(!0,r);break;case du.STATE:this.msgTaskQueue.push((function(){return t._stateHandle(r)}));break;case du.MODIFY:case du.PUBLISH:case du.UNPUBLISH:case du.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push((function(){return t._resourceHandle(r,e.messageType,e.senderUserId)}));break;case du.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case du.USER_NOTIFY:os.warn("TODO: ".concat(du.USER_NOTIFY));break;case du.PK_INVITE:case du.PK_CANCEL_INVITE:case du.PK_INVITE_TIMEOUT:case du.PK_INVITE_ANSWER:case du.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case du.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;os.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C,E,T,S,I,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 os.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=[],a=[],c=[],l=this._roomResources[n]||(this._roomResources[n]=[]),r.t0=t,r.next=r.t0===du.MODIFY?10:r.t0===du.PUBLISH?12:r.t0===du.UNPUBLISH?14:r.t0===du.TOTAL_CONTENT_RESOURCE?16:17;break;case 10:return c.push.apply(c,s(i)),r.abrupt("break",17);case 12:return o.push.apply(o,s(i)),r.abrupt("break",17);case 14:return a.push.apply(a,s(i)),r.abrupt("break",17);case 16:u=ru(l,i),o.push.apply(o,s(u.publishedList)),a.push.apply(a,s(u.unpublishedList)),c.push.apply(c,s(u.modifiedList));case 17:if(!(o.length>0)){r.next=28;break}if(d=l.map($c),h=[],f=[],o.forEach((function(e){var t=$c(e),n=d.indexOf(t),r=eu(t),i=r.userId,o=r.tag,a=r.mediaType;n>-1?l[n]=e:l.push(e);var s=w._remoteTracks[t];s?s.isSubscribed()&&h.push(s):(s=a===Cc.AUDIO_ONLY?new qc(o,i):new Yc(o,i),w._remoteTracks[t]=s,f.push(s)),s.__innerSetRemoteMuted(0===e.state)})),!h.length){r.next=27;break}return p=h.map((function(e){return e.getTrackId()})),os.debug("resub tracks -> ".concat(JSON.stringify(p))),r.next=24,cs((function(){return w.__subscribe(h,!0)}));case 24:m=r.sent,(g=m.code)!==rs.SUCCESS&&os.error("resub tracks failed -> code: ".concat(g,", ids: ").concat(JSON.stringify(p)));case 27:this._onTrackPublish(f);case 28:if(!(a.length>0)){r.next=34;break}for(v=a.map($c),_=l.length-1;_>=0;_-=1)y=l[_],v.includes($c(y))&&l.splice(_,1);return R=a.map((function(e){var t=$c(e);return w._remoteTracks[t]})),r.next=34,this._onUserUnpublish(R);case 34:if(c.length>0)for(b=l.map($c),C=0;C<c.length;C+=1)E=c[C],T=$c(E),S=b.indexOf(T),l[S].state=E.state,(I=this._remoteTracks[T]).__innerSetRemoteMuted(0===E.state),I.isAudioTrack()?this._onAudioMuteChange(I):this._onVideoMuteChange(I);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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,c,u,l,d,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=[],a=[],c=[],r.forEach((function(e){0==+e.state?(os.debug("user joined -> ".concat(e.userId)),f._roomResources[e.userId]||(e.switchRoleType?a.push(e.userId):i.push(e.userId)),f._roomResources[e.userId]=f._roomResources[e.userId]||[]):(os.debug("user left -> ".concat(e.userId)),e.switchRoleType?c.push(e.userId):o.push(e.userId))})),u=[].concat(i,a),!(l=[].concat(o,c)).length){n.next=15;break}if(d=[],h=[],l.forEach((function(e){d.push.apply(d,s(f.getRemoteTracksByUserId(e))),h.push(e)})),n.t0=d.length,!n.t0){n.next=14;break}return n.next=13,this.unsubscribe(d);case 13:d.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",(a.length&&a.forEach((function(e){return f._callAppListener("onSwitchRole",e,Cu.ANCHOR)})),c.length&&c.forEach((function(e){return f._callAppListener("onSwitchRole",e,Cu.AUDIENCE)})),i.length&&this._callAppListener("onUserJoin",i),void(o.length&&this._callAppListener("onUserLeave",o))));case 17:u.length&&this._callAppListener("onUserJoin",u),l.length&&this._callAppListener("onUserLeave",l);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,s(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 ns(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(Le.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 2:return r=n.sent,i=r.code,n.abrupt("return",i!==st.SUCCESS?(os.error("send message failed -> code: ".concat(i)),{code:rs.SIGNAL_ERROR}):{code:rs.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 ns(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,Dt.ROOM,n);case 2:return o=i.sent,i.abrupt("return",o!==st.SUCCESS?(os.error("SetRoomAttributeValue Failed: ".concat(o)),{code:rs.SIGNAL_ERROR}):{code:rs.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 ns(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,Dt.ROOM,t);case 2:return i=r.sent,r.abrupt("return",i!==st.SUCCESS?(os.error("DeleteRoomAttribute Failed: ".concat(i)),{code:rs.SIGNAL_ERROR}):{code:rs.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 ns(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,Dt.ROOM);case 2:return r=n.sent,i=r.code,o=r.data,n.abrupt("return",i!==st.SUCCESS?(os.error("GetRoomAttributes Failed: ".concat(i)),{code:rs.SIGNAL_ERROR}):{code:rs.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,Dt.PERSON,n)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Dt.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,Dt.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 ns(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 Lc&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s,c,u,l=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]||[],a=[],s=function(e){var t=o[e],n=$c(t),r=i.findIndex((function(e){return e.resourceId===n}));if(r>=0){var s=i[r].enabled;return t.state=s?1:0,a.push(t),"break"}},c=0;case 3:if(!(c<o.length)){t.next=10;break}if("break"!==s(c)){t.next=7;break}return t.abrupt("break",10);case 7:c+=1,t.next=3;break;case 10:return t.next=12,cs((function(){return l._context.setRTCTotalRes(l._roomId,Gc(du.MODIFY,a),zc(o),du.TOTAL_CONTENT_RESOURCE)}));case 12:(u=t.sent)!==st.SUCCESS&&os.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 Pc?e:e.track;os.debug("remove pub failed track from peerconnection -> trackId: ".concat(n.getTrackId())),t._pc.removeLocalTrackById(n.getTrackId())}))}},{key:"publish",value:function(e){return ns(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",cs((function(){return n.__publish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__publish",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s,c,u,l,d,h,f,p,m,g,v,_,y,R,b=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._isMainRoom||!(this instanceof $u)){t.next=2;break}return t.abrupt("return",(os.error("the `publish` is disabled in PK room "),{code:rs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){t.next=4;break}return t.abrupt("return",(os.error("publish failed, room has been destroyed. -> roomId: ".concat(this._roomId)),{code:rs.ROOM_HAS_BEEN_DESTROYED}));case 4:if($t("tracks",e,(function(){return je(e)&&e.length>0&&e.every((function(e){return e instanceof Pc||e.track instanceof Pc}))}),!0)){t.next=6;break}return t.abrupt("return",(os.error("publish failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:rs.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 Pc?t++:e.pubTiny&&e.track.isVideoTrack()?t+=2:t++})),t}(e)>10)){t.next=9;break}return t.abrupt("return",(os.error("publish failed, tracks limit exceeded -> roomId: ".concat(this._roomId)),{code:rs.PUBLISH_TRACK_LIMIT_EXCEEDED}));case 9:return os.debug("publish tracks -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Hu))),e.forEach((function(e){var t=e instanceof Pc?{pubTiny:!1,track:e}:e,n=t.track,r=t.pubTiny;if(b._pc.addLocalTrack(n),n.isVideoTrack()&&r){var i;try{i=n.__innerGetMediaStreamTrack().clone();var o=r.frameRate||Rc.FPS_15,a=r.resolution||bc.W176_H144,s=iu(a),c=s.width,u=s.height,l=su(o);i.applyConstraints({width:c,height:u,frameRate:l})}catch(r){return null==i||i.stop(),void os.warn("pubTiny failed -> id: ".concat(n.getTrackId(),", msg: ").concat(r.message))}b._pc.addLocalTrack(new Lc(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===rs.SUCCESS){t.next=20;break}return t.abrupt("return",(os.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(o.code)),this._removePubFailedTracks(e),{code:o.code}));case 20:if(a=o.data,s=a.publishList,c=a.sdp,u=a.resultCode,l=a.message,d=a.urls,h=a.mcuPublishList,u===rs.SUCCESS){t.next=23;break}return t.abrupt("return",(os.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(u,", msg: ").concat(l)),this._removePubFailedTracks(e),{code:u}));case 23:return t.next=25,this._pc.setRemoteAnswer(c.sdp);case 25:if((f=t.sent)===rs.SUCCESS){t.next=28;break}return t.abrupt("return",{code:f});case 28:return p=this._roomResources[n],m=s.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:b._getResourceState($c(e))},e)})),g=ru(p,m),v=g.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,Gc(du.PUBLISH,v),zc(m),du.TOTAL_CONTENT_RESOURCE,zc(_));case 35:if((y=t.sent)===st.SUCCESS){t.next=38;break}return t.abrupt("return",(os.error("send publish streams notification failed: ".concat(y)),{code:rs.SIGNAL_ERROR}));case 38:return this._roomResources[n]=m,R=v.map((function(e){return $c(e)})),t.abrupt("return",(this._polarisReport&&this._polarisReport.sendR2(Ru.PUBLISH,bu.BEGIN,R),e.forEach((function(e){(e instanceof Pc?{track:e}:e).track.__innerSetPublished(!0)})),os.debug("publish success: ".concat(R.join(","))),this._roomMode===Pt.LIVE?{code:rs.SUCCESS,liveUrl:null==d?void 0:d.liveUrl}:{code:rs.SUCCESS}));case 41:case"end":return t.stop()}}),t,this)})))}},{key:"_getPushOtherRoomsParams",value:function(){if(this instanceof $u){var e=this.getRoomPKHandler(),t=e.code,n=e.roomPKHandler,r=[];if(t===rs.SUCCESS&&n){var i=n.getJoinedPKRooms();for(var o in i){var a=i[o].getSessionId(),s=n.getPKInfo(o);if(!s)return;var c=s.inviterUserAutoMix,u=s.inviteeUserAutoMix,l=s.inviterUserId,d=this._context.getCurrentId()===l;r.push({roomId:o,sessionId:a,autoMix:d?!!c:!!u})}}return r}}},{key:"_reTryExchange",value:function(){return ns(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:cs((function(){return ns(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s;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===rs.SUCCESS){e.next=10;break}return e.abrupt("return",(os.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 10:if(i=r.data,o=i.sdp,(a=i.resultCode)===rs.SUCCESS){e.next=13;break}return e.abrupt("return",(os.error("reTryExchange failed: ".concat(a)),{code:a}));case 13:return this._pc.clearReTryExchangeTimer(),e.next=16,this._pc.setRemoteAnswer(o.sdp);case 16:return s=e.sent,e.abrupt("return",s!==rs.SUCCESS?{code:s}: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 ns(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=eu(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?gu.TINY:gu.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 ns(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",cs((function(){return n.__unpublish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unpublish",value:function(e){var t;return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s,c,u,l,d,h,f,p,m,g,v,_,y,R=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._isMainRoom||!(this instanceof $u)){n.next=2;break}return n.abrupt("return",(os.error("the `unpublish` is disabled in PK room "),{code:rs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){n.next=4;break}return n.abrupt("return",(os.warn("room has been destroyed, no need to unpublish tracks -> roomId: ".concat(this._roomId)),{code:rs.SUCCESS}));case 4:if(r=this._context.getCurrentId(),$t("tracks",e,(function(){return e.every((function(e){return e.getUserId()===r&&e instanceof Pc}))}),!0)){n.next=7;break}return n.abrupt("return",(os.warn("unpublish failed, tracks is invalid -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Hu))),{code:rs.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:rs.SUCCESS});case 10:return a=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(Ru.PUBLISH,bu.END,i),this._pc.clearReTryExchangeTimer(),n.next=14,this._createExchangeParams(this._subscribedList,!1);case 14:return s=n.sent,(c=this._getPushOtherRoomsParams())&&(s.pushOtherRooms=c),n.next=19,this._exchangeHandle(s);case 19:if((u=n.sent).code===rs.SUCCESS){n.next=22;break}return n.abrupt("return",(os.error("exchange failed -> code: ".concat(u.code)),{code:u.code}));case 22:return l=u.data,d=l.publishList,h=l.sdp,f=l.resultCode,p=l.message,m=l.mcuPublishList,f!==rs.SUCCESS&&os.error("unpublish streams failed -> code: ".concat(f,", msg: ").concat(p)),g=m?m.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)})):[],n.next=27,this._context.setRTCTotalRes(this._roomId,Gc(du.UNPUBLISH,o),zc(a),du.TOTAL_CONTENT_RESOURCE,zc(g));case 27:if((v=n.sent)===st.SUCCESS){n.next=30;break}return n.abrupt("return",(os.error("send unpublish notification failed:",v),{code:rs.SIGNAL_ERROR}));case 30:return os.debug("unpublish success -> tracks: ".concat(i.join(","))),n.next=33,this._pc.setRemoteAnswer(h.sdp);case 33:if((_=n.sent)===rs.SUCCESS){n.next=36;break}return n.abrupt("return",{code:_});case 36:return y=d.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:R._getResourceState($c(e))},e)})),n.abrupt("return",(this._roomResources[r]=y,{code:rs.SUCCESS}));case 38:case"end":return n.stop()}}),n,this)})))}},{key:"_getResourceById",value:function(e){var t=eu(e).userId;return this._roomResources[t].find((function(t){return $c(t)===e}))}},{key:"_isValidResourceId",value:function(e){var t,n=eu(e).userId;return!!(null===(t=this._roomResources[n])||void 0===t?void 0:t.find((function(t){return $c(t)===e})))}},{key:"subscribe",value:function(e){return ns(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",cs((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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",(os.error("subscribe failed, room has been destroyed -> roomId: ".concat(this._roomId)),{code:rs.ROOM_HAS_BEEN_DESTROYED}));case 2:if($t("tracks",e,(function(){return je(e)&&e.length>0&&e.every((function(e){return e instanceof Kc||e.track instanceof Kc}))}),!0)){r.next=4;break}return r.abrupt("return",(os.error("subscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:rs.PARAMS_ERROR}));case 4:return os.info("subscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Hu))),i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Kc?{track:e}:e})),a=!1,s=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();s.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),a=!0)})),a||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(Ru.SUBSCRIBE,bu.BEGIN,s),this._updateSubListHandle(i,!0)):{code:rs.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"unsubscribe",value:function(e){return ns(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",cs((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return ns(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",(os.warn("room has beed destroyed, no need to unsubscribe tracks -> roomId: ".concat(this._roomId)),{code:rs.SUCCESS}));case 2:if($t("tracks",e,(function(){return je(e)&&e.length>0&&e.every((function(e){return e instanceof Kc}))}),!0)){n.next=4;break}return n.abrupt("return",(os.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:rs.PARAMS_ERROR}));case 4:return os.info("unsubscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Hu))),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(Ru.SUBSCRIBE,bu.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 os.warn("This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance."),rs.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 ns(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",cs((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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C,E=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:rs.ROOM_HAS_BEEN_DESTROYED});case 2:if($t("resources",e,(function(){return je(e)&&e.every((function(e){return e instanceof Kc||e.track instanceof Kc}))}),!0)){n.next=4;break}return n.abrupt("return",(os.error("update sublist failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:rs.PARAMS_ERROR}));case 4:if(os.info("update subscribe list -> roomId: ".concat(this._roomId,", forceReq: ").concat(t,", tracks: ").concat(e.map(Hu))),i=e.map((function(e){return e instanceof Kc?{track:e}:Object.assign({},e)})),o={},i=i.filter((function(e){var t=e.track.getTrackId();return E._remoteTracks[t]?!o[t]&&(o[t]=!0):(os.warn("track cannot found in room -> trackId: ".concat(t)),!1)})).map((function(e){return Object.assign({},e)})),a=this._subscribedList.map((function(e){return Object.assign({},e)})),t){n.next=13;break}if(c=!1,i.forEach((function(e){var t=a.findIndex((function(t){return t.track===e.track}));-1!==t?a.splice(t,1)[0].subTiny!==e.subTiny&&(c=!0):c=!0})),a.length&&(c=!0),c){n.next=13;break}return n.abrupt("return",{code:rs.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,(l=this._getPushOtherRoomsParams())&&(u.pushOtherRooms=l),n.next=21,this._exchangeHandle(u);case 21:if(d=n.sent,h=i.map((function(e){return e.track.getTrackId()})),d.code===rs.SUCCESS){n.next=25;break}return n.abrupt("return",{code:d.code});case 25:if(f=d.data,p=f.sdp,m=f.resultCode,f.message,g=f.subscribedList,m===rs.SUCCESS){n.next=28;break}return n.abrupt("return",(os.error("change subscribe list failed: ".concat(m)),{code:m}));case 28:return os.debug("subscribe success: ".concat(h.join(","))),n.next=31,this._pc.setRemoteAnswer(p.sdp);case 31:if((v=n.sent)===rs.SUCCESS){n.next=34;break}return n.abrupt("return",{code:v});case 34:for(C in _=null==g?void 0:g.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()))})),b=function(e){var t=y.some((function(t){return t.track.getTrackId()===e}));E._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)b(C);return n.abrupt("return",((r=this._subscribedList).splice.apply(r,[0,this._subscribedList.length].concat(s(y))),R.length?{code:rs.SUCCESS,failedList:R}:{code:rs.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 Du(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}},{key:"__onReconnected",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C,E,T=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",(os.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===st.SUCCESS){t.next=9;break}return t.abrupt("return",void os.error("RTC __onReconnected getRTCRoomInfo failed: ".concat(r)));case 9:os.debug("RTC __onReconnected getRTCRoomInfo success: ".concat(JSON.stringify(i))),o=[],a={},s={},c={},u=mu(i),l=Object.keys(u),d=Object.keys(this._roomResources),h=l.length-1;case 12:if(!(h>=0)){t.next=22;break}if(f=l[h],-1!==(p=d.indexOf(f))){t.next=17;break}return o.push(f),a[f]=nu(u[f]),t.abrupt("continue",19);case 17:m=this._roomResources[f],g=u[f],v=ru(m,g,!0),_=v.publishedList,y=v.modifiedList,R=v.unpublishedList,a[f]=nu(_),s[f]=nu(R),c[f]=nu(y),d.splice(p,1);case 19:h-=1,t.next=12;break;case 22:d.length&&d.forEach((function(e){delete T._roomResources[e]})),Object.assign(this._roomResources,u),d.length&&this._callAppListener("onUserLeave",d),o.length&&this._callAppListener("onUserJoin",o),t.t0=regeneratorRuntime.keys(s);case 24:if((t.t1=t.t0()).done){t.next=33;break}if(b=t.t1.value,!(C=s[b]).length){t.next=31;break}return E=C.map((function(e){return T._remoteTracks[$c(e)]})),t.next=31,this._onUserUnpublish(E);case 31:t.next=24;break;case 33:return t.abrupt("return",(Object.keys(a).forEach((function(e){var t=a[e];if(0!==t.length){var n=t.map((function(e){var t=$c(e),n=eu(t),r=n.userId,i=n.tag,o=n.mediaType,a=T._remoteTracks[t]=o===Cc.AUDIO_ONLY?new qc(i,r):new Yc(i,r);return a.__innerSetRemoteMuted(0===e.state),a}));T._onTrackPublish(n)}})),Object.keys(c).forEach((function(e){c[e].forEach((function(e){var t=$c(e),n=T._remoteTracks[t];n.__innerSetRemoteMuted(0===e.state),n.isAudioTrack()?T._onAudioMuteChange(n):T._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"}(Vu||(Vu={})),function(e){e[e.CUSTOMIZE=1]="CUSTOMIZE",e[e.SUSPENSION=2]="SUSPENSION",e[e.ADAPTATION=3]="ADAPTATION"}(Bu||(Bu={})),function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Fu||(Fu={}));var Ku,qu,Yu,Gu,zu=function(){return{version:1,mode:Bu.SUSPENSION}},Ju=function(){function e(t,n,r){_(this,e),this._onFlush=t,this._isValidTrackId=n,this._sendCDNInfoSignal=r,this._values=zu()}return R(e,[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return os.error("setHostVideoTrack failed: videoTrackId is invalid -> ".concat(e)),this;var t=eu(e),n=t.mediaType,r=t.tag,i=t.userId;return n!==Cc.VIDEO_ONLY?(os.error("setHostVideoTrack failed: kind of resource is not 'video' -> ".concat(e)),this):(this._values.host_stream_id=tu(i,r),this)}},{key:"setMixLayoutMode",value:function(e){return[Bu.CUSTOMIZE,Bu.SUSPENSION,Bu.ADAPTATION].includes(e)?(this._values.mode=e,this):(os.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:Vu.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var a=i[n]||(i[n]={});Object.assign(a,t)}}else r.audio={bitrate:t};else r.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!ou(e))return os.warn("setOutputVideoResolution failed: `resolution` is invalid"),this;var t=iu(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"normal"),this}},{key:"setOutputVideoFPS",value:function(e){if(!au(e))return os.warn("setOutputVideoFPS failed: `fps` is invalid"),this;var t=su(e);return this._addOutputValue("video",{fps:t},"normal"),this}},{key:"setOutputVideoBitrate",value:function(e){return!He(e)||e<=0?os.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"normal"),this}},{key:"setOutputTinyVideoResolution",value:function(e){if(!ou(e))return os.warn("setOutputTinyVideoResolution failed: `resolution` is invalid"),this;var t=iu(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"tiny"),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!au(e))return os.warn("setOutputTinyVideoFPS failed: `fps` is invalid"),this;var t=su(e);return this._addOutputValue("video",{fps:t},"tiny"),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!He(e)||e<=0?os.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"tiny"),this}},{key:"setOutputVideoRenderMode",value:function(e){return[Fu.CROP,Fu.WHOLE].includes(e)?this._addOutputValue("video",e,"exparams"):os.error("renderMode is invalid: ".concat(e)),this}},{key:"setOutputAudioBitrate",value:function(e){return He(e)&&e>0?this._addOutputValue("audio",e):os.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"):os.error("color is invalid: ".concat(e)),this}},{key:"addOutputBackgroundPicture",value:function(e,t,n,r,i){var o,a,s;if(!We(e))return os.error("uri is invalid: ".concat(e)),this;if([t,n,r,i].some((function(e){return!He(e)||e<0||e>1})))return os.error("some attrs of (x, y, w, h) is invalid: ".concat(t,", ").concat(n,", ").concat(r,", ").concat(i)),this;var c=(null===(s=null===(a=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===a?void 0:a.backgroundPicture)||void 0===s?void 0:s.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(!We(e))return os.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[Vu.CROP,Vu.WHOLE].includes(e)?this._addOutputValue("video",{fillMode:e},"backgroundPicture"):os.error("fillMode is invalid: ".concat(e)),this}},{key:"addPublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!je(e)||0===e.length||e.some((function(e){return!r.test(e)})))return os.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?(os.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(!je(e)||0===e.length||e.some((function(e){return!r.test(e)})))return os.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 a=i[o].pushurl,s=e.indexOf(a);s>=0&&(e.splice(s,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 os.error("trackId is invalid: ".concat(e)),this;if(!He(t)||!He(n))return os.error("some attrs of (x, y) is invalid: ".concat(t,", ").concat(n)),this;if([r,i].some((function(e){return!He(e)||e<0})))return os.error("some attrs of (width, height) is invalid: ".concat(r,", ").concat(i)),this;var o=eu(e),a=o.userId,s=o.tag;if(o.mediaType!==Cc.VIDEO_ONLY)return os.error("kind of resource is not 'video': ".concat(e)),this;var c=tu(a,s);return(this._values.input||(this._values.input={video:[]})).video.push({user_id:a,stream_id:c,x:t,y:n,width:r,height:i}),this}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return os.error("trackId is invalid: ".concat(e)),this;var t=eu(e),n=t.userId,r=t.tag;if(t.mediaType!==Cc.VIDEO_ONLY)return os.error("kind of resource is not 'video': ".concat(e)),this;var i=tu(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 ns(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,a,s;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 a=i.sent,s=a.code,i.abrupt("return",(s===rs.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=zu(),{code:s}));case 6:case"end":return i.stop()}}),i,this)})))}}]),e}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(Ku||(Ku={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(qu||(qu={})),function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(Yu||(Yu={})),function(e){e[e.VIDEO=0]="VIDEO",e[e.AUDIO=1]="AUDIO"}(Gu||(Gu={}));var Wu,Qu,Xu=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)}))},Zu=function(){function e(t,n,r,i,o,a,s,c){_(this,e),this._context=t,this._runtime=n,this._service=r,this._initOptions=i,this._mainLivingRoom=o,this._registerPKMsgListener=a,this._onJoinedPKRoom=s,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){os.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,a=n.inviteeUserId,s=n.inviteeRoomId,c=(n.extra,{agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:s,inviteeUserId:a});this._PKInfo[s].inviteeUserAutoMix=r,this._callAppListener("onResponseJoinOtherRoom",c)}},{key:"_onPKEnd",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s;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,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},t.next=3,this.leaveOtherRoom(this._joinedPKRooms[a]);case 3:delete this._PKInfo[a],this._callAppListener("onFinishOtherRoom",s);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_onRecvPKMsg",value:function(e){e.targetId;var t=e.content;switch(e.messageType){case du.PK_INVITE:this._onInvite(t);break;case du.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case du.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case du.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case du.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,n){return ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,s,c;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if($t("inviteeRoomId",e,qe,!0)&&$t("inviteeUserId",t,qe,!0)){r.next=2;break}return r.abrupt("return",{code:rs.PARAMS_ERROR});case 2:return os.debug("requestRoomPK -> inviteeRoomId: ".concat(e,"; inviteeUserId: ").concat(t,"; options: ").concat(JSON.stringify(n||{}))),i=Xu(),o=!Fe(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),a={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)||""},s={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(a),inviteSessionId:i},os.debug("requestRoomPK -> params: ".concat(JSON.stringify(s))),r.next=7,this._context.requestRoomPK(s);case 7:return c=r.sent,r.abrupt("return",c!==st.SUCCESS?(os.error("requestRoomPK failed: ".concat(c)),{code:c}):(os.debug("requestRoomPK success"),this._PKInfo[e]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e},{code:rs.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,n){return ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if($t("inviteeRoomId",e,qe,!0)&&$t("inviteeUserId",t,qe,!0)){r.next=2;break}return r.abrupt("return",{code:rs.PARAMS_ERROR});case 2:if(this._PKInfo[e]){r.next=4;break}return r.abrupt("return",(os.error("未发起过与 ".concat(e," 房间内 ").concat(t," 连麦的请求")),{code:rs.PARAMS_ERROR}));case 4:return os.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)},os.debug("canceRequestJoinPK -> params: ".concat(JSON.stringify(o))),r.next=9,this._context.cancelRoomPK(o);case 9:return a=r.sent,r.abrupt("return",a!==st.SUCCESS?(os.error("canceRequestJoinPK failed: ".concat(a)),{code:a}):(os.debug("canceRequestJoinPK success"),delete this._PKInfo[e],{code:rs.SUCCESS}));case 11:case"end":return r.stop()}}),r,this)})))}},{key:"responseJoinOtherRoom",value:function(e,t,n,r){return ns(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,a,s,c,u,l,d,h,f;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if($t("inviterRoomId",e,qe,!0)&&$t("inviterUserId",t,qe,!0)){i.next=2;break}return i.abrupt("return",{code:rs.PARAMS_ERROR});case 2:if(this._PKInfo[e]){i.next=4;break}return i.abrupt("return",(os.error("".concat(e," 房间内的 ").concat(t," 未发起过连麦请求")),{code:rs.PARAMS_ERROR}));case 4:return os.debug("responseRoomPK -> inviterRoomId: ".concat(e,"; inviterUserId: ").concat(t,"; agree: ").concat(n,"; options: ").concat(JSON.stringify(r||{}))),o=this._PKInfo[e],a=o.inviteSessionId,s=o.inviterUserAutoMix,c=!Fe(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),u={inviteSessionId:a,inviterRoomId:e,inviterUserId:t,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:c},l=Object.assign(u,{inviterUserAutoMix:s}),d=n?Object.assign(u,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(l)}):u,!ze(null==r?void 0:r.extra)&&Object.assign(d,{extra:r.extra}),h={agree:n,roomId:this._mainRoomId,inviteSessionId:a,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(d),key:"".concat(e,"|").concat(t),value:JSON.stringify(u)},os.debug("responseRoomPK -> params: ".concat(JSON.stringify(h))),i.next=11,this._context.responseRoomPK(h);case 11:return f=i.sent,i.abrupt("return",f!==st.SUCCESS?(os.error("responseRoomPK failed: ".concat(f)),{code:f}):(os.debug("responseRoomPK success"),this._PKInfo[e].inviteeUserAutoMix=c,{code:rs.SUCCESS}));case 13:case"end":return i.stop()}}),i,this)})))}},{key:"_quitRoomPK",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s,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,a={inviteeRoomId:i,inviterRoomId:r,userId:this._context.getCurrentId()},s={roomId:this._mainRoomId,endRoomId:e,sessionId:this._PKInfo[e].inviteSessionId,content:JSON.stringify(a),keys:["".concat(r,"|").concat(o)]},os.debug("quitRoomPK -> params: ".concat(JSON.stringify(s))),t.next=4,this._context.endRoomPK(s);case 4:return c=t.sent,t.abrupt("return",c!==st.SUCCESS?(os.error("quitRoomPK failed: ".concat(c)),{code:rs.SIGNAL_ERROR}):(os.debug("quitRoomPK success"),delete this._PKInfo[e],{code:rs.SUCCESS}));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"_relaseCrtRoom",value:function(){}},{key:"joinOtherRoom",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if($t("roomId",e,qe,!0)){t.next=2;break}return t.abrupt("return",{code:rs.PARAMS_ERROR});case 2:if(this._context.getConnectionStatus()===ut.CONNECTED){t.next=4;break}return t.abrupt("return",{code:rs.SIGNAL_DISCONNECTED});case 4:if(os.debug("joinPKRoom, roomId: ".concat(e)),!this._joinedPKRooms[e]){t.next=6;break}return t.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 6:return n=Gu.VIDEO,t.next=9,this._context.joinRTCRoom(e,Pt.LIVE,n);case 9:if(r=t.sent,i=r.code,o=r.data,i===st.SUCCESS){t.next=14;break}return t.abrupt("return",(os.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 14:return os.debug("JoinPKRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),a=new $u(this._context,this._runtime,e,o,this._service,this._initOptions,this._relaseCrtRoom.bind(this),n,!1,!1),t.abrupt("return",(this._joinedPKRooms[e]=a,this._onJoinedPKRoom(e,a),{room:a,code:rs.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()}));case 17:case"end":return t.stop()}}),t,this)})))}},{key:"leaveOtherRoom",value:function(e,t){return ns(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",cs((function(){return ns(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(),os.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:rs.SUCCESS}):{code:rs.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}(),$u=function(e){l(n,e);var t=h(n);function n(e,r,i,o,a,s,u,l){var d,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,Pt.LIVE,a,s,u,g,v))._livingType=l,h._isMainRoom=v,h._CDNUris=null,h._CDNEnable=!1,h._mcuConfigBuilder=new Ju(h._onMCUConfigFlush.bind(p(h)),h._isValidResourceId.bind(p(h)),h._sendCDNInfoSignal.bind(p(h))),h._isMainRoom&&(h._roomPKHandler=new Zu(e,r,a,s,p(h),c((d=p(h),m(n.prototype)),"_registerPKMsgListener",d).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=eu(e).userId,i=!!(null===(t=this._roomResources[r])||void 0===t?void 0:t.find((function(t){return $c(t)===e}))),o=this.getRoomPKHandler(),a=o.code,c=o.roomPKHandler;if(a!==rs.SUCCESS||!c)return i;var u=c.getJoinedPKRooms(),l=[];return Object.values(u).map((function(e){l.push.apply(l,s(e.getRemoteTracks()))})),n=l.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:(os.error("the `getMCUConfigBuilder` is disabled in PK room "),{code:rs.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_onMCUConfigFlush",value:function(e){return ns(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!==rs.SUCCESS?(os.error("set MCU config failed: ".concat(i)),{code:i}):(os.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,o,a,s;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,a=null===(e=o.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===e?void 0:e.value,a){n.next=8;break}return n.abrupt("return");case 8:s=JSON.parse(a),(null===(t=this._CDNUris)||void 0===t?void 0:t.enableInnerCDN)!==s.enableInnerCDN&&this._callAppListener("onCDNEnableChange",s.enableInnerCDN),this._CDNUris=s;case 10:case"end":return n.stop()}}),n,this)})))}},{key:"enableInnerCDN",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s=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",(os.error("the `enableInnerCDN` is disabled in PK room "),{code:rs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(Fe(e)){t.next=4;break}return t.abrupt("return",(os.error("`enable` is invalid"),{code:rs.PARAMS_ERROR}));case 4:return this._CDNEnable=e,n={version:2,output:{inCDNModel:e?Ku.OPEN:Ku.STOP}},t.next=8,this._onMCUConfigFlush(n);case 8:if(r=t.sent,(i=r.code)===rs.SUCCESS){t.next=12;break}return t.abrupt("return",(os.error("enableInnerCDN failed -> code: ".concat(i)),{code:rs.SIGNAL_ERROR}));case 12:if(!this._CDNUris||this._CDNUris.broadcast===qu.SPREAD){t.next=14;break}return t.abrupt("return",(os.info("enableInnerCDN succeed"),{code:rs.SUCCESS}));case 14:return t.next=16,cs((function(){return ns(s,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,a=o.code,t.abrupt("return",a===rs.SUCCESS?(os.info("enableInnerCDN succeed"),{code:rs.SUCCESS}):(os.error("enableInnerCDN failed -> code: ".concat(a)),{code:a}));case 19:case"end":return t.stop()}}),t,this)})))}},{key:"_sendCDNInfoSignal",value:function(){return ns(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===rs.SUCCESS},!e.sent.every(e.t0)){e.next=8;break}e.t1={code:rs.SUCCESS},e.next=9;break;case 8:e.t1={code:rs.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 ns(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,du.TOTAL_CONTENT_RESOURCE,JSON.stringify([e]));case 2:return n=t.sent,t.abrupt("return",n!==st.SUCCESS?(os.error("spreadCDNInfo failed -> code: ".concat(n)),{code:rs.SIGNAL_ERROR}):(os.info("spreadCDNInfo succeed"),{code:rs.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_setRoomCDNInfo",value:function(e){return ns(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,Dt.ROOM);case 2:return n=t.sent,t.abrupt("return",n!==st.SUCCESS?(os.error("setRoomCDNInfo failed -> code: ".concat(n)),{code:rs.SIGNAL_ERROR}):(os.info("setRoomCDNInfo succeed"),{code:rs.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_resourceHandle",value:function(e,t,r){var i,o=this,a=Object.create(null,{_resourceHandle:{get:function(){return c(m(n.prototype),"_resourceHandle",o)}}});return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:a._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 ns(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,a;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,a=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===rs.SUCCESS&&a?(this._CDNUris=JSON.parse(a),(null===(r=this._CDNUris)||void 0===r?void 0:r.broadcast)===qu.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=mu(e),r=this._context.getCurrentId(),i=Object.keys(n);setTimeout((function(){var o,a,s,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]},du.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===(a=t._CDNUris)||void 0===a?void 0:a.push_mode)===Yu.MANUAL&&t._callAppListener("onCDNEnableChange",null===(s=t._CDNUris)||void 0===s?void 0:s.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===rs.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===rs.SUCCESS&&r){if(!r.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}},{key:"_exchangeWithPushOtherRoom",value:function(){return ns(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s;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===rs.SUCCESS){e.next=12;break}return e.abrupt("return",(os.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 12:if(i=r.data,o=i.sdp,(a=i.resultCode)===rs.SUCCESS){e.next=15;break}return e.abrupt("return",(os.error("exchange with pushOtherRoom failed: ".concat(a)),{code:a}));case 15:return e.next=17,this._pc.setRemoteAnswer(o.sdp);case 17:return s=e.sent,e.abrupt("return",s!==rs.SUCCESS?{code:s}:void 0);case 19:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomPKHandler",value:function(){return this._isMainRoom?{code:rs.SUCCESS,roomPKHandler:this._roomPKHandler}:(os.error("the `getRoomPKHandler` is disabled in PK room "),{code:rs.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}(ju),el=function(e){l(n,e);var t=h(n);function n(e,r,i,o,a,s,c){return _(this,n),t.call(this,e,r,i,o,Pt.RTC,a,s,c,!1)}return R(n)}(ju),tl=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(cu.browser,"|").concat(cu.version),ClientVersion:"5.3.1","Client-Session-Id":Xu(),"Request-Id":Date.now().toString()}},nl=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,s(function(e){var t,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(t){return os.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,s(this._failedMs)),this._failedMs.length=0)),this._msInNavi.map((function(e){return e.trim()})))}},{key:"_request",value:function(e,t,n){return ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,c,u,l,d,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:rs.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=tl(),os.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:ji.POST,timeout:this._timeout});case 10:if(l=r.sent,d=l.status,h=l.data,200!==d){r.next=16;break}return f=JSON.parse(h),r.abrupt("return",(f.rtcFinger&&(this._rtcFinger=f.rtcFinger),f.clusterId&&(this._clusterId=f.clusterId),os.debug("request success -> Request-Id: ".concat(u["Request-Id"])),{code:rs.SUCCESS,data:f}));case 16:os.warn("request failed -> Request-Id: ".concat(u["Request-Id"],", status: ").concat(d,", url: ").concat(c)),(a=this._failedMs).push.apply(a,s(this._msInNavi.splice(o,1)));case 17:o+=1,r.next=5;break;case 20:return r.abrupt("return",{code:rs.REQUEST_FAILED});case 21:case"end":return r.stop()}}),r,this)})))}},{key:"exchange",value:function(e,t){var n;return ns(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===rs.SUCCESS&&(null===(n=i.data)||void 0===n?void 0:n.resultCode)===rs.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 ns(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 ns(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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s,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:rs.MCU_SERVER_NOT_FOUND});case 2:return r="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),i=tl(),os.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:ji.POST});case 6:if(o=n.sent,a=o.status,s=o.data,200!==a){n.next=13;break}return os.debug("request success -> Request-Id: ".concat(i["Request-Id"])),c=JSON.parse(s),n.abrupt("return",{code:c.resultCode,res:c});case 13:return n.abrupt("return",{code:rs.REQUEST_FAILED});case 14:case"end":return n.stop()}}),n,this)})))}},{key:"getCDNResourceInfo",value:function(e,t){return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=tl(),n.next=3,this._runtime.httpReq({url:t,headers:Object.assign(Object.assign({},r),e),method:ji.GET});case 3:if(i=n.sent,o=i.status,a=i.data,200!==o){n.next=9;break}return s=JSON.parse(a),n.abrupt("return",{code:s.resultCode,res:s});case 9:return n.abrupt("return",(os.warn("request failed -> Request-Id: ".concat(r["Request-Id"],", status: ").concat(o,", url: ").concat(t)),{code:rs.REQUEST_FAILED}));case 10:case"end":return n.stop()}}),n,this)})))}}]),e}(),rl=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 nl(n,t,r.mediaServer)}return R(e,[{key:"_getReqHeaders",value:function(e){return ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a;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,Pt.LIVE,e);case 4:if(i=t.sent,o=i.code,a=i.data,o===st.SUCCESS){t.next=9;break}return t.abrupt("return",(os.error("getRTCToken failed: ".concat(o)),{code:rs.SIGNAL_ERROR}));case 9:this._rtcToken=a.rtcToken;case 10:return t.abrupt("return",{code:rs.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:n,RoomId:r,RoomType:Pt.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 ns(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===rs.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 ns(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",cs((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 ns(this,void 0,void 0,regeneratorRuntime.mark((function o(){var a,s,c,u,l,d,h,f,p,m,g,v,_=this;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(a=[],!pu(this._context.getNaviInfo())){o.next=3;break}return o.abrupt("return",{code:rs.PACKAGE_ENVIRONMENT_ERROR,tracks:a});case 3:if(!this._fromRetry&&(null===(r=this._pc)||void 0===r||r.clearReTryExchangeTimer()),this._fromRetry=!1,Be(e)){o.next=5;break}return o.abrupt("return",(os.error("liveUrl is invalid: ".concat(e)),{code:rs.PARAMS_ERROR,tracks:a}));case 5:if([Gu.AUDIO,Gu.VIDEO].includes(t)){o.next=7;break}return o.abrupt("return",(os.error("livingType is invalid: ".concat(t)),{code:rs.PARAMS_ERROR,tracks:a}));case 7:if([Cc.AUDIO_ONLY,Cc.VIDEO_ONLY,Cc.AUDIO_VIDEO].includes(n)){o.next=9;break}return o.abrupt("return",(os.error("mediaType is invalid: ".concat(n)),{code:rs.PARAMS_ERROR,tracks:a}));case 9:if(!this._liveUrl||this._liveUrl===e){o.next=11;break}return o.abrupt("return",{code:rs.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:a});case 11:return this._pc||(this._pc=new Lu(this._reTryExchange.bind(this)),this._pc.on(Lu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=e,o.next=14,this._getReqHeaders(t);case 14:if(s=o.sent,c=s.code,u=s.headers,c===rs.SUCCESS){o.next=19;break}return o.abrupt("return",{code:c,tracks:a});case 19:return l="rc_mcu_".concat(Date.now()),d="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new qc(d,l),new Yc(d,l)),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?gu.TINY:gu.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===rs.SUCCESS){o.next=34;break}return o.abrupt("return",(os.error("andience subscribe failed: ".concat(f.code)),{code:f.code,tracks:a}));case 34:if((p=f.data).resultCode===rs.SUCCESS){o.next=37;break}return o.abrupt("return",(os.error("andience subscribe failed! code: ".concat(p.resultCode,"; message: ").concat(p.message)),{code:p.resultCode,tracks:a}));case 37:return os.debug("andience subscribe success: ".concat(e)),this._livingType=t,this._mediaType=n,this._subTiny=i,m=p.sdp,g=p.subscribedList,v=[],o.abrupt("return",(g.forEach((function(e){var t=e.mediaType,n=_._subTracks[t];v.push(n),n.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(m.sdp),{code:rs.SUCCESS,tracks:v}));case 40:case"end":return o.stop()}}),o,this)})))}},{key:"unsubscribe",value:function(){return ns(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",cs((function(){return t.__unsubscribe()})));case 1:case"end":return e.stop()}}),e)})))}},{key:"__unsubscribe",value:function(){var e;return ns(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:rs.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!==rs.SUCCESS?os.error("broadcast unsubscribe failed: ".concat(o)):os.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?Cc.AUDIO_ONLY:Cc.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){os.error(e)}}}]),e}();!function(e){e.RTMP="rtmp",e.FLV="flv",e.HLS="hls"}(Wu||(Wu={})),function(e){e[e.NOT_HTTPS=0]="NOT_HTTPS",e[e.HTTPS=1]="HTTPS"}(Qu||(Qu={}));var il,ol=Object.assign(Object.assign({},iu(bc.W176_H144)),{frameRate:su(Rc.FPS_15)}),al=function(){function e(t,n,r,i,o,a){var s=this;_(this,e),this._context=t,this._runtime=n,this._initOptions=r,this._roomId=i,this._joinResData=o,this._livingType=a,this._roomAnchorList=[],this._roomRes={},this._roomAnchorRes={},this._remoteTracks={},this._appListener=null,this._subscribedList=[],this._sessionId="",this._destroyed=!1,this._setInitData(),this._service=new nl(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new Uu(this._context,this._runtime,this._roomId,this,yu.Audience),this._polarisReport.sendR1(),this._pc=new Lu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(Lu.__INNER_EVENT_TRACK_READY__,(function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?Cc.AUDIO_ONLY:Cc.VIDEO_ONLY].join("_"),i=s._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),s._callAppListener("onTrackReady",i)):os.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||"{}")})),a=o.length?JSON.parse(o[0].mcu_uris||"[]"):[],c=[];a.forEach((function(t){var n=t.mediaType,r=t.tag,i=n===Cc.AUDIO_ONLY?new qc(r,"",e):new Yc(r,"",e);c.push(i)}));var u=[],l=[];o.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,s(t)),t.forEach((function(e){var t=e.mediaType,n=e.tag,r=e.msid.split("_")[0],i=t===Cc.AUDIO_ONLY?new qc(n,r):new Yc(n,r);l.push(i)}))}));var d=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:a,remoteRTCTracks:l,remoteMCUTracks:c,remoteTracks:[].concat(l,c),CDNUris:d||{}}}(this._roomId,this._joinResData.kvEntries),n=t.sessionId,r=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,c=t.CDNUris;this._sessionId=n,this._roomAnchorList=r,a.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=$c(t);e._roomRes[n]=t}))}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed){return os.warn("This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance."),rs.ROOM_HAS_BEEN_DESTROYED}}},{key:"singalDataChange",value:function(e,t){var n,r=this;if(t===this._roomId){os.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 a=JSON.parse(n||"{}"),c=JSON.parse(a.mcu_uris||"[]"),u=JSON.parse(a.uris||"[]");return i.push.apply(i,s(c)),void r._diffAnchorResource(u,o)}if("RC_ANCHOR_LIST"===t){var l=JSON.parse(n||"[]"),d=r._diffAnchorList(l),h=d.joinUserIds,f=d.leftUserIds;h.length>0&&r._handleNewJoinedAnchor(h),f.length>0&&r._handleLeftedAnchor(f)}})),this._diffRoomResource(i)}else os.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,s(e)),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e){return ns(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,s(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 ns(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=$c(e),r=eu(t),a=(r.userId,r.tag),s=r.mediaType,c=[o._roomId,a,s].join("_");if(!o._remoteTracks[c]){var u=s===Cc.AUDIO_ONLY?new qc(a,"",o._roomId):new Yc(a,"",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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C,E,T=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),i=ru(r,e),o=i.publishedList,a=i.unpublishedList,s=i.modifiedList,!o.length){n.next=12;break}if(c=r.map($c),u=[],l=[],o.forEach((function(e){var t=$c(e),n=c.indexOf(t),i=eu(t),o=i.userId,a=i.tag,s=i.mediaType;n>-1?r[n]=e:r.push(e);var d=T._remoteTracks[t];T._roomRes[t]=e,d?d.isSubscribed()&&u.push(d):(d=s===Cc.AUDIO_ONLY?new qc(a,o):new Yc(a,o),T._remoteTracks[t]=d,l.push(d)),d.__innerSetRemoteMuted(0===e.state)})),!u.length){n.next=11;break}return d=u.map((function(e){return e.getTrackId()})),os.debug("resub tracks -> ".concat(JSON.stringify(d))),n.next=8,cs((function(){return T._subscribeHandle(u,!0)}));case 8:h=n.sent,(f=h.code)!==rs.SUCCESS&&os.error("resub tracks failed -> code: ".concat(f,", ids: ").concat(JSON.stringify(d)));case 11:this._callAppListener("onAnchorTrackPublish",l);case 12:if(!a.length){n.next=18;break}for(p=a.map($c),m=r.length-1;m>=0;m-=1)g=r[m],p.includes($c(g))&&r.splice(m,1);return v=a.map((function(e){var t=$c(e);return T._remoteTracks[t]})),n.next=18,this._onUserUnpublish(v,"onAnchorTrackUnpublish");case 18:if(s.length)for(_=r.map($c),y=0;y<s.length;y++)R=s[y],b=$c(R),C=_.indexOf(b),r[C].state=R.state,(E=this._remoteTracks[b]).__innerSetRemoteMuted(0===R.state),E.isAudioTrack()?this._callAppListener("onAudioMuteChange",E):this._callAppListener("onVideoMuteChange",E);case 19:case"end":return n.stop()}}),n,this)})))}},{key:"_onUserUnpublish",value:function(e,t){return ns(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){os.error(e)}}},{key:"_reTryExchange",value:function(){return ns(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:cs((function(){return ns(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,a,s,c,u,l,d,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===rs.SUCCESS){e.next=9;break}return e.abrupt("return",(os.error("reTryExchange failed: ".concat(i.code)),{code:i.code}));case 9:if(o=i.data,a=o.sdp,(s=o.resultCode)===rs.SUCCESS){e.next=12;break}return e.abrupt("return",(os.error("reTryExchange failed: ".concat(s)),{code:s}));case 12:return this._pc.clearReTryExchangeTimer(),c=this._subscribedList.filter((function(e){return e.track.isMCUTrack()})),c.length>0&&(u=c[0].track.getTrackId(),l=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,d=[this._roomId,"RongCloudRTC"].join("_"),a.sdp=a.sdp.replace(new RegExp(l,"g"),d)),e.next=17,this._pc.setRemoteAnswer(a.sdp);case 17:return h=e.sent,e.abrupt("return",h!==rs.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,s=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:[]},a={min:0,max:0},Object.keys(t).forEach((function(e){var n=t[e];[n.mediaStream,n.tinyStream].forEach((function(t,n){var r,s=1===n?[e,"tiny"].join("_"):e;i.sdp=null===(r=i.sdp)||void 0===r?void 0:r.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===n,l=u?Xc(c):ol,d=l.width,h=l.height,f=l.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?gu.NORMAL:gu.TINY,resolution:"".concat(d,"x").concat(h)});var p=Ic(d,h),m=kc(f);a.min+=p.minBitrate*m,a.max+=p.maxBitrate*m}}))})),r.abrupt("return",{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?gu.TINY:gu.NORMAL,resolution:"",uri:s._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:a,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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,s;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:rs.ROOM_HAS_BEEN_DESTROYED});case 2:if($t("tracks",e,(function(){return je(e)&&e.length>0&&e.every((function(e){return e instanceof Kc||e.track instanceof Kc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:rs.PARAMS_ERROR});case 4:return i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Kc?{track:e}:e})),a=!1,s=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();s.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),a=!0)})),a||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(Ru.SUBSCRIBE,bu.BEGIN,s),this._updateSubListHandle(i,!0)):{code:rs.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:Pt.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,c,u,l,d,h,f,p,m,g,v,_,y,R,b,C,E,T,S,I=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:rs.ROOM_HAS_BEEN_DESTROYED});case 2:if($t("resources",e,(function(){return je(e)&&e.every((function(e){return e instanceof Kc||e.track instanceof Kc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:rs.PARAMS_ERROR});case 4:if(o=e.map((function(e){return e instanceof Kc?{track:e}:Object.assign({},e)})),a={},o=o.filter((function(e){var t=e.track.getTrackId();return!a[t]&&(a[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:rs.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 l=r.sent,d=l.reqBody,r.next=19,this._exchangeHandle(d);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===rs.SUCCESS){r.next=23;break}return r.abrupt("return",{code:h.code});case 23:if(p=h.data,m=p.sdp,g=p.resultCode,v=p.message,_=p.subscribedList,g===rs.SUCCESS){r.next=26;break}return r.abrupt("return",(os.error("change subscribe list failed:",v,g),{code:g}));case 26:return o.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var n=I._roomRes[t.getTrackId()].msid,r=eu(t.getTrackId()),i=r.tag,o=[r.userId,i].join("_");m.sdp=m.sdp.replace(new RegExp(n,"g"),o)}})),r.next=29,this._pc.setRemoteAnswer(m.sdp);case 29:if((y=r.sent)===rs.SUCCESS){r.next=32;break}return r.abrupt("return",{code:y});case 32:for(S in R=null==_?void 0:_.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),b=o.filter((function(e){if(e.track.isMCUTrack()){var t=I._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())})),C=null==b?void 0:b.map((function(e){return"".concat(e.track.getTrackId())})),E=o.filter((function(e){return!(null==C?void 0:C.includes(e.track.getTrackId()))})),T=function(e){var t=b.some((function(t){return t.track.getTrackId()===e}));I._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)T(S);return r.abrupt("return",((i=this._subscribedList).splice.apply(i,[0,this._subscribedList.length].concat(s(b))),E.length?{code:rs.SUCCESS,failedList:E}:{code:rs.SUCCESS}));case 36:case"end":return r.stop()}}),r,this)})))}},{key:"_diffCDNUris",value:function(e){return ns(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 ns(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,a,s,c,u,l,d,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||Wu.FLV,a=this._initOptions.pullInnerCDNUseHttps===Qu.NOT_HTTPS?Qu.NOT_HTTPS:Qu.HTTPS,this._CDNUris.url){t.next=3;break}return t.abrupt("return",(os.error("cdn_uris url is empty, the anchor need to open or push CDN, code: ".concat(rs.CDN_RESOURCE_IS_EMPTY)),{code:rs.CDN_RESOURCE_IS_EMPTY}));case 3:return s={"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(a)),u=c.join("&"),l="".concat(this._CDNUris.url,"?"),u&&(l+=u),t.next=10,this._service.getCDNResourceInfo(s,l);case 10:return d=t.sent,h=d.code,f=d.res,t.abrupt("return",h!==rs.SUCCESS?(os.error("getCDNPlayUrl failed: ".concat(h)),{code:h}):(os.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e||ou(e)){n.next=2;break}return n.abrupt("return",(os.error("`resolution` is invalid"),{code:rs.PARAMS_ERROR}));case 2:if(!t||au(t)){n.next=4;break}return n.abrupt("return",(os.error("`fps` is invalid"),{code:rs.PARAMS_ERROR}));case 4:return r=e?iu(e):{width:null,height:null},i=r.width,o=r.height,a=t?su(t):null,s={},n.abrupt("return",(i&&(s.w=i),o&&(s.h=o),a&&(s.fps=a),this._getCDNPlayUrl(s)));case 6:case"end":return n.stop()}}),n,this)})))}},{key:"subscribe",value:function(e){return ns(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",cs((function(){return n._subscribeHandle(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return ns(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($t("tracks",e,(function(){return je(e)&&e.length>0&&e.every((function(e){return e instanceof Kc}))}),!0)){n.next=2;break}return n.abrupt("return",(os.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:rs.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(Ru.SUBSCRIBE,bu.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 ns(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",cs((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__destroy",value:function(e){var t;return ns(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 ns(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,Pt.LIVE);case 2:t=e.sent,t.code!==st.SUCCESS&&os.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 Du(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,s(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}(),sl=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},cl=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,Au.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new nl(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===Le.RTC_ROOM&&(this._crtRoom instanceof $u&&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===rs.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 cs((function(){return n._joinRTCRoom(e,t)}))}},{key:"_joinRTCRoom",value:function(e,t){return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!pu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:rs.PACKAGE_ENVIRONMENT_ERROR});case 2:if($t("roomId",e,qe,!0)){n.next=4;break}return n.abrupt("return",{code:rs.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===ut.CONNECTED){n.next=8;break}return n.abrupt("return",{code:rs.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:rs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return os.debug("joinRoom -> roomId: ".concat(e,"; joinType: ").concat(t||Bt.KICK)),n.next=13,this._context.joinRTCRoom(e,Pt.RTC,void 0,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===st.SUCCESS){n.next=19;break}return os.error("joinRoom failed -> code: ".concat(i)),n.abrupt("return",{code:i===is.JOIN_REFUSED?rs.SIGNAL_JOIN_RTC_ROOM_REFUSED:i});case 19:return os.debug("joinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),a=new el(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this)),n.abrupt("return",(this._crtRoom=a,{room:a,code:rs.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()}));case 22:case"end":return n.stop()}}),n,this)})))}},{key:"joinLivingRoom",value:function(e,t){var n=this;return cs((function(){return n._joinLivingRoom(e,t)}))}},{key:"_joinLivingRoom",value:function(e,t){return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!pu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:rs.PACKAGE_ENVIRONMENT_ERROR});case 2:if($t("roomId",e,qe,!0)&&$t("livingType",t,(function(e){return e===Gu.AUDIO||e===Gu.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:rs.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===ut.CONNECTED){n.next=8;break}return n.abrupt("return",{code:rs.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:rs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return os.debug("joinRoom, roomId: ".concat(e)),n.next=13,this._context.joinRTCRoom(e,Pt.LIVE,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===st.SUCCESS){n.next=18;break}return n.abrupt("return",(os.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 18:return os.debug("JoinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),a=new $u(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this),t,!1,!0),this._crtRoom=a,s={room:a,code:rs.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()},n.abrupt("return",(a.__getCDNPushMode()===Yu.MANUAL&&Object.assign(s,{CDNEnable:a.__getCDNEnable()}),s));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"getAudienceClient",value:function(){return this._audience||(this._audience=new rl(this._context,this._runtime,this._options)),this._audience}},{key:"_onIMStatusChange",value:function(e){os.debug("signal server connection state change: ".concat(e)),e===ut.CONNECTED&&(this._crtRoom instanceof $u&&this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()})),this._crtRoom&&this._crtRoom.__onReconnected())}},{key:"_onIMDisconnect",value:function(){os.debug("TODO -> on IM disconnect")}},{key:"_onIMUninit",value:function(){os.debug("TODO -> on IM client ondestroy")}},{key:"leaveRoom",value:function(e){var t=this;return cs((function(){return t._leaveRoom(e)}))}},{key:"_leaveRoom",value:function(e){return ns(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:os.debug("quitRTCRoom -> userId: ".concat(this._context.getCurrentId()," , roomId: ").concat(this._crtRoom.getRoomId())),this._crtRoom=null,e.t0={code:rs.SUCCESS},e.next=9;break;case 8:e.t0={code:rs.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 ns(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:rs.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:rs.PERMISSION_DENIED});case 11:os.error("get user media failed -> ".concat(n.t0.message));case 12:return n.abrupt("return",{code:"getUserMedia"===t?rs.GET_USER_MEDIA_FAILED:rs.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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Jc(e)){n.next=2;break}return n.abrupt("return",{code:rs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:rs.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,(a=i.code)===rs.SUCCESS){n.next=12;break}return n.abrupt("return",{code:a});case 12:return s=o.getAudioTracks()[0],n.abrupt("return",{code:a,track:new Fc(e,r,s)});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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s,c,u,l,d;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Jc(e)){n.next=2;break}return n.abrupt("return",{code:rs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:rs.INVALID_USER_ID});case 5:return i=ou(null==t?void 0:t.resolution)?t.resolution:bc.W640_H480,o=iu(i),a=o.width,s=o.height,n.next=11,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:su((null==t?void 0:t.frameRate)||Rc.FPS_15),width:a,height:s,facingMode:null==t?void 0:t.faceMode}});case 11:if(c=n.sent,u=c.stream,(l=c.code)===rs.SUCCESS){n.next=16;break}return n.abrupt("return",{code:l});case 16:return d=u.getVideoTracks()[0],n.abrupt("return",{code:l,track:new Hc(e,r,d)});case 18:case"end":return n.stop()}}),n,this)})))}},{key:"createMicrophoneAndCameraTracks",value:function(){var e,t,n,r,i,o,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",s=arguments.length>1?arguments[1]:void 0;return ns(this,void 0,void 0,regeneratorRuntime.mark((function c(){var u,l,d,h,f,p,m,g,v;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(u=[],Jc(a)){c.next=3;break}return c.abrupt("return",{code:rs.INVALID_TAGS,tracks:u});case 3:if(l=this._context.getCurrentId()){c.next=6;break}return c.abrupt("return",{code:rs.INVALID_USER_ID,tracks:u});case 6:return d=ou(null===(e=null==s?void 0:s.video)||void 0===e?void 0:e.resolution)?s.video.resolution:bc.W640_H480,h=iu(d),f=h.width,p=h.height,c.next=12,this._getMediaStream({video:{deviceId:null===(t=null==s?void 0:s.video)||void 0===t?void 0:t.cameraId,frameRate:su((null===(n=null==s?void 0:s.video)||void 0===n?void 0:n.frameRate)||Rc.FPS_15),width:f,height:p,facingMode:null===(r=null==s?void 0:s.video)||void 0===r?void 0:r.faceMode},audio:{deviceId:null===(i=null==s?void 0:s.audio)||void 0===i?void 0:i.micphoneId,sampleRate:null===(o=null==s?void 0:s.audio)||void 0===o?void 0:o.sampleRate}});case 12:return m=c.sent,g=m.stream,v=m.code,c.abrupt("return",(v!==rs.SUCCESS||g.getTracks().forEach((function(e){"video"===e.kind?u.push(new Hc(a,l,e)):u.unshift(new Fc(a,l,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 ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a,s,c,u,l,d,h,f;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Jc(e)){n.next=2;break}return n.abrupt("return",{code:rs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:rs.INVALID_USER_ID});case 5:if(lu()){n.next=7;break}return n.abrupt("return",{code:rs.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:rs.PARAMS_ERROR});case 10:return o=ou(null==t?void 0:t.resolution)?t.resolution:bc.W1280_H720,a=iu(o),s=a.width,c=a.height,u=i?{mandatory:{chromeMediaSourceId:t.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:s,maxWidth:s,minHeight:c,maxHeight:c}}:{frameRate:su((null==t?void 0:t.frameRate)||Rc.FPS_15),width:s,height:c},n.next=17,this._getMediaStream({video:u,audio:!1},i?"getUserMedia":"getDisplayMedia");case 17:if(l=n.sent,d=l.stream,(h=l.code)===rs.SUCCESS){n.next=22;break}return n.abrupt("return",{code:h});case 22:return f=d.getVideoTracks()[0],n.abrupt("return",{code:h,track:new jc(e,r,f)});case 24:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalAudioTrack",value:function(e,t){return ns(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(Jc(e)){n.next=2;break}return n.abrupt("return",{code:rs.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){n.next=4;break}return n.abrupt("return",{code:rs.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:rs.SUCCESS,track:new Mc(e,r,t)}:{code:rs.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalVideoTrack",value:function(e,t){return ns(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(Jc(e)){n.next=2;break}return n.abrupt("return",{code:rs.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"video"===t.kind){n.next=4;break}return n.abrupt("return",{code:rs.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:rs.SUCCESS,track:new Lc(e,r,t)}:{code:rs.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalFileTracks",value:function(e,t,n){return ns(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(Jc(e)){r.next=2;break}return r.abrupt("return",{code:rs.INVALID_TAGS,tracks:[]});case 2:if(uu()){r.next=4;break}return r.abrupt("return",{code:rs.BROWSER_NOT_SUPPORT,tracks:[]});case 4:if(i=t instanceof File?URL.createObjectURL(t):t,We(i)||/^blob:/.test(i)){r.next=7;break}return r.abrupt("return",(os.warn("createLocalFileTracks failed: params error -> url: ".concat(i)),{code:rs.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 s,c=[];try{var u=r.mozCaptureStream?"mozCaptureStream":"captureStream";s=r[u]()}catch(e){os.error("create RCLocalFileTrack failed, captureSteam error. -> url: ".concat(i)),os.error(e),t({code:rs.CREATE_FILE_TRACK_FAILED,tracks:c})}var l=a(sl(s,n),2),d=l[0],h=l[1];d&&c.push(new Bc(e,o,d,r)),h&&c.push(new Vc(e,o,h,r)),0===c.length&&(r.pause(),r.src=""),r.onerror=null,t({code:rs.SUCCESS,tracks:c})},r.onerror=function(){os.error("create RCLocalFileTrack failed -> url: ".concat(i)),t({code:rs.CREATE_FILE_TRACK_FAILED,tracks:[]})},r.src=i,r.loop=!0,r.play()})):{code:rs.INVALID_USER_ID,tracks:[]});case 9:case"end":return r.stop()}}),r,this)})))}},{key:"createLocalTracks",value:function(e,t,n){return ns(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,l;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=[],Jc(e)){r.next=3;break}return r.abrupt("return",{code:rs.INVALID_TAGS,tracks:i});case 3:if(t instanceof MediaStream){r.next=5;break}return r.abrupt("return",{code:rs.PARAMS_ERROR,tracks:i});case 5:if(o=this._context.getCurrentId()){r.next=8;break}return r.abrupt("return",{code:rs.INVALID_USER_ID,tracks:i});case 8:return s=sl(t,n),c=a(s,2),u=c[0],l=c[1],r.abrupt("return",(u&&i.push(new Mc(e,o,u)),l&&i.push(new Lc(e,o,l)),{code:rs.SUCCESS,tracks:i}));case 10:case"end":return r.stop()}}),r,this)})))}},{key:"joinLivingRoomAsAudience",value:function(e,t){return ns(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!pu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:rs.PACKAGE_ENVIRONMENT_ERROR});case 2:if($t("roomId",e,qe,!0)&&$t("livingType",t,(function(e){return e===Gu.AUDIO||e===Gu.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:rs.PARAMS_ERROR});case 4:if(!this._crtAudienceLivingRoom){n.next=6;break}return n.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 6:if(this._service.getNaviMS().length){n.next=8;break}return n.abrupt("return",{code:rs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 8:return n.next=10,this._context.joinLivingRoomAsAudience(e,Pt.LIVE,t);case 10:if(r=n.sent,i=r.code,o=r.data,i===st.SUCCESS){n.next=15;break}return n.abrupt("return",(os.error("audienceJoinLivingRoomError:",i),{code:rs.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}));case 15:return os.info("joinLivingRoomAsAudience success, room data: ".concat(JSON.stringify(o))),a=new al(this._context,this._runtime,this._options,e,o,t),n.abrupt("return",(this._crtAudienceLivingRoom=a,{room:a,code:rs.SUCCESS,userIds:a.getRemoteUserIds(),RTCTracks:a.getRemoteRTCTracks(),MCUTracks:a.getRemoteMCUTracks(),CDNUris:a.getCDNInfo()}));case 18:case"end":return n.stop()}}),n,this)})))}},{key:"leaveLivingRoomAsAudience",value:function(e){return ns(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:rs.PARAMS_ERROR},t.next=9;break;case 5:return t.next=7,this._crtAudienceLivingRoom.__destroy(!0);case 7:this._crtAudienceLivingRoom=null,t.t1={code:rs.SUCCESS};case 9:t.t0=t.t1,t.next=13;break;case 12:t.t0={code:rs.SUCCESS};case 13:return t.abrupt("return",t.t0);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"upgradeToAnchorRoom",value:function(e){return ns(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($t("room._roomId",e._roomId,qe,!0)){t.next=2;break}return t.abrupt("return",{code:rs.PARAMS_ERROR});case 2:if(!this._crtRoom){t.next=4;break}return t.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Vt.ViewerToAnchor,e._livingType);case 6:if(n=t.sent,r=n.code,i=n.data,r===st.SUCCESS){t.next=11;break}return t.abrupt("return",(os.error("change room identity error",r),{code:rs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return t.next=13,this._crtAudienceLivingRoom.__destroy(!1);case 13:return o=new $u(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:rs.SUCCESS,userIds:e.getRemoteUserIds(),tracks:o.getRemoteTracks()}));case 15:case"end":return t.stop()}}),t,this)})))}},{key:"downgradeToAudienceRoom",value:function(e){return ns(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($t("room._roomId",e._roomId,qe,!0)){t.next=2;break}return t.abrupt("return",{code:rs.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.next=4;break}return t.abrupt("return",{code:rs.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Vt.AnchorToViewer,e.getLivingType());case 6:if(n=t.sent,r=n.code,i=n.data,r===st.SUCCESS){t.next=11;break}return t.abrupt("return",(os.error("change room identity error",r),{code:rs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return os.info("downgradeToAudienceRoom success, room data: ".concat(JSON.stringify(i))),o=new al(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:rs.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 ns(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!==st.SUCCESS?(os.error("getJoinedUserInfo error",n),{code:rs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:rs.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"}(il||(il={}));var ul={tag:"RCRTC",verify:function(e){return"browser"!==e.tag?(os.error("RCRTC Plugin is not support the runtime '".concat(e.tag,"'")),!1):Wc?(qt.add("plugin-rtc","5.3.1"),!!qt.validEngine("5.1.0")||(os.error("The current engine version '".concat(qt.getInfo().engine,"' error, plugin-rtc required engine version at least '5.1.0'.")),!1)):(os.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 os.setLogLevel(n.logLevel),os.setLogStdout(n.logStdout),os.warn("RCRTC Version: 5.3.1, Commit: e1af0f5ccb06a0084c94e1219d8af54c9793c06b"),os.warn("browserInfo.browser -> ".concat(cu.browser)),os.warn("browserInfo.supportsUnifiedPlan -> ".concat(cu.supportsUnifiedPlan)),os.warn("browserInfo.version -> ".concat(cu.version)),Zt("options.mediaServer",n.mediaServer,(function(e){return!(!We(e)||"https:"===location.protocol&&!/^https/.test(e))})),Zt("options.timeout",n.timeout,(function(e){return He(e)&&e>=5e3&&e<=3e4})),Zt("options.pingGap",n.pingGap,(function(e){return He(e)&&e>=3e3&&e<=1e4})),new cl(e,t,n)}},ll={transResolution:iu,transFrameRate:su,parseTrackId:eu,ifSupportLocalFileTrack:uu,ifSupportScreenShare:lu};var dl={"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","RC:ForcedOffline":"ForcedOffline","RC:LookerLoginOut":"LookerLoginOut"},hl=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)}))}}}(),fl="start-live-time",pl="start-live-status",ml="video-deviceId",gl="audio-deviceId",vl="audio-device-volume",_l=f({roomUid:sessionStorage.getItem("roomUid")||"",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:y(null),rtcClient:null,joinedRoom:null,mediaStreamTrack:[],mediaStreams:null,videoStatus:"init",microphones:[],cameras:[],selectedCamera:null,selectedMicrophone:null,likeCount:0,lookCount:0,lastLikeCount:0,activeTracks:{},allowSeatsCtrl:!0,allowChatCtrl:!0,deviceStatus:{microphone:"init",camera:"init",screen:"init"}}),yl=_l;!function(e){ua=ua||new la(e)}({appkey:"c9kqb3rdc451j"});var Rl=ts("RC:Chatroom:SeatsCtrl",!0,!0),bl=ts("RC:Chatroom:ChatBan",!0,!0),Cl=ts("RC:Chatroom:SeatApply",!0,!0),El=ts("RC:Chatroom:SeatResponse",!0,!0),Tl=Uo,Sl=(Tl.MESSAGES,o(Tl,e));ya(Tl.MESSAGES,(function(e){console.log(e,"收到消息");var t,n=b(e.messages);try{for(n.s();!(t=n.n()).done;){var r=t.value;dl[r.messageType]&&hl.emit(dl[r.messageType],i(i({},r.content),{},{$EventMessage:r}))}}catch(o){n.e(o)}finally{n.f()}}));for(var Il=function(){var e=kl[wl];ya(e,(function(t){console.log(e,t),hl.emit(e,{$EventMessage:null})}))},wl=0,kl=Object.values(Sl);wl<kl.length;wl++)Il();ya(Tl.CONNECTING,(function(){console.log("connecting"),_l.imConnectStatus="connecting"})),ya(Tl.CONNECTED,(function(){console.log("connected"),_l.imConnectStatus="connected"})),ya(Tl.DISCONNECT,(function(){console.log("disconnect"),_l.imConnectStatus="disconnect"}));var xl=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,_a(t);case 3:return r=e.sent,_l.rtcClient=va(ul,{}),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)}}(),Ol=function(e){localStorage.setItem(vl,e.toString()),_l.videoRef&&(_l.videoRef.volume=e/100),_l.activeTracks.microphone&&_l.activeTracks.microphone._element&&(_l.activeTracks.microphone._element.volume=e/100)},Nl=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(!_l.rtcClient||_l.screenShareStatus){e.next=9;break}return e.next=3,Ul("screen");case 3:n=e.sent,r=_l.activeTracks.camera,null===(t=_l.joinedRoom)||void 0===t||t.unpublish([r]),Dl([n],"screen"),_l.videoRef&&(n.play(_l.videoRef),_l.screenShareStatus=!0),null==n||n.on(Pc.EVENT_LOCAL_TRACK_END,(function(e){_l.screenShareStatus=!1,e.destroy(),r&&(Dl([r],"camera"),_l.videoRef&&r.play(_l.videoRef))}));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Al=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,Oc();case 2:return t=e.sent,_l.microphones=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Pl=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,xc();case 2:return t=e.sent,_l.cameras=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ml=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:if(_l.selectedCamera=t,localStorage.setItem(ml,t.deviceId),!(n=_l.activeTracks.camera)){e.next=6;break}return e.next=6,Vl([n],"camera",n.isPublished());case 6:return e.next=8,Ul("camera");case 8:r=e.sent,Dl([r],"camera","liveing"===_l.videoStatus);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ll=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:if(_l.selectedMicrophone=t,localStorage.setItem(gl,t.deviceId),!(n=_l.activeTracks.microphone)){e.next=6;break}return e.next=6,Vl([n],"microphone",n.isPublished());case 6:return e.next=8,Ul("microphone");case 8:r=e.sent,Dl([r],"microphone","liveing"===_l.videoStatus);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ul=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,s,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=_l.rtcClient)||void 0===o?void 0:o.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:null===(a=_l.selectedMicrophone)||void 0===a?void 0:a.deviceId});case 4:r=e.sent,e.next=16;break;case 7:if("camera"!==t){e.next=13;break}return e.next=10,null===(s=_l.rtcClient)||void 0===s?void 0:s.createCameraVideoTrack("RongCloudRTC",{cameraId:null===(c=_l.selectedCamera)||void 0===c?void 0:c.deviceId,faceMode:"user",frameRate:Rc.FPS_24,resolution:bc.W1920_H1080});case 10:r=e.sent,e.next=16;break;case 13:return e.next=15,null==_l||null===(u=_l.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,("camera"!==t||_l.cameras.length)&&("microphone"!==t||_l.microphones.length)&&("screen"!==t||_l.screenShareStatus)||(_l.deviceStatus[t]="none"),r.code===rs.PERMISSION_DENIED?_l.deviceStatus[t]="denied":_l.deviceStatus[t]="granted",e.abrupt("return",i);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Dl=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s,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=b(t);try{for(i.s();!(o=i.n()).done;)a=o.value,"microphone"===n&&(console.log("添加麦克风"),a.play()),_l.activeTracks[n]=a}catch(u){i.e(u)}finally{i.f()}if(!r){e.next=6;break}return e.next=6,null===(s=_l.joinedRoom)||void 0===s?void 0:s.publish(t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Vl=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,a,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!(s.length>2&&void 0!==s[2])||s[2])){e.next=4;break}return e.next=4,null===(r=_l.joinedRoom)||void 0===r?void 0:r.unpublish(t);case 4:i=b(t);try{for(i.s();!(o=i.n()).done;)null==(a=o.value)||a.destroy(),_l.activeTracks[n]=null}catch(c){i.e(c)}finally{i.f()}case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Bl=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ra(t,{count:-1});case 2:return e.next=4,null===(i=_l.rtcClient)||void 0===i?void 0:i.joinLivingRoom(t,n);case 4:if((null==(a=e.sent)?void 0:a.code)==rs.SUCCESS){e.next=7;break}throw Error("加入房间失败");case 7:return null===(o=a.room)||void 0===o||o.registerRoomEventListener(r),e.abrupt("return",a);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Fl=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bl(t,n,r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Hl=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(o.length>0&&void 0!==o[0])||o[0],"stream"===_l.videoStatus){e.next=5;break}throw n="请确定摄像头已经开启",C.error(n),Error(n);case 5:if(!_l.joinedRoom){e.next=14;break}return e.next=9,Dl([_l.activeTracks.camera],"camera");case 9:return e.next=11,Dl([_l.activeTracks.microphone],"microphone");case 11:return e.next=13,u.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"1",roomUid:_l.roomUid,userId:null===(i=r.user)||void 0===i?void 0:i.speakerId}});case 13:_l.videoStatus="liveing";case 14:t&&sessionStorage.setItem(fl,E().valueOf().toString()),sessionStorage.setItem(pl,"liveing");case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),jl=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,i,o,a,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>0&&void 0!==s[0]&&s[0],e.next=3,u.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"2",roomUid:_l.roomUid,userId:null===(t=r.user)||void 0===t?void 0:t.speakerId}});case 3:sessionStorage.removeItem(fl),sessionStorage.removeItem(pl),e.t0=regeneratorRuntime.keys(_l.activeTracks);case 6:if((e.t1=e.t0()).done){e.next=18;break}if(i=e.t1.value,!Object.prototype.hasOwnProperty.call(_l.activeTracks,i)){e.next=16;break}if(!(o=_l.activeTracks[i])){e.next=16;break}return e.next=13,null===(a=_l.joinedRoom)||void 0===a?void 0:a.unpublish([o]);case 13:if(!n){e.next=16;break}return e.next=16,Vl([o],i);case 16:e.next=6;break;case 18:_l.videoStatus="stream";case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Kl=function(){var e=n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_l.likeCount===_l.lastLikeCount&&0!==_l.likeCount||!r.user){e.next=9;break}return e.prev=1,e.next=4,u.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:_l.likeCount,roomUid:_l.roomUid}});case 4:_l.lastLikeCount=_l.likeCount,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:setTimeout((function(){Kl()}),6e4);case 10:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}(),ql=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}},Yl=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:"text",i=null,t){e.next=4;break}return e.abrupt("return");case 4:if(o={conversationType:Le.CHATROOM,targetId:null===(n=_l.joinedRoom)||void 0===n?void 0:n._roomId},"text"===r?i=new ka({user:ql(),content:t}):"SeatsCtrl"===r?i=new Rl(t):"ChatBan"===r?i=new bl(t):"SeatApply"===r?i=new Cl(t):"SeatResponse"===r&&(i=new El(t)),i){e.next=8;break}return e.abrupt("return");case 8:return console.log(i),e.next=11,$a(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)}}(),Gl=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||!_l.activeTracks[t]){e.next=5;break}null===(r=_l.activeTracks[t])||void 0===r||r.unmute(),e.next=11;break;case 5:return e.next=7,Ul(t);case 7:return i=e.sent,e.next=10,Dl([i],t,n);case 10:_l.videoRef&&i.play(_l.videoRef);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),zl=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=_l.activeTracks[t],"microphone"===t){e.next=7;break}return e.next=5,Vl([r],t,n);case 5:e.next=8;break;case 7:null==r||r.mute();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Jl=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=_l.activeTracks[t],r="liveing"===_l.videoStatus,n?("camera"===t&&(_l.deviceStatus.camera="closed"),zl(t,r)):("camera"===t&&(_l.deviceStatus.camera="granted"),Gl(t,r));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Wl=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,jl(!0);case 2:if(!_l.joinedRoom){e.next=6;break}return e.next=5,null===(t=_l.rtcClient)||void 0===t?void 0:t.leaveRoom(_l.joinedRoom);case 5:_l.joinedRoom=null;case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ql=S({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,Wl();case 3:return t.next=5,u.post("/api-auth/exit",{data:{}});case 5:zl("camera"),zl("microphone"),r.user=null,C.success("退出成功"),d(),e.$router.push({path:"/login",query:i({},e.$route.query)}),t.next=15;break;case 13:t.prev=13,t.t0=t.catch(0);case 15:case"end":return t.stop()}}),t,null,[[0,13]])})))()}},render:function(){var e,t,n,i=this;return I("div",{class:$},[I("div",{class:te},[I("div",{class:ne},[I("img",{class:ee,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:re},[w("《"),null===(n=r.user)||void 0===n?void 0:n.roomTitle,w("》")])]),I(k,{trigger:"hover"},{default:function(){var e,t,n;return[I("div",{class:ie},[null!==(e=r.user)&&void 0!==e&&e.speakerPic?I("img",{class:oe,src:null===(t=r.user)||void 0===t?void 0:t.speakerPic},null):I("img",{class:oe,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAJy0lEQVRYR62ZeXTTVRbHPy9tU5qmC90oqSylDBYBPbgM6PEIOqioVEekMgocdMTDjkwtAxTBslNgKrJDBaWnIoyKMgozc8bBQQdBFodddlpKW5bSJulC0yS/35z3a9KmadIUZ945yR959933fffd+73v3gh+wVBVVQc8CDwBPADcDXQEIlzqqoAy4CxwBNgDHBZCKHe6nbiTBaqqJgETgZFAJ/daVVVp+CigAgKE0CGE0D6uUQwUAGuEECVt3bdNAFVVjQXmAW8AoVK5BHTt6hVOHTnEyYMHuF50icobZThs9QTr9UQnmujT/1GeHPoyCSZ5rsZhAzYBc4QQtwIBDQhQVdXhwGogTipzOp2cOHSAr/M3U3b+JDHGcBJjowgNCUGnkzevwcfpVLlZaaH4lpX0yZkMTHvRY14TKgcmCSG2twbSL0BVVYOBlcC4hksDq7mS/PdyuHDgO5JN8UQYwjyv0Oc+druD45eKeSVzDo889Yy3vHSI9cAUIYTDlwKfAFVVDQM+BZ5zLzLfuknO1PEYbVZMCfLG2z4cTifHr9xg1vp8Ejt19rVwF5AuhLjtPdkCoMtyX3qCq7fZmDd2NFGOKuKiIl32bDtAKVlWXoHpoYG89vZMfwslyN96W9IXwLXAeM8I/eLDPP7z1TaSTQkBr9Tf7k6nwumyCmZ/sJX2cfH+xNYJISZ4TjYD6AqIT9w+JwWrLWamD0+jbzcTQY1BcGfWc0uX3qzAQiivTZ9Nz74P+jqs9MlXPAOnEaCLSs64o9Wt9O+ffsK+rRtJTkr8Zai8VtXV13P0Qgnv5BXQKaW7L50yulPdFOQJcA3QzLyS65ZMHUdUbTlhofqAAJ2Kovna9QorApWOce3pENseXRNZazrMVTUEdU5lyvyl/nSuFULIhNBAH64McdFNwq7f2Pv1Tj5fv4K+XRMD+p6luobCmxb6Pf08jz31LE5rBbu//JzSn4+SnNShGRB58NPXq5j30TYMRnd2bCYiyTxFZhw3wEVAs/CqtlqYMGQQBqHQr0+PVqynUm62ctMezNiZc0lJ7SlPDNVmLOYK5rw1nvuSTS0OeKLoOjM3FhDf0eRP92IhRJZwJf5Cz9wqV5QWXWbBmFeJDtPzq85+lSAtV1zlYM7qD4hqH9O0WXUlqqKwauli6q5dIj46qhmQE4Vl/FHy4l0+eVHKytzdVQL8NfCj9zGKL13g/Slv0C0xlrB2WvptMWpu13HuuoWZ762nozcB11hAcXK9rIx5mVPok2wiNEQmp4ZxqrSSdzdvIyI6ujXf7icBzgAWe0uZK24xd/Qw+nTu4NP/aurqOFtawVsLc+nes5cP9FZQHNqj4vCBH9iyKpfUTomEG9pRZ6vnlj6arFV53vnZW89MCVCmtGHeM1JxztRxhFSUEBPl6cgqVTV1nL9hZvLcpfTofa9vC9RawdmUXk8dP8qWtatIDA+m0lpNyoBnGT01M1DwfSYBHgf6+AK4dMYMzuzfw/3dkzAawlAUlZKbt6h0BpGxMJdOyd38X8/tKnDYm82XlVxl0cxpOFWV0JgujMnMoNf9ff3qUFX1hAR405uc5YobZdfYsCSHUWNeZ3lWBkF1VYh2Ru4fMIhhr72JwWhszXfgdjU46pvLqHDm9El2fPEVacNfZe+3e5k0S3qY31EuAdZ58p9btPhyIds3bCQzew5/3pJPu3Z6Hh88GGNkVKBraVDhw4Ly50qzmfz87aSlD2Pn5zv4w9x3WwNo8wvQbrfzzviJTMiYSuGFi1gtVtLSX2rdap6zXj7onjpz5hw/HTuN2WwmpVcvnn7xhdauWAPo84rlqrMnT7Fq/kLi4uLQ6/VkLV7QdoA1DVHsPT7d9hk7d+6m/+MDGTstgxC9/xSqqqp2xT6DxK1YvgV/PnaczStWsmzdGvRtyMna2mozyCLKY0hmWDB3Ea9OnkK3Hj0QutYrDkVRtCDxSTPeinNmzOKFYUPp2ad3YCtqqa6yhVxFRSXvr9zAu6tWBOI/ba2qqhrN+CRqb+3HDx3mX7t2M3n6tMBBojhBZhKv8ZeduzAkdGTQ80MCHxJwOBwaUftMdd4aZDWXPWUqvx8/juTuKa1vIOlF0ozHqKquZvnylUxfmoMhPDwgQEVRZAWppTpZK7Z4LPjScProMbbnbWJ2ziKCg5vyagtZWy3US/ZqGPKZvCnvI1If6sejT/4mIDgpoChKsU6n6+r3ueVLizzV1g15OG02Rr75BkFBQS3FpP9JipHX7Crwv/9+H8fPXGTc9GmtH8x9IFXW1c7FISEhWX4frP6O6XA4WL1gERHhRkaNHaPRT7PhtEOtbM1oVmDPP/ey/9BPZC6cT5jB0Fbr2Ww2W4rBYGh4sLpO2uLJ70+b4lTYUfAxe3f/VbPkQw/3RyetqVmvClVxcKXoCpvzttClZ09GTRjXKt9572O329fq9fqmJ78LoKzGWxRNvkBKPjt28BCL3s7grq4p2lXHxscRLh8U9nqqLFZqamu5UlzCsg83Yerc2GcKaEGn01leW1ubGhkZqfVtApadvjReLSxiReaLdI4pIfXJNTwy4DHKiy5RV1urEXlsXCxlpaXkLX+dkPYPkr3+Y9qFyWZF60NVVdVut78SGhra2K8JWLh7qpSWc9jtbFyeS8+QZSTEKOw4OoLZCxcgZOQ2+QtbC7bSwbmEE+f0hPXIZMjwdBJNJoL8RL+m2+FYp9fr/RfurquW/NGs9SEXX71cyGf5Bfzj4I+UWirJGXKWQf3r+dMWI6beE3kpfbgWBA67jX/v/YZvdy4ma0w5K7eGs9E2EIPZwj2hBtIGDyZteDoRUU01itRvt9t36fX6wK0PF8jG5pG5ooKP1qzj4/37uNarB3WmRIKrqhh5LJ8lkyzU3Ba8lRPJeboRZozAXmmmd0QRORkWFAVG5HZh/7MjIEiHqLcTfrGQ7oWlTBw1kmeGDtVcwgWubc0jj6gOLrp0aeXsGVnjvouLFDU9UrRNXCFP0jd7WPrwIXb+YORv8QOw9rkHWZ9LEPEHDjIi8giJMU7mW5+h6t57ZMu10QN0NhsxR07wu6Su6tvZs9cbjcY7a795+p1p1rTh9QnxqxENDUz3CDZbifvmOyoe6099QrMpjW4M5y8TcfocN54bhOpRzbnXh+h05d2KSiftW5b7yxqYnmAiVi+K1TtD5gmhNraAtfwlv7zaGk2B4nteJ4TNGKLfdF9C9Jwvho7+31vAnkBj1+Um4bBPBDFSqE1N9ED0Ief1QUHFQUJXcF9czJqvXx79/22itwCQna2LjQmT/bMnUMUDOqHejSo6qqgRslEkhND+hhBCd1ZVlCOxkeF7Tl++fpjs7Dv+G+K/XpA1Lg9OfHQAAAAASUVORK5CYII="},null),I("span",null,[null===(n=r.user)||void 0===n?void 0:n.speakerName])])]},dropdown:function(){return I(x,null,{default:function(){return[I(O,{command:"1",onClick:i.loginOut},{default:function(){return[I("span",null,[w("安全退出")])]}})]}})}})])}}),Xl="_header_22t18_1",Zl="_title_22t18_9",$l=S({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,N.confirm("是否确认开始直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,Hl();case 5:C.success("开启成功"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))()},closeLive: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,N.confirm("是否确认结束直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,jl();case 5:C.success("关闭成功"),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]])})))()}},render:function(){var e;return I("div",{class:Xl},[I("h3",{class:Zl},[w("直播内容:"),null===(e=r.user)||void 0===e?void 0:e.liveRemark]),"liveing"===yl.videoStatus?I(A,{type:"danger",color:"#EA4132",onClick:this.closeLive},{default:function(){return[w("关闭直播")]}}):I(A,{type:"primary",color:"#01A79E",onClick:this.startLive},{default:function(){return[w("开始直播")]}})])}}),ed="_action-bar_1akc3_1",td="_bar-btn_1akc3_12",nd="_bar-btn-text_1akc3_19",rd="_volumeSlider_1akc3_71",id="_volumeIcon_1akc3_80",od="_btnInner_1akc3_85",ad={shareWrap:"_shareWrap_d61fv_1",shareBtn:"_shareBtn_d61fv_27"};var sd=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},cd="application/font-woff",ud="image/jpeg",ld={woff:cd,woff2:cd,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ud,jpeg:ud,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function dd(e){var t=function(e){var t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return ld[t]||""}function hd(e){return-1!==e.search(/^(data:)/)}function fd(e,t){return"data:".concat(t,";base64,").concat(e)}var pd,md=(pd=0,function(){return pd+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(pd)});function gd(e){for(var t=[],n=0,r=e.length;n<r;n+=1)t.push(e[n]);return t}function vd(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}function _d(e){var t=vd(e,"border-left-width"),n=vd(e,"border-right-width");return e.clientWidth+t+n}function yd(e){var t=vd(e,"border-top-width"),n=vd(e,"border-bottom-width");return e.clientHeight+t+n}function Rd(){var e,t;try{t=process}catch(Z){}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 bd(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 Cd(e){return sd(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 Ed(e,t,n){return sd(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a;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"),a=document.createElementNS(i,"foreignObject"),o.setAttribute("width","".concat(t)),o.setAttribute("height","".concat(n)),o.setAttribute("viewBox","0 0 ".concat(t," ").concat(n)),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),o.appendChild(a),a.appendChild(e),r.abrupt("return",Cd(o));case 14:case"end":return r.stop()}}),r)})))}var Td={};function Sd(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!=Td[n])return Td[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 Td[n]=r,r}function Id(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 gd(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 wd(e,t,n){var r=window.getComputedStyle(e,n),i=r.getPropertyValue("content");if(""!==i&&"none"!==i){var o=md();try{t.className="".concat(t.className," ").concat(o)}catch(s){return}var a=document.createElement("style");a.appendChild(Id(o,n,r)),t.appendChild(a)}}function kd(e,t){wd(e,t,":before"),wd(e,t,":after")}var xd=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Od(e){return xd(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",bd(n));case 4:case"end":return t.stop()}}),t)})))}function Nd(e,t){return xd(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 Sd(e,t)})).then((function(t){return fd(t.blob,dd(e.poster)||t.contentType)})).then((function(e){return bd(e)})));case 1:case"end":return n.stop()}}),n)})))}function Ad(e,t){return xd(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",Od(e));case 2:if(!(e instanceof HTMLVideoElement&&e.poster)){n.next=4;break}return n.abrupt("return",Nd(e,t));case 4:return n.abrupt("return",Promise.resolve(e.cloneNode(!1)));case 5:case"end":return n.stop()}}),n)})))}function Pd(e,t,n){var r;return xd(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!=(a=e).tagName&&"SLOT"===a.tagName.toUpperCase()&&e.assignedNodes?gd(e.assignedNodes()):gd((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 Dd(r,n)})).then((function(e){e&&t.appendChild(e)}))}),Promise.resolve()).then((function(){return t})));case 4:case"end":return i.stop()}var a}),i)})))}function Md(e,t){var n=window.getComputedStyle(e),r=t.style;r&&(n.cssText?r.cssText=n.cssText:gd(n).forEach((function(e){r.setProperty(e,n.getPropertyValue(e),n.getPropertyPriority(e))})))}function Ld(e,t){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function Ud(e,t){return xd(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 Md(e,t)})).then((function(){return kd(e,t)})).then((function(){return Ld(e,t)})).then((function(){return t})));case 3:case"end":return n.stop()}}),n)})))}function Dd(e,t,n){return xd(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 Ad(e,t)})).then((function(n){return Pd(e,n,t)})).then((function(t){return Ud(e,t)})));case 3:case"end":return r.stop()}}),r)})))}var Vd=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},Bd=/url\((['"]?)([^'"]+?)\1\)/g,Fd=/url\([^)]+\)\s*format\((["'])([^"']+)\1\)/g,Hd=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function jd(e){var t=[];return e.replace(Bd,(function(e,n,r){return t.push(r),e})),t.filter((function(e){return!hd(e)}))}function Kd(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):Sd(e,r)})).then((function(e){return"string"==typeof e?fd(e,dd(t)):fd(e.blob,dd(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 qd(e,t){var n=t.preferredFontFormat;return n?e.replace(Hd,(function(e){for(;;){var t=a(Fd.exec(e)||[],3),r=t[0],i=t[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):e}function Yd(e){return-1!==e.search(Bd)}function Gd(e,t,n){return Vd(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(Yd(e)){r.next=2;break}return r.abrupt("return",Promise.resolve(e));case 2:return i=qd(e,n),r.abrupt("return",Promise.resolve(i).then(jd).then((function(e){return e.reduce((function(e,r){return e.then((function(e){return Kd(e,r,t,n)}))}),Promise.resolve(i))})));case 4:case"end":return r.stop()}}),r)})))}var zd=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Jd(e,t){var n;return zd(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 Gd(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 Wd(e,t){return zd(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&&!hd(e.src)||e instanceof SVGImageElement&&!hd(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 Sd(e,t)})).then((function(e){return fd(e.blob,dd(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 Qd(e,t){return zd(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=gd(e.childNodes),i=r.map((function(e){return Xd(e,t)})),n.abrupt("return",Promise.all(i).then((function(){return e})));case 3:case"end":return n.stop()}}),n)})))}function Xd(e,t){return zd(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 Jd(e,t)})).then((function(e){return Wd(e,t)})).then((function(e){return Qd(e,t)})));case 3:case"end":return n.stop()}}),n)})))}function Zd(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 $d=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},eh={};function th(e){var t=eh[e];if(null!=t)return t;var n=window.fetch(e).then((function(t){return{url:e,cssText:t.text()}}));return eh[e]=n,n}function nh(e){return $d(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 rh(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,a=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");;){var s=o.exec(n);if(null===s){if(null===(s=a.exec(n)))break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;t.push(s[0])}return t}function ih(e){return $d(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{gd(t.cssRules).forEach((function(e,n){if(e.type===CSSRule.IMPORT_RULE){var i=n+1,o=th(e.href).then((function(e){return e?nh(e):""})).then((function(e){return rh(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(Z){var n=e.find((function(e){return null==e.href}))||document.styleSheets[0];null!=t.href&&r.push(th(t.href).then((function(e){return e?nh(e):""})).then((function(e){return rh(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",Z.toString())}})),t.abrupt("return",Promise.all(r).then((function(){return e.forEach((function(e){if("cssRules"in e)try{gd(e.cssRules).forEach((function(e){n.push(e)}))}catch(Z){console.error("Error while reading CSS rules from ".concat(e.href),Z.toString())}})),n})));case 4:case"end":return t.stop()}}),t)})))}function oh(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return Yd(e.style.getPropertyValue("src"))}))}function ah(e){return $d(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(gd(e.ownerDocument.styleSheets))})).then((function(e){return ih(e)})).then(oh));case 1:case"end":return t.stop()}}),t)})))}function sh(e,t){return $d(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",ah(e).then((function(e){return Promise.all(e.map((function(e){var n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Gd(e.cssText,n,t)})))})).then((function(e){return e.join("\n")})));case 1:case"end":return n.stop()}}),n)})))}function ch(e,t){return $d(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):sh(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 uh=globalThis&&globalThis.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(Z){o(Z)}}function s(e){try{c(r.throw(e))}catch(Z){o(Z)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function lh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.width||_d(e),r=t.height||yd(e);return{width:n,height:r}}function dh(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uh(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=lh(e,t),i=r.width,o=r.height,n.abrupt("return",Promise.resolve(e).then((function(e){return Dd(e,t,!0)})).then((function(e){return ch(e,t)})).then((function(e){return Xd(e,t)})).then((function(e){return Zd(e,t)})).then((function(e){return Ed(e,i,o)})));case 2:case"end":return n.stop()}}),n)})))}var hh=16384;function fh(e){(e.width>hh||e.height>hh)&&(e.width>hh&&e.height>hh?e.width>e.height?(e.height*=hh/e.width,e.width=hh):(e.width*=hh/e.height,e.height=hh):e.width>hh?(e.height*=hh/e.width,e.width=hh):(e.width*=hh/e.height,e.height=hh))}function ph(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uh(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",dh(e,t).then(bd).then((function(n){var r=document.createElement("canvas"),i=r.getContext("2d"),o=t.pixelRatio||Rd(),a=lh(e,t),s=a.width,c=a.height,u=t.canvasWidth||s,l=t.canvasHeight||c;return r.width=u*o,r.height=l*o,t.skipAutoScale||fh(r),r.style.width="".concat(u),r.style.height="".concat(l),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 mh=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()}},gh={"text/plain":"Text","text/html":"Url",default:"Text"};var vh=function(e,t){var n,r,i,o,a,s,c=!1;t||(t={}),n=t.debug||!1;try{if(i=mh(),o=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.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=gh[t.format]||gh.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(s),o.selectNodeContents(s),a.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{a&&("function"==typeof a.removeRange?a.removeRange(o):a.removeAllRanges()),s&&document.body.removeChild(s),i()}return c},_h=vh,yh={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 Rh,bh=S({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(P,{model:this.searchForm,ref:"form",inline:!0,class:yh.form},{default:function(){return[I(M,null,{default:function(){return[I(L,{clearable:!0,placeholder:"群聊名称/课程名称",modelValue:n.searchForm.search,onInput:function(e){return n.searchForm.search=e}},null)]}}),I(M,null,{default:function(){return[I(A,{type:"primary",onClick:n.search},{default:function(){return[w("搜索")]}}),I(A,{type:"danger",onClick:n.onReSet},{default:function(){return[w("重置")]}})]}})]}}),this.tableList.length>0?I("div",{class:yh.tableWrap},[I(U,{modelValue:this.checkList},(t=e=this.tableList.map((function(e){return I("div",{class:yh.cell,onClick:function(){return n.resectCheck(e.id)}},[I(D,{class:yh.chioseBox,label:e.id,onChange:function(){return n.resectCheck(e.id)}},{default:function(){return[I("br",null,null)]}}),I("div",{class:yh.dotle},["MUSIC"==e.type?"乐团":"VIP"]),I("div",{class:yh.teamInfo},[I("p",{class:yh.title},[e.name]),I("p",{class:yh.subInfo},[e.memo,w("(共"),e.memberNum,w("人)")])])])})),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!V(t)?e:{default:function(){return[e]}}))]):I(B,{description:"暂无群聊"},null)])}}),Ch="_third_a6fb3_1",Eh="_preCore_a6fb3_19",Th="_title_a6fb3_19",Sh="_second_a6fb3_22",Ih="_first_a6fb3_43",wh="_icon_a6fb3_61",kh="_teacher_a6fb3_68",xh="_start_a6fb3_85",Oh="_time_a6fb3_104",Nh="_content_a6fb3_113",Ah="_pre_a6fb3_19",Ph="_end_a6fb3_133",Mh="_bottom_a6fb3_140",Lh="_logo_a6fb3_146",Uh="_code_a6fb3_150",Dh={},Vh={},Bh={},Fh=[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];Bh.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},Bh.getSymbolTotalCodewords=function(e){return Fh[e]},Bh.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},Bh.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');Rh=e},Bh.isKanjiModeEnabled=function(){return void 0!==Rh},Bh.toSJIS=function(e){return Rh(e)};var Hh={};function jh(){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(Z){return n}}}(Hh),jh.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 Kh=jh;function qh(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)}qh.prototype.set=function(e,t,n,r){var i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},qh.prototype.get=function(e,t){return this.data[e*this.size+t]},qh.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},qh.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Yh=qh,Gh={};!function(e){var t=Bh.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],a=1;a<n-1;a++)o[a]=o[a-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 a=0;a<i;a++)0===o&&0===a||0===o&&a===i-1||o===i-1&&0===a||n.push([r[o],r[a]]);return n}}(Gh);var zh={},Jh=Bh.getSymbolSize;zh.getPositions=function(e){var t=Jh(e);return[[0,0],[t-7,0],[0,t-7]]};var Wh={};!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,a=null,s=null,c=0;c<n;c++){i=o=0,a=s=null;for(var u=0;u<n;u++){var l=e.get(c,u);l===a?i++:(i>=5&&(r+=t+(i-5)),a=l,i=1),(l=e.get(u,c))===s?o++:(o>=5&&(r+=t+(o-5)),s=l,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 a=e.get(i,o)+e.get(i,o+1)+e.get(i+1,o)+e.get(i+1,o+1);4!==a&&0!==a||r++}return r*n},e.getPenaltyN3=function(e){for(var t=e.size,n=0,i=0,o=0,a=0;a<t;a++){i=o=0;for(var s=0;s<t;s++)i=i<<1&2047|e.get(a,s),s>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|e.get(s,a),s>=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,a=0;a<r;a++){n(a),e.applyMask(a,t);var s=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(a,t),s<o&&(o=s,i=a)}return i}}(Wh);var Qh={},Xh=Hh,Zh=[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],$h=[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];Qh.getBlocksCount=function(e,t){switch(t){case Xh.L:return Zh[4*(e-1)+0];case Xh.M:return Zh[4*(e-1)+1];case Xh.Q:return Zh[4*(e-1)+2];case Xh.H:return Zh[4*(e-1)+3];default:return}},Qh.getTotalCodewordsCount=function(e,t){switch(t){case Xh.L:return $h[4*(e-1)+0];case Xh.M:return $h[4*(e-1)+1];case Xh.Q:return $h[4*(e-1)+2];case Xh.H:return $h[4*(e-1)+3];default:return}};var ef={},tf={},nf=new Uint8Array(512),rf=new Uint8Array(256);!function(){for(var e=1,t=0;t<255;t++)nf[t]=e,rf[e]=t,256&(e<<=1)&&(e^=285);for(var n=255;n<512;n++)nf[n]=nf[n-255]}(),tf.log=function(e){if(e<1)throw new Error("log("+e+")");return rf[e]},tf.exp=function(e){return nf[e]},tf.mul=function(e,t){return 0===e||0===t?0:nf[rf[e]+rf[t]]},function(e){var t=tf;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 a=0;a<r.length&&0===r[a];)a++;r=r.slice(a)}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}}(ef);var of=ef;function af(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}af.prototype.initialize=function(e){this.degree=e,this.genPoly=of.generateECPolynomial(this.degree)},af.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=of.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 sf=af,cf={},uf={},lf={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},df={},hf="[0-9]+",ff="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",pf="(?:(?![A-Z0-9 $%*+\\-./:]|"+(ff=ff.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";df.KANJI=new RegExp(ff,"g"),df.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),df.BYTE=new RegExp(pf,"g"),df.NUMERIC=new RegExp(hf,"g"),df.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var mf=new RegExp("^"+ff+"$"),gf=new RegExp("^[0-9]+$"),vf=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");df.testKanji=function(e){return mf.test(e)},df.testNumeric=function(e){return gf.test(e)},df.testAlphanumeric=function(e){return vf.test(e)},function(e){var t=lf,n=df;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(Z){return n}}}(uf),function(e){var t=Bh,n=Qh,r=Hh,i=uf,o=lf,a=t.getBCHDigit(7973);function s(e,t){return i.getCharCountIndicator(e,t)+4}function c(e,t){var n=0;return e.forEach((function(e){var r=s(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,a){if(!o.isValid(e))throw new Error("Invalid QR Code version");void 0===a&&(a=i.BYTE);var c=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(a===i.MIXED)return c;var u=c-s(a,e);switch(a){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,a=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,a);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(),a)},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)-a>=0;)n^=7973<<t.getBCHDigit(n)-a;return e<<12|n}}(cf);var _f={},yf=Bh,Rf=yf.getBCHDigit(1335);_f.getEncodedBits=function(e,t){for(var n=e.bit<<3|t,r=n<<10;yf.getBCHDigit(r)-Rf>=0;)r^=1335<<yf.getBCHDigit(r)-Rf;return 21522^(n<<10|r)};var bf={},Cf=uf;function Ef(e){this.mode=Cf.NUMERIC,this.data=e.toString()}Ef.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Ef.prototype.getLength=function(){return this.data.length},Ef.prototype.getBitsLength=function(){return Ef.getBitsLength(this.data.length)},Ef.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 Tf=Ef,Sf=uf,If=["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 wf(e){this.mode=Sf.ALPHANUMERIC,this.data=e}wf.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},wf.prototype.getLength=function(){return this.data.length},wf.prototype.getBitsLength=function(){return wf.getBitsLength(this.data.length)},wf.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var n=45*If.indexOf(this.data[t]);n+=If.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(If.indexOf(this.data[t]),6)};var kf=wf,xf=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},Of=uf;function Nf(e){this.mode=Of.BYTE,this.data=new Uint8Array(xf(e))}Nf.getBitsLength=function(e){return 8*e},Nf.prototype.getLength=function(){return this.data.length},Nf.prototype.getBitsLength=function(){return Nf.getBitsLength(this.data.length)},Nf.prototype.write=function(e){for(var t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var Af=Nf,Pf=uf,Mf=Bh;function Lf(e){this.mode=Pf.KANJI,this.data=e}Lf.getBitsLength=function(e){return 13*e},Lf.prototype.getLength=function(){return this.data.length},Lf.prototype.getBitsLength=function(){return Lf.getBitsLength(this.data.length)},Lf.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var n=Mf.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 Uf=Lf,Df={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,n,r){var i={},o={};o[n]=0;var a,s,c,u,l,d,h,f=t.PriorityQueue.make();for(f.push(n,0);!f.empty();)for(c in s=(a=f.pop()).value,u=a.cost,l=e[s]||{})l.hasOwnProperty(c)&&(d=u+l[c],h=o[c],(void 0===o[c]||h>d)&&(o[c]=d,f.push(c,d),i[c]=s));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}(Df),function(e){var t=uf,n=Tf,r=kf,i=Af,o=Uf,a=df,s=Bh,c=Df.exports;function u(e){return unescape(encodeURIComponent(e)).length}function l(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 d(e){var n,r,i=l(a.NUMERIC,t.NUMERIC,e),o=l(a.ALPHANUMERIC,t.ALPHANUMERIC,e);return s.isKanjiModeEnabled()?(n=l(a.BYTE,t.BYTE,e),r=l(a.KANJI,t.KANJI,e)):(n=l(a.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,a){switch(a){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,a){var c,u=t.getBestModeForData(e);if((c=t.from(a,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||s.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}(d(n,s.isKanjiModeEnabled())),o=function(e,n){for(var r={},i={start:{}},o=["start"],a=0;a<e.length;a++){for(var s=e[a],c=[],u=0;u<s.length;u++){var l=s[u],d=""+a+u;c.push(d),r[d]={node:l,lastCount:0},i[d]={};for(var f=0;f<o.length;f++){var p=o[f];r[p]&&r[p].node.mode===l.mode?(i[p][d]=h(r[p].lastCount+l.length,l.mode)-h(r[p].lastCount,l.mode),r[p].lastCount+=l.length):(r[p]&&(r[p].lastCount=l.length),i[p][d]=h(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}o=c}for(var m=0;m<o.length;m++)i[o[m]].end=0;return{map:i,table:r}}(i,r),a=c.find_path(o.map,"start","end"),l=[],f=1;f<a.length-1;f++)l.push(o.table[a[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)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}}(bf);var Vf=Bh,Bf=Hh,Ff=Kh,Hf=Yh,jf=Gh,Kf=zh,qf=Wh,Yf=Qh,Gf=sf,zf=cf,Jf=_f,Wf=uf,Qf=bf;function Xf(e,t,n){var r,i,o=e.size,a=Jf.getEncodedBits(t,n);for(r=0;r<15;r++)i=1==(a>>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 Zf(e,t,n){var r=new Ff;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),Wf.getCharCountIndicator(t.mode,e)),t.write(r)}));var i=8*(Vf.getSymbolTotalCodewords(e)-Yf.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,a=0;a<o;a++)r.put(a%2?17:236,8);return function(e,t,n){for(var r=Vf.getSymbolTotalCodewords(t),i=Yf.getTotalCodewordsCount(t,n),o=r-i,a=Yf.getBlocksCount(t,n),s=a-r%a,c=Math.floor(r/a),u=Math.floor(o/a),l=u+1,d=c-u,h=new Gf(d),f=0,p=new Array(a),m=new Array(a),g=0,v=new Uint8Array(e.buffer),_=0;_<a;_++){var y=_<s?u:l;p[_]=v.slice(f,f+y),m[_]=h.encode(p[_]),f+=y,g=Math.max(g,y)}var R,b,C=new Uint8Array(r),E=0;for(R=0;R<g;R++)for(b=0;b<a;b++)R<p[b].length&&(C[E++]=p[b][R]);for(R=0;R<d;R++)for(b=0;b<a;b++)C[E++]=m[b][R];return C}(r,e,t)}function $f(e,t,n,r){var i;if(Array.isArray(e))i=Qf.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var o=t;if(!o){var a=Qf.rawSplit(e);o=zf.getBestVersionForData(a,n)}i=Qf.fromString(e,o||40)}var s=zf.getBestVersionForData(i,n);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<s)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+s+".\n")}else t=s;var c=Zf(t,n,i),u=Vf.getSymbolSize(t),l=new Hf(u);return function(e,t){for(var n=e.size,r=Kf.getPositions(t),i=0;i<r.length;i++)for(var o=r[i][0],a=r[i][1],s=-1;s<=7;s++)if(!(o+s<=-1||n<=o+s))for(var c=-1;c<=7;c++)a+c<=-1||n<=a+c||(s>=0&&s<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===s||6===s)||s>=2&&s<=4&&c>=2&&c<=4?e.set(o+s,a+c,!0,!0):e.set(o+s,a+c,!1,!0))}(l,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)}}(l),function(e,t){for(var n=jf.getPositions(t),r=0;r<n.length;r++)for(var i=n[r][0],o=n[r][1],a=-2;a<=2;a++)for(var s=-2;s<=2;s++)-2===a||2===a||-2===s||2===s||0===a&&0===s?e.set(i+a,o+s,!0,!0):e.set(i+a,o+s,!1,!0)}(l,t),Xf(l,n,0),t>=7&&function(e,t){for(var n,r,i,o=e.size,a=zf.getEncodedBits(t),s=0;s<18;s++)n=Math.floor(s/3),r=s%3+o-8-3,i=1==(a>>s&1),e.set(n,r,i,!0),e.set(r,n,i,!0)}(l,t),function(e,t){for(var n=e.size,r=-1,i=n-1,o=7,a=0,s=n-1;s>0;s-=2)for(6===s&&s--;;){for(var c=0;c<2;c++)if(!e.isReserved(i,s-c)){var u=!1;a<t.length&&(u=1==(t[a]>>>o&1)),e.set(i,s-c,u),-1==--o&&(a++,o=7)}if((i+=r)<0||n<=i){i-=r,r=-r;break}}}(l,c),isNaN(r)&&(r=qf.getBestMask(l,Xf.bind(null,l,n))),qf.applyMask(r,l),Xf(l,n,r),{modules:l,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}Vh.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var n,r,i=Bf.M;return void 0!==t&&(i=Bf.from(t.errorCorrectionLevel,Bf.M),n=zf.from(t.version),r=qf.from(t.maskPattern),t.toSJISFunc&&Vf.setToSJISFunction(t.toSJISFunc)),$f(e,n,i,r)};var ep={},tp={};!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,a=e.getScale(i,r),s=Math.floor((i+2*r.margin)*a),c=r.margin*a,u=[r.color.light,r.color.dark],l=0;l<s;l++)for(var d=0;d<s;d++){var h=4*(l*s+d),f=r.color.light;if(l>=c&&d>=c&&l<s-c&&d<s-c)f=u[o[Math.floor((l-c)/a)*i+Math.floor((d-c)/a)]?1:0];t[h++]=f.r,t[h++]=f.g,t[h++]=f.b,t[h]=f.a}}}(tp),function(e){var t=tp;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(Z){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);var a=t.getImageWidth(e.modules.size,i),s=o.getContext("2d"),c=s.createImageData(a,a);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"}(s,o,a),s.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),a=i.type||"image/png",s=i.rendererOpts||{};return o.toDataURL(a,s.quality)}}(ep);var np={},rp=tp;function ip(e,t){var n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function op(e,t,n){var r=e+t;return void 0!==n&&(r+=" "+n),r}np.render=function(e,t,n){var r=rp.getOptions(t),i=e.modules.size,o=e.modules.data,a=i+2*r.margin,s=r.color.light.a?"<path "+ip(r.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+ip(r.color.dark,"stroke")+' d="'+function(e,t,n){for(var r="",i=0,o=!1,a=0,s=0;s<e.length;s++){var c=Math.floor(s%t),u=Math.floor(s/t);c||o||(o=!0),e[s]?(a++,s>0&&c>0&&e[s-1]||(r+=o?op("M",c+n,.5+u+n):op("m",i,0),i=0,o=!1),c+1<t&&e[s+1]||(r+=op("h",a),a=0)):i++}return r}(o,i,r.margin)+'"/>',u='viewBox="0 0 '+a+" "+a+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+s+c+"</svg>\n";return"function"==typeof n&&n(null,l),l};var ap=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},sp=Vh,cp=ep,up=np;function lp(e,t,n,r,i){var o=[].slice.call(arguments,1),a=o.length,s="function"==typeof o[a-1];if(!s&&!ap())throw new Error("Callback required as last argument");if(!s){if(a<1)throw new Error("Too few arguments provided");return 1===a?(n=t,t=r=void 0):2!==a||t.getContext||(r=n,n=t,t=void 0),new Promise((function(i,o){try{var a=sp.create(n,r);i(e(a,t,r))}catch(Z){o(Z)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(i=n,n=t,t=r=void 0):3===a&&(t.getContext&&void 0===i?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0));try{var c=sp.create(n,r);i(null,e(c,t,r))}catch(Z){i(Z)}}Dh.create=sp.create,Dh.toCanvas=lp.bind(null,cp.render),Dh.toDataURL=lp.bind(null,cp.renderToDataURL),Dh.toString=lp.bind(null,(function(e,t,n){return up.render(e,n)}));var dp=Dh,hp="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==",fp="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=",pp="./assets/logo.6e1120ae.png",mp="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=",gp=S({name:"LiveBroadcastSharePreview",props:["form","url"],data:function(){return{detail:{roomTitle:"",liveStartTime:"",liveRemark:""}}},mounted:function(){var e=document.getElementById("canvas"),t=this.url;dp.toCanvas(e,t,{width:79,margin:1},(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:Ih},[I("h2",null,[this.form.roomTitle]),I("p",{class:kh},[w(" 主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon1.ef6bbd86.png",class:wh,alt:""},null),I("div",{class:Eh},[I("img",{src:mp,class:xh,alt:""},null),I("p",{class:Th},[w("开播时间")]),I("p",{class:Oh},[this.form.liveStartTime]),I("p",{class:Th},[w("直播内容")]),I("div",{class:Nh},[I("img",{class:Ah,src:fp,alt:""},null),I("img",{class:Ph,src:hp,alt:""},null),this.form.liveRemark])]),I("div",{class:Mh},[I("img",{class:Lh,src:pp,alt:""},null),I("div",{class:Uh},[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:Sh},[I("h2",null,[this.form.roomTitle]),I("p",{class:kh},[w("主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon3.0d23bbac.png",class:wh,alt:""},null),I("div",{class:Eh},[I("img",{src:mp,class:xh,alt:""},null),I("p",{class:Th},[w("开播时间")]),I("p",{class:Oh},[this.form.liveStartTime]),I("p",{class:Th},[w("直播内容")]),I("div",{class:Nh},[I("img",{class:Ah,src:fp,alt:""},null),I("img",{class:Ph,src:hp,alt:""},null),this.form.liveRemark])]),I("div",{class:Mh},[I("img",{class:Lh,src:pp,alt:""},null),I("div",{class:Uh},[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:Ch},[I("h2",null,[this.form.roomTitle]),I("p",{class:kh},[w("主讲人:"),this.form.speakerName]),I("img",{src:"./assets/icon2.e7f0fa2e.png",class:wh,alt:""},null),I("div",{class:Eh},[I("img",{src:mp,class:xh,alt:""},null),I("p",{class:Th},[w("开播时间")]),I("p",{class:Oh},[this.form.liveStartTime]),I("p",{class:Th},[w("直播内容")]),I("div",{class:Nh},[I("img",{class:Ah,src:fp,alt:""},null),I("img",{class:Ph,src:hp,alt:""},null),this.form.liveRemark])]),I("div",{class:Mh},[I("img",{class:Lh,src:pp,alt:""},null),I("div",{class:Uh},[I("div",null,[I("canvas",{id:"canvas",height:"80",width:"80",style:"width: 80px; margin:0"},null)])])])]):null])}}),vp=y(null),_p=S({name:"LiveBroadcastShare",props:{onClose:{type:Function,default:function(){}}},data:function(){return{form:{shareType:"1"},detail:{roomTitle:"",liveStartTime:"",liveRemark:"",roomUid:"",speakerName:""},url:""}},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.detail=i({},r.user),e.url=(n=void 0,n=window.location.href,(/online/.test(n)?"https://mstuonline.dayaedu.com":/dev/.test(n)?"http://mstudev.dayaedu.com":/test/.test(n)?"http://mstutest.dayaedu.com":"http://mstudev.dayaedu.com")+"/#/liveClassTransfer?roomUid=".concat(e.detail.roomUid));case 2:case"end":return t.stop()}var n}),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&&(_h(e),C.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 uh(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",ph(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=vp.value)||void 0===n?void 0:n.checkList)||[]).length>0){t.next=4;break}return C.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,C.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(P,{model:this.form,ref:"form",class:ad.form},{default:function(){return[I(M,{label:"分享方式"},{default:function(){return[I(F,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("1")},label:"1"},{default:function(){return[w("链接分享")]}}),I(F,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("2")},label:"2"},{default:function(){return[w("二维码分享")]}}),I(F,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("3")},label:"3"},{default:function(){return[w("群聊分享")]}})]}})]}}),I("div",null,["1"===this.form.shareType?I("div",{class:"linkWrap"},[I("div",{class:ad.shareWrap},[I("h2",null,[w("乐团老师邀请您参与直播课!")]),I("h4",null,[this.detail.roomTitle]),I("p",null,[w("主讲人:"),this.detail.speakerName]),I("p",null,[w("开播时间:"),this.detail.liveStartTime]),I("p",null,[w("直播内容:"),this.detail.liveRemark]),I("p",null,[w("直播地址:"),this.url])]),I("div",{class:ad.shareBtn,onClick:this.copyText},[w("复制分享内容")])]):null]),"2"===this.form.shareType?I("div",{class:ad.codeWrap},[I("div",{class:ad.shareWrap},[I(gp,{form:this.detail,url:this.url},null)]),I("div",{class:ad.shareBtn,onClick:this.shareImage},[w("复制分享内容")])]):null,"3"==this.form.shareType?I("div",{class:ad.shareWrap},[I("div",{class:ad.groupWrap},[I(bh,{ref:vp},null)]),I("div",{class:ad.shareBtn,onClick:this.shareChat},[w("发送分享信息")])]):null])}});function yp(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!V(e)}var Rp=f({volume:30,barStatus:{camera:!1,volume:!1,microphone:!1,screen:!1,share:!1},shareVisiable:!1}),bp=S({name:"LiveBroadcast-ActionBar",computed:{isCameraDisabled:function(){return Rp.barStatus.camera&&"denied"!==yl.deviceStatus.camera&&yl.cameras.length},isMicrophoneDisabled:function(){return Rp.barStatus.microphone&&"denied"!==yl.deviceStatus.microphone&&yl.microphones.length},isVolumeDisabled:function(){return 0===Rp.volume}},mounted:function(){console.log(yl.cameras,yl.cameras.length)},methods:{startShare:function(){console.log("调用"),Rp.shareVisiable=!0},volumeChange:function(e){Rp.volume=e,Ol(e)}},render:function(){var e=this;return I("div",{class:ed,id:"action-bar"},[I("div",{style:{display:"flex"}},[I("div",{class:td},[I("div",{class:od},[I(H("SvgIcon"),{onClick:function(){Rp.barStatus.camera=!Rp.barStatus.camera,Jl("camera")},name:this.isCameraDisabled?"bar-camera-disabled":"bar-camera",style:{width:"22px",cursor:"pointer"}},null),0===yl.cameras.length?null:I(k,{placement:"top",disabled:0===yl.cameras.length,onCommand:Ml},{default:function(){return[I("div",{class:td,style:{height:"32px"}},[I(H("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(x,null,yp(e=yl.cameras.map((function(e){return I(O,{disabled:e===yl.selectedCamera,command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:nd},[w("摄像头")])]),I("div",{class:td},[I("div",{class:od},[I(H("SvgIcon"),{onClick:function(){Rp.barStatus.volume=!Rp.barStatus.volume,Rp.barStatus.volume?(sessionStorage.setItem("volume",Rp.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(k,{placement:"top-start","popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1}},{default:function(){return[I("div",{class:td,style:{height:"32px"}},[I(H("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){return I("div",{class:rd},[I(H("SvgIcon"),{class:id,name:"message-voice",color:"#fff"},null),I(j,{modelValue:Rp.volume,onInput:e.volumeChange,size:"small"},null)])}})]),I("span",{class:nd},[w("音量调节")])]),I("div",{class:td,onClick:Nl},[I("div",{class:od},[I(H("SvgIcon"),{name:"bar-screen-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:nd},[w("屏幕共享")])]),I("div",{class:td},[I("div",{class:od},[I(H("SvgIcon"),{onClick:function(){var e="liveing"===yl.videoStatus;Rp.barStatus.microphone=!Rp.barStatus.microphone,Rp.barStatus.microphone?zl("microphone",e):Gl("microphone",e)},name:this.isMicrophoneDisabled?"bar-mike-disabled":"bar-mike",style:{width:"22px",cursor:"pointer"}},null),0===yl.microphones.length?null:I(k,{placement:"top-start",disabled:0===yl.microphones.length,"popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1},onCommand:Ll},{default:function(){return[I("div",{class:td,style:{height:"32px"}},[I(H("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(x,null,yp(e=yl.microphones.map((function(e){return I(O,{disabled:e===yl.selectedMicrophone,command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:nd},[w("麦克风")])])]),I("div",{style:{display:"flex"},onClick:this.startShare},[I("div",{class:td},[I("div",{class:od},[I(H("SvgIcon"),{name:"bar-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:nd},[w("分享")])])]),I(K,{width:"510px","destroy-on-close":!0,"append-to-body":!0,modelValue:Rp.shareVisiable,title:"分享","before-close":function(){Rp.shareVisiable=!1}},{default:function(){return[I(_p,{onClose:function(){return Rp.shareVisiable=!1}},null)]}})])}}),Cp={container:"_container_19awp_1",title:"_title_19awp_21",tips:"_tips_19awp_25"},Ep=S({name:"VideoStatus",render:function(){return I("div",{class:Cp.container},["denied"===yl.deviceStatus.camera?I("div",{class:Cp.denied},[I(H("SvgIcon"),{name:"camera-status",class:Cp.icon},null),I("p",{class:Cp.title},[w("摄像头被禁用")]),I("p",{class:Cp.tips},[w("请授权允许访问摄像头")])]):null,"init"===yl.deviceStatus.camera?I("div",{class:Cp.init},[I(H("SvgIcon"),{name:"camera-status",class:Cp.icon},null),I("p",{class:Cp.title},[w("请完成摄像头授权")]),I("p",{class:Cp.tips},[w("请授权允许访问摄像头")])]):null,"closed"===yl.deviceStatus.camera?I("div",{class:Cp.closed},[I(H("SvgIcon"),{name:"camera-status",class:Cp.icon},null),I("p",{class:Cp.title},[w("摄像头已关闭")]),I("p",{class:Cp.tips},[w("您已关闭摄像头")])]):null,"none"===yl.deviceStatus.camera?I("div",{class:Cp.none},[I(H("SvgIcon"),{name:"camera-status",class:Cp.icon},null),I("p",{class:Cp.title},[w("暂无摄像头")]),I("p",{class:Cp.tips},[w("该设备无摄像头")])]):null])}}),Tp={exports:{}};Tp.exports=function(){var e,t,n=1e3,r=6e4,i=36e5,o=864e5,a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,s=31536e6,c=2592e6,u=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,l={years:s,months:c,days:o,hours:i,minutes:r,seconds:n,milliseconds:1,weeks:6048e5},d=function(e){return e instanceof _},h=function(e,t,n){return new _(e,n,t.$l)},f=function(e){return t.p(e)+"s"},p=function(e){return e<0},m=function(e){return p(e)?Math.ceil(e):Math.floor(e)},g=function(e){return Math.abs(e)},v=function(e,t){return e?p(e)?{negative:!0,format:""+g(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},_=function(){function p(e,t,n){var r=this;if(this.$d={},this.$l=n,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return h(e*l[f(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==T(e))return Object.keys(e).forEach((function(t){r.$d[f(t)]=e[t]})),this.calMilliseconds(),this;if("string"==typeof e){var i=e.match(u);if(i){var o=i.slice(2).map((function(e){return null!=e?Number(e):0}));return this.$d.years=o[0],this.$d.months=o[1],this.$d.weeks=o[2],this.$d.days=o[3],this.$d.hours=o[4],this.$d.minutes=o[5],this.$d.seconds=o[6],this.calMilliseconds(),this}}return this}var g=p.prototype;return g.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce((function(t,n){return t+(e.$d[n]||0)*l[n]}),0)},g.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=m(e/s),e%=s,this.$d.months=m(e/c),e%=c,this.$d.days=m(e/o),e%=o,this.$d.hours=m(e/i),e%=i,this.$d.minutes=m(e/r),e%=r,this.$d.seconds=m(e/n),e%=n,this.$d.milliseconds=e},g.toISOString=function(){var e=v(this.$d.years,"Y"),t=v(this.$d.months,"M"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var r=v(n,"D"),i=v(this.$d.hours,"H"),o=v(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3);var s=v(a,"S"),c=e.negative||t.negative||r.negative||i.negative||o.negative||s.negative,u=i.format||o.format||s.format?"T":"",l=(c?"-":"")+"P"+e.format+t.format+r.format+u+i.format+o.format+s.format;return"P"===l||"-P"===l?"P0D":l},g.toJSON=function(){return this.toISOString()},g.format=function(e){var n=e||"YYYY-MM-DDTHH:mm:ss",r={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return n.replace(a,(function(e,t){return t||String(r[e])}))},g.as=function(e){return this.$ms/l[f(e)]},g.get=function(e){var t=this.$ms,n=f(e);return"milliseconds"===n?t%=1e3:t="weeks"===n?m(t/l[n]):this.$d[n],0===t?0:t},g.add=function(e,t,n){var r;return r=t?e*l[f(t)]:d(e)?e.$ms:h(e,this).$ms,h(this.$ms+r*(n?-1:1),this)},g.subtract=function(e,t){return this.add(e,t,!0)},g.locale=function(e){var t=this.clone();return t.$l=e,t},g.clone=function(){return h(this.$ms,this)},g.humanize=function(t){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!t)},g.milliseconds=function(){return this.get("milliseconds")},g.asMilliseconds=function(){return this.as("milliseconds")},g.seconds=function(){return this.get("seconds")},g.asSeconds=function(){return this.as("seconds")},g.minutes=function(){return this.get("minutes")},g.asMinutes=function(){return this.as("minutes")},g.hours=function(){return this.get("hours")},g.asHours=function(){return this.as("hours")},g.days=function(){return this.get("days")},g.asDays=function(){return this.as("days")},g.weeks=function(){return this.get("weeks")},g.asWeeks=function(){return this.as("weeks")},g.months=function(){return this.get("months")},g.asMonths=function(){return this.as("months")},g.years=function(){return this.get("years")},g.asYears=function(){return this.as("years")},p}();return function(n,r,i){e=i,t=i().$utils(),i.duration=function(e,t){var n=i.locale();return h(e,{$l:n},t)},i.isDuration=d;var o=r.prototype.add,a=r.prototype.subtract;r.prototype.add=function(e,t){return d(e)&&(e=e.asMilliseconds()),o.bind(this)(e,t)},r.prototype.subtract=function(e,t){return d(e)&&(e=e.asMilliseconds()),a.bind(this)(e,t)}}}();var Sp=Tp.exports,Ip="_time_1c1wd_1",wp="_status_1c1wd_14",kp="_text_1c1wd_27";E.extend(Sp);var xp,Op,Np=S({setup:function(){var e=f({duration:""}),t=sessionStorage.getItem(fl),n=Number(t),r=null;return q((function(){r=setInterval((function(){var t=E().valueOf();n&&t-n&&(e.duration=E.duration(t-n).format("HH:mm:ss"))}))})),Y((function(){r&&clearInterval(r)})),function(){return"liveing"===yl.videoStatus&&n?I("div",{class:Ip},[I("div",{class:wp},[I("div",{class:"line-scale-pulse-out"},[I("div",null,null),I("div",null,null),I("div",null,null)]),I("span",null,[w("直播中")])]),I("span",{class:kp},[e.duration])]):null}}}),Ap="_main_1b4ip_1",Pp="_video_1b4ip_12",Mp=y(null),Lp=S({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(),Kl(),hl.on(dl["RC:Chatroom:Like"],e.onLikeMessage),window.onbeforeunload=e.beforeunload;case 4:case"end":return t.stop()}}),t)})))()},beforeUnmount:function(){hl.off(dl["RC:Chatroom:Like"],this.onLikeMessage),window.onbeforeunload=null},methods:{beforeunload:function(){if("liveing"===yl.videoStatus)return"当前正在直播中是否确认关闭页面?"},onLikeMessage:function(e){yl.likeCount+=e.counts},getDeviceByDeviceType:function(e){var t=localStorage.getItem(ml),n=localStorage.getItem(gl);return"camera"===e?t&&yl.cameras.find((function(e){return e.deviceId===t}))||yl.cameras[0]:n&&yl.microphones.find((function(e){return e.deviceId===n}))||yl.microphones[0]},initializeRoom:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var i,o,a,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.user){t.next=2;break}throw Error("请先登录");case 2:return t.prev=2,a="liveing"===sessionStorage.getItem(pl),t.next=6,xl(null===(i=r.user)||void 0===i?void 0:i.imToken);case 6:return yl.videoRef=Mp.value,t.next=9,Al();case 9:return t.next=11,Pl();case 11:return Ml(e.getDeviceByDeviceType("camera")),Ll(e.getDeviceByDeviceType("microphone")),t.next=15,Ul("camera");case 15:return Op=t.sent,yl.videoRef&&Op.play(yl.videoRef),t.next=19,Ul("microphone");case 19:return xp=t.sent,yl.videoStatus="stream",t.next=23,Fl(null===(o=r.user)||void 0===o?void 0:o.roomUid,Gu.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==s||null===(n=s.room)||void 0===n?void 0:n.subscribe(e);case 2:r=t.sent,console.log(r),null!=r&&r.code&&r.code!==rs.SUCCESS&&console.log("资源订阅失败 ->",r.code);case 5:case"end":return t.stop()}}),t)})))()},onTrackUnpublish:function(e){console.log(e),hl.emit(dl["RM:RTC:TrackUnpublish"],e)},onSwitchRole:function(e,t){hl.emit(dl["RM:RTC:SwitchRole"],{userId:e,role:t})},onTrackReady:function(e){e.isAudioTrack()&&e.play()},onUserJoin:function(e){console.log("onUserJoin",e)},onUserLeave:function(e){hl.emit(dl["RM:RTC:UserLeave"],e),console.log("onUserLeave",e)}});case 23:if((s=t.sent).room&&s.code===rs.SUCCESS&&(yl.joinedRoom=s.room),!a){t.next=31;break}return t.next=28,Hl(!1);case 28:yl.videoStatus="liveing",t.next=35;break;case 31:return t.next=33,Dl([Op],"camera",!1);case 33:return t.next=35,Dl([xp],"microphone",!1);case 35:(c=localStorage.getItem(vl))&&(Rp.volume=parseInt(c),Ol(parseInt(c))),t.next=43;break;case 39:t.prev=39,t.t0=t.catch(2),yl.videoStatus="error",console.log(t.t0);case 43:case"end":return t.stop()}}),t,null,[[2,39]])})))()},closeLive:function(){yl.videoStatus="stream"}},render:function(){return I("div",{class:Ap},[I($l,null,null),I("div",{class:Pp},[I("video",{ref:Mp},null),yl.screenShareStatus?null:I(Ep,null,null),"liveing"===yl.videoStatus?I(Np,null,null):null]),I(bp,null,null)])}}),Up="_container_1cod9_1",Dp="_dataCount_1cod9_6",Vp="_num_1cod9_17",Bp="_text_1cod9_22",Fp="_dataIcon_1cod9_26",Hp="_tabContainer_1cod9_31",jp="_tabIcon_1cod9_31",Kp="_point_1cod9_36",qp="_tabContent_1cod9_67",Yp="_tabList_1cod9_73",Gp="_message_4zab7_1",zp="_buttonGroup_4zab7_1",Jp=S({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,Yl(i({seatBan:yl.allowSeatsCtrl},ql()),"SeatsCtrl");case 2:yl.allowSeatsCtrl=!yl.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,Yl(i({chatBan:yl.allowChatCtrl},ql()),"ChatBan");case 2:yl.allowChatCtrl=!yl.allowChatCtrl;case 3:case"end":return e.stop()}}),e)})))()}},render:function(){return I("div",{class:Gp},[I("div",{class:zp},[I(A,{type:yl.allowChatCtrl?"info":"primary",onClick:this.ChatBan},{default:function(){return[yl.allowChatCtrl?"全体禁言":"关闭全体禁言"]}}),I(A,{type:yl.allowSeatsCtrl?"info":"primary",onClick:this.SeatsCtrl},{default:function(){return[yl.allowSeatsCtrl?"禁止连麦":"关闭禁止连麦"]}})])])}}),Wp="_sendMessage_p2cnx_1",Qp="_form_p2cnx_10",Xp=f({messageList:[],joinList:{},joinTips:!1,lookList:{}}),Zp=Xp,$p=function(e){Xp.messageList.push(e)},em=function(e,t){Xp.joinTips=!0,Xp.joinList[e]=t},tm=function(e){delete Xp.joinList[e]},nm=function(e,t){Xp.lookList[e]=t},rm=S({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,Yl(e.message);case 3:n=ql(),$p({id:n.id,name:n.name,content:e.message,isSelf:!0,sendTime:E(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:Wp},[I("div",{class:Qp},[I(L,{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[w("发送")]}})])])}}),im="_itemContent_1wo39_1",om="_itemInfo_1wo39_11",am="_itemName_1wo39_14",sm="_userName_1wo39_20",cm="_name-style_1wo39_26",um="_rightTime_1wo39_30",lm="_itemText_1wo39_38",dm="_active_1wo39_42",hm="_joinText_1wo39_45",fm="_join_1wo39_45",pm="_btn_1wo39_54",mm="_downBtn_1wo39_66",gm="_loadingStyle_1wo39_71",vm={"empty-container":"_empty-container_1svqd_1",icon:"_icon_1svqd_9"},_m=S({props:{text:{type:String,default:"暂无数据"},icon:{type:String,default:"noData-no-message"}},render:function(){return I("div",{class:vm["empty-container"]},[I(H("SvgIcon"),{name:this.icon,class:[vm.icon]},null),I("p",{class:vm["empty-text"]},[this.text])])}}),ym=S({data:function(){return{joinList:{},loadingJoin:!1}},computed:{count:function(){var e=0;for(var t in Zp.joinList){if(Object.prototype.hasOwnProperty.call(Zp.joinList,t))if(3===Zp.joinList[t].type&&(e+=1),e>3)break}return e}},mounted:function(){hl.on(dl["RC:Chatroom:SeatApply"],this.onSeatApply),hl.on(dl["RC:Chatroom:SeatResponse"],this.onSeatApply),hl.on(dl["RM:RTC:UserLeave"],this.onSeatApply),hl.on(dl["RM:RTC:SwitchRole"],this.onSwitchRole),hl.on(dl["RC:Chatroom:Leave"],this.onLeave),hl.on(dl["RC:LookerLoginOut"],this.onLeave)},methods:{onLeave:function(e){var t;yl.lookCount=yl.lookCount-1>=0?yl.lookCount-1:0,Zp.joinList[e.userId]&&tm(e.userId),Zp.lookList[e.userId]&&(t=e.userId,delete Xp.lookList[t])},onSeatApply:function(e){if(Array.isArray(e)){var t,n=b(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;console.log("onSeatApply",r),tm(r)}}catch(s){n.e(s)}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};em(e.audienceId,o),nm(e.audienceId,o)}if(4===e.type&&(console.log(e,"取消连麦"),Zp.joinList[e.audienceId]&&tm(e.audienceId),Zp.lookList[e.audienceId])){var a=Zp.lookList[e.audienceId];a.userRoomType=1,nm(e.audienceId,a)}}},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});em(e.id,o),nm(e.id,o),Yl(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});em(e.id,o),Yl(o,"SeatApply")},onSwitchRole:function(e){if(console.log(e,"onSwitchRole"),Zp.joinList[e.userId]&&2===e.role&&tm(e.userId),Zp.lookList[e.userId]&&2===e.role){var t=Zp.lookList[e.userId];t.userRoomType=1,nm(e.userId,t)}}},render:function(){var e=this,t=Object.values(Zp.joinList);return I("div",{style:{minHeight:"100%",position:"relative"}},[t.length>0?t.map((function(t){return I("div",{class:im},[I("div",{class:om},[I("div",{class:am},[I("p",{class:sm},[I("span",{class:cm},[t.name]),4!==t.userRoomType?I("span",{style:{paddingLeft:"10px"}},[w("申请连麦")]):I("span",{style:{paddingLeft:"10px",color:"var(--live-text-color)"}},[w("正在连麦")])]),4!==t.userRoomType?I("div",{class:hm},[I("div",{class:fm},null),I(A,{size:"small",type:"primary",disabled:e.count>3,class:pm,onClick:function(){return e.agree(t)}},{default:function(){return[w("上麦")]}})]):I("div",{class:hm},[I("div",{class:fm},null),I(A,{size:"small",plain:!0,class:[pm,mm],onClick:function(){return e.refuse(t)}},{default:function(){return[w("下麦")]}})])])])])})):this.loadingJoin?I("div",{class:gm},[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(_m,{style:{paddingTop:"120px"},text:"暂无学员发起连麦!",icon:"noData-no-join"},null)])}}),Rm=S({data:function(){return{loadingLook:!1}},computed:{count:function(){var e=0;for(var t in Zp.joinList){if(Object.prototype.hasOwnProperty.call(Zp.joinList,t))if(3===Zp.joinList[t].type&&(e+=1),e>3)break}return e}},mounted: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.next=2,e._init();case 2:e.loadingLook=!0,hl.on(dl["RC:Chatroom:Welcome"],e.onWelcome),setTimeout((function(){e.loadingLook=!1}));case 5:case"end":return t.stop()}}),t)})))()},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,n.data.forEach((function(e){Zp.lookList[e.userId]||(Zp.lookList[e.userId]={id:e.userId,name:e.userName,type:3,userRoomType:1,time:E().format("YYYY-MM-DD HH:mm:ss")})})),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]])})))()},onWelcome:function(e){if(e&&e.user){var t=E(e.$EventMessage.sentTime||new Date).format("HH:mm:ss"),n={name:e.user.name,id:e.user.id,sendTime:t,userRoomType:1,type:3};!!Zp.lookList[n.id]||nm(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,Yl(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,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{a=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}),em(e.id,a),Yl(a,"SeatApply")}catch(s){}case 1:case"end":return t.stop()}}),t)})))()}},render:function(){var e=this,t=Object.values(Zp.lookList);return I("div",null,[t.length>0?t.map((function(t){return I("div",{class:im},[I("div",{class:om},[I("div",{class:am},[I("p",{class:sm},[I("span",{class:cm},[t.name])]),4!==t.userRoomType?I(A,{size:"small",type:"primary",disabled:e.count>3,class:pm,onClick:function(){return e.onUpLook(t)}},{default:function(){return[w("上麦")]}}):I(A,{size:"small",plain:!0,class:[pm,mm],onClick:function(){return e.onDownLook(t)}},{default:function(){return[w("下麦")]}})])])])})):this.loadingLook?I("div",{class:gm},[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(_m,{style:{paddingTop:"120px"},text:"暂无学员观看!",icon:"noData-no-user"},null)])}}),bm=S({data:function(){return{messageList:[],loadingMessage:!1}},mounted:function(){var e=this;this.loadingMessage=!0,hl.on(dl["RC:TxtMsg"],this.onMessage),hl.on(dl["RC:ForcedOffline"],this.onForcedOffline),setTimeout((function(){e.loadingMessage=!1}),2e3),this.scrollToBottom()},beforeUnmount:function(){hl.off(dl["RC:TxtMsg"],this.onMessage)},methods:{onForcedOffline: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,Wl();case 3:return t.next=5,u.post("/api-auth/exit",{data:{}});case 5:zl("camera"),zl("microphone"),r.user=null,d(),e.$router.push({path:"/login",query:i({},e.$route.query)}),t.next=14;break;case 12:t.prev=12,t.t0=t.catch(0);case 14:case"end":return t.stop()}}),t,null,[[0,12]])})))()},onLike:function(e){if(e&&e.user){var t,n=E(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};$p(r),this.loadingMessage=!1}this.scrollToBottom()},onMessage:function(e){if(e&&e.user){var t,n=E(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),$p(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"},[Zp.messageList.length>0?Zp.messageList.map((function(e){return I("div",{class:im},[I("div",{class:om},[I("div",{class:am},[I("div",{class:sm},[e.isSelf?I(G,{effect:"dark",color:"#01A79E"},{default:function(){return[w("主讲人")]}}):null,I("span",{class:cm},[e.name,w(":")]),I("span",{class:[lm,e.isSelf?dm:null]},[e.content])]),I("p",{class:um},[e.sendTime])])])])})):this.loadingMessage?I("div",{class:gm},[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(_m,{style:{paddingTop:"120px"},text:"暂无学员互动!",icon:"noData-no-message"},null)])}}),Cm=S({name:"LiveMessage",data:function(){return{modelIndex:"message"}},computed:{joinStatus:function(){console.log(this.modelIndex);var e=Zp.joinTips;return Zp.joinTips&&"join"===this.modelIndex&&(e=!1,Zp.joinTips=!1),e}},mounted:function(){var e,t;yl.likeCount=(null===(e=r.user)||void 0===e?void 0:e.likeNum)||0,yl.lookCount=(null===(t=r.user)||void 0===t?void 0:t.lookNum)||0},methods:{tabChange:function(e){this.modelIndex=e.props.name}},render:function(){var e=this;return I("div",{class:Up},[I("div",{class:Dp},[I("div",null,[I("p",{class:Vp},[yl.lookCount]),I("p",{class:Bp},[I(H("SvgIcon"),{name:"message-look",color:"#fff",class:Fp},null),w("当前观看")])]),I("div",null,[I("p",{class:Vp},[yl.likeCount]),I("p",{class:Bp},[I(H("SvgIcon"),{name:"message-giveUp",color:"#fff",class:Fp},null),w("累计点赞")])])]),I(z,{modelValue:this.modelIndex,"onTab-click":this.tabChange,class:Hp},{default:function(){return[I(J,{name:"message"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(H("SvgIcon"),{name:"message-message",color:"message"===e.modelIndex?"#00FFF0":"#fff",class:jp},null),w("聊天")])}}),I(J,{name:"join"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center",position:"relative"}},[I(H("SvgIcon"),{name:"message-evenEtc",color:"join"===e.modelIndex?"#00FFF0":"#fff",class:jp},null),w("连麦 "),e.joinStatus?I("i",{class:Kp},null):null])}}),I(J,{name:"look"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(H("SvgIcon"),{name:"message-look",color:"look"===e.modelIndex?"#00FFF0":"#fff",class:jp},null),w("观看")])}})]}}),I("div",{class:qp},[I(Jp,null,null),I("div",{class:Yp,id:"tabList"},[W(I(bm,null,null),[[Q,"message"===this.modelIndex]]),W(I(ym,null,null),[[Q,"join"===this.modelIndex]]),W(I(Rm,null,null),[[Q,"look"===this.modelIndex]])]),I(rm,null,null)])])}}),Em="_container_13n1h_1",Tm="_home_13n1h_4";t("default",S({render:function(){return I("div",{class:Tm},[I(Ql,null,null),I("div",{class:Em},[I(Lp,null,null),I(Cm,null,null)])])}}))}}}))}();