/*! * artplayer-react.js v3.1.18 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2019 Harvey Zack * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ArtplayerReact=t()}(this,function(){"use strict";var a=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r.")}return t}(t);if(!we[n]){we[n]=!0;var r="";e&&e._owner&&e._owner!==z.current&&(r=" It was passed a child from "+F(e._owner.type)+"."),V(e),U(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),V(null)}}}function je(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",o=" Did you accidentally export a JSX literal instead of a component?"):a=typeof e,U(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",a,o)}var c=K.apply(this,arguments);if(null==c)return c;if(r)for(var u=2;u is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||U(!(r=!0),"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===f?k(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?k(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&k(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null==e||null==e.defaultProps&&null==e.propTypes||k(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:i,render:e}},lazy:function(e){var t={$$typeof:p,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){U(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){U(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return he(e)||k(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:f,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return ve().useCallback(e,t)},useContext:function(e,t){var n=ve();if(void 0!==t&&U(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?U(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&U(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return ve().useEffect(e,t)},useImperativeHandle:function(e,t,n){return ve().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return ve().useDebugValue(e,t)},useLayoutEffect:function(e,t){return ve().useLayoutEffect(e,t)},useMemo:function(e,t){return ve().useMemo(e,t)},useReducer:function(e,t,n){return ve().useReducer(e,t,n)},useRef:function(e){return ve().useRef(e)},useState:function(e){return ve().useState(e)},Fragment:s,Profiler:r,StrictMode:n,Suspense:u,unstable_SuspenseList:l,createElement:Pe,cloneElement:function(e,t,n){for(var r=function(e,t,n){!function(){if(null==e)throw O(Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+"."))}();var r=void 0,o=y({},e.props),i=e.key,a=e.ref,c=e._self,u=e._source,s=e._owner;if(null!=t){J(t)&&(a=t.ref,s=z.current),G(t)&&(i=""+t.key);var l=void 0;for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)B.call(t,r)&&!Y.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==l?o[r]=l[r]:o[r]=t[r])}var f=arguments.length-2;if(1==f)o.children=n;else if(1").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 $e(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function Ce(e){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(e){return(0\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":de(this.$player,"artplayer-destroy")}}]),n}(),Ke={"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:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},et={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function t(e){c(this,t),this.art=e,this.languages={"zh-cn":Ke,"zh-tw":et},this.init()}return u(t,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=We(this.languages,e),this.init()}}]),t}();var nt=e(function(e){var i,t,o,r,n;i="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,o=function(){for(var e,t=[["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,r=t.length,o={};n ").concat(u));var s=document.createElement("div");s.classList.value="art-".concat(i," art-").concat(i,"-").concat(u),a.html&&ve(s,a.html),a.style&&be(s,a.style),a.tooltip&&ke(s,a.tooltip);var l=Array.from(e.children);s.dataset.index=a.index||c;var f=l.find(function(e){return Number(e.dataset.index)>=Number(s.dataset.index)});return f?f.insertAdjacentElement("beforebegin",s):ve(e,s),a.click&&t.events.proxy(s,"click",function(e){e.preventDefault(),a.click.call(t,n,e),t.emit("".concat(i,":click"),s)}),a.mounted&&a.mounted(s,n,t),o&&o(s,n,t),Object.defineProperty(n,u,{value:{get id(){return c},get $ref(){return s},set show(e){e?(ge(s,"display","block"),t.emit("".concat(i,":show"),s)):(ge(s,"display","none"),t.emit("".concat(i,":hide"),s))},set remove(e){e&&(me(s),t.emit("".concat(i,":remove"),s))}}}),t.emit("".concat(i,":add"),a),n[u]}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 ct(e){return function(a){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(i){var o=!1,n=fe(".art-progress-loaded",i),r=fe(".art-progress-played",i),a=fe(".art-progress-highlight",i),c=fe(".art-progress-indicator",i),u=fe(".art-progress-tip",i);function s(e,t){"loaded"===e&&ge(n,"width","".concat(100*t,"%")),"played"===e&&(ge(r,"width","".concat(100*t,"%")),ge(c,"left","calc(".concat(100*t,"% - ").concat(we(c,"width")/2,"px)")))}t.forEach(function(e){var t=Ue(e.time,0,p.duration)/p.duration*100;ve(a,''))}),s("loaded",p.loaded),l.on("video:progress",function(){s("loaded",p.loaded)}),l.on("video:timeupdate",function(){s("played",p.played)}),l.on("video:ended",function(){s("played",1)}),f(i,"mousemove",function(e){ge(u,"display","block"),-1i.clientWidth-r/2?ge(u,"left","".concat(i.clientWidth-r,"px")):ge(u,"left","".concat(t-r/2,"px"))}(e):function(e){var t=ht(l,e),n=t.width,r=t.time;u.innerHTML=r;var o=u.clientWidth;n<=o/2?ge(u,"left",0):n>i.clientWidth-o/2?ge(u,"left","".concat(i.clientWidth-o,"px")):ge(u,"left","".concat(n-o/2,"px"))}(e)}),f(i,"mouseout",function(){ge(u,"display","none")}),f(i,"click",function(e){if(e.target!==c){var t=ht(l,e),n=t.second;s("played",t.percentage),p.seek=n}}),f(c,"mousedown",function(){o=!0}),f(document,"mousemove",function(e){if(o){var t=ht(l,e),n=t.second,r=t.percentage;de(c,"art-show-indicator"),s("played",r),p.seek=n}}),f(document,"mouseup",function(){o&&(o=!1,ye(c,"art-show-indicator"))})}})}}function mt(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 gt(e){return function(a){return function(t){for(var e=1;e'),s=ve(u,'
');function l(e){var t=u.getBoundingClientRect(),n=t.left,r=t.width,o=s.getBoundingClientRect().width;return Ue(e.pageX-n-o/2,0,r-o/2)/(r-o)}function f(e){var t=0d.clientWidth-o/2?ge(f,"left","".concat(d.clientWidth-o,"px")):ge(f,"left","".concat(t-o/2,"px"))}(e))}),t(d,"mouseout",function(){ge(f,"display","none")})}})}}function Et(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 Rt(e){return function(a){return function(t){for(var e=1;e'.concat(o.name,"")),s=i.map(function(e,t){return'
').concat(e.name,"
")}).join(""),l=ve(e,'
'.concat(s,"
"));r(e,function(){l.style.left="-".concat(we(l,"width")/2-e.clientWidth/2,"px")}),n(l,"click",function(e){var t=Number(e.target.dataset.index),n=i[t],r=n.url,o=n.name;r&&o&&c!==t&&(a.switchQuality(r,o),u.innerHTML=o,c=t)})}})}}var Dt=function(){function n(e){var t=this;c(this,n),this.id=0,this.art=e,this.art.on("ready",function(){t.init()})}return u(n,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(vt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(St({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(dt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(jt({name:"volume",disable:!1,position:"left",index:20})),this.add(wt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Ct({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(Rt({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(gt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(ft({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(ct({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach(function(e){t.add(e)})}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}this.id+=1,Ee(r.position,"Controls option.position can not be empty");var u=it(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||de(u.$ref,"art-control-onlyText"),u}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,ye(t,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Tt(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 _t(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(t.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(r.playbackRate=Number(n),e.show=!1)},mounted:function(n){e.on("playbackRateChange",function(t){var e=pe("span",n).find(function(e){return Number(e.dataset.rate)===t});e&&je(e,"current")})}})}}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 Lt(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(t.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(r.aspectRatio=n,e.show=!1)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("span",n).find(function(e){return e.dataset.ratio===t});e&&je(e,"current")})}})}}function Mt(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 zt(e){return function(t){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(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(t){return function(e){return function(t){for(var e=1;e\n
Player version:
\n
3.1.18
\n \n '),e.push('\n
\n
Video url:
\n
'.concat(this.art.option.url,"
\n
\n ")),e.push('\n
\n
Video volume:
\n
\n
\n '),e.push('\n
\n
Video time:
\n
\n
\n '),e.push('\n
\n
Video duration:
\n
\n
\n '),e.push('\n
\n
Video resolution:
\n
\n x \n
\n
\n '),e.join("")}},{key:"readInfo",value:function(){var e=this.art.template,t=e.$infoPanel,n=e.$video;pe("[data-video]",t).forEach(function(e){var t=n[e.dataset.video];e.innerHTML=void 0!==t?"number"==typeof t?t.toFixed(2):t:"unknown"})}},{key:"loop",value:function(){var e=this;this.readInfo(),this.timer=setTimeout(function(){e.readInfo(),e.loop()},1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template,n=t.$player,r=t.$infoPanel;e?(this.state=!0,de(n,"artplayer-info-show"),r.innerHTML||ve(r,this.creatInfo()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,ye(n,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),t}();var Ht=function(e){if(Array.isArray(e))return e};var Ut=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}};var Bt=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var Yt=function(e,t){return Ht(e)||Ut(e,t)||Bt()},Xt=function(){function n(e){c(this,n),this.art=e,this.state=!0,this.isInit=!1;var t=this.art.option.subtitle.url;t&&this.init(t)}return u(n,[{key:"switch",value:function(e,t){var n=1".concat(e,"

")}).join("")),this.art.emit("subtitle:update",u)},o=Yt(c.textTracks,1)[0];l.isInit||(l.isInit=!0,a(o,"cuechange",r.bind(l))),l.art.on("artplayerPluginSubtitleOffset",r.bind(l))}i(e)}})})}},{key:"load",value:function(t){var n=this.art.notice;return fetch(t).then(function(e){return e.text()}).then(function(e){switch(De(t)){case"srt":return $e(Re(e));case"ass":return $e(Ce(e));case"vtt":return $e(e);default:return t}}).catch(function(e){throw n.show(e),e})}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){var e=this.art.template.$track;return e?e.src:""}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ye(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,de(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),n}();function Zt(e){var n=this;c(this,Zt);var r=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'},e.option.icons);Object.keys(r).forEach(function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),ve(t,r[e]),n[e]=t})}var Jt=function(){function n(e){var t=this;c(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),e.whitelist.state&&e.once("video:canplay",function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],function(e){-1');ve(t,e.icons.state)}return u(n,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,ye(t,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),n}();function nn(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 rn(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(t.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(r.flip=n)},mounted:function(n){e.on("flipChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&je(e.parentElement,"current")})}})}}function on(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 an(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(t.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&je(e.parentElement,"current")})}})}}function cn(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 un(t){return function(r){var e=r.i18n,o=r.player,i=r.events.proxy;return function(t){for(var e=1;e\n '.concat(e.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);i(t,"change",function(){var e=t.value;n.innerText=e,o.playbackRate=Number(e)}),r.on("playbackRateChange",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}})}}var sn=function(){function n(e){var t=this;c(this,n),this.id=0,this.art=e,this.state=!1,e.option.setting&&(this.art.on("ready",function(){t.init()}),this.art.on("blur",function(){t.show=!1}))}return u(n,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",function(e){e.target===r&&(t.show=!1)}),this.add(rn({disable:!n.flip,name:"flip"})),this.add(an({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(un({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return it(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,ye(t,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),ln=function(){function t(e){c(this,t),this.art=e,this.name="artplayer_settings",this.init()}return u(t,[{key:"init",value:function(){var e=this.art.option,t=this.get("volume");t&&(e.volume=t)}},{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var n=Object.assign({},this.get(),d({},e,t));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),t}();function fn(r){var e=r.i18n,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);o(t,"change",function(){var e=t.value;n.innerText=e,r.plugins.subtitleOffset.offset(Number(e))}),r.on("subtitle:switch",function(){t.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}}}function pn(r){var o=r.constructor.utils.clamp,e=r.setting,i=r.notice,a=r.template,c=r.i18n,u=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),e.add(fn);var s=[];return r.on("subtitle:switch",function(){s=[]}),{name:"subtitleOffset",offset:function(e){if(a.$track&&a.$track.track){var t=Array.from(a.$track.track.cues),n=o(e,-5,5);t.forEach(function(e,t){s[t]||(s[t]={startTime:e.startTime,endTime:e.endTime}),e.startTime=o(s[t].startTime+n,0,u.duration),e.endTime=o(s[t].endTime+n,0,u.duration)}),i.show("".concat(c.get("Subtitle offset time"),": ").concat(e,"s")),r.emit("artplayerPluginSubtitleOffset",e)}else i.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function dn(e){var n=e.events.proxy,i=e.notice,a=e.i18n,c=e.template,u=e.player,s="Playback of this file format is not supported";function r(e){if(e){var t=De(e.name),n=c.$video.canPlayType(e.type);if("maybe"===n||"probably"===n){var r=URL.createObjectURL(e);u.switchUrl(r,e.name)}else{var o="".concat(a.get(s),": ").concat(e.type||t);i.show(o,!0,3e3),Ee(!1,o)}}}return a.update({"zh-cn":d({},s,"不支持播放该文件格式"),"zh-tw":d({},s,"不支持播放該文件格式")}),n(c.$player,"dragover",function(e){e.preventDefault()}),n(c.$player,"drop",function(e){e.preventDefault(),r(e.dataTransfer.files[0])}),{name:"localVideo",attach:function(e){var t=ve(e,'');ge(e,"position","relative"),be(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){r(t.files[0])})}}}function yn(e){var n=e.events.proxy,r=e.notice,o=e.i18n,c=e.subtitle,u="Only supports subtitle files in .ass, .vtt and .srt format";return o.update({"zh-cn":d({},u,"只支持 .ass、.vtt 和 .srt 格式的字幕文件"),"zh-tw":d({},u,"只支持 .ass、.vtt 和 .srt 格式的字幕文件")}),{name:"localSubtitle",attach:function(e){var t=ve(e,'');ge(e,"position","relative"),be(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){!function(i){if(i){var a=De(i.name);if(["ass","vtt","srt"].includes(a)){var e=new FileReader;n(e,"load",function(e){var t=e.target.result;switch(a){case"srt":var n=$e(Re(t));c.switch(n,i.name);break;case"ass":var r=$e(Ce(t));c.switch(r,i.name);break;case"vtt":var o=$e(t);c.switch(o,i.name)}}),e.readAsText(i)}else{var t=o.get(u);r.show(t,!0,3e3),Ee(!1,t)}}}(t.files[0])})}}}function hn(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("controls:show",function(){e.style.display="none"}),t.on("destroy",function(){e.style.display="none"}),t.on("controls:hide",function(){e.style.display="block"}),t.on("video:timeupdate",function(){e.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function vn(r){var o=1e4,i=0,a=0,c=0,e=null;function t(){c=a=i=0,cancelAnimationFrame(e),e=null}function n(){e||!function n(){r.isDestroy||(e=requestAnimationFrame(function(){var e=Date.now();if(c){var t=e-c;a+=t,r.player.playing||(i+=t)}c=e,r.emit("networkMonitor",i/a),o<=a&&(a=i=0),n()}))}()}return r.on("play",n),r.on("pause",t),{name:"networkMonitor",reset:t,start:n,sample:function(e){o=e}}}function mn(t){var e=t.events,n=t.player,r=t.template,o=Ve(function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))},300);return e.proxy(window,"scroll",o),{name:"autoPip"}}function gn(t){c(this,gn);var n=t.option,r=t.events.proxy,o=t.template.$video;Ge.video.events.forEach(function(e){r(o,e,function(e){t.emit("video:".concat(e.type),e)})}),Object.keys(n.moreVideoAttr).forEach(function(e){o[e]=n.moreVideoAttr[e]}),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=Ue(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var e=n.type||De(n.url),i=n.customType[e];e&&i?(t.emit("beforeCustomType",e),i(o,n.url,t),t.emit("afterCustomType",e)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))}var bn=function(){function r(e){var t=this;c(this,r),this.art=e,this.id=0;var n=e.option;n.subtitle.url&&n.subtitleOffset&&this.add(pn),!n.isLive&&n.miniProgressBar&&this.add(hn),n.localVideo&&this.add(dn),n.localSubtitle&&this.add(yn),n.networkMonitor&&this.add(vn),n.autoPip&&this.add(mn),e.option.plugins.forEach(function(e){t.add(e)})}return u(r,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return Ee(!qe(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),r}(),wn=0,On=function(){function n(e){var t;return c(this,n),(t=l(this,f(n).call(this))).option=se(We(n.option,e),Je),t.isFocus=!1,t.isDestroy=!1,t.whitelist=new Ze(s(t)),t.template=new Qe(s(t)),t.events=new Jt(s(t)),t.whitelist.state?(t.storage=new ln(s(t)),t.icons=new Zt(s(t)),t.i18n=new tt(s(t)),t.notice=new en(s(t)),t.player=new ot(s(t)),t.layers=new Qt(s(t)),t.controls=new Dt(s(t)),t.contextmenu=new Nt(s(t)),t.subtitle=new Xt(s(t)),t.info=new Vt(s(t)),t.loading=new Kt(s(t)),t.hotkey=new Gt(s(t)),t.mask=new tn(s(t)),t.setting=new sn(s(t)),t.plugins=new bn(s(t))):t.mobile=new gn(s(t)),wn+=1,t.id=wn,n.instances.push(s(t)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),t}return t(n,le),u(n,[{key:"destroy",value:function(e){var t=0