/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../utils/util.js"),i=require("../../utils/sniffer.js"),o=require("../../events.js"),n=require("../../plugin/plugin.js"),r=require("../../stateClassMap.js");var s=function(s){e.inherits(a,s);var l=e.createSuper(a);function a(){var t;e.classCallCheck(this,a);for(var i=arguments.length,o=new Array(i),n=0;n<i;n++)o[n]=arguments[n];return t=l.call.apply(l,[this].concat(o)),e.defineProperty(e.assertThisInitialized(t),"onMouseEnter",function(i){var o=e.assertThisInitialized(t),n=o.player;o.playerConfig.closeControlsBlur&&n.focus({autoHide:!1})}),e.defineProperty(e.assertThisInitialized(t),"onMouseLeave",function(i){e.assertThisInitialized(t).player.focus()}),t}return e.createClass(a,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==i.default.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,n=this.config,s=n.disable,l=n.height,a=n.mode;if(!s){"flex"===a&&this.player.addClass(r.default.FLEX_CONTROLS);var u={height:"".concat(l,"px")};Object.keys(u).map(function(t){e.root.style[t]=u[t]}),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(o.MINI_STATE_CHANGE,function(i){i?t.default.addClass(e.root,"mini-controls"):t.default.removeClass(e.root,"mini-controls")});var c=this.playerConfig.isMobileSimulateMode;"mobile"!==i.default.device&&"mobile"!==c&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&t.default.addClass(this.root,r.default.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){t.default.removeClass(this.root,r.default.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(this.root){var r=t.defaultConfig||{};if(!i.root){switch(i.position?i.position:i.config&&i.config.position?i.config.position:r.position){case n.POSITIONS.CONTROLS_LEFT:i.root=this.left;break;case n.POSITIONS.CONTROLS_RIGHT:i.root=this.right;break;case n.POSITIONS.CONTROLS_CENTER:i.root=this.center;break;case n.POSITIONS.CONTROLS:i.root=this.root;break;default:i.root=this.left}return e.get(e.getPrototypeOf(a.prototype),"registerPlugin",this).call(this,t,i,o)}}}},{key:"destroy",value:function(){"mobile"!==i.default.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var i=this.config,o=i.mode,n=i.autoHide,s=i.initShow;if(!i.disable){var l=t.default.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===o},{"bottom-controls":"bottom"===o},e.defineProperty({},r.default.CONTROLS_AUTOHIDE,n),{"xgplayer-controls-initshow":s||!n});return'<xg-controls class="'.concat(l,'" unselectable="on">\n    <xg-inner-controls class="xg-inner-controls xg-pos">\n      <xg-left-grid class="xg-left-grid">\n      </xg-left-grid>\n      <xg-center-grid class="xg-center-grid"></xg-center-grid>\n      <xg-right-grid class="xg-right-grid">\n      </xg-right-grid>\n    </xg-inner-controls>\n    </xg-controls>')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),a}(n.default);exports.default=s;