"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyPlayerIconAvailability=void 0;var _constant=require("../constant");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,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var VIDEO_TYPE_LIVE="live",VIDEO_TYPE_VOD="vod",isEnabledByReplayConfig=function(e){return"0"!==String(null!=e?e:"1")},resolvePlayerIconVisible=function(e){var t=e.key,r=e.videoType,o=e.status,n=e.replayPlayerConfig,i=o===_constant.LIVE_STATUS.回放;return"BACKRATE"===t?r===VIDEO_TYPE_VOD&&(!i||isEnabledByReplayConfig(null==n?void 0:n.IsSpeedControlEnable)):"CLARITY"===t?(r===VIDEO_TYPE_VOD||r===VIDEO_TYPE_LIVE)&&(!i||r===VIDEO_TYPE_LIVE||isEnabledByReplayConfig(null==n?void 0:n.IsResolutionEnable)):void 0},applyPlayerIconAvailability=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(function(e){var r=resolvePlayerIconVisible({key:null==e?void 0:e.key,videoType:t.videoType,status:t.status,replayPlayerConfig:t.replayPlayerConfig});return void 0===r?e:_objectSpread(_objectSpread({},e),{},{visible:r})}):[]};exports.applyPlayerIconAvailability=applyPlayerIconAvailability;