"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function ownKeys(e,o){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,t)}return r}function _objectSpread(e){for(var o=1;o1&&void 0!==arguments[1]&&arguments[1];switch(e){case"cold":case"classic":return o?RefreshingTheme:ClassicTheme;case"light":case"refreshing":return RefreshingTheme;case"holiday":return HolidayTheme;default:return DarkTheme}};exports.getThemeColor=getThemeColor;var getDefaultThemeConfig=function(e){switch(e){case"cold":case"classic":return{MobileBackgroundColor:"#FFFFFF",MobileChatBackgroundColor:"#FC555D",FontColor:"#1D2129",InteractionColor:"#F2F3F8",PresenterChatColor:"#FA9600"};case"light":case"refreshing":return{MobileBackgroundColor:"#E0E1E2",MobileChatBackgroundColor:"#000000",FontColor:"#1D2129",InteractionColor:"#FAFBFC",PresenterChatColor:"#FF8B07"};case"holiday":return{MobileBackgroundColor:"#DB3143",MobileChatBackgroundColor:"#FC555D",FontColor:"#1D2129",InteractionColor:"#FFFFFF",PresenterChatColor:"#D12A05"};default:return{MobileBackgroundColor:"#060815",MobileChatBackgroundColor:"#000000",FontColor:"#FFFFFF",InteractionColor:"#202124",PresenterChatColor:"#FFD58B"}}};exports.getDefaultThemeConfig=getDefaultThemeConfig;var isUseDarkTheme=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"dark"===(null==e?void 0:e.ColorThemeIndex)||1===(null==e?void 0:e.ThemeMode)||"dark"===(null==e?void 0:e.ThemeMode)};exports.isUseDarkTheme=isUseDarkTheme;var colorIsCustom=function(e,o){var r,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!t)return!1;var n=null===(r=getDefaultThemeConfig(e))||void 0===r?void 0:r[o];return!!n&&n!==String(t).toUpperCase()};exports.colorIsCustom=colorIsCustom;var getDefaultMobileBackground=function(e){switch(e){case"cold":case"classic":case"custom":return"";case"light":case"refreshing":return normalizeImageUrl("//p6-live.byteimg.com/tos-cn-i-gjr78lqtd0/0707c2cc3a6efa062124d3c71ad2c842.png~tplv-gjr78lqtd0-3:q100.png");case"holiday":return normalizeImageUrl("//p1-live.byteimg.com/tos-cn-i-gjr78lqtd0/98e7520e56bd4e918fb0466741862fe5~tplv-gjr78lqtd0-image.image");default:return normalizeImageUrl("//p6-live.byteimg.com/tos-cn-i-gjr78lqtd0/923a9e572712a19d5b8c84fa66e90bd6.png~tplv-gjr78lqtd0-3:q75.png")}};exports.getDefaultMobileBackground=getDefaultMobileBackground;var isNewThemeColorCustom=function(e,o,r){return!!e&&("custom"===e.ColorThemeIndex||Number(e.ConfigVersion)===THEME_VERSION.V2&&colorIsCustom(e.ColorThemeIndex,o,r))},resolveLiveThemeConfig=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=e||{};var o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isPortrait,r=void 0!==o&&o,t=e.ColorThemeIndex||"dark",n=getDefaultThemeConfig(t),l=_objectSpread({},getThemeColor(t,r)),a={ColorThemeIndex:t,MobileBackgroundColor:getColor(e.MobileBackgroundColor,n.MobileBackgroundColor),MobileChatBackgroundColor:getColor(e.MobileChatBackgroundColor,n.MobileChatBackgroundColor),FontColor:getColor(e.FontColor,n.FontColor),InteractionColor:getColor(e.InteractionColor,n.InteractionColor),PresenterChatColor:isNewThemeColorCustom(e,"PresenterChatColor",e.PresenterChatColor)?getColor(e.PresenterChatColor,n.PresenterChatColor):n.PresenterChatColor};return _objectSpread(_objectSpread({},a),{},{themeColor:_objectSpread(_objectSpread({},l),{},{Background_1:a.MobileBackgroundColor,FontColor:a.FontColor,InteractionColor:a.InteractionColor,PresenterChatColor:a.PresenterChatColor})})};exports.resolveLiveThemeConfig=resolveLiveThemeConfig;var resolveMobileAppearanceConfig=function(){var e,o,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=resolveLiveThemeConfig(r,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=t.ColorThemeIndex,l=t.MobileBackgroundColor,a=t.themeColor,i=void 0===(null==r?void 0:r.IsMobileBackImageEnable)?MOBILE_BACK_IMAGE_ENABLE.Custom:Number(null==r?void 0:r.IsMobileBackImageEnable);o=i===MOBILE_BACK_IMAGE_ENABLE.Disabled?"":i===MOBILE_BACK_IMAGE_ENABLE.Custom?normalizeImageUrl((null==r?void 0:r.MobileBackImage)||""):getDefaultMobileBackground(n);var c=Number(null!==(e=null==r?void 0:r.IsBackgroundBlur)&&void 0!==e?e:BackgroundBlurType.Neither),C=[BackgroundBlurType.Mobile,BackgroundBlurType.Both].includes(c),s=Array.isArray(null==r?void 0:r.PlayerTopType)?r.PlayerTopType.map(function(e){return Number(e)}):[],u=1===Number(null==r?void 0:r.IsPlayerTopEnable)&&s.includes(2),g=normalizeImageUrl((null==r?void 0:r.HeaderImageUrl)||""),d=1===Number(null==r?void 0:r.IsHeaderImageEnable)&&!!g&&!u;return _objectSpread(_objectSpread({},t),{},{MobileBackgroundColor:l,MobileBackImage:o,isMobileBackgroundBlur:C,HeaderImageUrl:g,showHeaderImage:d,isMobileTopPlayer:u,themeColor:a})};exports.resolveMobileAppearanceConfig=resolveMobileAppearanceConfig;var MOBILE_APPEARANCE_FIELDS=["MobileBackgroundColor","MobileBackImage","isMobileBackgroundBlur","showHeaderImage","HeaderImageUrl","IsUseDarkTheme"],MOBILE_APPEARANCE_THEME_KEYS=["FontColor","InteractionColor","PresenterChatColor"],CHAT_THEME_STATE_KEYS=["MobileChatBackgroundColor","PresenterChatColor","PresenterTagBackgroundColor","FontColor","InteractionColor","ColorThemeIndex"];exports.CHAT_THEME_STATE_KEYS=CHAT_THEME_STATE_KEYS;var isThemeStateChanged=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]).some(function(r){return e[r]!==o[r]})};exports.isThemeStateChanged=isThemeStateChanged;var isThemeColorChanged=function(){return isThemeStateChanged(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:MOBILE_APPEARANCE_THEME_KEYS)};exports.isThemeColorChanged=isThemeColorChanged;var isMobileAppearanceConfigChanged=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.themeColor||{},t=o.themeColor||{};return e.ColorThemeIndex!==o.colorThemeIndex||isThemeStateChanged(e,o,MOBILE_APPEARANCE_FIELDS)||isThemeColorChanged(r,t)};exports.isMobileAppearanceConfigChanged=isMobileAppearanceConfigChanged;var DarkTheme={Fill_7:"#2C2D30",Background_1:"#060815",FontColor:"#FFFFFF",BackFontColor:"#86909C",InteractionColor:"#202124",PresenterChatColor:"#FFD58B"},RefreshingTheme={Fill_7:"#F6F7FB",Background_1:"linear-gradient(89.97deg, #D3E8EF -0.7%, #E6F2F5 99.98%);",FontColor:"#1D2129",BackFontColor:"#202124",InteractionColor:"#FAFBFC",PresenterChatColor:"#FF8B07"},ClassicTheme={Fill_7:"#E5E8EF",Background_1:"#ffffff",FontColor:"#1D2129",BackFontColor:"#202124",InteractionColor:"#F2F3F8",PresenterChatColor:"#FA9600"},HolidayTheme={Fill_7:"#F6F7FB",Background_1:"#DB3143",FontColor:"#1D2129",BackFontColor:"#202124",InteractionColor:"#FFFFFF",PresenterChatColor:"#D12A05"};