/*!
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 r,classCallCheck as t,defineProperty as i,assertThisInitialized as n,createClass as a}from"../../_virtual/_rollupPluginBabelHelpers.js";import s from"../../utils/util.js";import{TIME_UPDATE as o,EMPTIED as c}from"../../events.js";import l from"../../plugin/plugin.js";function u(e){return e?"background:".concat(e,";"):""}var p=/* @__PURE__ */function(){e(g,l);var p=r(g);function g(){var e;t(this,g);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return e=p.call.apply(p,[this].concat(a)),i(n(e),"onTimeupdate",function(){var r=e.player.ended,t=n(e).offsetDuration,i=e.currentTime;i=s.adjustTimeByDuration(i,t,r),e.update({played:i},t)}),e}return a(g,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,r=e.offsetCurrentTime,t=e.currentTime;return r>=0?r:t}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(o,this.onTimeupdate),this.on(c,function(){e.reset()}))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},r=arguments.length>1?arguments[1]:void 0;r&&this.root&&(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/r*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/r*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,r=e.commonStyle;if(e.miniprogress){var t=this.config,i=t.mode,n=t.height,a={cached:u(r.cachedColor),played:u(r.playedColor),progress:u(r.progressColor),height:n>0&&2!==n?"height: ".concat(n,"px;"):""};return'<xg-mini-progress class="xg-mini-progress '.concat("show"===i?"xg-mini-progress-show":"",'" style="').concat(a.progress," ").concat(a.height,'">\n    <xg-mini-progress-cache class="xg-mini-progress-cache" style="').concat(a.cached,'"></xg-mini-progress-cache>\n    <xg-mini-progress-played class="xg-mini-progress-played" style="').concat(a.played,'"></xg-mini-progress-played>\n    </xg-mini-progress>')}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),g}();export{p as default};