/*!
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("../../../../../_virtual/download.js"),i=require("../../utils/util.js"),n=require("../../plugin/plugin.js"),o=require("../common/iconTools.js"),r=require("../common/iconPlugin.js"),l=require("../assets/download.js");var s=function(r){e.inherits(a,r);var s=e.createSuper(a);function a(n){var o;return e.classCallCheck(this,a),o=s.call(this,n),e.defineProperty(e.assertThisInitialized(o),"download",function(e){if(!o.isLock){o.emitUserAction(e,"download");var n=o.playerConfig.url,r="";"String"===i.default.typeOf(n)?r=n:"Array"===i.default.typeOf(n)&&n.length>0&&(r=n[0].src);var l=o.getAbsoluteURL(r);t.default(l),o.isLock=!0,o.timer=window.setTimeout(function(){o.isLock=!1,window.clearTimeout(o.timer),o.timer=null},300)}}),o.timer=null,o.isLock=!1,o}return e.createClass(a,[{key:"afterCreate",value:function(){e.get(e.getPrototypeOf(a.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:l.default}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var t=document.createElement("div");t.innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href}return e}},{key:"destroy",value:function(){e.get(e.getPrototypeOf(a.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n   <div class="xgplayer-icon">\n   </div>\n   '.concat(o.xgIconTips(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:n.POSITIONS.CONTROLS_RIGHT,index:3,disable:!0}}}]),a}(r.default);exports.default=s;