/*!
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
*/
import{inherits as e,createSuper as t,classCallCheck as o,defineProperty as i,assertThisInitialized as n,createClass as s,get as r,getPrototypeOf as l}from"../../_virtual/_rollupPluginBabelHelpers.js";import a from"../../utils/util.js";import u from"../../utils/sniffer.js";import{MINI_STATE_CHANGE as c}from"../../events.js";import f,{POSITIONS as g}from"../../plugin/plugin.js";import h from"../../stateClassMap.js";var d=/* @__PURE__ */function(){e(p,f);var d=t(p);function p(){var e;o(this,p);for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return e=d.call.apply(d,[this].concat(s)),i(n(e),"onMouseEnter",function(t){var o=n(e),i=o.player;o.playerConfig.closeControlsBlur&&i.focus({autoHide:!1})}),i(n(e),"onMouseLeave",function(t){n(e).player.focus()}),e}return s(p,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==u.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,t=this.config,o=t.disable,i=t.height,n=t.mode;if(!o){"flex"===n&&this.player.addClass(h.FLEX_CONTROLS);var s={height:"".concat(i,"px")};Object.keys(s).map(function(t){e.root.style[t]=s[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(c,function(t){t?a.addClass(e.root,"mini-controls"):a.removeClass(e.root,"mini-controls")});var r=this.playerConfig.isMobileSimulateMode;"mobile"!==u.device&&"mobile"!==r&&(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&&a.addClass(this.root,h.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){a.removeClass(this.root,h.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(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(this.root){var i=e.defaultConfig||{};if(!t.root){switch(t.position?t.position:t.config&&t.config.position?t.config.position:i.position){case g.CONTROLS_LEFT:t.root=this.left;break;case g.CONTROLS_RIGHT:t.root=this.right;break;case g.CONTROLS_CENTER:t.root=this.center;break;case g.CONTROLS:t.root=this.root;break;default:t.root=this.left}return r(l(p.prototype),"registerPlugin",this).call(this,e,t,o)}}}},{key:"destroy",value:function(){"mobile"!==u.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 e=this.config,t=e.mode,o=e.autoHide,n=e.initShow;if(!e.disable){var s=a.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},i({},h.CONTROLS_AUTOHIDE,o),{"xgplayer-controls-initshow":n||!o});return'<xg-controls class="'.concat(s,'" 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}}}]),p}();export{d as default};