/*! * artplayer.js v5.3.1 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};const a=/* @__PURE__ */t((e||(e=1,r.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===a(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(a(r)){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(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){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 o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function a(t){return t.constructor?t.constructor.name:null}function o(t,e){var a=2=1,d=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(i)||c,p="undefined"!==typeof window&&"undefined"!==typeof document;function h(t,e=document){return e.querySelector(t)}function u(t,e=document){return Array.from(e.querySelectorAll(t))}function m(t,e){return t.classList.add(e)}function f(t,e){return t.classList.remove(e)}function g(t,e){return t.classList.contains(e)}function v(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function y(t){return t.parentNode.removeChild(t)}function b(t,e,r){return t.style[e]=r,t}function w(t,e){for(const r in e)b(t,r,e[r]);return t}function x(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function k(t,e){x(t).forEach(t=>f(t,e)),m(t,e)}function $(t,e,r="top"){d||(t.setAttribute("aria-label",e),m(t,"hint--rounded"),m(t,`hint--${r}`))}function T(t,e=0){const r=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,n=r.top-e<=a&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return n&&i}function E(t,e){return A(t).includes(e)}function C(t,e){return e.parentNode.replaceChild(t,e),t}function z(t){return document.createElement(t)}function L(t="",e=""){const r=z("i");return m(r,"art-icon"),m(r,`art-icon-${t}`),v(r,e),r}function S(t,e){let r=document.getElementById(t);r||(r=document.createElement("style"),r.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(r)}):(document.head||document.documentElement).appendChild(r)),r.textContent=e}function M(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function I(t){return t.getBoundingClientRect()}function P(t,e){return new Promise((r,a)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const n=document.createElement("canvas"),i=n.getContext("2d");n.width=o.width*e,n.height=o.height*e,i.drawImage(o,0,0,n.width,n.height),n.toBlob(e=>{const o=URL.createObjectURL(e),n=new Image;n.onload=function(){r(n)},n.onerror=function(){URL.revokeObjectURL(o),a(new Error(`Image load failed: ${t}`))},n.src=o})}else r(o)},o.onerror=function(){a(new Error(`Image load failed: ${t}`))},o.src=t})}function A(t){if(t.composedPath)return t.composedPath();const e=[];let r=t.target;for(;r;)e.push(r),r=r.parentNode;return e.includes(window)||void 0===window||e.push(window),e}class R extends Error{constructor(t,e){super(t),"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function O(t,e){if(!t)throw new R(e);return t}function _(t){return t.includes("?")?_(t.split("?")[0]):t.includes("#")?_(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function V(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function Y(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function D(t){return t.charAt(0).toUpperCase()+t.slice(1)}function N(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),a=Math.floor(t-3600*e-60*r);return(e>0?[e,r,a]:[r,a]).map(t=>t<10?`0${t}`:String(t)).join(":")}function F(t){return t.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t))}const B=Object.defineProperty,{hasOwnProperty:H}=Object.prototype;function W(t,e){return H.call(t,e)}function j(t,e){return Object.getOwnPropertyDescriptor(t,e)}function U(...t){const e=t=>t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(a=>{const o=t[a],n=r[a];Array.isArray(o)&&Array.isArray(n)?t[a]=o.concat(...n):e(o)&&e(n)?t[a]=U(o,n):t[a]=n}),t),{})}function q(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let a=r.slice(0,3);return 1===r.length&&(a=`${r}00`),2===r.length&&(a=`${r}0`),`${e},${a}`})).replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").replace(/\{[\s\S]*?\}/g,"").concat("\r\n\r\n"));var e}function X(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function G(t){const e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t=""){return t.split(/[:.]/).map((t,e,r)=>{if(e===r.length-1){if(1===t.length)return`.${t}00`;if(2===t.length)return`.${t}0`}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?`.${t}`:`:${t}`}).join("")}return`WEBVTT\n\n${t.split(/\r?\n/).map(t=>{const a=t.match(e);return a?{start:r(a[1].trim()),end:r(a[2].trim()),text:a[5].replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}:null}).filter(t=>t).map((t,e)=>t?`${e+1}\n${t.start} --\x3e ${t.end}\n${t.text}`:"").filter(t=>t.trim()).join("\n\n")}`}function K(t=0){return new Promise(e=>setTimeout(e,t))}function Z(t,e){let r;return function(...a){clearTimeout(r),r=setTimeout(()=>(r=null,t.apply(this,a)),e)}}function J(t,e){let r=!1;return function(...a){r||(t.apply(this,a),r=!0,setTimeout(()=>{r=!1},e))}}const Q=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,ArtPlayerError:R,addClass:m,append:v,assToVtt:G,capitalize:D,clamp:Y,createElement:z,debounce:Z,def:B,download:V,errorHandle:O,escape:F,get:j,getComposedPath:A,getExt:_,getIcon:L,getRect:I,getStyle:function(t,e,r=!0){const a=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(a):a},has:W,hasClass:g,includeFromEvent:E,inverseClass:k,isBrowser:p,isIOS:l,isIOS13:c,isInViewport:T,isMobile:d,isSafari:s,loadImg:P,mergeDeep:U,query:h,queryAll:u,remove:y,removeClass:f,replaceElement:C,secondToTime:N,setStyle:b,setStyleText:S,setStyles:w,siblings:x,sleep:K,srtToVtt:q,supportsFlex:M,throttle:J,tooltip:$,unescape:function(t){const e={"&":"&","<":"<",">":">","'":"'",""":'"'},r=new RegExp(`(${Object.keys(e).join("|")})`,"g");return t.replace(r,t=>e[t]||t)},userAgent:i,vttToBlob:X},Symbol.toStringTag,{value:"Module"})),tt="array",et="boolean",rt="string",at="number",ot="object",nt="function";function it(t,e,r){return O(e===rt||e===at||t instanceof Element,`${r.join(".")} require '${rt}' or 'Element' type`)}const st={html:it,disable:`?${et}`,name:`?${rt}`,index:`?${at}`,style:`?${ot}`,click:`?${nt}`,mounted:`?${nt}`,tooltip:`?${rt}|${at}`,width:`?${at}`,selector:`?${tt}`,onSelect:`?${nt}`,switch:`?${et}`,onSwitch:`?${nt}`,range:`?${tt}`,onRange:`?${nt}`,onChange:`?${nt}`},lt={id:rt,container:it,url:rt,poster:rt,type:rt,theme:rt,lang:rt,volume:at,isLive:et,muted:et,autoplay:et,autoSize:et,autoMini:et,loop:et,flip:et,playbackRate:et,aspectRatio:et,screenshot:et,setting:et,hotkey:et,pip:et,mutex:et,backdrop:et,fullscreen:et,fullscreenWeb:et,subtitleOffset:et,miniProgressBar:et,useSSR:et,playsInline:et,lock:et,gesture:et,fastForward:et,autoPlayback:et,autoOrientation:et,airplay:et,proxy:`?${nt}`,plugins:[nt],layers:[st],contextmenu:[st],settings:[st],controls:[{...st,position:(t,e,r)=>{const a=["top","left","right"];return O(a.includes(t),`${r.join(".")} only accept ${a.toString()} as parameters`)}}],quality:[{default:`?${et}`,html:rt,url:rt}],highlight:[{time:at,text:rt}],thumbnails:{url:rt,number:at,column:at,width:at,height:at,scale:at},subtitle:{url:rt,name:rt,type:rt,style:ot,escape:et,encoding:rt,onVttLoad:nt},moreVideoAttr:ot,i18n:ot,icons:ot,cssVar:ot,customType:ot};class ct{constructor(t){this.id=0,this.art=t,this.cache=/* @__PURE__ */new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return g(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?m(e,r):f(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){const e="function"===typeof t?t(this.art):t;if(e.html=e.html||"",a(e,st),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`;O(!this.cache.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const o=z("div");m(o,`art-${this.name}`),m(o,`art-${this.name}-${r}`);const n=Array.from(this.$parent.children);o.dataset.index=e.index||this.id;const i=n.find(t=>Number(t.dataset.index)>=Number(o.dataset.index));i?i.insertAdjacentElement("beforebegin",o):v(this.$parent,o),e.html&&v(o,e.html),e.style&&w(o,e.style),e.tooltip&&$(o,e.tooltip);const s=[];if(e.click){const t=this.art.events.proxy(o,"click",t=>{t.preventDefault(),e.click.call(this.art,this,t)});s.push(t)}return e.selector&&["left","right"].includes(e.position)&&this.selector(e,o,s),this[r]=o,this.cache.set(r,{$ref:o,events:s,option:e}),e.mounted&&e.mounted.call(this.art,o),o}remove(t){O(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);for(const r of e.events)this.art.events.remove(r);this.cache.delete(t),delete this[t],y(e.$ref)}update(t){if(this.cache.has(t.name)){const e=this.cache.get(t.name);t=Object.assign(e.option,t),this.remove(t.name)}return this.add(t)}}class dt extends ct{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,d||this.init()}init(){const{option:t,proxy:e,template:{$player:r,$contextmenu:a}}=this.art;t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:a}}=e,o=a.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.playbackRate=Number(a),t.show=!1)},mounted:t=>{const r=h('[data-value="1"]',t);r&&k(r,"art-current"),e.on("video:ratechange",()=>{const r=u("span",t).find(t=>Number(t.dataset.value)===e.playbackRate);r&&k(r,"art-current")})}}}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:a}}=e,o=a.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.aspectRatio=a,t.show=!1)},mounted:t=>{const r=h('[data-value="default"]',t);r&&k(r,"art-current"),e.on("aspectRatio",e=>{const r=u("span",t).find(t=>t.dataset.value===e);r&&k(r,"art-current")})}}}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:a}}=e,o=a.map(t=>`${r.get(D(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.flip=a.toLowerCase(),t.show=!1)},mounted:t=>{const r=h('[data-value="normal"]',t);r&&k(r,"art-current"),e.on("flip",e=>{const r=u("span",t).find(t=>t.dataset.value===e);r&&k(r,"art-current")})}}}}({name:"flip",index:30})),this.add(function(t){return e=>({...t,html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){const e=p?location.href:"";return{...t,html:`ArtPlayer ${o}`}}({name:"version",index:50})),this.add(function(t){return e=>({...t,html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let o=0;o{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const e=t.clientX,o=t.clientY,{height:n,width:i,left:s,top:l}=I(r),{height:c,width:d}=I(a);let p=e-s,h=o-l;e+d>s+i&&(p=i-d),o+c>l+n&&(h=n-c),w(a,{top:`${h}px`,left:`${p}px`})}),e(r,"click",t=>{E(t,a)||(this.show=!1)}),this.art.on("blur",()=>{this.show=!1})}}function pt(t,e){const{$progress:r}=t.template,{left:a}=I(r),o=Y((d?e.touches[0].clientX:e.clientX)-a,0,r.clientWidth),n=o/r.clientWidth*t.duration;return{second:n,time:N(n),width:o,percentage:Y(o/r.clientWidth,0,1)}}function ht(t,e){if(t.isRotate){const r=e.touches[0].clientY/t.height,a=r*t.duration;t.emit("setBar","played",r,e),t.seek=a}else{const{second:r,percentage:a}=pt(t,e);t.emit("setBar","played",a,e),t.seek=r}}function ut(t){return e=>{const{icons:r,option:a,proxy:o}=e,{$player:n}=e.template;return{...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{let i=null,s=!1;const l=h(".art-progress-hover",t),c=h(".art-progress-loaded",t),p=h(".art-progress-played",t),u=h(".art-progress-highlight",t),g=h(".art-progress-indicator",t),y=h(".art-progress-tip",t);function w(r,a){const{width:o,time:n}=a||pt(e,r);y.textContent=n||"00:00";const i=y.clientWidth;o<=i/2?b(y,"left",0):o>t.clientWidth-i/2?b(y,"left",t.clientWidth-i+"px"):b(y,"left",o-i/2+"px")}r.indicator?v(g,r.indicator):b(g,"backgroundColor","var(--art-theme)"),e.on("setBar",function(r,a,o){const s="played"===r&&o&&d;if("loaded"===r&&b(c,"width",100*a+"%"),"hover"===r&&(b(l,"width",100*a+"%"),E(o,u)?function(r){const{width:a}=pt(e,r),{text:o}=r.target.dataset;y.textContent=o;const n=y.clientWidth;a<=n/2?b(y,"left",0):a>t.clientWidth-n/2?b(y,"left",t.clientWidth-n+"px"):b(y,"left",a-n/2+"px")}(o):w(o),0===a?f(n,"art-progress-hover"):m(n,"art-progress-hover")),"played"===r&&(b(p,"width",100*a+"%"),b(g,"left",100*a+"%")),s){m(n,"art-progress-hover");w(o,{width:t.clientWidth*a,time:N(a*e.duration)}),clearTimeout(i),i=setTimeout(()=>{f(n,"art-progress-hover")},500)}}),e.on("video:loadedmetadata",function(){u.textContent="";for(let t=0;t`;v(u,n)}}),e.constructor.USE_RAF?e.on("raf",()=>{e.emit("setBar","played",e.played),e.emit("setBar","loaded",e.loaded)}):(e.on("video:timeupdate",()=>{e.emit("setBar","played",e.played)}),e.on("video:progress",()=>{e.emit("setBar","loaded",e.loaded)}),e.on("video:ended",()=>{e.emit("setBar","played",1)})),e.emit("setBar","loaded",e.loaded||0),d||(o(t,"click",t=>{t.target!==g&&ht(e,t)}),o(t,"mousemove",t=>{const{percentage:r}=pt(e,t);e.emit("setBar","hover",r,t)}),o(t,"mouseleave",t=>{e.emit("setBar","hover",0,t)}),o(t,"mousedown",t=>{s=0===t.button}),e.on("document:mousemove",t=>{if(s){const{second:r,percentage:a}=pt(e,t);e.emit("setBar","played",a,t),e.seek=r}}),e.on("document:mouseup",()=>{s&&(s=!1)}))}}}}class mt extends ct{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:a}=this.art.template;t.on("mousemove",()=>{d||(this.show=!0)}),t.on("click",()=>{d?this.toggle():this.show=!0}),t.on("document:mousemove",t=>{this.isHover=E(t,a)}),t.on("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),t.on("control",t=>{t?(f(r,"art-hide-cursor"),m(r,"art-hover"),this.timer=Date.now()):(m(r,"art-hide-cursor"),f(r,"art-hover"))}),this.init()}init(){const{option:t}=this.art;t.isLive||this.add(ut({name:"progress",position:"top",index:10})),this.add({name:"thumbnails",position:"top",index:20}),this.add(function(t){return e=>({...t,mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=v(t,a.play),i=v(t,a.pause);function s(){b(n,"display","flex"),b(i,"display","none")}function l(){b(n,"display","none"),b(i,"display","flex")}$(n,o.get("Play")),$(i,o.get("Pause")),r(n,"click",()=>{e.play()}),r(i,"click",()=>{e.pause()}),e.playing?l():s(),e.on("video:playing",()=>{l()}),e.on("video:pause",()=>{s()})}})}({name:"playAndPause",position:"left",index:10})),this.add(function(t){return e=>({...t,mounted:t=>{const{proxy:r,icons:a}=e,o=v(t,a.volume),n=v(t,a.volumeClose),i=v(t,'
'),s=v(i,'
'),l=v(s,'
'),c=v(s,'
'),p=v(c,'
'),h=v(p,'
'),u=v(c,'
');function m(t){const{top:e,height:r}=I(c);return 1-(t.clientY-e)/r}function f(){if(e.muted||0===e.volume)b(o,"display","none"),b(n,"display","flex"),b(u,"top","100%"),b(h,"top","100%"),l.textContent=0;else{const t=100*e.volume;b(o,"display","flex"),b(n,"display","none"),b(u,"top",100-t+"%"),b(h,"top",100-t+"%"),l.textContent=Math.floor(t)}}if(f(),e.on("video:volumechange",f),r(o,"click",()=>{e.muted=!0}),r(n,"click",()=>{e.muted=!1}),d)b(i,"display","none");else{let t=!1;r(c,"mousedown",r=>{t=0===r.button,e.volume=m(r)}),e.on("document:mousemove",r=>{t&&(e.muted=!1,e.volume=m(r))}),e.on("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),t.isLive||this.add(function(t){return e=>({...t,style:d?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{function r(){const r=`${N(e.currentTime)} / ${N(e.duration)}`;r!==t.textContent&&(t.textContent=r)}r();const a=["video:loadedmetadata","video:timeupdate","video:progress"];for(let o=0;o{this.art.quality=t.quality}),t.screenshot&&!d&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r,icons:a}=e;v(t,a.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),t.setting&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e;v(t,a.setting),r(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),e.on("setting",e=>{$(t,o.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),t.pip&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e;v(t,a.pip),r(t,"click",()=>{e.pip=!e.pip}),e.on("pip",e=>{$(t,o.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),t.airplay&&window.WebKitPlaybackTargetAvailabilityEvent&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r,icons:a}=e;v(t,a.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),t.fullscreenWeb&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=v(t,a.fullscreenWebOn),i=v(t,a.fullscreenWebOff);b(i,"display","none"),r(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),e.on("fullscreenWeb",e=>{e?($(t,o.get("Exit Web Fullscreen")),b(n,"display","none"),b(i,"display","inline-flex")):($(t,o.get("Web Fullscreen")),b(n,"display","inline-flex"),b(i,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),t.fullscreen&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=v(t,a.fullscreenOn),i=v(t,a.fullscreenOff);b(i,"display","none"),r(t,"click",()=>{e.fullscreen=!e.fullscreen}),e.on("fullscreen",e=>{e?($(t,o.get("Exit Fullscreen")),b(n,"display","none"),b(i,"display","inline-flex")):($(t,o.get("Fullscreen")),b(n,"display","inline-flex"),b(i,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let e=0;et.selector}),B(e,"$control_item",{get:()=>r}),B(e,"$control_value",{get:()=>o})}const i=a(n,"click",async e=>{const r=A(e),a=t.selector.find(t=>t.$control_item===r.find(e=>t.$control_item===e));this.check(a),t.onSelect&&(o.innerHTML=await t.onSelect.call(this.art,a,a.$control_item,e))});r.push(i)}}function ft(t,e,r,a){const o=e-a,n=r-t;let i=0;if(Math.abs(n)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(n,o);return s>=-45&&s<45?i=4:s>=45&&s<135?i=1:s>=-135&&s<-45?i=2:(s>=135&&s<=180||s>=-180&&s<-135)&&(i=3),i}class gt{constructor(t){this.destroyEvents=/* @__PURE__ */new Set,this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:a,$video:o}}=t;function n(e){E(e,a)?(t.isInput="INPUT"===e.target.tagName,t.isFocus=!0,t.emit("focus",e)):(t.isInput=!1,t.isFocus=!1,t.emit("blur",e))}t.on("document:click",n),t.on("document:contextmenu",n);let i=[];e.proxy(o,"click",e=>{const a=Date.now();i.push(a);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:n,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>a-t<=n);switch(c.length){case 1:t.emit("click",e),d?!t.isLock&&o&&t.toggle():t.toggle(),i=c;break;case 2:t.emit("dblclick",e),d?!t.isLock&&s&&t.toggle():l&&(t.fullscreen=!t.fullscreen),i=[];break;default:i=[]}})}(t,this),function(t,e){const{$player:r}=t.template;e.hover(r,e=>{m(r,"art-hover"),t.emit("hover",!0,e)},e=>{f(r,"art-hover"),t.emit("hover",!1,e)})}(t,this),function(t,e){const{$player:r}=t.template;e.proxy(r,"mousemove",e=>{t.emit("mousemove",e)})}(t,this),function(t,e){const{option:r,constructor:a}=t;t.on("resize",()=>{const{aspectRatio:e,notice:a}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,a.show=""});const o=Z(()=>t.emit("resize"),a.RESIZE_TIME);t.on("window:orientationchange",()=>o()),t.on("window:resize",()=>o()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>o())}(t,this),function(t,e){if(d&&!t.option.isLive){const{$video:r,$progress:a}=t.template;let o=null,n=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===a&&ht(t,e),n=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&n&&t.duration){const{pageX:a,pageY:n}=e.touches[0],c=ft(i,s,a,n),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=Y((a-i)/t.width,-1,1),d=Y((n-s)/t.height,-1,1),p=t.isRotate?d:c,h=o===r?t.constructor.TOUCH_MOVE_RATIO:1,u=Y(l+t.duration*p*h,0,t.duration);t.seek=u,t.emit("setBar","played",Y(u/t.duration,0,1),e),t.notice.show=`${N(u)} / ${N(t.duration)}`}}},p=()=>{n&&(i=0,s=0,l=0,n=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(a,"touchstart",t=>{o=a,c(t)}),e.proxy(a,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:a}}=t,o=J(()=>{t.emit("view",T(a,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>o()),t.on("view",r=>{e.autoMini&&(t.mini=!r)})}(t),function(t,e){const r=["click","mouseup","keydown","touchend","touchmove","mousemove","pointerup","contextmenu","pointermove","visibilitychange","webkitfullscreenchange"],a=["resize","scroll","orientationchange"],o=[];function n(n={}){for(let t=0;t{const a=n.document||i.ownerDocument||document,s=e.proxy(a,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),a.forEach(r=>{const a=n.window||i.ownerDocument?.defaultView||window,s=e.proxy(a,r,e=>{t.emit(`window:${r}`,e)});o.push(s)})}n(),e.bindGlobalEvents=n}(t,this),function(t){if(t.constructor.USE_RAF){let e=null;!function r(){t.playing&&t.emit("raf"),t.isDestroy||(e=requestAnimationFrame(r))}(),t.on("destroy",()=>{cancelAnimationFrame(e)})}}(t)}proxy(t,e,r,a={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,a));t.addEventListener(e,r,a);const o=()=>t.removeEventListener(e,r,a);return this.destroyEvents.add(o),o}hover(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}remove(t){if(this.destroyEvents.has(t))try{t()}catch(e){console.warn("Failed to remove event listener:",e)}finally{this.destroyEvents.delete(t)}}destroy(){for(const e of this.destroyEvents)try{e()}catch(t){console.warn("Failed to destroy event listener:",t)}this.destroyEvents.clear()}}class vt{constructor(t){this.art=t,this.keys={},d||this.init()}init(){const{constructor:t}=this.art;this.art.option.hotkey&&(this.add("Escape",()=>{this.art.fullscreenWeb&&(this.art.fullscreenWeb=!1)}),this.add("Space",()=>{this.art.toggle()}),this.add("ArrowLeft",()=>{this.art.backward=t.SEEK_STEP}),this.add("ArrowUp",()=>{this.art.volume+=t.VOLUME_STEP}),this.add("ArrowRight",()=>{this.art.forward=t.SEEK_STEP}),this.add("ArrowDown",()=>{this.art.volume-=t.VOLUME_STEP})),this.art.on("document:keydown",t=>{if(this.art.isFocus){const e=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==r&&"true"!==r&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey){const e=this.keys[t.code];if(e){t.preventDefault();for(let r=0;r\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\n',play:'\n \n',pause:'\n \n',check:'\n\n',volume:'\n \n \n',volumeClose:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',pip:'\n\n',arrowLeft:'\n \n',arrowRight:'\n \n',playbackRate:'',aspectRatio:'',config:'',lock:'\n\n\n\n\n',flip:'\n\n\n\n\n\n',unlock:'\n\n\n',fullscreenOff:'\n\n\n\n\n',fullscreenOn:'\n\n\n\n\n',fullscreenWebOff:'\n\n\n\n\n',fullscreenWebOn:'\n\n\n\n\n',switchOn:'\n\n\n \n',switchOff:'\n\n\n \n\n',error:'\n\n\n\n\n',close:'\n\n\n\n\n',airplay:'\n \n \n \n \n\n',...t.option.icons};for(const r in e)B(this,r,{get:()=>L(r,e[r])})}}class xt extends ct{constructor(t){super(t),this.name="info",d||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:a,$video:o}}=this.art;t(a,"click",()=>{this.show=!1});let n=null;const i=u("[data-video]",r)||[];this.art.on("destroy",()=>clearTimeout(n)),function t(){for(let e=0;e{b(o,"display","none"),b(n,"display",null)}),a.proxy(e.$state,"click",()=>t.play())}}class Et{constructor(t){this.art=t,this.timer=null,t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){const{constructor:e,template:{$player:r,$noticeInner:a}}=this.art;t?(a.textContent=t instanceof Error?t.message.trim():t,m(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{a.textContent="",f(r,"art-notice-show")},e.NOTICE_TIME)):f(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}const Ct=[["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"]],zt=(()=>{if("undefined"===typeof document)return!1;const t=Ct[0],e={};for(const r of Ct){if(r[1]in document){for(const[a,o]of r.entries())e[t[a]]=o;return e}}return!1})(),Lt={change:zt.fullscreenchange,error:zt.fullscreenerror},St={request:(t=document.documentElement,e)=>new Promise((r,a)=>{const o=()=>{St.off("change",o),r()};St.on("change",o);const n=t[zt.requestFullscreen](e);n instanceof Promise&&n.then(o).catch(a)}),exit:()=>new Promise((t,e)=>{if(!St.isFullscreen)return void t();const r=()=>{St.off("change",r),t()};St.on("change",r);const a=document[zt.exitFullscreen]();a instanceof Promise&&a.then(r).catch(e)}),toggle:(t,e)=>St.isFullscreen?St.exit():St.request(t,e),onchange(t){St.on("change",t)},onerror(t){St.on("error",t)},on(t,e){const r=Lt[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Lt[t];r&&document.removeEventListener(r,e,!1)},raw:zt};function Mt(t){const{i18n:e,notice:r,template:{$video:a,$player:o}}=t;t.once("video:loadedmetadata",()=>{var n;St.isEnabled?(n=t,St.on("change",()=>{n.emit("fullscreen",St.isFullscreen),St.isFullscreen?(n.state="fullscreen",m(o,"art-fullscreen")):f(o,"art-fullscreen"),n.emit("resize")}),St.on("error",t=>{n.emit("fullscreenError",t)}),B(n,"fullscreen",{get:()=>St.isFullscreen,async set(t){t?await St.request(o):await St.exit()}})):a.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),B(t,"fullscreen",{get:()=>document.fullscreenElement===a,set(e){e?(t.state="fullscreen",a.webkitEnterFullscreen()):a.webkitExitFullscreen()}})})(t):B(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),B(t,"fullscreen",j(t,"fullscreen"))})}function It(t){const{icons:e,proxy:r,storage:a,template:{$player:o,$video:n}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(f(o,"art-mini"),b(e,"display","none"),o.prepend(n),t.emit("mini",!1))}function d(e,r){t.playing?(b(e,"display","none"),b(r,"display","flex")):(b(e,"display","flex"),b(r,"display","none"))}function p(){const{$mini:e}=t.template,r=I(e),o=window.innerHeight-r.height-50,n=window.innerWidth-r.width-50;a.set("top",o),a.set("left",n),b(e,"top",`${o}px`),b(e,"left",`${n}px`)}B(t,"mini",{get:()=>g(o,"art-mini"),set(h){if(h){t.state="mini",m(o,"art-mini");const h=function(){const{$mini:o}=t.template;if(o)return v(o,n),b(o,"display","flex");{const o=z("div");m(o,"art-mini-popup"),v(document.body,o),t.template.$mini=o,v(o,n);const p=v(o,'
');v(p,e.close),r(p,"click",c);const h=v(o,'
'),u=v(h,e.play),g=v(h,e.pause);return r(u,"click",()=>t.play()),r(g,"click",()=>t.pause()),d(u,g),t.on("video:playing",()=>d(u,g)),t.on("video:pause",()=>d(u,g)),t.on("video:timeupdate",()=>d(u,g)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){m(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;b(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,f(o,"art-mini-dragging");const t=I(o);a.set("left",t.left),a.set("top",t.top),b(o,"left",`${t.left}px`),b(o,"top",`${t.top}px`),b(o,"transform",null)}}),o}}(),u=a.get("top"),g=a.get("left");"number"===typeof u&&"number"===typeof g?(b(h,"top",`${u}px`),b(h,"left",`${g}px`),T(h)||p()):p(),t.emit("mini",!0)}else c()}})}function Pt(t){const{i18n:e,notice:r,template:{$video:a}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:a}=t;e.disablePictureInPicture=!1,B(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw a.show=t,t})):document.exitPictureInPicture().catch(t=>{throw a.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):a.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),B(t,"pip",{get:()=>"picture-in-picture"===e.webkitPresentationMode,set(r){r?(t.state="pip",e.webkitSetPresentationMode("picture-in-picture"),t.emit("pip",!0)):(e.webkitSetPresentationMode("inline"),t.emit("pip",!1))}})}(t):B(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function At(t){const{option:e,template:{$progress:r,$video:a}}=t;let o=null,n=!1,i=null;t.on("setBar",async(o,s,l)=>{const c=t.controls?.thumbnails,{url:p,scale:h}=e.thumbnails;if(!c||!p)return;if("hover"===o||"played"===o&&l&&d){if(i||n||(n=!0,i=await P(p,h),n=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?b(n,"left",r.clientWidth-h+"px"):b(n,"left",o-h/2+"px")}(o)}}),B(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,n=!1,i=null)}})}Object.defineProperties(St,{isFullscreen:{get:()=>Boolean(document[zt.fullscreenElement])},element:{enumerable:!0,get:()=>document[zt.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[zt.fullscreenEnabled])}});class Rt{constructor(t){!function(t){const{option:e,template:{$video:r}}=t;B(t,"url",{get:()=>r.src,async set(a){if(a){const o=t.url,n=e.type||_(a),i=e.customType[n];n&&i?(await K(),t.loading.show=!0,i.call(t,r,a,t)):(URL.revokeObjectURL(o),r.src=a),o!==t.url&&(t.option.url=a,t.isReady&&o&&t.once("video:canplay",()=>{t.emit("restart",a)}))}else await K(),t.loading.show=!0}})}(t),function(t){const{template:{$video:e}}=t;B(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:a,constructor:{instances:o},template:{$video:n}}=t;B(t,"play",{async value(){const i=await n.play();if(r.show=e.get("Play"),t.emit("play"),a.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;B(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${N(t.currentTime)} / ${N(t.duration)}`),t.emit("seek",t.currentTime,r)}}),B(t,"forward",{set(e){t.seek=t.currentTime+e}}),B(t,"backward",{set(e){t.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:a,storage:o}=t;B(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=Y(t,0,1),a.show=`${r.get("Volume")}: ${Number.parseInt(100*e.volume,10)}`,0!==e.volume&&o.set("volume",e.volume)}}),B(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;B(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{r=Number.parseFloat(r),Number.isNaN(r)||(e.currentTime=Y(r,0,t.duration))}})}(t),function(t){B(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){function e(e,r){return new Promise((a,o)=>{if(e===t.url)return void a();const{playing:n,aspectRatio:i,playbackRate:s}=t;t.pause(),t.url=e,t.notice.show="";const l={error:e=>{t.off("video:canplay",l.canplay),t.off("video:loadedmetadata",l.metadata),o(e)},metadata:()=>{t.currentTime=r},canplay:async()=>{t.off("video:error",l.error),t.playbackRate=s,t.aspectRatio=i,n&&await t.play(),t.notice.show="",a()}};t.once("video:error",l.error),t.once("video:loadedmetadata",l.metadata),t.once("video:canplay",l.canplay)})}B(t,"switchQuality",{value:r=>e(r,t.currentTime)}),B(t,"switchUrl",{value:t=>e(t,0)}),B(t,"switch",{set:t.switchUrl})}(t),function(t){const{template:{$video:e},i18n:r,notice:a}=t;B(t,"playbackRate",{get:()=>e.playbackRate,set(o){if(o){if(o===e.playbackRate)return;e.playbackRate=o,a.show=`${r.get("Rate")}: ${1===o?r.get("Normal"):`${o}x`}`}else t.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:a,$player:o}}=t;B(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(n){if(n||(n="default"),"default"===n)b(a,"width",null),b(a,"height",null),b(a,"margin",null),delete o.dataset.aspectRatio;else{const t=n.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(b(a,"width",s*r+"px"),b(a,"height","100%"),b(a,"margin","0 auto")):(b(a,"width","100%"),b(a,"height",e/s+"px"),b(a,"margin","auto 0")),o.dataset.aspectRatio=n}r.show=`${e.get("Aspect Ratio")}: ${"default"===n?e.get("Default"):n}`,t.emit("aspectRatio",n)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,a=z("canvas");B(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{a.width=r.videoWidth,a.height=r.videoHeight,a.getContext("2d").drawImage(r,0,0),t(a.toDataURL("image/png"))}catch(n){e.show=n,o(n)}})}),B(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{a.width=r.videoWidth,a.height=r.videoHeight,a.getContext("2d").drawImage(r,0,0),a.toBlob(e=>{t(URL.createObjectURL(e))})}catch(n){e.show=n,o(n)}})}),B(t,"screenshot",{value:async e=>{const a=await t.getDataURL();return V(a,`${e||`artplayer_${N(r.currentTime)}`}.png`),t.emit("screenshot",a),a}})}(t),Mt(t),function(t){const{constructor:e,template:{$container:r,$player:a}}=t;let o="";B(t,"fullscreenWeb",{get:()=>g(a,"art-fullscreen-web"),set(n){n?(o=a.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&v(document.body,a),t.state="fullscreenWeb",b(a,"width","100%"),b(a,"height","100%"),m(a,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&v(r,a),o&&(a.style.cssText=o,o=""),f(a,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Pt(t),function(t){const{$video:e}=t.template;B(t,"loaded",{get:()=>t.loadedTime/e.duration}),B(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){B(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;B(t,"playing",{get:()=>"boolean"===typeof e.playing?e.playing:!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)})}(t),function(t){const{$container:e,$player:r,$video:a}=t.template;B(t,"autoSize",{value(){const{videoWidth:o,videoHeight:n}=a,{width:i,height:s}=I(e),l=o/n;if(i/s>l)b(r,"width",s*l/i*100+"%"),b(r,"height","100%");else{const t=i/l/s*100;b(r,"width","100%"),b(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){B(t,"rect",{get:()=>I(t.template.$player)});const e=["bottom","height","left","right","top","width"];for(let r=0;rt.rect[a]})}B(t,"x",{get:()=>t.left+window.pageXOffset}),B(t,"y",{get:()=>t.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:a}=t;B(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,a.show=`${r.get("Video Flip")}: ${r.get(D(o))}`,t.emit("flip",o)}})}(t),It(t),function(t){const{template:{$poster:e}}=t;B(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){b(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;B(t,"autoHeight",{value(){const{clientWidth:a}=e,{videoHeight:o,videoWidth:n}=r,i=o*(a/n);b(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;B(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){B(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){B(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];B(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let a=0;aa.$track?.offset||0,set(o){const{cues:n}=t.subtitle;if(!a.$track||0===n.length)return;const i=Y(o,-10,10);a.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":n=!0;break;case"not-available":n=!1}}):n=!1,B(t,"airplay",{value(){n?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),function(t){B(t,"quality",{set(e){const{controls:r,notice:a,i18n:o}=t,n=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:n?.html||"",selector:e,onSelect:async e=>(await t.switchQuality(e.url),a.show=`${o.get("Switch Video")}: ${e.html}`,e.html)})}})}(t),At(t),function(t){const{i18n:e,notice:r,option:a,constructor:o,proxy:i,template:{$player:s,$video:l,$poster:c}}=t;let p=0;for(let d=0;d{t.emit(`video:${e.type}`,e)});t.on("video:canplay",()=>{p=0,t.loading.show=!1}),t.once("video:canplay",()=>{t.loading.show=!1,t.controls.show=!0,t.mask.show=!0,t.isReady=!0,t.emit("ready")}),t.on("video:ended",()=>{a.loop?(t.seek=0,t.play(),t.controls.show=!1,t.mask.show=!1):(t.controls.show=!0,t.mask.show=!0)}),t.on("video:error",async n=>{p{t.emit("resize"),d&&(t.loading.show=!1,t.controls.show=!0,t.mask.show=!0)}),t.on("video:loadstart",()=>{t.loading.show=!0,t.mask.show=!1,t.controls.show=!0}),t.on("video:pause",()=>{t.controls.show=!0,t.mask.show=!0}),t.on("video:play",()=>{t.mask.show=!1,b(c,"display","none")}),t.on("video:playing",()=>{t.mask.show=!1}),t.on("video:progress",()=>{t.playing&&(t.loading.show=!1)}),t.on("video:seeked",()=>{t.loading.show=!1,t.mask.show=!0}),t.on("video:seeking",()=>{t.loading.show=!0,t.mask.show=!1}),t.on("video:timeupdate",()=>{t.mask.show=!1}),t.on("video:waiting",()=>{t.loading.show=!0,t.mask.show=!1})}(t),function(t){const{option:e,storage:r,template:{$video:a,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(a.volume=Y(e.volume,0,1));const n=r.get("volume");"number"===typeof n&&(a.volume=Y(n,0,1)),e.poster&&b(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(a.autoplay=e.autoplay),e.playsInline&&(a.playsInline=!0,a["webkit-playsinline"]=!0),e.theme&&(e.cssVar["--art-theme"]=e.theme);for(const i in e.cssVar)t.cssVar(i,e.cssVar[i]);t.url=e.url}(t)}}function Ot(t){const{notice:e,constructor:r,template:{$player:a,$video:o}}=t,n="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,a=document.documentElement.clientHeight;return t>e&&ra}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!g(a,n)&&function(){const e=document.documentElement.clientWidth,r=document.documentElement.clientHeight;b(a,"width",`${r}px`),b(a,"height",`${e}px`),b(a,"transform-origin","0 0"),b(a,"transform",`rotate(90deg) translate(0, -${e}px)`),m(a,n),t.isRotate=!0,t.emit("resize")}()},e)}}else g(a,n)&&(b(a,"width",""),b(a,"height",""),b(a,"transform-origin",""),b(a,"transform",""),f(a,n),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",async t=>{const r=!!screen?.orientation?.lock;if(t){if(r&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";await screen.orientation.lock(t),s=!0,m(a,i)}catch(o){s=!1,e.show=o}}else if(g(a,i)&&f(a,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return g(a,n)}}}function _t(t){const{i18n:e,icons:r,storage:a,constructor:o,proxy:n,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=h(".art-auto-playback-last",s),c=h(".art-auto-playback-jump",s),d=h(".art-auto-playback-close",s);v(d,r.close);let p=null;function u(){const r=(a.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),b(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(b(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${N(r)}`,c.textContent=e.get("Jump Play"),n(d,"click",()=>{b(s,"display","none")}),n(c,"click",()=>{t.seek=r,t.play(),b(i,"display","none"),b(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{b(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=a.get("times")||{},r=Object.keys(e);r.length>o.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,a.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return a.get("times")||{}},clear:()=>a.del("times"),delete(t){const e=a.get("times")||{};return delete e[t],a.set("times",e),e}}}function Vt(t){const{constructor:e,proxy:r,template:{$player:a,$video:o}}=t;let n=null,i=!1,s=1;const l=()=>{clearTimeout(n),i&&(i=!1,t.playbackRate=s,f(a,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(n=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,m(a,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return g(a,"art-fast-forward")}}}function Yt(t){const{layers:e,icons:r,template:{$player:a}}=t;function o(){return g(a,"art-lock")}function n(){m(a,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){f(a,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const a=v(e,r.lock),o=v(e,r.unlock);b(a,"display","none"),t.on("lock",t=>{t?(b(a,"display","inline-flex"),b(o,"display","none")):(b(a,"display","none"),b(o,"display","inline-flex"))})},click(){o()?i():n()}}),{name:"lock",get state(){return o()},set state(t){t?n():i()}}}function Dt(t){return t.on("control",e=>{e?f(t.template.$player,"art-mini-progress-bar"):m(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Nt{constructor(t){this.art=t,this.id=0;const{option:e}=t;e.miniProgressBar&&!e.isLive&&this.add(Dt),e.lock&&d&&this.add(Yt),e.autoPlayback&&!e.isLive&&this.add(_t),e.autoOrientation&&d&&this.add(Ot),e.fastForward&&d&&!e.isLive&&this.add(Vt);for(let r=0;rthis.next(t,e)):this.next(t,e)}next(t,e){const r=e&&e.name||t.name||`plugin${this.id}`;return O(!W(this,r),`Cannot add a plugin that already has the same name: ${r}`),B(this,r,{value:e}),this}}class Ft extends ct{constructor(t){super(t);const{option:e,controls:r,template:{$setting:a}}=t;this.name="setting",this.$parent=a,this.id=0,this.active=null,this.cache=/* @__PURE__ */new Map,this.option=[...this.builtin,...e.settings],e.setting&&(this.format(),this.render(),t.on("blur",()=>{this.show&&(this.show=!1,this.render())}),t.on("focus",t=>{const e=E(t,r.setting),a=E(t,this.$parent);!this.show||e||a||(this.show=!1,this.render())}),t.on("resize",()=>this.resize()))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,PLAYBACK_RATE:o}}=t;function n(t){return 1===t?e.get("Normal"):t.toFixed(1)}function i(){const e=t.setting.find(`playback-rate-${t.playbackRate}`);t.setting.check(e)}return{width:a,name:"playback-rate",html:e.get("Play Speed"),tooltip:n(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:n(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:()=>{i(),t.on("video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,ASPECT_RATIO:o}}=t;function n(t){return"default"===t?e.get("Default"):t}function i(){const e=t.setting.find(`aspect-ratio-${t.aspectRatio}`);t.setting.check(e)}return{width:a,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:n(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:n(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:()=>{i(),t.on("aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,FLIP:o}}=t;function n(t){return e.get(D(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:a,name:"flip",html:e.get("Video Flip"),tooltip:n(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:n(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:()=>{i(),t.on("flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:a}=t;return{width:a.SETTING_ITEM_WIDTH,name:"subtitle-offset",html:e.get("Subtitle Offset"),icon:r.subtitle,tooltip:"0s",range:[0,-10,10,.1],onChange:e=>(t.subtitleOffset=e.range[0],`${e.range[0]}s`),mounted:(e,r)=>{t.on("subtitleOffset",t=>{r.$range.value=t,r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){for(let r=0;r{e.default=e===t,e.default&&e.$item&&k(e.$item,"art-current")},t.$option),this.render(t.$parents))}format(t=this.option,e,r,a=[]){for(let o=0;oe}),B(n,"$parents",{get:()=>r}),B(n,"$option",{get:()=>t});const a=[];B(n,"$events",{get:()=>a}),B(n,"$formatted",{get:()=>!0})}this.format(n.selector||[],n,t,a)}this.option=t}find(t=""){let e=null;return this.traverse(r=>{r.name===t&&(e=r)}),e}resize(){const{controls:t,constructor:{SETTING_WIDTH:e,SETTING_ITEM_HEIGHT:r},template:{$player:a,$setting:o}}=this.art;if(t.setting&&this.show){const n=this.active[0]?.$parent?.width||e,{left:i,width:s}=I(t.setting),{left:l,width:c}=I(a),p=i-l+s/2-n/2;if(b(o,"height",`${this.active===this.option?this.active.length*r:(this.active.length+1)*r}px`),b(o,"width",`${n}px`),this.art.isRotate||d)return;p+n>c?(b(o,"left",null),b(o,"right",null)):(b(o,"left",`${p}px`),b(o,"right","auto"))}}inactivate(t){for(let e=0;e'),s=z("div");m(s,"art-setting-item-left-icon"),v(s,a),v(i,s),v(i,t.$parent.html);const l=r(n,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),v(e,n)}createItem(t,e=!1){if(!this.cache.has(t.$option))return;const r=this.cache.get(t.$option),a=t.$item;let o="selector";W(t,"switch")&&(o="switch"),W(t,"range")&&(o="range"),W(t,"onClick")&&(o="button");const{icons:n,proxy:i,constructor:s}=this.art,l=z("div");m(l,"art-setting-item"),b(l,"height",`${s.SETTING_ITEM_HEIGHT}px`),l.dataset.name=t.name||"",l.dataset.value=t.value||"";const c=v(l,'
'),d=v(l,'
'),p=z("div");switch(m(p,"art-setting-item-left-icon"),o){case"button":case"switch":case"range":v(p,t.icon||n.config);break;case"selector":t.selector?.length?v(p,t.icon||n.config):v(p,n.check)}v(c,p),B(t,"$icon",{configurable:!0,get:()=>p}),B(t,"icon",{configurable:!0,get:()=>p.innerHTML,set(t){p.innerHTML="",v(p,t)}});const h=z("div");m(h,"art-setting-item-left-text"),v(h,t.html||""),v(c,h),B(t,"$html",{configurable:!0,get:()=>h}),B(t,"html",{configurable:!0,get:()=>h.innerHTML,set(t){h.innerHTML="",v(h,t)}});const u=z("div");switch(m(u,"art-setting-item-right-tooltip"),v(u,t.tooltip||""),v(d,u),B(t,"$tooltip",{configurable:!0,get:()=>u}),B(t,"tooltip",{configurable:!0,get:()=>u.innerHTML,set(t){u.innerHTML="",v(u,t)}}),o){case"switch":{const e=z("div");m(e,"art-setting-item-right-icon");const r=v(e,n.switchOn),a=v(e,n.switchOff);b(t.switch?a:r,"display","none"),v(d,e),B(t,"$switch",{configurable:!0,get:()=>e});let o=t.switch;B(t,"switch",{configurable:!0,get:()=>o,set(t){o=t,t?(b(a,"display","none"),b(r,"display",null)):(b(a,"display",null),b(r,"display","none"))}});break}case"range":{const e=z("div");m(e,"art-setting-item-right-icon");const r=v(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],m(r,"art-setting-range"),v(d,e),B(t,"$range",{configurable:!0,get:()=>r});let a=[...t.range];B(t,"range",{configurable:!0,get:()=>a,set(t){a=[...t],r.value=t[0],r.min=t[1],r.max=t[2],r.step=t[3]}})}break;case"selector":if(t.selector?.length){const t=z("div");m(t,"art-setting-item-right-icon"),v(t,n.arrowRight),v(d,t)}}switch(o){case"switch":if(t.onSwitch){const e=i(l,"click",async e=>{t.switch=await t.onSwitch.call(this.art,t,l,e)});t.$events.push(e)}break;case"range":if(t.$range){if(t.onRange){const e=i(t.$range,"change",async e=>{t.range[0]=t.$range.valueAsNumber,t.tooltip=await t.onRange.call(this.art,t,l,e)});t.$events.push(e)}if(t.onChange){const e=i(t.$range,"input",async e=>{t.range[0]=t.$range.valueAsNumber,t.tooltip=await t.onChange.call(this.art,t,l,e)});t.$events.push(e)}}break;case"selector":{const e=i(l,"click",async e=>{t.selector?.length?this.render(t.selector):(this.check(t),t.$parent.onSelect&&(t.$parent.tooltip=await t.$parent.onSelect.call(this.art,t,l,e)))});t.$events.push(e),t.default&&m(l,"art-current")}break;case"button":if(t.onClick){const e=i(l,"click",async e=>{t.tooltip=await t.onClick.call(this.art,t,l,e)});t.$events.push(e)}}B(t,"$item",{configurable:!0,get:()=>l}),e?C(l,a):v(r,l),t.mounted&&setTimeout(()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){if(this.active=t,this.cache.has(t)){k(this.cache.get(t),"art-current")}else{const e=z("div");this.cache.set(t,e),m(e,"art-setting-panel"),v(this.$parent,e),k(e,"art-current"),t[0]?.$parent&&this.createHeader(t[0]);for(let r=0;rnull,this.init(t.option.subtitle);let e=!1;t.on("video:timeupdate",()=>{if(!this.url)return;const t=this.art.template.$video.webkitDisplayingFullscreen;"boolean"===typeof t&&t!==e&&(e=t,this.createTrack(t?"subtitles":"metadata",this.url))})}get url(){return this.art.template.$track.src}set url(t){this.switch(t)}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return this.textTrack?Array.from(this.textTrack.activeCues):[]}get cues(){return this.textTrack?Array.from(this.textTrack.cues):[]}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?w(r,t):b(r,t,e)}update(){const{option:{subtitle:t},template:{$subtitle:e}}=this.art;e.innerHTML="",this.activeCues.length&&(this.art.emit("subtitleBeforeUpdate",this.activeCues),e.innerHTML=this.activeCues.map((e,r)=>e.text.split(/\r?\n/).filter(t=>t.trim()).map(e=>`
\n ${t.escape?F(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:a,option:o}=this.art,n={...o.subtitle,...e,url:t},i=await this.init(n);return e.name&&(a.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:a,option:o}=this.art,{$video:n,$track:i}=r,s=z("track");s.default=!0,s.kind=t,s.src=e,s.label=o.subtitle.name||"Artplayer",s.track.mode="hidden",s.onload=()=>{this.art.emit("subtitleLoad",this.cues,this.option)},this.art.events.remove(this.destroyEvent),i.onload=null,y(i),v(n,s),r.$track=s,this.destroyEvent=a(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(a(t,lt.subtitle),t.url?(this.option=t,this.style(t.style),fetch(t.url).then(t=>t.arrayBuffer()).then(e=>{const r=new TextDecoder(t.encoding).decode(e);switch(t.type||_(t.url)){case"srt":{const e=q(r);return X(t.onVttLoad(e))}case"ass":{const e=G(r);return X(t.onVttLoad(e))}case"vtt":return X(t.onVttLoad(r));default:return t.url}}).then(t=>(r.innerHTML="",this.url===t||(URL.revokeObjectURL(this.url),this.createTrack("metadata",t)),t)).catch(t=>{throw r.innerHTML="",e.show=t,t})):void 0):null}}class jt{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=h(e.container),O(this.$container,`No container element found by ${e.container}`)),O(M(),"The current browser does not support flex layout");const a=this.$container.tagName.toLowerCase();O("div"===a,`Unsupported container element type, only support 'div' but got '${a}'`),O(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=t.id,this.init()}static get html(){return`\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
${o}
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n `}query(t){return h(t,this.$container)}init(){const{option:t}=this.art;if(t.useSSR||(this.$container.innerHTML=jt.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query("track"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsCenter=this.query(".art-controls-center"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$contextmenu=this.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);O(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'"),C(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&m(this.$player,"art-backdrop"),d&&m(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":m(this.$player,"art-destroy")}}class Ut{on(t,e,r){const a=this.e||(this.e={});return(a[t]||(a[t]=[])).push({fn:e,ctx:r}),this}once(t,e,r){const a=this;function o(...n){a.off(t,o),e.apply(r,n)}return o._=e,this.on(t,o,r)}emit(t,...e){const r=((this.e||(this.e={}))[t]||[]).slice();for(let a=0;ae.call(this,this)),Gt.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Gt.version}`);for(let e=0;et(`Event@${e.type}`))}Xt.push(this)}static get instances(){return Xt}static get version(){return o}static get config(){return n}static get utils(){return Q}static get scheme(){return lt}static get Emitter(){return Ut}static get validator(){return a}static get kindOf(){return a.kindOf}static get html(){return jt.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,gesture:!0,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,proxy:void 0,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0,scale:1},subtitle:{url:"",type:"",style:{},name:"",escape:!0,encoding:"utf-8",onVttLoad:t=>t},moreVideoAttr:{controls:!1,preload:s?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:navigator?.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}get video(){return this.template.$video}reset(){this.video.removeAttribute("src"),this.video.load()}destroy(t=!0){Gt.REMOVE_SRC_WHEN_DESTROY&&this.reset(),this.events.destroy(),this.template.destroy(t),Xt.splice(Xt.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}Gt.STYLE=Ht,Gt.DEBUG=!1,Gt.CONTEXTMENU=!0,Gt.NOTICE_TIME=2e3,Gt.SETTING_WIDTH=250,Gt.SETTING_ITEM_WIDTH=200,Gt.SETTING_ITEM_HEIGHT=35,Gt.RESIZE_TIME=200,Gt.SCROLL_TIME=200,Gt.SCROLL_GAP=50,Gt.AUTO_PLAYBACK_MAX=10,Gt.AUTO_PLAYBACK_MIN=5,Gt.AUTO_PLAYBACK_TIMEOUT=3e3,Gt.RECONNECT_TIME_MAX=5,Gt.RECONNECT_SLEEP_TIME=1e3,Gt.CONTROL_HIDE_TIME=3e3,Gt.DBCLICK_TIME=300,Gt.DBCLICK_FULLSCREEN=!0,Gt.MOBILE_DBCLICK_PLAY=!0,Gt.MOBILE_CLICK_PLAY=!1,Gt.AUTO_ORIENTATION_TIME=200,Gt.INFO_LOOP_TIME=1e3,Gt.FAST_FORWARD_VALUE=3,Gt.FAST_FORWARD_TIME=1e3,Gt.TOUCH_MOVE_RATIO=.5,Gt.VOLUME_STEP=.1,Gt.SEEK_STEP=5,Gt.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Gt.ASPECT_RATIO=["default","4:3","16:9"],Gt.FLIP=["normal","horizontal","vertical"],Gt.FULLSCREEN_WEB_IN_BODY=!0,Gt.LOG_VERSION=!0,Gt.USE_RAF=!1,Gt.REMOVE_SRC_WHEN_DESTROY=!0,p&&(S("artplayer-style",Ht),setTimeout(()=>{Gt.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Gt.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100));export{Gt as default};