/*!
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"),n=require("../../utils/sniffer.js"),i=require("../../events.js"),l=require("../../plugin/plugin.js"),s=require("../common/iconTools.js"),r=require("../common/iconPlugin.js"),c=require("./backicon.js"),a=require("../assets/requestFull.js"),o=require("../assets/exitFull.js");var u=function(r){e.inherits(f,r);var u=e.createSuper(f);function f(){var t;e.classCallCheck(this,f);for(var n=arguments.length,i=new Array(n),l=0;l<n;l++)i[l]=arguments[l];return t=u.call.apply(u,[this].concat(i)),e.defineProperty(e.assertThisInitialized(t),"_onOrientationChange",function(e){t.player.fullscreen&&t.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?t.player.setRotateDeg(0):t.player.setRotateDeg(90))}),t}return e.createClass(f,[{key:"afterCreate",value:function(){var l=this;e.get(e.getPrototypeOf(f.prototype),"afterCreate",this).call(this);var s=this.config,r=this.playerConfig;if(!s.disable){s.target&&(this.playerConfig.fullscreenTarget=this.config.target);var a=t.default.getFullScreenEl();r.fullscreenTarget===a&&this.player.getFullscreen().catch(function(e){}),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(e){var t=l.player.fullscreen;l.emitUserAction(e,"switch_fullscreen",{prop:"fullscreen",from:t,to:!t})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(i.FULLSCREEN_CHANGE,function(e){var t=l.find(".xg-tips");t&&l.changeLangTextKey(t,e?l.i18nKeys.EXITFULLSCREEN_TIPS:l.i18nKeys.FULLSCREEN_TIPS),l.animate(e)}),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:c.default,options:{config:{onClick:function(e){l.handleFullscreen(e)}}}})),"mobile"===n.default.device&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:a.default,class:"xg-get-fullscreen"},exitFullscreen:{icon:o.default,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){e.get(e.getPrototypeOf(f.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===n.default.device?"touchend":"click",this.handleFullscreen),"mobile"===n.default.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e instanceof Event&&(e.preventDefault(),e.stopPropagation());var t=this.player,n=this.config;!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen()?(t.fullscreen?t.exitCssFullscreen():t.getCssFullscreen(),this.animate(t.fullscreen)):n.rotateFullscreen?(t.fullscreen?t.exitRotateFullscreen():t.getRotateFullscreen(),this.animate(t.fullscreen)):n.switchCallback&&"function"==typeof n.switchCallback?n.switchCallback(t.fullscreen):t.fullscreen?(t.exitFullscreen(),n.useScreenOrientation&&this.unlockScreen()):(t.getFullscreen().catch(function(e){}),n.useScreenOrientation&&t.aspectRatio>1&&this.lockScreen(n.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){return'<xg-icon class="xgplayer-fullscreen">\n    <div class="xgplayer-icon">\n    </div>\n    '.concat(s.xgIconTips(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch(function(e){})}catch(t){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch(function(e){})}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:l.POSITIONS.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),f}(r.default);exports.default=u;