!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=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=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=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._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_169yn_1{padding:16px 16px 5px;display:flex;color:var(--live-color)}._itemContent_169yn_1>img{width:28px;height:28px;margin-right:8px}._itemInfo_169yn_11{width:100%}._itemName_169yn_14{display:flex;justify-content:space-between;align-items:center;padding-top:3px}._itemName_169yn_14 ._userName_169yn_20{font-size:15px;line-height:22px;align-items:center;font-weight:500}._itemName_169yn_14 ._name-style_169yn_26{line-height:24px;color:var(--live-text-color)}._itemName_169yn_14 ._rightTime_169yn_30{font-size:12px}._itemName_169yn_14 .el-tag--default{border-radius:20px;margin-right:8px;height:20px}._itemText_169yn_38{font-size:15px;line-height:20px}._itemText_169yn_38._active_169yn_42{color:var(--live-text-color)}._joinText_169yn_45{display:flex;justify-content:space-between;align-items:center}._joinText_169yn_45 ._join_169yn_45{display:flex;align-items:center}._btn_169yn_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_169yn_54._downBtn_169yn_66{background-color:transparent;border-color:var(--live-light-color);color:var(--live-light-color)}._loadingStyle_169yn_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.7f3de85f.js","./vendor-legacy.98843153.js"],(function(t){"use strict";var r,u,d,f,y,C,E,S,I,w,k,x,O,N,A,M,P,L,U,D,V,B,F,H,j,K,q,Y,G,z,W,J,Q;return{setters:[function(e){r=e.s,u=e.r,d=e.a},function(e){e.n,f=e.j,y=e.p,C=e.i,E=e.d,S=e.a,I=e.l,w=e.t,k=e.v,x=e.x,O=e.y,N=e.A,A=e.B,M=e.C,P=e.D,L=e.F,U=e.G,D=e.H,V=e.I,B=e.J,F=e.K,H=e.r,j=e.L,K=e.M,q=e.N,Y=e.O,G=e.P,z=e.Q,W=e.R,J=e.S,Q=e.T}],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;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] "+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;i0&&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)}))},Me=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;n0},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)},We=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Je=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=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;o255?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;nye.DEBUG&&this.__pushLocalLog(e,t.map($e).join(" "),this.tag),!(e=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=Me(),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=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,Mt,Pt,Lt,Ut=Ot;!function(e){ /*! 全局敏感词:命中了融云内置的全局敏感词 */ e[e.GLOBAL=1]="GLOBAL", /*! 自定义敏感词拦截:命中了客户在融云自定义的敏感词 */ e[e.CUSTOM=2]="CUSTOM", /*! 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态 */ e[e.THIRD_PARTY=3]="THIRD_PARTY"}(At||(At={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(Mt||(Mt={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Pt||(Pt={})),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,Wt,Jt,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;i0;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=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;i255&&(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="";++i1114111||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",Mn="SessionInfo",Pn="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",Wn="RtcDataInput",Jn="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",Mr="SessionTagAddInput",Pr="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",Wr="RtcEndInviteInput",Jr=((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[Mn]=["type","channelId","busChannel"],pn[Pn]=["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[Mr]=["version","tags"],pn[Pr]=["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[Wn]=["interior","target","key","objectName","content"],pn[Jn]=["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[Wr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],pn),Qr={},Xr=function(e){var t=Jr[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]/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"),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(ot;++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;a4294967295||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;++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;oa;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.offset0;){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;i0;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;o1&&(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=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),a=0,o=0;o=0&&!r){for(o=n.readVarint32(),o=n.offset+o,a=[];n.offset0;)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;ri;++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;r0;){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;c1024&&(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<>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<>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<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>>=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++])<>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>>=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>>=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>>=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>>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<=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<>>32-e,this.unsigned):i(0,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 "+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=Wt.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=Wt.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=Wt.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),Mi=function(e){function t(t,n,r){var i=e.call(this,Gt.QUERY)||this;return i.name=zt.QUERY,i.identifier=Wt.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),Pi=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=Wt.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 Pi(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 Pi(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+"×trap="+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}(),Wi=function(e,t,n){return[e,t,n].join("_")},Ji=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=Wi("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=Wi("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=Wi("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=Wi("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 "+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] 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 Mi(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:!We(i)&&i,isPersited:!We(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 Mi(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 Mi(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 Mi("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 Mi(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 Mi(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 Mi("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 Mi(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 Mi("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 Mi(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 rh})),p=[],d.forEach((function(e){e.sentTime0)&&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 Mi("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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(Vi[Vi.rtcUList],t,e);return this._channel.send(n,qn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=Mt.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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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 Mi(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;n0){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=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=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;athis.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=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 "+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.timestamp0){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;n1e3?[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;r0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]"+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 Pa(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),Pa(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>Ma)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>Ma)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=[],Ma=5368709120;function Pa(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(/(?:)(\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="",l=Array.from(h.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",l),l.map((function(e){s+="".concat(h.get(e),"").concat(e,"")})),s+="",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=en.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)}})},Wa=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()}},Ja=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 Wa(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 Ja(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 Po(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=Mo({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 Po(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 Po(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)} /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ 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,Ms,Ps=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;r0?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-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;i0?"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=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=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,M=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,M.length&&"new"===b.state&&(!l&&!A||d&&0!==c?M.forEach((function(e){Bs(y.iceTransport,e)})):b.setRemoteCandidates(M)),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)),M.length&&"new"===y.iceTransport.state&&(!A||d&&0!==c?M.forEach((function(e){Bs(y.iceTransport,e)})):y.iceTransport.setRemoteCandidates(M)),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 P,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}}),P=a[v.stream]):(a.default||(a.default=new e.MediaStream),P=a.default)),P&&(n(w,P),y.associatedRemoteMediaStreams.push(P)),s.push([w,E,P]))):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;a0?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;l55&&"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 Ws(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 Js(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:Ws,shimSenderGetStats:Js,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=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;i0?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(!Ps||!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=Ps,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||!Ws||!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),Ws(t,i),zs(t),Xs(t),Js(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 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