/*!
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 t=require("../../_virtual/_rollupPluginBabelHelpers.js"),e=require("../../utils/util.js"),i=require("../../events.js"),o=require("../../plugin/plugin.js"),n=require("../common/iconTools.js"),r=require("../common/iconPlugin.js"),a=require("../assets/rotate.js");var s=function(r){t.inherits(c,r);var s=t.createSuper(c);function c(e){var i;return t.classCallCheck(this,c),(i=s.call(this,e)).rotateDeg=i.config.rotateDeg||0,i}return t.createClass(c,[{key:"afterCreate",value:function(){var o=this;if(!this.config.disable){t.get(t.getPrototypeOf(c.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(i.VIDEO_RESIZE,function(){o.rotateDeg&&o.config.innerRotate&&e.default.setTimeout(o,function(){o.updateRotateDeg(o.rotateDeg,o.config.innerRotate)},100)});var n=this.player.root;this.rootWidth=n.style.width||n.offsetWidth||n.clientWidth,this.rootHeight=n.style.height||n.offsetHeight||n.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){t.get(t.getPrototypeOf(c.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(t){t.preventDefault(),t.stopPropagation(),this.emitUserAction(t,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(t,e){if(t||(t=0),e)this.player.videoRotateDeg=t;else{var i=this.player,o=this.rootWidth,n=this.rootHeight,r=i.root,a=i.innerContainer,s=i.media,c=r.offsetWidth,l=a&&e?a.offsetHeight:r.offsetHeight,h=o,u=n,g=0,f=0;.75!==t&&.25!==t||(h="".concat(l,"px"),u="".concat(c,"px"),g=-(l-c)/2,f=-(c-l)/2);var p="translate(".concat(g,"px,").concat(f,"px) rotate(").concat(t,"turn)"),d={transformOrigin:"center center",transform:p,webKitTransform:p,height:u,width:h},y=e?s:r,v=e?i.getPlugin("poster"):null;Object.keys(d).map(function(t){y.style[t]=d[t],v&&v.root&&(v.root.style[t]=d[t])})}}},{key:"rotate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.player;this.rotateDeg||(this.rotateDeg=0);var r=t?1:-1;this.rotateDeg=(this.rotateDeg+1+.25*r*o)%1,this.updateRotateDeg(this.rotateDeg,e),n.emit(i.ROTATE,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:a.default}}},{key:"render",value:function(){if(!this.config.disable)return'\n    <xg-icon class="xgplayer-rotate">\n      <div class="xgplayer-icon">\n      </div>\n      '.concat(n.xgIconTips(this,"ROTATE_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:o.POSITIONS.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),c}(r.default);exports.default=s;