Files
ArtPlayer/packages/artplayer/dist/artplayer.js
T
2018-11-09 12:17:19 +08:00

9 lines
84 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*!
* artplayer.js v1.0.2
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2018 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.artplayer={})}(this,function(t){"use strict";var Dt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var r=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t},o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var l=n(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=i=function(t){return n(t)}:e.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(t)}e.exports=i});var a=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var s=function(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?a(t):e},c=n(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),u=n(function(n){function i(t,e){return n.exports=i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}n.exports=i});var h=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)};var d=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 f=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(t){d(e,t,n[t])})}return e};var p=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var v=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var y=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var g=function(t){return p(t)||v(t)||y()};var m=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},b=n(function(i){function r(t,e,n){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?i.exports=r=function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&u(r,n.prototype),r}:i.exports=r=Reflect.construct,r.apply(null,arguments)}i.exports=r}),w=function(t){function i(t,e){var n;return Dt(this,i),n=s(this,c(i).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(a(n)),e||n.constructor),n.name="ArtPlayerError",n}return h(i,t),i}(n(function(e){function i(t){var n="function"==typeof Map?new Map:void 0;return e.exports=i=function(t){if(null===t||!m(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return b(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u(e,t)},i(t)}e.exports=i})(Error));function x(t,e){var n="function"==typeof t;if(n?!n():!t)throw new w(e)}function Wt(t,e,n){return Math.max(Math.min(t,Math.max(e,n)),Math.min(e,n))}function $(t){return t.includes("?")?$(t.split("?")[0]):t.includes("#")?$(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function qt(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.lastElementChild}function k(t,e,n){var i=Array.from(t.children);e.dataset.index=n;var r=i.find(function(t){return Number(t.dataset.index)>=Number(n)});return r?r.insertAdjacentElement("beforebegin",e):qt(t,e),e}function zt(t,e,n){return t.style[e]=n,t}function E(e,n){return Object.keys(n).forEach(function(t){zt(e,t,n[t])}),e}function S(t,e){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],i=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(i):i}function Ft(t){var e=Math.floor(t/3600),n=Math.floor((t-3600*e)/60),i=Math.floor(t-3600*e-60*n);return(0<e?[e,n,i]:[n,i]).map(function(t){return t<10?"0".concat(t):String(t)}).join(":")}function P(){for(var t=function(t){return null!==t&&"object"===l(t)},e={},n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];for(var o=0;o<i.length;o++){var a=i[o];if(Array.isArray(a))Array.isArray(e)||(e=[]),e=g(e).concat(g(a));else if(t(a)){if(a instanceof Element)return a;for(var s in a)if(a.hasOwnProperty(s)){var c=a[s];t(c)&&s in e&&(c=P(e[s],c)),e=f({},e,d({},s,c))}}}return e}function T(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("data-balloon",e),t.setAttribute("data-balloon-pos",n)}function Bt(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return new Promise(function(t){return setTimeout(t,e)})}function It(e){return Array.from(e.parentElement.children).filter(function(t){return t!==e})}function C(e,n,i){var r;function t(){var t=arguments;clearTimeout(r),r=setTimeout(function(){r=null,e.apply(i,t)},n)}return t.clearTimeout=function(){clearTimeout(r)},t}var L=Object.freeze({instances:[],ArtPlayerError:w,errorHandle:x,clamp:Wt,getExt:$,append:qt,insertByIndex:k,setStyle:zt,setStyles:E,getStyle:S,secondToTime:Ft,deepMerge:P,tooltip:T,sleep:Bt,sublings:It,debounce:C}),_=n(function(t,e){t.exports=function(){function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var l=Object.prototype.toString,a=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e,n,i,r,o,a,s=c(t);if("boolean"===s)return"boolean";if("string"===s)return"string";if("number"===s)return"number";if("symbol"===s)return"symbol";if("function"===s)return"GeneratorFunction"===u(t)?"generatorfunction":"function";if(e=t,Array.isArray?Array.isArray(e):e instanceof Array)return"array";if((a=t).constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if((n=t)instanceof Date||"function"==typeof n.toDateString&&"function"==typeof n.getDate&&"function"==typeof n.setDate)return"date";if((i=t)instanceof Error||"string"==typeof i.message&&i.constructor&&"number"==typeof i.constructor.stackTraceLimit)return"error";if((r=t)instanceof RegExp||"string"==typeof r.flags&&"boolean"==typeof r.ignoreCase&&"boolean"==typeof r.multiline&&"boolean"==typeof r.global)return"regexp";switch(u(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if("function"==typeof(o=t).throw&&"function"==typeof o.return&&"function"==typeof o.next)return"generator";switch(s=l.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return s.slice(8,-1).toLowerCase().replace(/\s/g,"")};function u(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];for(var i in h(t,e,n),d(t,e,n),f(t,e,n),e)if(e.hasOwnProperty(i)){var r=t[i],o=e[i],a=n.concat(i);if(s(t,i,o,a))continue;h(r,o,a),d(r,o,a),f(r,o,a)}}function s(t,e,n,i){if(!Object.prototype.hasOwnProperty.call(t,e)){if(!0===n.__required__||!0===n.required)throw new TypeError("'".concat(i.join("."),"' is required"));return!0}}function h(t,e,n){var i;if("string"===a(e)?i=e:e.__type__?i=e.__type__:e.type&&(i=e.type),i&&"string"===a(i)){i=i.trim().toLowerCase();var r=a(t),o=r===i;if(-1<i.indexOf("|")&&(o=i.split("|").filter(Boolean).some(function(t){return r===t.trim()})),!o)throw new TypeError("'".concat(n.join("."),"' require '").concat(i,"' type, but got '").concat(r,"'"))}}function d(t,e,n){var i;if(e.___validator__?i=e.___validator__:e.validator&&(i=e.validator),"function"===a(i)){var r=i(n,t,a(t));if(!0!==r)throw new TypeError("The scheme for '".concat(n.join("."),"' validator function require return true, but got '").concat(r,"'"))}}function f(t,e,n){var i;if(e.___child__?i=e.___child__:e.child&&(i=e.child),"object"===a(i)){var r=a(t);"object"===r?o(t,i,n):"array"===r&&t.forEach(function(t,e){o(t,i,n.concat(e))})}}return o.kindOf=a,window.optionValidator=o}()});function R(t,e,n){if("string"===n){if(""===e.trim())throw new w("".concat(t.join(".")," can not be empty"));return!0}if(e instanceof Element)return!0;throw new w("".concat(t.join(".")," require 'string' or 'Element' type, but got '").concat(n,"'"))}var M={container:{validator:R,required:!0},url:{type:"string",required:!0,validator:function(t,e,n){if("string"!==n)throw new w("".concat(t.join(".")," required 'string' type."));if(""===e.trim())throw new w("".concat(t.join(".")," can not be empty"));return!0}},title:"string",volume:"number",thumbnails:{type:"object",child:{url:"string",number:"number",width:"number",height:"number",column:"number"}},screenshot:"boolean",autoplay:"boolean",playbackRate:"boolean",aspectRatio:"boolean",loop:"boolean",type:{type:"string"},mimeCodec:"string",layers:{type:"array",child:{name:"string",index:"number",html:{validator:R},style:"object"}},contextmenu:{type:"array",child:{type:"object|function",name:"string",html:{validator:R},click:"function"}},quality:{type:"array",child:{default:"boolean",name:"string",url:"string"}},loading:R,play:R,theme:"string",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitle:{type:"object",child:{url:"string",style:"object"}},controls:{type:"array",child:{option:{type:"object",child:{disable:"boolean",position:"boolean",index:"number"}}}},highlight:{type:"array",child:{time:"number",text:"string"}},moreVideoAttr:"object",lang:"string"},Nt={mimeCodec:{mp4:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',webm:'video/webm; codecs="vorbis, vp8"',ts:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'},mse:{mediaSource:{propertys:["activeSourceBuffers","duration","readyState","sourceBuffers"],methods:["addSourceBuffer","endOfStream","removeSourceBuffer","clearLiveSeekableRange","setLiveSeekableRange"],events:["sourceclose","sourceended","sourceopen"]},sourceBuffer:{propertys:["mode","updating","buffered","timestampOffset","audioTracks","videoTracks","textTracks","appendWindowStart","appendWindowEnd","trackDefaults"],methods:["appendBuffer","appendStream","abort","remove"],events:["abort","error","update","updateend","updatestart"]},sourceBufferList:{propertys:["length"],events:["addsourcebuffer","removesourcebuffer"]}},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"]}};function O(){}O.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function r(){i.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,r=n.length;i<r;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],r=[];if(i&&e)for(var o=0,a=i.length;o<a;o++)i[o].fn!==e&&i[o].fn._!==e&&r.push(i[o]);return r.length?n[t]=r:delete n[t],this}};var j=O,A=function t(e){Dt(this,t);var n=e.refs;n.$container.innerHTML='\n <div class="artplayer-video-player">\n <video class="artplayer-video"></video>\n <div class="artplayer-subtitle"></div>\n <div class="artplayer-layers"></div>\n <div class="artplayer-mask"></div>\n <div class="artplayer-bottom">\n <div class="artplayer-progress"></div>\n <div class="artplayer-controls">\n <div class="artplayer-controls-left"></div>\n <div class="artplayer-controls-right"></div>\n </div>\n </div>\n <div class="artplayer-loading"></div>\n <div class="artplayer-notice">\n <div class="artplayer-notice-inner"></div>\n </div>\n <div class="artplayer-setting">\n <div class="artplayer-setting-inner">\n <div class="artplayer-setting-body"></div>\n <div class="artplayer-setting-close">×</div>\n </div>\n </div>\n <div class="artplayer-info">\n <div class="artplayer-info-panel"></div>\n <div class="artplayer-info-close">[x]</div>\n </div>\n <div class="artplayer-pip-header">\n <div class="artplayer-pip-title"></div>\n <div class="artplayer-pip-close">×</div>\n </div>\n <div class="artplayer-contextmenu"></div>\n </div>\n ',n.$player=n.$container.querySelector(".artplayer-video-player"),n.$video=n.$container.querySelector(".artplayer-video"),n.$subtitle=n.$container.querySelector(".artplayer-subtitle"),n.$bottom=n.$container.querySelector(".artplayer-bottom"),n.$progress=n.$container.querySelector(".artplayer-progress"),n.$controls=n.$container.querySelector(".artplayer-controls"),n.$controlsLeft=n.$container.querySelector(".artplayer-controls-left"),n.$controlsRight=n.$container.querySelector(".artplayer-controls-right"),n.$layers=n.$container.querySelector(".artplayer-layers"),n.$loading=n.$container.querySelector(".artplayer-loading"),n.$notice=n.$container.querySelector(".artplayer-notice"),n.$noticeInner=n.$container.querySelector(".artplayer-notice-inner"),n.$mask=n.$container.querySelector(".artplayer-mask"),n.$setting=n.$container.querySelector(".artplayer-setting"),n.$settingInner=n.$container.querySelector(".artplayer-setting-inner"),n.$settingBody=n.$container.querySelector(".artplayer-setting-body"),n.$settingClose=n.$container.querySelector(".artplayer-setting-close"),n.$info=n.$container.querySelector(".artplayer-info"),n.$infoPanel=n.$container.querySelector(".artplayer-info-panel"),n.$infoClose=n.$container.querySelector(".artplayer-info-close"),n.$pipHeader=n.$container.querySelector(".artplayer-pip-header"),n.$pipTitle=n.$container.querySelector(".artplayer-pip-title"),n.$pipClose=n.$container.querySelector(".artplayer-pip-close"),n.$contextmenu=n.$container.querySelector(".artplayer-contextmenu")},H={"zh-cn":{"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏",Common:"常规","Hide setting":"隐藏设置","Show setting":"显示设置","Mini player":"迷你播放器"},"zh-tw":{"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏",Common:"常規","Hide setting":"隱藏設置","Show setting":"顯示設置","Mini player":"迷你播放器"}},D=function(){function n(t){var e=t.option;Dt(this,n),this.option=e,this.init()}return r(n,[{key:"init",value:function(){this.language=H[this.option.lang.toLowerCase()]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){H=t(H),this.init()}}]),n}();function Vt(r,t){var o=r.option,e=r.notice;Object.defineProperty(t,"screenshot",{value:function(){try{!function(){var t=r.refs.$video,e=document.createElement("canvas");e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0);var n=e.toDataURL("image/png"),i=document.createElement("a");zt(i,"display","none"),i.href=n,i.download="".concat(o.title||"artplayer","_").concat(Ft(t.currentTime),".png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}(),r.emit("screenshot")}catch(t){e.show(t),console.warn(t)}}})}var Ut=n(function(t){var o,e,n,i,r,a;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,n="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,i=function(){for(var t,e=[["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,i=e.length,r={};n<i;n++)if((t=e[n])&&t[1]in o){for(n=0;n<t.length;n++)r[e[0][n]]=t[n];return r}return!1}(),r={change:i.fullscreenchange,error:i.fullscreenerror},a={request:function(t){var e=i.requestFullscreen;t=t||o.documentElement,/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)?t[e]():t[e](n?Element.ALLOW_KEYBOARD_INPUT:{})},exit:function(){o[i.exitFullscreen]()},toggle:function(t){this.isFullscreen?this.exit():this.request(t)},onchange:function(t){this.on("change",t)},onerror:function(t){this.on("error",t)},on:function(t,e){var n=r[t];n&&o.addEventListener(n,e,!1)},off:function(t,e){var n=r[t];n&&o.removeEventListener(n,e,!1)},raw:i},i?(Object.defineProperties(a,{isFullscreen:{get:function(){return Boolean(o[i.fullscreenElement])}},element:{enumerable:!0,get:function(){return o[i.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return Boolean(o[i.fullscreenEnabled])}}}),e?t.exports=a:window.screenfull=a):e?t.exports=!1:window.screenfull=!1});var W=n(function(t){var e,n;e=window,n=function(){function g(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}var n="undefined"==typeof console?function(){}:function(t){console.error(t)},m=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],b=m.length;function w(t){var e=getComputedStyle(t);return e||n("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}var x,$=!1;function k(t){if(function(){if(!$){$=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(t);var n=w(t);x=200==Math.round(g(n.width)),k.isBoxSizeOuter=x,e.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=w(t);if("none"==e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<b;e++)t[m[e]]=0;return t}();var n={};n.width=t.offsetWidth,n.height=t.offsetHeight;for(var i=n.isBorderBox="border-box"==e.boxSizing,r=0;r<b;r++){var o=m[r],a=e[o],s=parseFloat(a);n[o]=isNaN(s)?0:s}var c=n.paddingLeft+n.paddingRight,l=n.paddingTop+n.paddingBottom,u=n.marginLeft+n.marginRight,h=n.marginTop+n.marginBottom,d=n.borderLeftWidth+n.borderRightWidth,f=n.borderTopWidth+n.borderBottomWidth,p=i&&x,v=g(e.width);!1!==v&&(n.width=v+(p?0:c+d));var y=g(e.height);return!1!==y&&(n.height=y+(p?0:l+f)),n.innerWidth=n.width-(c+d),n.innerHeight=n.height-(l+f),n.outerWidth=n.width+u,n.outerHeight=n.height+h,n}}return k},t.exports?t.exports=n():e.getSize=n()}),q=n(function(t){var e,n;e="undefined"!=typeof window?window:o,n=function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return-1==i.indexOf(e)&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return-1!=i&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){n=n.slice(0),e=e||[];for(var i=this._onceEvents&&this._onceEvents[t],r=0;r<n.length;r++){var o=n[r];i&&i[o]&&(this.off(t,o),delete i[o]),o.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t},t.exports?t.exports=n():e.EvEmitter=n()}),z=n(function(t){var e,n;e=window,n=function(r,t){function e(){}var n=e.prototype=Object.create(t.prototype);n.bindStartEvent=function(t){this._bindStartEvent(t,!0)},n.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},n._bindStartEvent=function(t,e){var n=(e=void 0===e||e)?"addEventListener":"removeEventListener",i="mousedown";r.PointerEvent?i="pointerdown":"ontouchstart"in r&&(i="touchstart"),t[n](i,this)},n.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.getTouch=function(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.identifier==this.pointerIdentifier)return n}},n.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},n.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},n.onpointerdown=function(t){this._pointerDown(t,t)},n._pointerDown=function(t,e){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},n.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var i={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return n._bindPostStartEvents=function(t){if(t){var e=i[t.type];e.forEach(function(t){r.addEventListener(t,this)},this),this._boundPointerEvents=e}},n._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(t){r.removeEventListener(t,this)},this),delete this._boundPointerEvents)},n.onmousemove=function(t){this._pointerMove(t,t)},n.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},n.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},n._pointerMove=function(t,e){this.pointerMove(t,e)},n.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},n.onmouseup=function(t){this._pointerUp(t,t)},n.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},n.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},n._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},n._pointerDone=function(){this._pointerReset(),this._unbindPostStartEvents(),this.pointerDone()},n._pointerReset=function(){this.isPointerDown=!1,delete this.pointerIdentifier},n.pointerDone=function(){},n.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},n.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},n._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},n.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},e.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},e},t.exports?t.exports=n(e,q):e.Unipointer=n(e,e.EvEmitter)}),F=n(function(t){var e,n;e=window,n=function(o,t){function e(){}var n=e.prototype=Object.create(t.prototype);n.bindHandles=function(){this._bindHandles(!0)},n.unbindHandles=function(){this._bindHandles(!1)},n._bindHandles=function(t){for(var e=(t=void 0===t||t)?"addEventListener":"removeEventListener",n=t?this._touchActionValue:"",i=0;i<this.handles.length;i++){var r=this.handles[i];this._bindStartEvent(r,t),r[e]("click",this),o.PointerEvent&&(r.style.touchAction=n)}},n._touchActionValue="none",n.pointerDown=function(t,e){this.okayPointerDown(t)&&(this.pointerDownPointer=e,t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e]))};var r={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},a={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};return n.okayPointerDown=function(t){var e=r[t.target.nodeName],n=a[t.target.type],i=!e||n;return i||this._pointerReset(),i},n.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},n.pointerMove=function(t,e){var n=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,n]),this._dragMove(t,e,n)},n._dragPointerMove=function(t,e){var n={x:e.pageX-this.pointerDownPointer.pageX,y:e.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this._dragStart(t,e),n},n.hasDragStarted=function(t){return 3<Math.abs(t.x)||3<Math.abs(t.y)},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},n._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},n._dragStart=function(t,e){this.isDragging=!0,this.isPreventingClicks=!0,this.dragStart(t,e)},n.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},n._dragMove=function(t,e,n){this.isDragging&&this.dragMove(t,e,n)},n.dragMove=function(t,e,n){t.preventDefault(),this.emitEvent("dragMove",[t,e,n])},n._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},n.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},n.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},n._staticClick=function(t,e){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},n.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},e.getPointerPoint=t.getPointerPoint,e},t.exports?t.exports=n(e,z):e.Unidragger=n(e,e.Unipointer)}),Yt=n(function(t){var e,n;e=window,n=function(o,c,t){function n(t,e){for(var n in e)t[n]=e[n];return t}var i=o.jQuery;function e(t,e){this.element="string"==typeof t?document.querySelector(t):t,i&&(this.$element=i(this.element)),this.options=n({},this.constructor.defaults),this.option(e),this._create()}var r=e.prototype=Object.create(t.prototype);e.defaults={},r.option=function(t){n(this.options,t)};var a={relative:!0,absolute:!0,fixed:!0};function l(t,e,n){return n=n||"round",e?Math[n](t/e)*e:t}return r._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=n({},this.position);var t=getComputedStyle(this.element);a[t.position]||(this.element.style.position="relative"),this.on("pointerDown",this.onPointerDown),this.on("pointerMove",this.onPointerMove),this.on("pointerUp",this.onPointerUp),this.enable(),this.setHandles()},r.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},r.dispatchEvent=function(t,e,n){var i=[e].concat(n);this.emitEvent(t,i),this.dispatchJQueryEvent(t,e,n)},r.dispatchJQueryEvent=function(t,e,n){var i=o.jQuery;if(i&&this.$element){var r=i.Event(e);r.type=t,this.$element.trigger(r,n)}},r._getPosition=function(){var t=getComputedStyle(this.element),e=this._getPositionCoord(t.left,"width"),n=this._getPositionCoord(t.top,"height");this.position.x=isNaN(e)?0:e,this.position.y=isNaN(n)?0:n,this._addTransformPosition(t)},r._getPositionCoord=function(t,e){if(-1==t.indexOf("%"))return parseInt(t,10);var n=c(this.element.parentNode);return n?parseFloat(t)/100*n[e]:0},r._addTransformPosition=function(t){var e=t.transform;if(0===e.indexOf("matrix")){var n=e.split(","),i=0===e.indexOf("matrix3d")?12:4,r=parseInt(n[i],10),o=parseInt(n[i+1],10);this.position.x+=r,this.position.y+=o}},r.onPointerDown=function(t,e){this.element.classList.add("is-pointer-down"),this.dispatchJQueryEvent("pointerDown",t,[e])},r.dragStart=function(t,e){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[e]),this.animate())},r.measureContainment=function(){var t=this.getContainer();if(t){var e=c(this.element),n=c(t),i=this.element.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.borderLeftWidth+n.borderRightWidth,a=n.borderTopWidth+n.borderBottomWidth,s=this.relativeStartPosition={x:i.left-(r.left+n.borderLeftWidth),y:i.top-(r.top+n.borderTopWidth)};this.containSize={width:n.width-o-s.x-e.width,height:n.height-a-s.y-e.height}}},r.getContainer=function(){var t=this.options.containment;if(t)return t instanceof HTMLElement?t:"string"==typeof t?document.querySelector(t):this.element.parentNode},r.onPointerMove=function(t,e,n){this.dispatchJQueryEvent("pointerMove",t,[e,n])},r.dragMove=function(t,e,n){if(this.isEnabled){var i=n.x,r=n.y,o=this.options.grid,a=o&&o[0],s=o&&o[1];i=l(i,a),r=l(r,s),i=this.containDrag("x",i,a),r=this.containDrag("y",r,s),i="y"==this.options.axis?0:i,r="x"==this.options.axis?0:r,this.position.x=this.startPosition.x+i,this.position.y=this.startPosition.y+r,this.dragPoint.x=i,this.dragPoint.y=r,this.dispatchEvent("dragMove",t,[e,n])}},r.containDrag=function(t,e,n){if(!this.options.containment)return e;var i="x"==t?"width":"height",r=l(-this.relativeStartPosition[t],n,"ceil"),o=this.containSize[i];return o=l(o,n,"floor"),Math.max(r,Math.min(o,e))},r.onPointerUp=function(t,e){this.element.classList.remove("is-pointer-down"),this.dispatchJQueryEvent("pointerUp",t,[e])},r.dragEnd=function(t,e){this.isEnabled&&(this.element.style.transform="",this.setLeftTop(),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[e]))},r.animate=function(){if(this.isDragging){this.positionDrag();var t=this;requestAnimationFrame(function(){t.animate()})}},r.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},r.positionDrag=function(){this.element.style.transform="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},r.staticClick=function(t,e){this.dispatchEvent("staticClick",t,[e])},r.setPosition=function(t,e){this.position.x=t,this.position.y=e,this.setLeftTop()},r.enable=function(){this.isEnabled=!0},r.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},r.destroy=function(){this.disable(),this.element.style.transform="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},r._init=function(){},i&&i.bridget&&i.bridget("draggabilly",e),e},t.exports?t.exports=n(e,W,F):e.Draggabilly=n(e,e.getSize,e.Unidragger)});var B=function t(e){var n,i,r,o,a,s,c,l,u,h,d,f,p,v,y,g,m,b,w,x,$,k,E,S,P,T,C,L,_,R,M,O,j,A,H,D,W,q,z,F,B,I,N,V,U,Y,J,Q,X,Z,G,K,tt,et,nt,it,rt,ot,at,st,ct,lt,ut,ht,dt,ft,pt,vt,yt,gt,mt,bt,wt,xt,$t,kt,Et,St,Pt,Tt,Ct,Lt,_t,Rt,Mt,Ot,jt,At,Ht;Dt(this,t),this.reconnectTime=0,this.maxReconnectTime=5,n=this,Object.defineProperty(n,"mountUrl",{writable:!0,value:function(t){return t}}),r=this,o=(i=e).option,a=i.refs.$video,Object.keys(o.moreVideoAttr).forEach(function(t){a[t]=o.moreVideoAttr[t]}),o.volume&&(a.volume=Wt(o.volume,0,1)),o.poster&&(a.poster=o.poster),o.autoplay&&(a.autoplay=o.autoplay),Bt().then(function(){i.emit("beforeMountUrl",o.url),a.src=r.mountUrl(o.url)}),c=this,l=(s=e).option,u=s.events.proxy,h=s.refs,d=h.$player,f=h.$video,p=s.i18n,v=s.notice,y=!1,u(f,"click",function(){c.toggle()}),Nt.video.events.forEach(function(t){u(f,t,function(t){s.emit("video:".concat(t.type),t)})}),s.on("video:loadstart",function(){s.loading.show()}),s.on("video:loadeddata",function(){s.loading.hide()}),s.on("video:waiting",function(){s.loading.show()}),s.on("video:seeking",function(){s.loading.show()}),s.on("video:canplay",function(){y||(y=!0,s.emit("firstCanplay")),s.controls.show(),s.mask.show(),s.loading.hide(),l.autoplay&&c.play()}),s.on("video:playing",function(){s.isPlaying=!0,s.controls.hide(),s.mask.hide()}),s.on("video:pause",function(){s.isPlaying=!1,s.controls.show(),s.mask.show()}),s.on("video:ended",function(){s.isPlaying=!1,s.controls.show(),s.mask.show(),l.loop&&(c.seek(0),c.play())}),s.on("video:error",function(){c.reconnectTime<c.maxReconnectTime?Bt(1e3).then(function(){c.reconnectTime++,s.emit("beforeMountUrl",l.url),f.src=c.mountUrl(l.url),v.show("".concat(p.get("Reconnect"),": ").concat(c.reconnectTime))}):(s.isPlaying=!1,s.loading.hide(),s.controls.hide(),d.classList.add("artplayer-error"),Bt(1e3).then(function(){v.show(p.get("Video load failed"),!1),s.destroy()}))}),m=this,b=(g=e).refs.$video,w=g.i18n,x=g.notice,$=g.option.mutex,Object.defineProperty(m,"play",{value:function(){var t=b.play();void 0!==t&&t.then().catch(function(t){x.show(t,!0,3e3),console.warn(t)}),$&&g.constructor.instances.filter(function(t){return t!==g}).forEach(function(t){return t.player.pause()}),x.show(w.get("Play")),g.emit("play",b)}}),E=this,S=(k=e).refs.$video,P=k.i18n,T=k.notice,Object.defineProperty(E,"pause",{value:function(){S.pause(),T.show(P.get("Pause")),k.emit("pause",S)}}),C=e,L=this,Object.defineProperty(L,"toggle",{value:function(){C.isPlaying?L.pause():L.play()}}),R=this,M=(_=e).notice,Object.defineProperty(R,"seek",{value:function(t){var e=Math.max(t,0);R.duration&&(e=Math.min(e,R.duration)),R.currentTime=e,M.show("".concat(Ft(e)," / ").concat(Ft(R.duration))),_.emit("seek",e)}}),j=this,A=(O=e).refs.$video,H=O.i18n,D=O.notice,W=O.storage,Object.defineProperty(j,"volume",{get:function(){return A.volume||0},set:function(t){void 0!==t&&(A.volume=Wt(t,0,1),D.show("".concat(H.get("Volume"),": ").concat(parseInt(100*A.volume))),0!==A.volume&&W.set("volume",A.volume),O.emit("volume",A.volume))}}),q=e,z=this,Object.defineProperty(z,"currentTime",{get:function(){return q.refs.$video.currentTime||0},set:function(t){q.refs.$video.currentTime=t}}),F=e,B=this,Object.defineProperty(B,"duration",{get:function(){return F.refs.$video.duration||0}}),N=this,V=(I=e).refs.$video,U=I.i18n,Y=I.notice,J=I.isPlaying,Q=I.option,Object.defineProperty(N,"switch",{value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"unknown",n=N.currentTime;I.emit("beforeMountUrl",t),V.src=N.mountUrl(t),Q.url=t,N.playbackRateRemove(),N.aspectRatioRemove(),N.reconnectTime=0,N.seek(n),J&&N.play(),Y.show("".concat(U.get("Switch video"),": ").concat(e)),I.emit("switch",t)}}),Z=this,G=(X=e).refs,K=G.$video,tt=G.$player,et=X.i18n,nt=X.notice,Object.defineProperty(Z,"playbackRate",{value:function(t){var e=Wt(t,.1,10);K.playbackRate=e,tt.dataset.playbackRate=e,nt.show("".concat(et.get("Rate"),": ").concat(1===e?et.get("Normal"):"".concat(e,"x"))),X.emit("playbackRate",e)}}),Object.defineProperty(Z,"playbackRateRemove",{value:function(){if(Z.playbackRate(1),delete tt.dataset.playbackRate,X.contextmenu.$playbackRate){var t=X.contextmenu.$playbackRate.querySelector(".normal");It(t).forEach(function(t){return t.classList.remove("current")}),t.classList.add("current")}}}),Object.defineProperty(Z,"playbackRateReset",{value:function(){var t=tt.dataset.playbackRate;t&&Z.playbackRate(Number(t))}}),rt=this,ot=(it=e).refs,at=ot.$video,st=ot.$player,ct=it.i18n,lt=it.notice,Object.defineProperty(rt,"aspectRatio",{value:function(t){var e=2===t.length?"".concat(t[0],":").concat(t[1]):ct.get("Default");if(2===t.length){var n=at.videoWidth,i=at.videoHeight,r=st.clientWidth,o=st.clientHeight,a=n/i,s=Number(t[0])/Number(t[1]);if(s<a){var c=s*i/n;zt(at,"width","".concat(100*c,"%")),zt(at,"height","100%"),zt(at,"padding","0 ".concat((r-r*c)/2,"px"))}else{var l=n/s/i;zt(at,"width","100%"),zt(at,"height","".concat(100*l,"%")),zt(at,"padding","".concat((o-o*l)/2,"px 0"))}st.dataset.aspectRatio=e}else rt.aspectRatioRemove();lt.show("".concat(ct.get("Aspect ratio"),": ").concat(e)),it.emit("aspectRatio",t)}}),Object.defineProperty(rt,"aspectRatioRemove",{value:function(){if(zt(at,"width",null),zt(at,"height",null),zt(at,"padding",null),delete st.dataset.aspectRatio,it.contextmenu.$aspectRatio){var t=it.contextmenu.$aspectRatio.querySelector(".default");It(t).forEach(function(t){return t.classList.remove("current")}),t.classList.add("current")}}}),Object.defineProperty(rt,"aspectRatioReset",{value:function(){var t=st.dataset.aspectRatio;t&&rt.aspectRatio(t.split(":"))}}),Vt(e,this),ht=this,dt=(ut=e).notice,ft=ut.events.destroyEvents,pt=ut.refs.$player,vt=function(){ut.emit("fullscreen",Ut.isFullscreen)},yt=function(){dt.show("Your browser does not seem to support full screen functionality.")},Ut.on("change",vt),Ut.on("error",yt),ft.push(function(){Ut.off("change",vt),Ut.off("error",yt)}),Object.defineProperty(ht,"fullscreenState",{get:function(){return Ut.isFullscreen}}),Object.defineProperty(ht,"fullscreenEnabled",{value:function(){ht.fullscreenWebState&&ht.fullscreenWebExit(),pt.classList.add("artplayer-fullscreen"),Ut.request(pt),ut.emit("fullscreen:enabled")}}),Object.defineProperty(ht,"fullscreenExit",{value:function(){ht.fullscreenWebState&&ht.fullscreenWebExit(),pt.classList.remove("artplayer-fullscreen"),Ut.exit(),ut.emit("fullscreen:exit")}}),Object.defineProperty(ht,"fullscreenToggle",{value:function(){ht.fullscreenState?ht.fullscreenExit():ht.fullscreenEnabled()}}),mt=this,bt=(gt=e).refs.$player,Object.defineProperty(mt,"fullscreenWebState",{get:function(){return bt.classList.contains("artplayer-web-fullscreen")}}),Object.defineProperty(mt,"fullscreenWebEnabled",{value:function(){mt.fullscreenState&&mt.fullscreenExit(),bt.classList.add("artplayer-web-fullscreen"),gt.emit("fullscreenWeb:enabled")}}),Object.defineProperty(mt,"fullscreenWebExit",{value:function(){mt.fullscreenState&&mt.fullscreenExit(),bt.classList.remove("artplayer-web-fullscreen"),gt.emit("fullscreenWeb:exit")}}),Object.defineProperty(mt,"fullscreenWebToggle",{value:function(){mt.fullscreenWebState?mt.fullscreenWebExit():mt.fullscreenWebEnabled()}}),xt=this,$t=(wt=e).option,kt=wt.i18n,Et=wt.refs,St=Et.$player,Pt=Et.$pipClose,Tt=Et.$pipTitle,Ct=wt.events,Lt=Ct.destroyEvents,_t=Ct.proxy,Mt=Rt=null,Object.defineProperty(xt,"pipState",{get:function(){return St.classList.contains("artplayer-pip")}}),Object.defineProperty(xt,"pipDraggie",{get:function(){return Mt}}),Object.defineProperty(xt,"pipEnabled",{value:function(){Mt?(zt(St,"left","".concat(Rt.x,"px")),zt(St,"top","".concat(Rt.y,"px"))):(Mt=new Yt(St,{handle:".artplayer-pip-header"}),qt(Tt,$t.title||kt.get("Mini player")),_t(Pt,"click",function(){xt.pipExit()}),Lt.push(function(){Mt.destroy()})),St.classList.add("artplayer-pip"),xt.fullscreenExit(),xt.fullscreenWebExit(),xt.aspectRatioRemove(),xt.playbackRateRemove(),wt.emit("pip",!0)}}),Object.defineProperty(xt,"pipExit",{value:function(){St.classList.remove("artplayer-pip"),Rt=Mt.position,zt(St,"left",null),zt(St,"top",null),xt.fullscreenExit(),xt.fullscreenWebExit(),xt.aspectRatioRemove(),xt.playbackRateRemove(),wt.emit("pip",!1)}}),Object.defineProperty(xt,"pipToggle",{value:function(){xt.pipState?xt.pipExit():xt.pipEnabled()}}),Ot=e,jt=this,Object.defineProperty(jt,"loaded",{get:function(){var t=Ot.refs.$video;return t.buffered.length?t.buffered.end(t.buffered.length-1)/t.duration:0}}),At=e,Ht=this,Object.defineProperty(Ht,"played",{get:function(){var t=At.refs.$video;return t.currentTime/t.duration}})};var I=function(t){if(Array.isArray(t))return t};var N=function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n};var V=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var U=function(t,e){return I(t)||N(t,e)||V()};var Y,J,Q=(Y={loading:'<svg xmlns="http://www.w3.org/2000/svg" width="50px" height="50px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-default">\n <rect x="0" y="0" width="100" height="100" fill="none" class="bk"/>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(0 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-1s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(30 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(60 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(90 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.75s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(120 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(150 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(180 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.5s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(210 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(240 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(270 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.25s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(300 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(330 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"/>\n </rect>\n</svg>',playBig:'<svg style="width: 60px; height: 60px; filter: drop-shadow(0px 1px 1px black);" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" >\n <path d="M20,2H4C1.8,2,0,3.8,0,6v12c0,2.2,1.8,4,4,4h16c2.2,0,4-1.8,4-4V6C24,3.8,22.2,2,20,2z M15.6,12.8L10.5,16 C9.9,16.5,9,16,9,15.2V8.8C9,8,9.9,7.5,10.5,8l5.1,3.2C16.3,11.5,16.3,12.5,15.6,12.8z" id="video"/>\n</svg>',play:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M17.982 9.275L8.06 3.27A2.013 2.013 0 0 0 5 4.994v12.011a2.017 2.017 0 0 0 3.06 1.725l9.922-6.005a2.017 2.017 0 0 0 0-3.45z"></path>\n</svg>',pause:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M7 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2zM15 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2z"></path>\n</svg>',volume:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M10.188 4.65L6 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39V5.04a.498.498 0 0 0-.812-.39zM14.446 3.778a1 1 0 0 0-.862 1.804 6.002 6.002 0 0 1-.007 10.838 1 1 0 0 0 .86 1.806A8.001 8.001 0 0 0 19 11a8.001 8.001 0 0 0-4.554-7.222z"></path><path d="M15 11a3.998 3.998 0 0 0-2-3.465v6.93A3.998 3.998 0 0 0 15 11z"></path>\n</svg>',volumeClose:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M15 11a3.998 3.998 0 0 0-2-3.465v2.636l1.865 1.865A4.02 4.02 0 0 0 15 11z"></path>\n <path d="M13.583 5.583A5.998 5.998 0 0 1 17 11a6 6 0 0 1-.585 2.587l1.477 1.477a8.001 8.001 0 0 0-3.446-11.286 1 1 0 0 0-.863 1.805zM18.778 18.778l-2.121-2.121-1.414-1.414-1.415-1.415L13 13l-2-2-3.889-3.889-3.889-3.889a.999.999 0 1 0-1.414 1.414L5.172 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39v-3.131l2.587 2.587-.01.005a1 1 0 0 0 .86 1.806c.215-.102.424-.214.627-.333l2.3 2.3a1.001 1.001 0 0 0 1.414-1.416zM11 5.04a.5.5 0 0 0-.813-.39L8.682 5.854 11 8.172V5.04z"></path>\n</svg>',subtitle:'<svg style="width: 100%; height: 100%" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 0h48v48H0z" fill="none"/>\n <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>\n</svg>',screenshot:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" style="width: 100%; height: 100%">\n\t<g id="surface1">\n\t\t<path d="M 19.402344 6 C 17.019531 6 14.96875 7.679688 14.5 10.011719 L 14.097656 12 L 9 12 C 6.238281 12 4 14.238281 4 17 L 4 38 C 4 40.761719 6.238281 43 9 43 L 41 43 C 43.761719 43 46 40.761719 46 38 L 46 17 C 46 14.238281 43.761719 12 41 12 L 35.902344 12 L 35.5 10.011719 C 35.03125 7.679688 32.980469 6 30.597656 6 Z M 25 17 C 30.519531 17 35 21.480469 35 27 C 35 32.519531 30.519531 37 25 37 C 19.480469 37 15 32.519531 15 27 C 15 21.480469 19.480469 17 25 17 Z M 25 19 C 20.589844 19 17 22.589844 17 27 C 17 31.410156 20.589844 35 25 35 C 29.410156 35 33 31.410156 33 27 C 33 22.589844 29.410156 19 25 19 Z "/>\n\t</g>\n</svg>\n',danmu:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" style="width: 85%; height: 85%">\r\n\t<path d="M54,2.5H6c-3.252,0-6,2.748-6,6v33c0,3.252,2.748,6,6,6h14.555l8.702,9.669C29.446,57.38,29.717,57.5,30,57.5 s0.554-0.12,0.743-0.331l8.702-9.669H54c3.252,0,6-2.748,6-6v-33C60,5.248,57.252,2.5,54,2.5z M16,28.5c-2.206,0-4-1.794-4-4 s1.794-4,4-4s4,1.794,4,4S18.206,28.5,16,28.5z M30,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S32.206,28.5,30,28.5z M44,28.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,28.5,44,28.5z"/>\r\n</svg>\r\n',setting:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <circle cx="11" cy="11" r="2"></circle>\n <path d="M19.164 8.861L17.6 8.6a6.978 6.978 0 0 0-1.186-2.099l.574-1.533a1 1 0 0 0-.436-1.217l-1.997-1.153a1.001 1.001 0 0 0-1.272.23l-1.008 1.225a7.04 7.04 0 0 0-2.55.001L8.716 2.829a1 1 0 0 0-1.272-.23L5.447 3.751a1 1 0 0 0-.436 1.217l.574 1.533A6.997 6.997 0 0 0 4.4 8.6l-1.564.261A.999.999 0 0 0 2 9.847v2.306c0 .489.353.906.836.986l1.613.269a7 7 0 0 0 1.228 2.075l-.558 1.487a1 1 0 0 0 .436 1.217l1.997 1.153c.423.244.961.147 1.272-.23l1.04-1.263a7.089 7.089 0 0 0 2.272 0l1.04 1.263a1 1 0 0 0 1.272.23l1.997-1.153a1 1 0 0 0 .436-1.217l-.557-1.487c.521-.61.94-1.31 1.228-2.075l1.613-.269a.999.999 0 0 0 .835-.986V9.847a.999.999 0 0 0-.836-.986zM11 15a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"></path>\n</svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 80%; height: 80%">\r\n<g>\r\n\t<g>\r\n\t\t<path d="M236.454,172.808L132.421,68.789l43.184-43.184C185.014,16.197,178.365,0,165,0H15C6.709,0,0,6.709,0,15v150\r\n\t\t\tc0,13.241,16.066,20.112,25.606,10.606l43.198-43.169l104.004,104.018c5.856,5.856,15.351,5.859,21.209,0.001l42.437-42.437\r\n\t\t\tC242.286,188.187,242.334,178.688,236.454,172.808z"/>\r\n\t</g>\r\n</g>\r\n<g>\r\n\t<g>\r\n\t\t<path d="M497,0H347c-13.361,0-20.018,16.193-10.606,25.605l43.184,43.184L275.544,172.792c-5.844,5.844-5.868,15.358,0,21.226\r\n\t\t\tl42.437,42.437c5.86,5.86,15.352,5.859,21.211,0l104.019-104.034l43.184,43.184C495.93,185.141,512,178.23,512,165V15\r\n\t\t\tC512,6.709,505.291,0,497,0z"/>\r\n\t</g>\r\n</g>\r\n<g>\r\n\t<g>\r\n\t\t<path d="M486.396,336.393l-43.184,43.184L339.193,275.544c-5.856-5.856-15.349-5.862-21.211,0l-42.437,42.437\r\n\t\t\tc-5.868,5.868-5.844,15.382,0,21.226l104.034,104.004l-43.184,43.184C326.986,495.803,333.635,512,347,512h150\r\n\t\t\tc8.291,0,15-6.709,15-15V347C512,333.639,495.807,326.982,486.396,336.393z"/>\r\n\t</g>\r\n</g>\r\n<g>\r\n\t<g>\r\n\t\t<path d="M236.456,317.983l-42.437-42.437c-5.625-5.625-15.586-5.625-21.211,0L68.789,379.579l-43.184-43.184\r\n\t\t\tC16.283,327.04,0,333.563,0,347v150c0,8.291,6.709,15,15,15h150c13.361,0,20.018-16.193,10.606-25.605l-43.184-43.184\r\n\t\t\tl104.034-104.017C242.336,333.314,242.289,323.816,236.456,317.983z"/>\r\n\t</g>\r\n</g>\r\n</svg>\r\n',fullscreenWeb:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" style="width: 80%; height: 80%">\r\n\t<path d="M4,18h14V4H4V18z M6,6h10v10H6V6z"/>\r\n\t<polygon points="2,16 0,16 0,22 6,22 6,20 2,20"/>\r\n\t<polygon points="2,2 6,2 6,0 0,0 0,6 2,6"/>\r\n\t<polygon points="20,20 16,20 16,22 22,22 22,16 20,16"/>\r\n\t<polygon points="16,0 16,2 20,2 20,6 22,6 22,0"/>\r\n</svg>\r\n',pip:'<svg viewBox="0 0 36 36" style="width: 100%; height: 100%">\n <path d="M25,17 L17,17 L17,23 L25,23 L25,17 L25,17 Z M29,25 L29,10.98 C29,9.88 28.1,9 27,9 L9,9 C7.9,9 7,9.88 7,10.98 L7,25 C7,26.1 7.9,27 9,27 L27,27 C28.1,27 29,26.1 29,25 L29,25 Z M27,25.02 L9,25.02 L9,10.97 L27,10.97 L27,25.02 L27,25.02 Z" fill="#fff" id="ytp-id-20"></path>\n</svg>'},J={},Object.keys(Y).forEach(function(t){var e=document.createElement("div");e.innerHTML='<i class="art-icon art-icon-'.concat(t,'">').concat(Y[t],"</i>");var n=U(e.childNodes,1);J[t]=n[0]}),J),X=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events.proxy,r=t.i18n,o=t.player;this.$fullscreen=qt(e,Q.fullscreen),T(this.$fullscreen,r.get("Fullscreen")),i(e,"click",function(){o.fullscreenToggle()}),t.on("fullscreen:enabled",function(){zt(n.$fullscreen,"opacity","0.8"),T(n.$fullscreen,r.get("Exit fullscreen"))}),t.on("fullscreen:exit",function(){zt(n.$fullscreen,"opacity","1"),T(n.$fullscreen,r.get("Fullscreen"))})}}]),e}(),Z=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events.proxy,r=t.i18n,o=t.player;this.$fullscreenWeb=qt(e,Q.fullscreenWeb),T(this.$fullscreenWeb,r.get("Web fullscreen")),i(e,"click",function(){o.fullscreenWebToggle()}),t.on("fullscreenWeb:enabled",function(){zt(n.$fullscreenWeb,"opacity","0.8"),T(n.$fullscreenWeb,r.get("Exit web fullscreen"))}),t.on("fullscreenWeb:exit",function(){zt(n.$fullscreenWeb,"opacity","1"),T(n.$fullscreenWeb,r.get("Web fullscreen"))})}}]),e}(),G=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=t.events.proxy,i=t.i18n,r=t.player;this.$pip=qt(e,Q.pip),T(this.$pip,i.get("Mini player")),n(e,"click",function(){r.pipEnabled()})}}]),e}(),K=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events.proxy,r=t.player,o=t.i18n;this.$play=qt(e,Q.play),this.$pause=qt(e,Q.pause),T(this.$play,o.get("Play")),T(this.$pause,o.get("Pause")),zt(this.$pause,"display","none"),i(this.$play,"click",function(){r.play()}),i(this.$pause,"click",function(){r.pause()}),t.on("video:playing",function(){zt(n.$play,"display","none"),zt(n.$pause,"display","block")}),t.on("video:pause",function(){zt(n.$play,"display","block"),zt(n.$pause,"display","none")})}}]),e}(),tt=function(){function e(t){Dt(this,e),this.option=t,this.isDroging=!1,this.set=this.set.bind(this)}return r(e,[{key:"apply",value:function(t,e){var r=this;this.art=t,this.$control=e;var n=t.option,i=n.highlight,o=n.theme,a=t.events.proxy,s=t.player;qt(e,'\n <div class="art-control-progress-inner">\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played" style="background: '.concat(o,'"></div>\n <div class="art-progress-highlight"></div>\n <div class="art-progress-indicator" style="background: ').concat(o,'"></div>\n <div class="art-progress-tip art-tip"></div>\n </div>\n ')),this.$loaded=e.querySelector(".art-progress-loaded"),this.$played=e.querySelector(".art-progress-played"),this.$highlight=e.querySelector(".art-progress-highlight"),this.$indicator=e.querySelector(".art-progress-indicator"),this.$tip=e.querySelector(".art-progress-tip"),i.forEach(function(t){var e=Number(t.time)/s.duration;qt(r.$highlight,'<span data-text="'.concat(t.text,'" data-time="').concat(t.time,'" style="left: ').concat(100*e,'%"></span>'))}),this.set("loaded",s.loaded),this.art.on("video:progress",function(){r.set("loaded",r.loaded)}),this.art.on("video:timeupdate",function(){r.set("played",r.played)}),this.art.on("video:ended",function(){r.set("played",1)}),a(e,"mousemove",function(t){zt(r.$tip,"display","block"),-1<t.composedPath().indexOf(r.$highlight)?r.showHighlight(t):r.showTime(t)}),a(e,"mouseout",function(){zt(r.$tip,"display","none")}),a(e,"click",function(t){if(t.target!==r.$indicator){var e=r.getPosFromEvent(t),n=e.second,i=e.percentage;r.set("played",i),s.seek(n)}}),a(this.$indicator,"mousedown",function(){r.isDroging=!0}),a(document,"mousemove",function(t){if(r.isDroging){var e=r.getPosFromEvent(t),n=e.second,i=e.percentage;r.$indicator.classList.add("show-indicator"),r.set("played",i),s.seek(n)}}),a(document,"mouseup",function(){r.isDroging&&(r.isDroging=!1,r.$indicator.classList.remove("show-indicator"))})}},{key:"showHighlight",value:function(t){var e=t.target.dataset,n=e.text,i=e.time;this.$tip.innerHTML=n;var r=Number(i)/this.art.player.duration*this.$control.clientWidth+t.target.clientWidth/2-this.$tip.clientWidth/2;zt(this.$tip,"left","".concat(r,"px"))}},{key:"showTime",value:function(t){var e=this.getPosFromEvent(t),n=e.width,i=e.time,r=this.$tip.clientWidth;this.$tip.innerHTML=i,n<=r/2?zt(this.$tip,"left",0):n>this.$control.clientWidth-r/2?zt(this.$tip,"left","".concat(this.$control.clientWidth-r,"px")):zt(this.$tip,"left","".concat(n-r/2,"px"))}},{key:"getPosFromEvent",value:function(t){var e=this.art,n=e.player,i=e.refs.$progress,r=i.getBoundingClientRect().left,o=Wt(t.x-r,0,i.clientWidth),a=o/i.clientWidth*n.duration;return{second:a,time:Ft(a),width:o,percentage:Wt(o/i.clientWidth,0,1)}}},{key:"set",value:function(t,e){zt(this["$".concat(t)],"width","".concat(100*e,"%")),"played"===t&&zt(this.$indicator,"left","calc(".concat(100*e,"% - ").concat(S(this.$indicator,"width")/2,"px)"))}}]),e}(),et=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events.proxy,r=t.i18n,o=t.subtitle;this.$subtitle=qt(e,Q.subtitle),T(this.$subtitle,r.get("Hide subtitle")),i(e,"click",function(){o.toggle()}),t.on("subtitle:show",function(){zt(n.$subtitle,"opacity","0.8"),T(n.$subtitle,r.get("Hide subtitle"))}),t.on("subtitle:hide",function(){zt(n.$subtitle,"opacity","1"),T(n.$subtitle,r.get("Show subtitle"))})}}]),e}(),nt=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){function n(){e.innerHTML="".concat(Ft(t.player.currentTime)," / ").concat(Ft(t.player.duration))}e.innerHTML="00:00 / 00:00",t.on("video:canplay",function(){n()}),t.on("video:timeupdate",function(){n()}),t.on("video:seeking",function(){n()})}}]),e}(),it=function(){function e(t){Dt(this,e),this.option=t,this.isDroging=!1}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events,r=i.proxy,o=i.hover,a=t.player,s=t.i18n,c=t.storage;this.$volume=qt(e,Q.volume),this.$volumeClose=qt(e,Q.volumeClose),this.$volumePanel=qt(e,'<div class="art-volume-panel"></div>'),this.$volumeHandle=qt(this.$volumePanel,'<div class="art-volume-slider-handle"></div>'),T(this.$volume,s.get("Mute")),zt(this.$volumeClose,"display","none"),t.on("volume",function(t){0===t?(zt(n.$volume,"display","none"),zt(n.$volumeClose,"display","block")):(zt(n.$volume,"display","block"),zt(n.$volumeClose,"display","none"))}),t.on("video:volumechange",function(){n.setVolumeHandle(a.volume)}),r(this.$volume,"click",function(){a.volume=0}),r(this.$volumeClose,"click",function(){a.volume=c.get("volume")}),o(e,function(){n.$volumePanel.classList.add("art-volume-panel-hover"),Bt(200).then(function(){n.setVolumeHandle(a.volume)})},function(){n.$volumePanel.classList.remove("art-volume-panel-hover")}),r(this.$volumePanel,"click",function(t){a.volume=n.volumeChangeFromEvent(t)}),r(this.$volumeHandle,"mousedown",function(){n.isDroging=!0}),r(this.$volumeHandle,"mousemove",function(t){n.isDroging&&(a.volume=n.volumeChangeFromEvent(t))}),r(document,"mouseup",function(){n.isDroging&&(n.isDroging=!1)})}},{key:"volumeChangeFromEvent",value:function(t){var e=this.$volumePanel.getBoundingClientRect(),n=e.left,i=e.width,r=this.$volumeHandle.getBoundingClientRect().width;return Wt(t.x-n-r/2,0,i-r/2)/(i-r)}},{key:"setVolumeHandle",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.7,e=S(this.$volumePanel,"width"),n=S(this.$volumeHandle,"width"),i=n/2+(e-n)*t-n/2;zt(this.$volumeHandle,"left","".concat(i,"px"))}}]),e}(),rt=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=this,i=t.events.proxy,r=t.i18n,o=t.setting;this.$setting=qt(e,Q.setting),T(this.$setting,r.get("Show setting")),i(e,"click",function(){o.toggle()}),t.on("setting:show",function(){zt(n.$setting,"opacity","0.8"),T(n.$setting,r.get("Hide setting"))}),t.on("setting:hide",function(){zt(n.$setting,"opacity","1"),T(n.$setting,r.get("Show setting"))})}}]),e}(),ot=function(){function e(t){Dt(this,e),this.option=t,this.loading=!1,this.isLoad=!1}return r(e,[{key:"apply",value:function(t,e){var n=this;x((this.art=t).controls.progress,"'thumbnails' control dependent on 'progress' control");var i=t.refs.$progress,r=t.events.proxy;this.$control=e,r(i,"mousemove",function(t){n.loading||(n.loading=!0,n.load(n.art.option.thumbnails.url).then(function(){n.isLoad=!0})),n.isLoad&&(zt(e,"display","block"),n.showThumbnails(t))}),r(i,"mouseout",function(){zt(e,"display","none")})}},{key:"load",value:function(i){var r=this.art.events.proxy;return new Promise(function(t,e){var n=new Image;if(n.src=i,n.complete)return t(n);r(n,"load",function(){return t(n)}),r(n,"error",function(){return e(n)})})}},{key:"showThumbnails",value:function(t){var e=this.art,n=e.refs.$progress,i=e.controls.progress.getPosFromEvent(t).width,r=this.art.option.thumbnails,o=r.url,a=r.height,s=r.width,c=r.number,l=r.column,u=n.clientWidth/c,h=Math.ceil(i/u),d=Math.ceil(h/l),f=h%l||l;zt(this.$control,"backgroundImage","url(".concat(o,")")),zt(this.$control,"height","".concat(a,"px")),zt(this.$control,"width","".concat(s,"px")),zt(this.$control,"backgroundPosition","-".concat(--f*s,"px -").concat(--d*a,"px")),i<=s/2?zt(this.$control,"left",0):i>n.clientWidth-s/2?zt(this.$control,"left","".concat(n.clientWidth-s,"px")):zt(this.$control,"left","".concat(i-s/2,"px"))}}]),e}(),at=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){var n=t.events.proxy,i=t.i18n,r=t.player;this.$screenshot=qt(e,Q.screenshot),T(this.$screenshot,i.get("Screenshot")),n(this.$screenshot,"click",function(){r.screenshot()})}}]),e}(),st=function(){function e(t){Dt(this,e),this.option=t,this.playIndex=-1}return r(e,[{key:"apply",value:function(t,e){var o=this,a=t.option,n=t.events,i=n.proxy,r=n.hover,s=t.player,c=a.quality.find(function(t){return t.default})||a.quality[0];this.playIndex=a.quality.indexOf(c);var l=qt(e,'<div class="art-quality-name">'.concat(c.name,"</div>")),u=a.quality.map(function(t,e){return'<div class="art-quality-item" data-index="'.concat(e,'">').concat(t.name,"</div>")}).join(""),h=qt(e,'<div class="art-qualitys">'.concat(u,"</div>"));r(e,function(){e.classList.add("hover")},function(){e.classList.remove("hover")}),i(h,"click",function(t){var e=Number(t.target.dataset.index),n=a.quality[e],i=n.url,r=n.name;i&&r&&o.playIndex!==e&&(s.switch(i,r),l.innerHTML=r,o.playIndex=e)})}}]),e}(),ct=0,lt=function(){function n(t){var e=this;Dt(this,n),ct=0,this.art=t,this.art.on("firstCanplay",function(){e.init()})}return r(n,[{key:"init",value:function(){var e=this;this.add(new tt({name:"progress",disable:!1,position:"top",index:10})),this.add(new ot({name:"thumbnails",disable:!this.art.option.thumbnails.url,position:"top",index:20})),this.add(new K({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(new it({name:"volume",disable:!1,position:"left",index:20})),this.add(new nt({name:"time",disable:!1,position:"left",index:30})),this.add(new st({name:"quality",disable:0===this.art.option.quality.length,position:"right",index:10})),this.add(new at({name:"screenshot",disable:!this.art.option.screenshot,position:"right",index:20})),this.add(new et({name:"subtitle",disable:!this.art.option.subtitle.url,position:"right",index:30})),this.add(new rt({name:"setting",disable:!this.art.option.setting,position:"right",index:40})),this.add(new G({name:"pip",disable:!this.art.option.pip,position:"right",index:50})),this.add(new Z({name:"fullscreenWeb",disable:!this.art.option.fullscreenWeb,position:"right",index:60})),this.add(new X({name:"fullscreen",disable:!this.art.option.fullscreen,position:"right",index:70})),this.art.option.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n=t.option;if(n&&!n.disable){ct++;var i=n.name||"control".concat(ct),r=document.createElement("div");r.setAttribute("class","art-control art-control-".concat(i)),this.mount(n.position,r,n.index||ct),t.apply&&t.apply(this.art,r),e&&e(r),this[i]=t}}},{key:"mount",value:function(t,e,n){var i=this.art.refs,r=i.$progress,o=i.$controlsLeft,a=i.$controlsRight;switch(t){case"top":k(r,e,n);break;case"left":k(o,e,n);break;case"right":k(a,e,n)}}},{key:"show",value:function(){this.art.refs.$player.classList.add("artplayer-controls-show")}},{key:"hide",value:function(){this.art.refs.$player.classList.remove("artplayer-controls-show")}}]),n}();function ut(t){var e=t.option,n=t.i18n,i=t.player,r=t.contextmenu;return{disable:!e.playbackRate,name:"playbackRate",index:10,html:"\n ".concat(n.get("Play speed"),':\n <span data-rate="0.5">0.5</span>\n <span data-rate="0.75">0.75</span>\n <span data-rate="1" class="normal current">').concat(n.get("Normal"),'</span>\n <span data-rate="1.25">1.25</span>\n <span data-rate="1.5">1.5</span>\n <span data-rate="2.0">2.0</span>\n '),click:function(t){var e=t.target,n=e.dataset.rate;n&&(i.playbackRate(Number(n)),It(e).forEach(function(t){return t.classList.remove("current")}),e.classList.add("current"),r.hide())}}}function ht(t){var e=t.option,n=t.i18n,i=t.player,r=t.contextmenu;return{disable:!e.aspectRatio,name:"aspectRatio",index:20,html:"\n ".concat(n.get("Aspect ratio"),':\n <span data-ratio="default" class="default current">').concat(n.get("Default"),'</span>\n <span data-ratio="4:3">4:3</span>\n <span data-ratio="16:9">16:9</span>\n '),click:function(t){var e=t.target,n=e.dataset.ratio;n&&(i.aspectRatio(n.split(":")),It(e).forEach(function(t){return t.classList.remove("current")}),e.classList.add("current"),r.hide())}}}function dt(t){return{disable:!1,name:"info",index:30,html:t.i18n.get("Video info"),click:function(){t.info.show(),t.contextmenu.hide()}}}var ft={disable:!1,name:"version",index:40,html:'<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 1.0.2</a>'};function pt(t){return{disable:!1,name:"close",index:50,html:t.i18n.get("Close"),click:function(){t.contextmenu.hide()}}}var vt=0,yt=function(){function e(t){Dt(this,e),vt=0,this.art=t,this.init()}return r(e,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,i=t.refs,r=t.events.proxy;n.contextmenu.push(ut,ht,dt,ft,pt),n.contextmenu.forEach(function(t){e.add(t)}),r(i.$player,"contextmenu",function(t){t.preventDefault(),e.show(),e.setPos(t)}),r(i.$player,"click",function(t){i.$contextmenu&&!t.composedPath().includes(i.$contextmenu)&&e.hide()})}},{key:"add",value:function(t,e){var n=this;if(!t.disable){var i=this.art,r=i.refs,o=i.events.proxy;vt++;var a=t.name||"menu".concat(vt),s="function"==typeof t?t(this.art):t,c=document.createElement("div");c.setAttribute("class","art-menu art-menu-".concat(a||vt)),qt(c,s.html),E(c,s.style||{}),s.click&&o(c,"click",function(t){t.preventDefault(),s.click.call(n,t),n.art.emit("contextmenu:click",c)}),e&&e(c),this[a]=c,k(r.$contextmenu,c,s.index||vt)}}},{key:"setPos",value:function(t){var e=this.art.refs,n=t.clientX,i=t.clientY,r=e.$player.getBoundingClientRect(),o=r.height,a=r.width,s=r.left,c=r.top,l=e.$contextmenu.getBoundingClientRect(),u=l.height,h=l.width,d=n-s,f=i-c;s+a<n+h&&(d=a-h),c+o<i+u&&(f=o-u),zt(e.$contextmenu,"left","".concat(d,"px")),zt(e.$contextmenu,"top","".concat(f,"px"))}},{key:"hide",value:function(){var t=this.art.refs.$contextmenu;zt(t,"display","none"),this.art.emit("contextmenu:hide",t)}},{key:"show",value:function(){var t=this.art.refs.$contextmenu;zt(t,"display","block"),this.art.emit("contextmenu:show",t)}}]),e}(),gt=function(){function e(t){Dt(this,e),this.art=t,this.init()}return r(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.refs,i=n.$infoClose,r=n.$infoPanel;(0,e.events.proxy)(i,"click",function(){t.hide()}),this.art.on("switch",function(){r.innerHTML&&t.getHeader()})}},{key:"show",value:function(){var t=this.art.refs,e=t.$info,n=t.$infoPanel;zt(e,"display","block"),n.innerHTML||(qt(n,this.creatInfo()),this.getHeader()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show",e)}},{key:"creatInfo",value:function(){var t=[];return t.push('\n <div class="art-info-item ">\n <div class="art-info-title">Player version:</div>\n <div class="art-info-content">1.0.2</div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video url:</div>\n <div class="art-info-content" data-video="currentSrc"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video type:</div>\n <div class="art-info-content" data-head="Content-Type"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video size:</div>\n <div class="art-info-content" data-head="Content-length"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video volume:</div>\n <div class="art-info-content" data-video="volume"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video time:</div>\n <div class="art-info-content" data-video="currentTime"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video duration:</div>\n <div class="art-info-content" data-video="duration"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video resolution:</div>\n <div class="art-info-content">\n <span data-video="videoWidth"></span> x <span data-video="videoHeight"></span>\n </div>\n </div>\n '),t.join("")}},{key:"getHeader",value:function(){var t=this.art.refs,e=t.$infoPanel,n=t.$video.src,i=Array.from(e.querySelectorAll("[data-head]"));i.forEach(function(t){t.innerHTML="loading..."}),fetch(n,{method:"HEAD"}).then(function(n){i.forEach(function(t){var e=n.headers.get(t.dataset.head);t.innerHTML=void 0!==e?e:"unknown"})}).catch(function(){i.forEach(function(t){t.innerHTML="unknown"})})}},{key:"readInfo",value:function(){var t=this.art.refs,e=t.$infoPanel,n=t.$video;Array.from(e.querySelectorAll("[data-video]")).forEach(function(t){var e=n[t.dataset.video];t.innerHTML=void 0!==e?e:"unknown"})}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout(function(){t.readInfo(),t.loop()},1e3)}},{key:"hide",value:function(){var t=this.art.refs.$info;zt(t,"display","none"),clearTimeout(this.timer),this.art.emit("info:hide",t)}}]),e}(),mt=function(){function n(t){Dt(this,n),this.art=t,this.state=!0,this.vttText="";var e=this.art.option.subtitle.url;e&&(this.checkExt(e),this.init())}return r(n,[{key:"init",value:function(){var i=this,t=this.art,e=t.events.proxy,n=t.option.subtitle,r=t.refs,o=r.$video,a=r.$subtitle;E(a,n.style||{});var s=document.createElement("track");s.default=!0,s.kind="metadata",this.load(n.url).then(function(t){if(s.src=t,o.appendChild(s),i.art.refs.$track=s,o.textTracks&&o.textTracks[0]){var n=U(o.textTracks,1)[0];e(n,"cuechange",function(){var t=U(n.activeCues,1)[0];if(a.innerHTML="",t){var e=document.createElement("div");e.appendChild(t.getCueAsHTML()),a.innerHTML=e.innerHTML.split(/\r?\n/).map(function(t){return"<p>".concat(t,"</p>")}).join("")}i.art.emit("subtitle:update",a)})}})}},{key:"load",value:function(t){var e,n=this,i=this.art.notice;return fetch(t).then(function(t){return e=t.headers.get("Content-Type"),t.text()}).then(function(t){return/x-subrip/gi.test(e)?n.vttText=n.srtToVtt(t):n.vttText=t,n.vttToBlob(n.vttText)}).catch(function(t){throw i.show(t),console.warn(t),t})}},{key:"srtToVtt",value:function(t){return"WEBVTT \r\n\r\n".concat(t.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"))}},{key:"vttToBlob",value:function(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}},{key:"checkExt",value:function(t){var e=$(t);x("vtt"===e||"srt"===e,"'subtitle.url' option require 'vtt' or 'srt' format, but got '".concat(e,"'."))}},{key:"show",value:function(){var t=this.art,e=t.refs.$subtitle,n=t.i18n,i=t.notice;zt(e,"display","block"),this.state=!0,i.show(n.get("Show subtitle")),this.art.emit("subtitle:show",e)}},{key:"hide",value:function(){var t=this.art,e=t.refs.$subtitle,n=t.i18n,i=t.notice;zt(e,"display","none"),this.state=!1,i.show(n.get("Hide subtitle")),this.art.emit("subtitle:hide",e)}},{key:"toggle",value:function(){this.state?this.hide():this.show()}},{key:"switch",value:function(e){var n=this,i=this.art.refs.$track;this.checkExt(e),x(i,"You need to initialize the subtitle option first."),this.load(e).then(function(t){i.src=t,n.art.emit("subtitle:switch",e)})}}]),n}();var bt=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.ContentRect=function(t){if("getBBox"in t){var e=t.getBBox();return Object.freeze({height:e.height,left:0,top:0,width:e.width})}var n=window.getComputedStyle(t);return Object.freeze({height:parseFloat(n.height||"0"),left:parseFloat(n.paddingLeft||"0"),top:parseFloat(n.paddingTop||"0"),width:parseFloat(n.width||"0")})}});e(bt);bt.ContentRect;var wt=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.target=t,this.$$broadcastWidth=this.$$broadcastHeight=0}return Object.defineProperty(t.prototype,"broadcastWidth",{get:function(){return this.$$broadcastWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"broadcastHeight",{get:function(){return this.$$broadcastHeight},enumerable:!0,configurable:!0}),t.prototype.isActive=function(){var t=bt.ContentRect(this.target);return!!t&&(t.width!==this.broadcastWidth||t.height!==this.broadcastHeight)},t}();e.ResizeObservation=n});e(wt);wt.ResizeObservation;var xt=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){this.target=t,this.contentRect=bt.ContentRect(t)};e.ResizeObserverEntry=n});e(xt);xt.ResizeObserverEntry;var $t=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=[],i=function(){function t(t){this.$$observationTargets=[],this.$$activeTargets=[],this.$$skippedTargets=[];var e=function(t){if(void 0===t)return"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.";if("function"!=typeof t)return"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function."}(t);if(e)throw TypeError(e);this.$$callback=t,n.push(this)}return t.prototype.observe=function(t){var e=r("observe",t);if(e)throw TypeError(e);0<o(this.$$observationTargets,t)||(this.$$observationTargets.push(new wt.ResizeObservation(t)),h())},t.prototype.unobserve=function(t){var e=r("unobserve",t);if(e)throw TypeError(e);var n=o(this.$$observationTargets,t);n<0||(this.$$observationTargets.splice(n,1),f())},t.prototype.disconnect=function(){this.$$observationTargets=[],this.$$activeTargets=[]},t}();function r(t,e){return void 0===e?"Failed to execute '"+t+"' on 'ResizeObserver': 1 argument required, but only 0 present.":e instanceof window.Element?void 0:"Failed to execute '"+t+"' on 'ResizeObserver': parameter 1 is not of type 'Element'."}function o(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1}e.ResizeObserver=i;var a,s=function(i){n.forEach(function(n){n.$$activeTargets=[],n.$$skippedTargets=[],n.$$observationTargets.forEach(function(t){if(t.isActive()){var e=l(t.target);i<e?n.$$activeTargets.push(t):n.$$skippedTargets.push(t)}})})},c=function(){var r=1/0;return n.forEach(function(t){if(t.$$activeTargets.length){var i=[];t.$$activeTargets.forEach(function(t){var e=new xt.ResizeObserverEntry(t.target);i.push(e),t.$$broadcastWidth=e.contentRect.width,t.$$broadcastHeight=e.contentRect.height;var n=l(t.target);n<r&&(r=n)}),t.$$callback(i,t),t.$$activeTargets=[]}}),r},l=function(t){for(var e=0;t.parentNode;)t=t.parentNode,e+=1;return e},u=function(){var t,e=0;for(s(e);n.some(function(t){return!!t.$$activeTargets.length});)e=c(),s(e);n.some(function(t){return!!t.$$skippedTargets.length})&&(t=new window.ErrorEvent("ResizeLoopError",{message:"ResizeObserver loop completed with undelivered notifications."}),window.dispatchEvent(t))},h=function(){a||d()},d=function(){a=window.requestAnimationFrame(function(){u(),d()})},f=function(){a&&!n.some(function(t){return!!t.$$observationTargets.length})&&(window.cancelAnimationFrame(a),a=void 0)};e.install=function(){return window.ResizeObserver=i}});e($t);var kt=$t.ResizeObserver;$t.install;var Et=function(){function v(t){var e,n,i,r,o,a,s,c,l,u,h,d,f,p;Dt(this,v),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),n=this,i=(e=t).refs.$player,n.proxy(document,["click","contextmenu"],function(t){-1<t.composedPath().indexOf(i)?e.isFocus=!0:(e.isFocus=!1,e.contextmenu.hide())}),o=this,a=(r=t).refs.$player,o.hover(a,function(){a.classList.add("artplayer-hover"),r.emit("hoverenter")},function(){a.classList.remove("artplayer-hover"),a.classList.remove("artplayer-hide-cursor"),r.emit("hoverleave")}),c=this,l=(s=t).refs.$player,u=C(function(){l.classList.add("artplayer-hide-cursor"),(s.player.fullscreenState||s.player.fullscreenWebState)&&(l.classList.remove("artplayer-hover"),s.controls.hide())},5e3),c.proxy(l,"mousemove",function(){l.classList.remove("artplayer-hide-cursor"),s.controls.show(),s.player.pipState?u.clearTimeout():u()}),d=this,f=(h=t).refs.$player,(p=new kt(function(){Bt().then(function(){h.player.aspectRatioReset(),h.emit("resize")})})).observe(f),d.destroyEvents.push(function(){p.unobserve(f)})}return r(v,[{key:"proxy",value:function(e,t,n){var i=this,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(t)?t.forEach(function(t){return i.proxy(e,t,n,r)}):(e.addEventListener(t,n,r),this.destroyEvents.push(function(){e.removeEventListener(t,n,r)}))}},{key:"hover",value:function(t,e,n){this.proxy(t,"mouseenter",e),this.proxy(t,"mouseleave",n)}},{key:"destroy",value:function(){this.destroyEvents.forEach(function(t){return t()})}}]),v}(),St=function(){function e(t){Dt(this,e),this.art=t,this.art.option.hotkey&&this.init()}return r(e,[{key:"init",value:function(){var i=this,t=this.art,r=t.player;(0,t.events.proxy)(window,"keydown",function(t){if(i.art.isFocus){var e=document.activeElement.tagName.toUpperCase(),n=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==n&&"true"!==n)switch(t.keyCode){case 39:t.preventDefault(),r.seek(r.currentTime()+10);break;case 37:t.preventDefault(),r.seek(r.currentTime()-10);break;case 38:t.preventDefault(),r.volume(r.volume()+.05);break;case 40:t.preventDefault(),r.volume(r.volume()-.05);break;case 32:t.preventDefault(),r.toggle()}}})}}]),e}(),Pt=0,Tt=function(){function n(t){var e=this;Dt(this,n),Pt=0,this.art=t,this.add=this.add.bind(this),this.art.option.layers.forEach(function(t){e.add(t)})}return r(n,[{key:"add",value:function(t,e){if(!t.disable){var n=this.art.refs.$layers;Pt++;var i=document.createElement("div");i.setAttribute("class","art-layer art-layer-".concat(t.name||Pt)),zt(i,"z-index",t.index||Pt),qt(i,t.html),E(i,t.style||{}),this.art.emit("layers:add",i),e&&e(i),k(n,i,t.index||Pt)}}},{key:"show",value:function(){var t=this.art.refs.$layers;zt(t,"display","block"),this.art.emit("layers:show",t)}},{key:"hide",value:function(){var t=this.art.refs.$layers;zt(t,"display","none"),this.art.emit("layers:hide",t)}}]),n}(),Ct=function(){function n(t){Dt(this,n);var e=(this.art=t).option;qt(t.refs.$loading,e.loading||Q.loading)}return r(n,[{key:"hide",value:function(){var t=this.art.refs.$loading;zt(t,"display","none"),this.art.emit("loading:hide",t)}},{key:"show",value:function(){var t=this.art.refs.$loading;zt(t,"display","flex"),this.art.emit("loading:show",t)}}]),n}(),Lt=function(){function e(t){Dt(this,e),this.art=t,this.timer=null}return r(e,[{key:"show",value:function(t){var e=this,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3,r=this.art.refs,o=r.$notice,a=r.$noticeInner;zt(o,"display","block"),a.innerHTML=t instanceof Error?t.message.trim():t,n&&(clearTimeout(this.timer),this.timer=setTimeout(function(){e.hide()},i)),this.art.emit("notice:show",o)}},{key:"hide",value:function(){var t=this.art.refs.$notice;zt(t,"display","none"),this.art.emit("notice:hide",t)}}]),e}(),_t=function(){function n(t){Dt(this,n);var e=(this.art=t).option;qt(t.refs.$mask,e.play||Q.playBig)}return r(n,[{key:"show",value:function(){var t=this.art.refs.$mask;zt(t,"display","flex"),this.art.emit("mask:show",t)}},{key:"hide",value:function(){var t=this.art.refs.$mask;zt(t,"display","none"),this.art.emit("mask:show",t)}}]),n}(),Rt=function(){function e(t){Dt(this,e),this.option=t}return r(e,[{key:"apply",value:function(t,e){this.art=t,this.$header=e.querySelector(".art-setting-header"),this.$body=e.querySelector(".art-setting-body"),qt(this.$body,"———— 先占坑,暂无设置 ————")}}]),e}(),Mt=0,Ot=function(){function e(t){Dt(this,e),Mt=0,this.art=t,this.state=!1,t.option.setting&&this.init()}return r(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.refs.$settingClose;(0,e.events.proxy)(n,"click",function(){t.hide()}),this.add(new Rt({name:"common",title:"Common",disable:!1,index:10}))}},{key:"add",value:function(t,e){var n=this.art,i=n.refs,r=n.i18n,o=t.option;if(o&&!o.disable){Mt++;var a=o.name||"setting".concat(Mt),s=o.title||a,c=document.createElement("div");c.setAttribute("class","art-setting art-setting-".concat(a)),qt(c,'<div class="art-setting-header">'.concat(r.get(s),"</div>")),qt(c,'<div class="art-setting-body"></div>'),t.apply&&t.apply(this.art,c),e&&e(c),this[a]=c,k(i.$settingBody,c,o.index||Mt)}}},{key:"show",value:function(){var t=this.art,e=t.refs.$setting,n=t.i18n,i=t.notice;zt(e,"display","flex"),this.state=!0,i.show(n.get("Show setting")),this.art.emit("setting:show",e)}},{key:"hide",value:function(){var t=this.art,e=t.refs.$setting,n=t.i18n,i=t.notice;zt(e,"display","none"),this.state=!1,i.show(n.get("Hide setting")),this.art.emit("setting:hide",e)}},{key:"toggle",value:function(){this.state?this.hide():this.show()}}]),e}(),jt=function(){function n(t){var e=this;Dt(this,n),this.art=t,this.storageName="artplayer_settings",Bt().then(function(){e.initVolume()})}return r(n,[{key:"get",value:function(t){return JSON.parse(localStorage.getItem(this.storageName))[t]}},{key:"set",value:function(t,e){var n=Object.assign({},this.get()||{},d({},t,e));localStorage.setItem(this.storageName,JSON.stringify(n))}},{key:"initVolume",value:function(){var t=this.art.player,e=this.get("volume");e&&(t.volume=e)}}]),n}(),At=0,Ht=function(t){function n(t){var e;return Dt(this,n),(e=s(this,c(n).call(this))).emit("init:start"),e.option=P({},n.DEFAULTS,t),_(e.option,M),e.init(),e.emit("init:end"),e}return h(n,j),r(n,[{key:"init",value:function(){this.isFocus=!1,this.isPlaying=!1,this.refs={},this.option.container instanceof Element?this.refs.$container=this.option.container:this.refs.$container=document.querySelector(this.option.container),this.template=new A(this),this.storage=new jt(this),this.i18n=new D(this),this.notice=new Lt(this),this.events=new Et(this),this.player=new B(this),this.layers=new Tt(this),this.controls=new lt(this),this.contextmenu=new yt(this),this.subtitle=new mt(this),this.info=new gt(this),this.loading=new Ct(this),this.hotkey=new St(this),this.mask=new _t(this),this.setting=new Ot(this),this.id=At++,n.instances.push(this)}},{key:"destroy",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.events.destroy(),n.instances.splice(n.instances.indexOf(this),1),t?this.refs.$container.innerHTML="":this.refs.$player.classList.add("artplayer-destroy"),this.emit("destroy")}}],[{key:"use",value:function(t){var e=this.plugins||(this.plugins=[]);if(-1===e.indexOf){e.push(t);var n=Array.from(arguments).slice(1);n.unshift(this),t.apply(null,n),this.prototype.emit("use",t)}return this}},{key:"version",get:function(){return"1.0.2"}},{key:"config",get:function(){return Nt}},{key:"utils",get:function(){return L}},{key:"DEFAULTS",get:function(){return{container:".artplayer",url:"",poster:"",title:"",volume:.7,thumbnails:{url:"",number:60,width:160,height:90,column:10},screenshot:!1,autoplay:!1,playbackRate:!0,aspectRatio:!0,loop:!1,type:"",mimeCodec:"",layers:[],contextmenu:[],quality:[],loading:"",play:"",theme:"#f00",setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!0,fullscreenWeb:!0,subtitle:{url:"",style:{}},controls:[],highlight:[],moreVideoAttr:{crossOrigin:"anonymous",controls:!1,preload:"auto","webkit-playsinline":!0,playsinline:!0},lang:navigator.language.toLowerCase()}}}]),n}();Ht.instances=[],window.Artplayer=Ht,t.default=Ht,Object.defineProperty(t,"__esModule",{value:!0})});