"use strict";var _notification=require("../../../utils/notification"),_utils=require("../../../utils/utils"),_bottomIcon=require("../../../utils/icons/bottom-icon"),_liveMenuIcon=require("../../../utils/icons/live-menu-icon");function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _defineProperty(t,n,o){return(n=_toPropertyKey(n))in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t}function _toPropertyKey(t){var n=_toPrimitive(t,"string");return"symbol"===_typeof(n)?n:String(n)}function _toPrimitive(t,n){if("object"!==_typeof(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,n||"default");if("object"!==_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}Component({properties:{sdkInstance:{type:Object,value:null}},observers:{sdkInstance:function(t){if(t){var n=t.store;this.store=n,this.sdkInstance=t;var o=this;"function"==typeof this._unsub&&this._unsub(),this._unsub=null,this._unsub=n.get({iconList:function(t){o.syncIconList(t)},liveInfo:function(){o.syncIconSources()},"reportInfo.videoType":function(){o.syncIconSources()},"notification.isNotificationOpen":function(t){(0,_utils.setDataIfChanged)(o,{isNotificationOpen:!1!==t}),o.syncIconSources()},"notification.isShowNotificationButton":function(){o.syncIconSources()},imageTextInfo:function(t){var n=t.countUnreadImageTextLive||0;(0,_utils.setDataIfChanged)(o,{countUnreadImageTextLive:n>=100?"99+":n})}})}}},lifetimes:{detached:function(){"function"==typeof this._unsub&&this._unsub(),this._unsub=null}},data:{outerIconList:[],innerIconList:[],countUnreadImageTextLive:0,isNotificationOpen:!0},methods:{findIconByKey:function(t,n){return(Array.isArray(t)?t:[]).find(function(t){return t.key===n})},syncIconSources:function(){(0,_liveMenuIcon.syncLiveRoomBottomIconSourcesFromStore)(this.sdkInstance)},syncIconList:function(t){var n=(0,_bottomIcon.buildBottomIconViewModel)(this.sdkInstance,_bottomIcon.BOTTOM_ICON_ROOM_TYPE.PORTRAIT,{defaultMaxVisibleCount:2,sourceIconList:t}),o={outerIconList:n.outerIconList,innerIconList:n.innerIconList};(0,_utils.isSmallPlainDataEqual)(this._iconListData,o)||(this._iconListData=o,this.setData(o))},openDrawer:function(){this.selectComponent("#volc-more-button-drawer").showFrame()},iconClick:function(t){var n=this.findIconByKey(this.data.outerIconList,t.currentTarget.dataset.key);this.dispatchIconClick(n,this.getIconHandlers())},innerIconClick:function(t){var n=this.findIconByKey(this.data.innerIconList,t.currentTarget.dataset.key);n&&((null==n?void 0:n.key)!==_bottomIcon.BOTTOM_ICON_KEY.NOTIFICATION_SWITCH?(this.selectComponent("#volc-more-button-drawer").hideFrame(),this.dispatchIconClick(n,this.getIconHandlers())):this.dispatchIconClick(n,this.getIconHandlers()))},getIconHandlers:function(){var t=this;return _defineProperty({},_bottomIcon.BOTTOM_ICON_KEY.NOTIFICATION_SWITCH,function(){return(0,_notification.toggleNotificationStateWithToast)(t.store)})},dispatchIconClick:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,_bottomIcon.dispatchBottomIconClick)({sdkInstance:this.sdkInstance,icon:t,roomType:_bottomIcon.BOTTOM_ICON_ROOM_TYPE.PORTRAIT,handlers:n})}}});