diff --git a/dist/artplayer.js b/dist/artplayer.js
index dcb17ebed..398ce3d48 100644
--- a/dist/artplayer.js
+++ b/dist/artplayer.js
@@ -1,8 +1,8 @@
/*!
- * artplayer.js v4.0.8
+ * artplayer.js v4.0.9
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2021 Harvey Zack
* Released under the MIT License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function k(t,e,r){return t.style[e]=r,t}function j(t,e){return Object.keys(e).forEach((function(r){k(t,r,e[r])})),t}function P(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=window.getComputedStyle(t,null).getPropertyValue(e);return r?parseFloat(n):n}function S(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function E(t,e){S(t).forEach((function(t){return w(t,e)})),b(t,e)}function R(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",r))}function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function D(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function T(t,e){return e.parentNode.replaceChild(t,e),t}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function A(t,e,r){return A=z()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&o(i,r.prototype),i},A.apply(null,arguments)}function C(t){var e="function"==typeof Map?new Map:void 0;return C=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return A(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},C(t)}function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var M=function(e){i(o,e);var r=L(o);function o(e,i){var a;return t(this,o),a=r.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(n(a),i||a.constructor),a.name="ArtPlayerError",a}return o}(C(Error));function q(t,e){if(!t)throw new M(e);return t}function F(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"$1>").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"$1>").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function I(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(/[:.]/).map((function(t,e,r){if(e===r.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var n=t.match(e);return n?{start:r(n[1].trim()),end:r(n[2].trim()),text:n[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(t,e){var r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function G(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),s=0;s0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function et(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var rt=Object.freeze({__proto__:null,query:m,queryAll:g,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:E,tooltip:R,isInViewport:$,includeFromEvent:D,replaceElement:T,ArtPlayerError:M,errorHandle:q,srtToVtt:F,vttToBlob:B,assToVtt:I,getExt:V,download:W,def:U,has:X,get:Q,proxyPropertys:Y,mergeDeep:Z,sleep:J,debounce:function(t,e,r){var n;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(f);case"regexp":return t.test(f);default:return!1}}))},vt=function(){function e(r){var n=this;t(this,e),this.art=r,this.query=this.query.bind(this),r.option.container instanceof Element?this.$container=r.option.container:(this.$container=m(r.option.container),q(this.$container,"No container element found by ".concat(r.option.container)));var o=this.$container.tagName.toLowerCase();q("div"===o,"Unsupported container element type, only support 'div' but got '".concat(o,"'")),q(r.constructor.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),this.$original=this.$container.cloneNode(!0),r.whitelist.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return m(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option,r=t.backdrop,n=t.theme;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),this.$player.style.setProperty("--theme",n),this.$container.dataset.artId=this.art.id,r&&(b(this.$settingInner,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(this.$container,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?T(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return''}}]),e}(),mt={"Video info":"统计信息",Close:"关闭","Video load failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"翻转",Rotate:"旋转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","PIP mode":"画中画模式","Exit PIP mode":"退出画中画模式","PIP not supported":"不支持画中画模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},gt={"Video info":"統計訊息",Close:"關閉","Video load failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"翻轉",Rotate:"旋轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","PIP mode":"畫中畫模式","Exit PIP mode":"退出畫中畫模式","PIP not supported":"不支持畫中畫模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},bt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":mt,"zh-tw":gt},this.init()}return r(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=Z(this.languages,t),this.init()}}]),e}();var wt={exports:{}};!function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},r=t.exports,n=function(){for(var t,r=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,o=r.length,i={};nd){var h=d*l/s;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var y=s/d/l;k(n,"width","100%"),k(n,"height","".concat(100*y,"%")),k(n,"padding","".concat((p-p*y)/2,"px 0"))}o.dataset.aspectRatio=e}a.show="".concat(i.get("Aspect ratio"),": ").concat("default"===e?i.get("Default"):e),t.emit("aspectRatio",e)}}),U(e,"aspectRatioReset",{set:function(t){if(t&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r}}})}(r,this),function(t,e){var r=t.option,n=t.notice,o=t.template.$video,i=document.createElement("canvas");U(e,"getDataURL",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),t(i.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),U(e,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),i.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),U(e,"screenshot",{value:function(){return e.getDataURL().then((function(e){return W(e,"".concat(r.title||"artplayer","_").concat(tt(o.currentTime),".png")),t.emit("screenshot",e),e}))}})}(r,this),Ot(r,this),function(t,e){var r=t.template.$player;U(e,"fullscreenWeb",{get:function(){return x(r,"art-fullscreen-web")},set:function(n){n?(b(r,"art-fullscreen-web"),e.aspectRatioReset=!0,t.emit("resize"),t.emit("fullscreenWeb",!0)):(w(r,"art-fullscreen-web"),e.aspectRatioReset=!0,e.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}})}(r,this),kt(r,this),function(t,e){var r=t.template.$video;U(e,"loaded",{get:function(){return e.loadedTime/r.duration}}),U(e,"loadedTime",{get:function(){return r.buffered.length?r.buffered.end(r.buffered.length-1):0}})}(r,this),function(t,e){U(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var r=t.template.$video;U(e,"playing",{get:function(){return!!(r.currentTime>0&&!r.paused&&!r.ended&&r.readyState>2)}})}(r,this),function(t,e){var r=t.template,n=r.$container,o=r.$player,i=r.$video;U(e,"autoSize",{get:function(){return x(n,"art-auto-size")},set:function(r){if(r){var a=i.videoWidth,c=i.videoHeight,s=n.getBoundingClientRect(),l=s.width,u=s.height,p=a/c,f=l/u;if(b(n,"art-auto-size"),f>p)k(o,"width","".concat(u*p/l*100,"%")),k(o,"height","100%");else{var d=l/p/u*100;k(o,"width","100%"),k(o,"height","".concat(d,"%"))}t.emit("autoSize",{width:e.width,height:e.height})}else w(n,"art-auto-size"),k(o,"width",null),k(o,"height",null),t.emit("autoSize")}})}(r,this),function(t,e){U(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){U(e,t,{get:function(){return e.rect[t]}})})),U(e,"x",{get:function(){return e.left+window.pageXOffset}}),U(e,"y",{get:function(){return e.top+window.pageYOffset}})}(r,this),function(t,e){var r=t.template.$player,n=t.i18n,o=t.notice;U(e,"flip",{get:function(){return r.dataset.flip},set:function(i){i||(i="normal");var a=["normal","horizontal","vertical"];q(a.includes(i),"'flip' only accept ".concat(a.toString()," as parameters")),"normal"===i?delete r.dataset.flip:(e.rotate=!1,r.dataset.flip=i);var c=i.replace(i[0],i[0].toUpperCase());o.show="".concat(n.get("Flip"),": ").concat(n.get(c)),t.emit("flip",i)}}),U(e,"flipReset",{set:function(t){if(t&&e.flip){var r=e.flip;e.flip=r}}})}(r,this),function(t,e){var r=t.i18n,n=t.option,o=t.storage,i=t.events.proxy,a=t.template,c=a.$player,s=a.$miniClose,l=a.$miniTitle,u=a.$miniHeader,p="",f=!1,d=0,h=0,y=0,v=0;i(u,"mousedown",(function(t){f=!0,d=t.pageX,h=t.pageY,y=e.left,v=e.top})),i(document,"mousemove",(function(t){if(f){b(c,"art-is-dragging");var e=v+t.pageY-h,r=y+t.pageX-d;k(c,"top","".concat(e,"px")),k(c,"left","".concat(r,"px")),o.set("top",e),o.set("left",r)}})),i(document,"mouseup",(function(){f=!1,w(c,"art-is-dragging")})),i(s,"click",(function(){e.mini=!1,f=!1,w(c,"art-is-dragging")})),O(l,n.title||r.get("Mini player")),U(e,"mini",{get:function(){return x(c,"art-mini")},set:function(r){if(r){e.autoSize=!1,p=c.style.cssText,b(c,"art-mini");var i=o.get("top"),a=o.get("left");if(i&&a)k(c,"top","".concat(i,"px")),k(c,"left","".concat(a,"px")),$(u)||(o.del("top"),o.del("left"),e.mini=!0);else{var s=document.body,l=s.clientHeight-e.height-50,f=s.clientWidth-e.width-50;o.set("top",l),o.set("left",f),k(c,"top","".concat(l,"px")),k(c,"left","".concat(f,"px"))}e.aspectRatio=!1,e.playbackRate=!1,t.emit("mini",!0)}else c.style.cssText=p,w(c,"art-mini"),k(c,"top",null),k(c,"left",null),e.aspectRatio=!1,e.playbackRate=!1,e.autoSize=n.autoSize,t.emit("mini")}})}(r,this),function(t,e){var r=[];U(e,"loop",{get:function(){return r},set:function(n){if(Array.isArray(n)&&"number"==typeof n[0]&&"number"==typeof n[1]){var o=K(n[0],0,Math.min(n[1],e.duration)),i=K(n[1],o,e.duration);i-o>=1?(r=[o,i],t.emit("loop",r)):(r=[],t.emit("loop"))}else r=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){r.length&&(e.currentTimer[1])&&(e.seek=r[0])}))}(r,this),function(t,e){var r=t.template,n=r.$video,o=r.$player,i=t.i18n,a=t.notice;U(e,"rotate",{get:function(){return Number(o.dataset.rotate)||0},set:function(r){r||(r=0);var c=[-270,-180,-90,0,90,180,270];if(q(c.includes(r),"'rotate' only accept ".concat(c.toString()," as parameters")),0===r)delete o.dataset.rotate,k(n,"transform",null);else{e.flip=!1,t.autoSize=!0,o.dataset.rotate=r;var s=function(){var t=n.videoWidth,e=n.videoHeight;return t>e?e/t:t/e},l=0,u=1;switch(r){case-270:l=90,u=s();break;case-180:l=180;break;case-90:l=270,u=s();break;case 90:l=90,u=s();break;case 180:l=180;break;case 270:l=270,u=s()}k(n,"transform","rotate(".concat(l,"deg) scale(").concat(u,")"))}a.show="".concat(i.get("Rotate"),": ").concat(r,"°"),t.emit("rotate",r)}}),U(e,"rotateReset",{set:function(t){if(t&&e.rotate){var r=e.rotate;e.rotate=r}}})}(r,this),function(t,e){var r=t.option,n=t.template.$poster;U(e,"poster",{get:function(){return r.poster},set:function(t){r.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(r,this),Y(r,this)};function Pt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function St(){return St="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=Pt(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},St.apply(this,arguments)}var Et=function(){function e(r){t(this,e),this.id=0,this.art=r,this.add=this.add.bind(this)}return r(e,[{key:"show",get:function(){return x(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,r="art-".concat(this.name,"-show");t?b(e,r):w(e,r),this.art.emit(this.name,t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}},{key:"add",value:function(t){var e=this,r="function"==typeof t?t(this.art):t;if(r.html=r.html||"",u(r,ft),this.$parent&&this.name&&!r.disable){var n=r.name||"".concat(this.name).concat(this.id);q(!X(this,n),"Cannot add an existing name [".concat(n,"] to the [").concat(this.name,"]")),this.id+=1;var o=document.createElement("div");b(o,"art-".concat(this.name)),b(o,"art-".concat(this.name,"-").concat(n));var i=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var a=i.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),r.html&&O(o,r.html),r.style&&j(o,r.style),r.tooltip&&R(o,r.tooltip),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(e.art,e,t)})),r.selector&&["left","right"].includes(r.position)&&this.selector(r,o),r.mounted&&r.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&b(o,"art-control-onlyText"),U(this,n,{value:o}),o}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'').concat(t.html,"
")})).join(""),s=document.createElement("div");b(s,"art-selector-list"),O(s,c),O(e,s);var l=function(){var t=P(e,"width")/2-P(s,"width")/2;s.style.left="".concat(t,"px")};o(e,l),i(s,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(n){E(n,"art-current");var o=Number(n.dataset.index),i=t.selector[o]||{};if(a.innerText=n.innerText,t.onSelect){var c=t.onSelect.call(r.art,i,n);"string"==typeof c&&(a.innerHTML=c)}l(),r.art.emit("selector",i,n)}}))}}]),e}();function Rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function $t(t){for(var e=1;e',mounted:function(t){var r=!1,s=m(".art-progress-loaded",t),l=m(".art-progress-played",t),u=m(".art-progress-highlight",t),p=m(".art-progress-indicator",t),f=m(".art-progress-tip",t);k(l,"backgroundColor",o);var d=14;function h(t,e){"loaded"===t&&k(s,"width","".concat(100*e,"%")),"played"===t&&(k(l,"width","".concat(100*e,"%")),k(p,"left","calc(".concat(100*e,"% - ").concat(d/2,"px)")))}c.indicator?(d=16,O(p,c.indicator)):j(p,{backgroundColor:o}),j(p,{left:"-".concat(d/2,"px"),width:"".concat(d,"px"),height:"".concat(d,"px")}),n.forEach((function(t){var e=K(t.time,0,a.duration)/a.duration*100;O(u,''))})),h("loaded",a.loaded),e.on("video:progress",(function(){h("loaded",a.loaded)})),e.on("video:timeupdate",(function(){h("played",a.played)})),e.on("video:ended",(function(){h("played",1)})),i(t,"mousemove",(function(r){k(f,"display","block"),D(r,u)?function(r){var n=Ft(e,r).width,o=r.target.dataset.text;f.innerHTML=o;var i=f.clientWidth;n<=i/2?k(f,"left",0):n>t.clientWidth-i/2?k(f,"left","".concat(t.clientWidth-i,"px")):k(f,"left","".concat(n-i/2,"px"))}(r):function(r){var n=Ft(e,r),o=n.width,i=n.time;f.innerHTML=i;var a=f.clientWidth;o<=a/2?k(f,"left",0):o>t.clientWidth-a/2?k(f,"left","".concat(t.clientWidth-a,"px")):k(f,"left","".concat(o-a/2,"px"))}(r)})),i(t,"mouseout",(function(){k(f,"display","none")})),i(t,"click",(function(t){if(t.target!==p){var r=Ft(e,t),n=r.second;h("played",r.percentage),a.seek=n}})),i(p,"mousedown",(function(){r=!0})),i(document,"mousemove",(function(t){if(r){var n=Ft(e,t),o=n.second;h("played",n.percentage),a.seek=o}})),i(document,"mouseup",(function(){r&&(r=!1)}))}})}}function It(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Vt(t){for(var e=1;en.clientWidth-s/2?k(t,"left","".concat(n.clientWidth-s,"px")):k(t,"left","".concat(i-s/2,"px"))}(o))})),i(n,"mouseout",(function(){k(t,"display","none")}))}})}}function Jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Gt(t){for(var e=1;e=3e3&&(r.show=!1,b(c,"art-hide-cursor"),w(c,"art-hover"))})),e.once("ready",(function(){r.add(Bt({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Zt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return re(re({},t),{},{mounted:function(t){var r=e.player,n=O(t,''),o=O(t,'');e.on("loop",(function(e){e?(k(t,"display","block"),k(n,"left","calc(".concat(e[0]/r.duration*100,"% - ").concat(n.clientWidth,"px)")),k(o,"left","".concat(e[1]/r.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),r.add(function(t){return function(e){return Lt(Lt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player,a=O(t,n.play),c=O(t,n.pause);function s(){k(a,"display","flex"),k(c,"display","none")}function l(){k(a,"display","none"),k(c,"display","flex")}R(a,o.get("Play")),R(c,o.get("Pause")),r(a,"click",(function(){i.play()})),r(c,"click",(function(){i.pause()})),i.playing?l():s(),e.on("video:playing",(function(){l()})),e.on("video:pause",(function(){s()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Ut(Ut({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player,i=e.i18n,a=!1,c=O(t,n.volume),s=O(t,n.volumeClose),l=O(t,''),u=O(l,'');function p(t){var e=l.getBoundingClientRect().left;return K(t.pageX-e-6,0,54)/48}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===t)k(c,"display","none"),k(s,"display","flex"),k(u,"left","0");else{var e=48*t;k(c,"display","flex"),k(s,"display","none"),k(u,"left","".concat(e,"px"))}}R(c,i.get("Mute")),k(s,"display","none"),d&&k(l,"display","none"),f(o.volume),e.on("video:volumechange",(function(){f(o.volume)})),r(c,"click",(function(){o.muted=!0})),r(s,"click",(function(){o.muted=!1})),r(l,"click",(function(t){o.muted=!1,o.volume=p(t)})),r(u,"mousedown",(function(){a=!0})),r(t,"mousemove",(function(t){a&&(o.muted=!1,o.volume=p(t))})),r(document,"mouseup",(function(){a&&(a=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),r.add(function(t){return function(e){return Ht(Ht({},t),{},{mounted:function(t){function r(){var r="".concat(tt(e.player.currentTime)," / ").concat(tt(e.player.duration));r!==t.innerText&&(t.innerText=r)}r(),["video:loadedmetadata","video:timeupdate","video:progress"].forEach((function(t){e.on(t,r)}))}})}}({name:"time",disable:i.isLive,position:"left",index:30})),r.add(function(t){return function(e){var r=e.option.quality,n=r.find((function(t){return t.default}))||r[0];return te(te({},t),{},{html:n?n.html:"",selector:r,onSelect:function(t){e.player.switchQuality(t.url,t.html)}})}}({name:"quality",disable:0===i.quality.length,position:"right",index:10})),r.add(function(t){return function(e){return Gt(Gt({},t),{},{tooltip:e.i18n.get("Screenshot"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player;O(t,n.screenshot),r(t,"click",(function(){o.screenshot()}))}})}}({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),r.add(function(t){return function(e){return Vt(Vt({},t),{},{tooltip:e.i18n.get("Hide subtitle"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.subtitle;O(t,n.subtitle),r(t,"click",(function(){i.toggle=!0})),e.on("subtitle",(function(e){R(t,o.get(e?"Hide subtitle":"Show subtitle"))}))}})}}({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),r.add(function(t){return function(e){return Xt(Xt({},t),{},{tooltip:e.i18n.get("Show setting"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.setting;O(t,n.setting),r(t,"click",(function(){i.toggle=!0})),e.on("setting",(function(e){R(t,o.get(e?"Hide setting":"Show setting"))}))}})}}({name:"setting",disable:!i.setting,position:"right",index:40})),r.add(function(t){return function(e){return At(At({},t),{},{tooltip:e.i18n.get("PIP mode"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;O(t,n.pip),r(t,"click",(function(){i.pip=!i.pip})),e.on("pip",(function(e){R(t,o.get(e?"Exit PIP mode":"PIP mode"))}))}})}}({name:"pip",disable:!i.pip,position:"right",index:50})),r.add(function(t){return function(e){return Tt(Tt({},t),{},{tooltip:e.i18n.get("Web fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;O(t,n.fullscreenWeb),r(t,"click",(function(){i.fullscreenWeb=!i.fullscreenWeb})),e.on("fullscreenWeb",(function(e){R(t,o.get(e?"Exit web fullscreen":"Web fullscreen"))}))}})}}({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),r.add(function(t){return function(e){return $t($t({},t),{},{tooltip:e.i18n.get("Fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;O(t,n.fullscreen),r(t,"click",(function(){i.fullscreen=!i.fullscreen})),e.on("fullscreen",(function(e){R(t,o.get(e?"Exit fullscreen":"Fullscreen"))}))}})}}({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){r.add(t)}))})),r}return r(o,[{key:"add",value:function(t){var e="function"==typeof t?t(this.art):t,r=this.art.template,n=r.$progress,i=r.$controlsLeft,a=r.$controlsRight;switch(e.position){case"top":this.$parent=n;break;case"left":this.$parent=i;break;case"right":this.$parent=a;break;default:q(!1,"Control option.position must one of 'top', 'left', 'right'")}St(s(o.prototype),"add",this).call(this,e)}}]),o}(Et);function ie(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ae(t){for(var e=1;e0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,e){var r=e.target.dataset.rate;r&&(n.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=g("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&E(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return se(se({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,e){var r=e.target.dataset.ratio;r&&(n.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("span",t).find((function(t){return t.dataset.ratio===e}));r&&E(r,"art-current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio",index:20})),o.add(function(t){return function(e){return ue(ue({},t),{},{html:e.i18n.get("Video info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:30})),o.add(function(t){return fe(fe({},t),{},{html:'ArtPlayer 4.0.8'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){return he(he({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60})),i.contextmenu.forEach((function(t){o.add(t)})),l(c,"contextmenu",(function(t){t.preventDefault(),o.show=!0;var e=t.clientX,r=t.clientY,n=c.getBoundingClientRect(),i=n.height,a=n.width,l=n.left,u=n.top,p=s.getBoundingClientRect(),f=p.height,d=p.width,h=e-l,y=r-u;e+d>l+a&&(h=a-d),r+f>u+i&&(y=i-f),j(s,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),l(c,"click",(function(t){D(t,s)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(Et);function me(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ge=function(e){i(o,e);var n=me(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name="info",r.art.template.$info&&r.init(),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.template,n=r.$infoPanel,o=r.$infoClose,i=r.$video;(0,e.events.proxy)(o,"click",(function(){t.show=!1}));var a=null,c=g("[data-video]",n);function s(){c.forEach((function(t){var e=i[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),a=setTimeout((function(){s()}),1e3)}this.art.on("destroy",(function(){clearTimeout(a)})),this.art.on("info",(function(t){clearTimeout(a),t&&s()}))}}]),o}(Et);function be(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function we(t){for(var e=1;e".concat(et(t),"
")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.art,n=r.i18n,o=r.notice,i=r.option,a=we(we(we({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(n.get("Switch subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,dt.subtitle),t.url){var r=this.art,n=r.notice,o=r.events.proxy,i=r.template,a=i.$subtitle,c=i.$video;if(!i.$track){var s=document.createElement("track");s.default=!0,s.kind="metadata",c.appendChild(s),this.art.template.$track=s,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(t.style),this.bilingual=t.bilingual,q(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(r){q(window.TextDecoder,"TextDecoder not support");var n=new TextDecoder(t.encoding).decode(r);switch(e.art.emit("subtitleLoad",t.url),t.type||V(t.url)){case"srt":return B(F(n));case"ass":return B(I(n));case"vtt":return B(n);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw n.show=t,t}))}}}]),o}(Et);var ke=function(){function e(r){var n=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),r.whitelist.state&&r.once("ready",(function(){!function(t,e){var r=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){D(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(r,n),function(t,e){var r=t.template.$player;e.hover(r,(function(){b(r,"art-hover"),t.emit("hover",!0)}),(function(){w(r,"art-hover"),t.emit("hover")}))}(r,n),function(t,e){var r=t.template.$player;e.proxy(r,"mousemove",(function(e){t.emit("mousemove",e)}))}(r,n),function(t,e){var r=t.option,n=t.player,o=G((function(){n.normalSize&&(n.autoSize=r.autoSize),n.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){o()}))}(r,n),function(t,e){if(d&&!t.option.isLive){var r=t.player,n=t.notice,o=t.template.$video,i=!1,a=0,c=0;e.proxy(o,"touchstart",(function(t){1===t.touches.length&&(i=!0,a=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(t){if(1===t.touches.length&&i){var e=K((t.touches[0].clientX-a)/o.clientWidth,-1,1);c=K(r.currentTime+60*e,0,r.duration),n.show="".concat(tt(c)," / ").concat(tt(r.duration))}})),e.proxy(document,"touchend",(function(){i&&c&&(r.seek=c),i=!1,a=0,c=0}))}}(r,n),function(t,e){var r=t.player,n=t.option,o=t.template.$container,i=G((function(){t.emit("view",$(o,50))}),200);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(t){n.autoMini&&(r.mini=!t)}))}(r,n)}))}return r(e,[{key:"proxy",value:function(t,e,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return n.proxy(t,e,r,o)}));t.addEventListener(e,r,o);var i=function(){return t.removeEventListener(e,r,o)};return this.destroyEvents.push(i),i}},{key:"hover",value:function(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(r,n){var o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return n(new M("Unable to get Image"));(o=new Image).src=t}if(o.complete)return r(o);e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new M("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),je=function(){function e(r){var n=this;t(this,e),this.keys={};var o=r.option,i=r.player,a=r.events.proxy;o.hotkey&&r.once("ready",(function(){n.add(27,(function(){i.fullscreenWeb&&(i.fullscreenWeb=!1)})),n.add(32,(function(){i.toggle()})),n.add(37,(function(){i.backward=5})),n.add(38,(function(){i.volume+=.1})),n.add(39,(function(){i.forward=5})),n.add(40,(function(){i.volume-=.1})),a(window,"keydown",(function(t){if(r.isFocus){var e=document.activeElement.tagName.toUpperCase(),o=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==o&&"true"!==o){var i=n.keys[t.keyCode];i&&(t.preventDefault(),i.forEach((function(e){return e.call(r,t)})),r.emit("hotkey",t))}}}))}))}return r(e,[{key:"add",value:function(t,e){return q("number"==typeof t,"The Hotkey.add() first parameter is not a number"),q("function"==typeof e,"The Hotkey.add() second parameter is not a function"),this.keys[t]?this.keys[t].push(e):this.keys[t]=[e],this}}]),e}();function Pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Se=function(e){i(n,e);var r=Pe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="layer",o.$parent=e.template.$layer,e.once("ready",(function(){e.option.layers.forEach((function(t){o.add(t)}))})),o}return n}(Et);function Ee(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Re=function(e){i(n,e);var r=Ee(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="loading",O(e.template.$loading,e.icons.loading),o}return n}(Et),$e=function(){function e(r){t(this,e),this.art=r,this.time=2e3,this.timer=null}return r(e,[{key:"show",set:function(t){var e=this.art.template,r=e.$player,n=e.$noticeInner;if(!t)return w(r,"art-notice-show");n.innerText=t instanceof Error?t.message.trim():t,b(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){n.innerText="",w(r,"art-notice-show")}),this.time)}}]),e}();function De(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Te=function(e){i(n,e);var r=De(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="mask",O(e.template.$state,e.icons.state),o}return n}(Et);function ze(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var Ae=function e(r){var n=this;t(this,e);var o=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'',setting:'',fullscreen:'',fullscreenWeb:'',pip:''},r.option.icons);Object.keys(o).forEach((function(t){U(n,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))};function Ce(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Le(t){for(var e=1;e