/*! * artplayer-vue.js v3.1.19 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2019 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=t||self).ArtplayerVue=e()}(this,(function(){"use strict";var t=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var e=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function n(t,e){for(var n=0;n1?n-1:0),i=1;i1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function E(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function S(t,e){return t.classList.add(e)}function $(t,e){return t.classList.remove(e)}function R(t,e){return t.classList.contains(e)}function D(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function T(t,e,n){return t.style[e]=n,t}function C(t,e){return Object.keys(e).forEach((function(n){T(t,n,e[n])})),t}function L(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function A(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function M(t,e){A(t).forEach((function(t){return $(t,e)})),S(t,e)}function z(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}function q(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function V(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function W(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 n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.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===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[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 F(t){return t.includes("?")?F(t.split("?")[0]):t.includes("#")?F(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function H(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function B(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function I(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:k,queryAll:E,addClass:S,removeClass:$,hasClass:R,append:D,remove:function(t){return t.parentNode.removeChild(t)},setStyle:T,setStyles:C,getStyle:L,sublings:A,inverseClass:M,tooltip:z,addShowProperty:function(t,e,n){var r="art-".concat(n,"-show");j(t,"show",{get:function(){return R(e,r)},set:function(i){i?S(e,r):$(e,r),t.art.emit("".concat(n,":toggle"),i)}}),j(t,"toggle",{value:function(){t.show=!t.show}})},ArtPlayerError:b,errorHandle:w,srtToVtt:q,vttToBlob:V,assToVtt:W,getExt:F,downloadFile:H,hasOwnProperty:O,defineProperty:j,proxyPropertys:P,mergeDeep:x,sleep:B,debounce:I,throttle:N,clamp:U,secondToTime:_});function Y(t,e,n){return w("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Z={container:Y,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return w(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},J={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},G=function t(n){var r=this;e(this,t);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},Q=function(){function t(n){var r=this;e(this,t),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=k(n.option.container),w(this.$container,"No container element found by ".concat(n.option.container))),w(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),w(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return r(t,[{key:"query",value:function(t){return k(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
3.1.19
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),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.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":S(this.$player,"art-destroy")}}]),t}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",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":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",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":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function t(n){e(this,t),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return r(t,[{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=x(this.languages,t),this.init()}}]),t}();var nt=i((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["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"]],r=0,i=n.length,o={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(o!==e.url){URL.revokeObjectURL(e.url);var c=e.currentTime,s=e.playing;return e.attachUrl(o).then((function(){i.url=o,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=c})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(a)),t.emit("switch",o)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(o!==e.url){URL.revokeObjectURL(e.url);var c=e.playing;return e.attachUrl(o).then((function(){i.url=o,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),c&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(a)),t.emit("switch",o)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(w(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(w(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){var y=h*l/u;T(r,"width","".concat(100*y,"%")),T(r,"height","100%"),T(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;T(r,"width","100%"),T(r,"height","".concat(100*v,"%")),T(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(T(r,"width",null),T(r,"height",null),T(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),Object.defineProperty(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;Object.defineProperty(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show(t),t}}}),Object.defineProperty(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show(t),e(t)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(H(r,"".concat(n.title||"artplayer","_").concat(_(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreenChange",nt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(nt.on("change",a),nt.on("error",c),i.push((function(){nt.off("change",a),nt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.request(o).then((function(){S(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenEnabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.exit().then((function(){$(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenExit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return nt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return R(n,"art-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),S(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebEnabled")):(e.fullscreen&&(e.fullscreen=!1),$(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebExit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;Object.defineProperty(e,"autoSize",{get:function(){return R(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(S(r,"art-auto-size"),p>f){T(i,"width","".concat(l*f/u*100,"%")),T(i,"height","100%")}else{var d=u/f/l*100;T(i,"width","100%"),T(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else $(r,"art-auto-size"),T(i,"width",null),T(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];w(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),P(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t},at=i((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function t(n){e(this,t),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return r(t,[{key:"toggle",value:function(){this.show=!this.show}},{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(!this.$parent||r.disable)return{};this.id+=1;var i=r.name||"".concat(this.name).concat(this.id);w(!O(this,i),"Cannot add a component that already has the same name: ".concat(i));var o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&D(o,r.html),r.style&&C(o,r.style),r.tooltip&&z(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return c?c.insertAdjacentElement("beforebegin",o):D(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),j(this,i,{value:{get $ref(){return o},set show(t){T(o,"display",t?"block":"none")}}}),this.art.emit("".concat(this.name,":add"),r),this[i]}},{key:"show",get:function(){return R(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){w(!1===t||!0===t,"The show attribute expects a boolean value");var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?S(e,n):$(e,n),this.art.emit("".concat(this.name,":toggle"),t)}}]),t}();function st(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ut(e){return function(n){return function(e){for(var n=1;n\n
\n
\n
\n
\n
\n \n '),mounted:function(t){var e=!1,r=k(".art-progress-loaded",t),o=k(".art-progress-played",t),s=k(".art-progress-highlight",t),u=k(".art-progress-indicator",t),l=k(".art-progress-tip",t);function f(t,e){"loaded"===t&&T(r,"width","".concat(100*e,"%")),"played"===t&&(T(o,"width","".concat(100*e,"%")),T(u,"left","calc(".concat(100*e,"% - ").concat(L(u,"width")/2,"px)")))}i.forEach((function(t){var e=U(t.time,0,c.duration)/c.duration*100;D(s,''))})),f("loaded",c.loaded),n.on("video:progress",(function(){f("loaded",c.loaded)})),n.on("video:timeupdate",(function(){f("played",c.played)})),n.on("video:ended",(function(){f("played",1)})),a(t,"mousemove",(function(e){T(l,"display","block"),e.composedPath().indexOf(s)>-1?function(e){var r=mt(n,e).width,i=e.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?T(l,"left",0):r>t.clientWidth-o/2?T(l,"left","".concat(t.clientWidth-o,"px")):T(l,"left","".concat(r-o/2,"px"))}(e):function(e){var r=mt(n,e),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?T(l,"left",0):i>t.clientWidth-a/2?T(l,"left","".concat(t.clientWidth-a,"px")):T(l,"left","".concat(i-a/2,"px"))}(e)})),a(t,"mouseout",(function(){T(l,"display","none")})),a(t,"click",(function(t){if(t.target!==u){var e=mt(n,t),r=e.second;f("played",e.percentage),c.seek=r}})),a(u,"mousedown",(function(){e=!0})),a(document,"mousemove",(function(t){if(e){var r=mt(n,t),i=r.second,o=r.percentage;S(u,"art-show-indicator"),f("played",o),c.seek=i}})),a(document,"mouseup",(function(){e&&(e=!1,$(u,"art-show-indicator"))}))}})}}function bt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function wt(e){return function(n){return function(e){for(var n=1;n'),l=D(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)T(c,"display","none"),T(s,"display","flex"),T(l,"left","0");else{var e=((L(u,"width")||60)-L(l,"width"))*t;T(c,"display","flex"),T(s,"display","none"),T(l,"left","".concat(e,"px"))}}z(c,o.get("Mute")),T(s,"display","none"),p(i.volume),n.on("video:volumechange",(function(){p(i.volume)})),e(c,"click",(function(){i.muted=!0})),e(s,"click",(function(){i.muted=!1})),e(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),e(l,"mousedown",(function(){a=!0})),e(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),e(document,"mouseup",(function(){a&&(a=!1)}))}})}}function kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Et(e){return function(n){return function(e){for(var n=1;nr.clientWidth-s/2?T(t,"left","".concat(r.clientWidth-s,"px")):T(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){T(t,"display","none")}))}})}}function Rt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(e){return function(n){return function(e){for(var n=1;n'.concat(s.name,"")),l=e.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=D(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(L(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var n=Number(t.target.dataset.index),r=e[n],i=r.url,o=r.name;i&&o&&c!==n&&(a.switchQuality(i,o),u.innerHTML=o,c=n)}))}})}}var Lt=function(t){function n(t){var r;return e(this,n),r=c(this,s(n).call(this,t)),t.on("ready",(function(){var e=t.option;r.add(gt({name:"progress",disable:e.isLive,position:"top",index:10})),r.add($t({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),r.add(yt({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(xt({name:"volume",disable:!1,position:"left",index:20})),r.add(jt({name:"time",disable:e.isLive,position:"left",index:30})),r.add(Ct({name:"quality",disable:0===e.quality.length,position:"right",index:10})),r.add(Dt({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),r.add(wt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),r.add(Et({name:"setting",disable:!e.setting,position:"right",index:40})),r.add(dt({name:"pip",disable:!e.pip,position:"right",index:50})),r.add(ft({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),r.add(ut({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(t){r.add(t)}))})),r}return l(n,t),r(n,[{key:"add",value:function(t,e){var r="function"==typeof t?t(this.art):t;w(r.position,"Controls option.position can not be empty");var i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":this.$parent=o;break;case"left":this.$parent=a;break;case"right":this.$parent=c}var u=at(s(n.prototype),"add",this).call(this,r,e);return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||S(u.$ref,"art-control-onlyText"),u}}]),n}(ct);function At(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Mt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n0.5\n 0.75\n ').concat(r.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(i.playbackRate=Number(n),t.show=!1)},mounted:function(t){n.on("playbackRateChange",(function(e){var n=E("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&M(n,"art-current")}))}})}}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function qt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n').concat(r.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(i.aspectRatio=n,t.show=!1)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=E("span",t).find((function(t){return t.dataset.ratio===e}));n&&M(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(e){return function(n){return function(e){for(var n=1;nArtPlayer 3.1.19'})}function Bt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(e){return function(n){return function(e){for(var n=1;nu+s&&(h=s-d),n+p>l+c&&(y=c-p),T(o,"left","".concat(h,"px")),T(o,"top","".concat(y,"px"))})),a(i,"click",(function(t){t.composedPath().includes(o)||(r.show=!1)})),t.on("blur",(function(){r.show=!1}))})),r}return l(n,t),n}(ct),Ut=function(t){function n(t){var r;e(this,n),r=c(this,s(n).call(this,t));var i=t.template,o=i.$infoPanel,a=i.$infoClose,u=i.$video;(0,t.events.proxy)(a,"click",(function(){r.show=!1}));var l=null,f=E("[data-video]",o);return t.on("destroy",(function(){clearTimeout(l)})),t.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerHTML="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return l(n,t),n}(ct),_t=function(t){function n(t){var r;e(this,n),r=c(this,s(n).call(this,t));var i=t.events.proxy,o=t.option.subtitle,a=t.template.$subtitle;return C(a,o.style),i(r.textTrack,"cuechange",(function(){a.innerHTML="",r.activeCue&&(a.innerHTML=r.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),t.emit("subtitle:update",r.activeCue.text))})),o.url&&r.init(o.url),r}return l(n,t),r(n,[{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(n){switch(e.art.emit("subtitle:load",t),F(t)){case"srt":return V(q(n));case"ass":return V(W(n));case"vtt":return V(n);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),e.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),n}(ct);var Xt=function(){function t(n){var r=this;e(this,t),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.once("video:canplay",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){S(n,"art-hover"),t.emit("hoverenter")}),(function(){$(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=I((function(){S(r,"art-hide-cursor"),$(r,"art-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),$(r,"art-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=N((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return r(t,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),t}(),Yt=function(){function t(n){var r=this;e(this,t),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return r(t,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),t}(),Zt=function(t){function n(t){var r;return e(this,n),(r=c(this,s(n).call(this,t))).$parent=t.template.$layer,t.on("ready",(function(){t.option.layers.forEach((function(t){r.add(t)}))})),r}return l(n,t),n}(ct),Jt=function(t){function n(t){var r;return e(this,n),r=c(this,s(n).call(this,t)),D(t.template.$loading,t.icons.loading),r}return l(n,t),n}(ct),Gt=function(){function t(n){e(this,t),this.art=n,this.timer=null}return r(t,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),S(o,"art-notice-show"),this.art.emit("notice:toggle",!0)}},{key:"hide",value:function(){$(this.art.template.$player,"art-notice-show"),this.art.emit("notice:toggle",!0)}}]),t}(),Qt=function(t){function n(t){var r;return e(this,n),r=c(this,s(n).call(this,t)),D(t.template.$state,t.icons.state),r}return l(n,t),n}(ct),Kt=function t(n){var r=this;e(this,t);var i=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),D(e,i[t]),r[t]=e}))};function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ee(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(i.flip=n)},mounted:function(t){n.on("flipChange",(function(e){var n=E("button",t).find((function(t){return t.dataset.value===e}));n&&M(n.parentElement,"current")}))}})}}function ne(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function re(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(i.aspectRatio=n)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=E("button",t).find((function(t){return t.dataset.value===e}));n&&M(n.parentElement,"current")}))}})}}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oe(e){return function(n){var r=n.i18n,i=n.player,o=n.events.proxy;return function(e){for(var n=1;n\n '.concat(r.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=k(".art-setting-range input",t),r=k(".art-subtitle-value",t);o(e,"change",(function(){var t=e.value;r.innerText=t,i.playbackRate=Number(t)})),n.on("playbackRateChange",(function(t){e.value!==t&&(e.value=t,r.innerText=t)}))}})}}var ae=function(t){function n(t){var r;e(this,n),(r=c(this,s(n).call(this,t))).$parent=t.template.$settingBody;var i=t.option,o=t.template.$setting,a=t.events.proxy;return t.option.setting&&t.on("ready",(function(){a(o,"click",(function(t){t.target===o&&(r.show=!1)})),r.add(ee({disable:!i.flip,name:"flip"})),r.add(re({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(oe({disable:!i.playbackRate,name:"playbackRate"}))})),t.on("blur",(function(){r.show=!1})),r}return l(n,t),n}(ct),ce=function(){function n(t){e(this,n),this.art=t,this.name="artplayer_settings";var r=t.option,i=this.get("volume");i&&(r.volume=i)}return r(n,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(e,n){var r=Object.assign({},this.get(),t({},e,n));window.localStorage.setItem(this.name,JSON.stringify(r))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),n}();function se(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var i=k(".art-setting-range input",e),o=k(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ue(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(se);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("subtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("subtitleOffset",0)}}}function le(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else w(!1,"Playback of this file format is not supported")}}function s(t){var n=D(t,'');T(t,"position","relative"),C(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'\n
\n '.concat(a.get("Local Video"),'\n
\n
\n
').concat(a.get("Open"),'
\n
\n
\n '),mounted:function(e){var n=k(".art-upload-btn",e),r=k(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function fe(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=D(r,'');T(r,"position","relative"),C(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(r){if(r){var i=F(r.name);if(["ass","vtt","srt"].includes(i)){var o=new FileReader;e(o,"load",(function(e){var o=e.target.result;switch(i){case"srt":var a=V(q(o));n.switch(a,r.name);break;case"ass":var c=V(W(o));n.switch(c,r.name);break;case"vtt":var s=V(o);n.switch(s,r.name)}t.emit("localSubtitle",r)})),o.readAsText(r)}else w(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'\n
\n '.concat(i.get("Local Subtitle"),'\n
\n
\n
').concat(i.get("Open"),'
\n
\n
\n '),mounted:function(e){var n=k(".art-upload-btn",e),r=k(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function pe(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function de(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function he(t){var e=t.events,n=t.player,r=t.template,i=I((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("autoPip",!0)):n.pip&&(n.pip=!1,t.emit("autoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var ye=function(){function t(n){var r=this;e(this,t),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(ue),!i.isLive&&i.miniProgressBar&&this.add(pe),i.localVideo&&this.add(le),i.localSubtitle&&this.add(fe),i.networkMonitor&&this.add(de),i.autoPip&&this.add(he),n.option.plugins.forEach((function(t){r.add(t)}))}return r(t,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return w(!O(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),t}(),ve=function t(n){e(this,t);var r=n.option,i=n.events.proxy,o=n.template.$video;J.video.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||F(r.url),c=r.customType[a];a&&c?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},me=0,ge=function(t){function n(t){var r;return e(this,n),(r=c(this,s(n).call(this))).option=f(x(n.option,t),Z),r.isFocus=!1,r.isDestroy=!1,r.whitelist=new G(a(r)),r.template=new Q(a(r)),r.events=new Xt(a(r)),r.whitelist.state?(r.storage=new ce(a(r)),r.icons=new Kt(a(r)),r.i18n=new et(a(r)),r.notice=new Gt(a(r)),r.player=new it(a(r)),r.layers=new Zt(a(r)),r.controls=new Lt(a(r)),r.contextmenu=new Nt(a(r)),r.subtitle=new _t(a(r)),r.info=new Ut(a(r)),r.loading=new Jt(a(r)),r.hotkey=new Yt(a(r)),r.mask=new Qt(a(r)),r.setting=new ae(a(r)),r.plugins=new ye(a(r))):r.mobile=new ve(a(r)),me+=1,r.id=me,n.instances.push(a(r)),r}return l(n,t),r(n,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),n.instances.splice(n.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.19"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Z}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return f}},{key:"kindOf",get:function(){return f.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),n}(p);function be(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}return Object.defineProperty(ge,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.1.19 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),{data:function(){return{instance:null}},props:{option:{type:Object,required:!0},getInstance:Function},mounted:function(){this.instance=new ge(function(e){for(var n=1;n