/*!
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"),o=require("../../events.js");var n=function(n){e.inherits(a,n);var i=e.createSuper(a);function a(){return e.classCallCheck(this,a),i.apply(this,arguments)}return e.createClass(a,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){t.default.addClass(this.root,"hide")}},{key:"show",value:function(e){t.default.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(o.ENDED,function(){e.isEndedShow&&t.default.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(o.TIME_UPDATE,function(){e.onTimeUpdate()}),this.on(o.URL_CHANGE,function(){t.default.removeClass(e.root,"hide"),t.default.addClass(e.root,"xg-showplay"),e.once(o.TIME_UPDATE,function(){e.onTimeUpdate()})})):this.on(o.PLAY,function(){t.default.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach(function(o){t.config[o]=e[o]});var o=this.config.poster;this.update(o)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?t.default.removeClass(this.root,"xg-showplay"):this.once(o.TIME_UPDATE,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;default:t=""}return t?"background-size: ".concat(t,";"):""}},{key:"render",value:function(){var e=this.config,t=e.poster,o=e.hideCanplay,n=e.fillMode,i=e.notHidden,a=this.getBgSize(n),r=t?"background-image:url(".concat(t,");").concat(a):a;return'<xg-poster class="xgplayer-poster '.concat(i?"xg-not-hidden":o?"xg-showplay":"",'" style="').concat(r,'">\n    </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),a}(require("../../plugin/plugin.js").default);exports.default=n;