From 64d1939daae00042ad205d401a3ed52aa74418f4 Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Fri, 11 Sep 2026 06:49:04 +0800 Subject: [PATCH] refactor(core): CORE-14 split typed settings and scope tree lifetimes --- docs/compiled/artplayer.js | 2 +- docs/compiled/artplayer.legacy.js | 2 +- docs/compiled/artplayer.mjs | 1675 +++- package.json | 2 +- packages/artplayer/ARCHITECTURE.md | 85 + packages/artplayer/dist/artplayer.js | 2 +- packages/artplayer/dist/artplayer.legacy.js | 2 +- packages/artplayer/dist/artplayer.mjs | 1675 +++- packages/artplayer/src/setting/activity.ts | 22 + .../{aspectRatio.js => aspectRatio.ts} | 13 +- packages/artplayer/src/setting/checkpoint.ts | 40 + packages/artplayer/src/setting/events.ts | 65 + .../src/setting/{flip.js => flip.ts} | 12 +- packages/artplayer/src/setting/index.js | 558 -- packages/artplayer/src/setting/index.ts | 185 + packages/artplayer/src/setting/layout.ts | 71 + packages/artplayer/src/setting/model.ts | 183 + packages/artplayer/src/setting/panels.ts | 31 + .../{playbackRate.js => playbackRate.ts} | 13 +- .../artplayer/src/setting/registration.ts | 20 + packages/artplayer/src/setting/render.ts | 378 + packages/artplayer/src/setting/resources.ts | 202 + packages/artplayer/src/setting/selection.ts | 83 + .../artplayer/src/setting/subtitleOffset.js | 22 - .../artplayer/src/setting/subtitleOffset.ts | 25 + packages/artplayer/src/setting/types.ts | 80 + packages/artplayer/src/setting/update.ts | 210 + packages/artplayer/src/style/setting.less | 20 +- .../baselines/setting-manager-validation.json | 543 ++ .../setting-model-layout-validation.json | 200 + .../setting-ownership-validation.json | 4821 ++++++++++ .../baselines/setting-panels-validation.json | 3351 +++++++ .../setting-resources-validation.json | 426 + .../baselines/setting-update-validation.json | 4345 +++++++++ refactor/baselines/setting-validation.json | 8336 +++++++++++++++++ .../changes/2026-09-11-CORE-14-setting.md | 105 + refactor/core-design.md | 4 +- refactor/plan.md | 5 +- refactor/progress.md | 8 + refactor/risk-table.md | 8 +- refactor/risks.json | 180 +- refactor/tasks.json | 7 +- test/browser/setting-interaction.spec.js | 125 + test/browser/setting-ownership.spec.js | 155 + test/browser/setting-update.spec.js | 307 + test/browser/setting.spec.js | 545 ++ test/setting-layout.test.js | 22 + test/setting-model.test.js | 188 + test/setting-resources.test.js | 267 + test/types/setting-manager.ts | 17 + test/types/setting-model.ts | 20 + 51 files changed, 28144 insertions(+), 1519 deletions(-) create mode 100644 packages/artplayer/src/setting/activity.ts rename packages/artplayer/src/setting/{aspectRatio.js => aspectRatio.ts} (67%) create mode 100644 packages/artplayer/src/setting/checkpoint.ts create mode 100644 packages/artplayer/src/setting/events.ts rename packages/artplayer/src/setting/{flip.js => flip.ts} (67%) delete mode 100644 packages/artplayer/src/setting/index.js create mode 100644 packages/artplayer/src/setting/index.ts create mode 100644 packages/artplayer/src/setting/layout.ts create mode 100644 packages/artplayer/src/setting/model.ts create mode 100644 packages/artplayer/src/setting/panels.ts rename packages/artplayer/src/setting/{playbackRate.js => playbackRate.ts} (67%) create mode 100644 packages/artplayer/src/setting/registration.ts create mode 100644 packages/artplayer/src/setting/render.ts create mode 100644 packages/artplayer/src/setting/resources.ts create mode 100644 packages/artplayer/src/setting/selection.ts delete mode 100644 packages/artplayer/src/setting/subtitleOffset.js create mode 100644 packages/artplayer/src/setting/subtitleOffset.ts create mode 100644 packages/artplayer/src/setting/types.ts create mode 100644 packages/artplayer/src/setting/update.ts create mode 100644 refactor/baselines/setting-manager-validation.json create mode 100644 refactor/baselines/setting-model-layout-validation.json create mode 100644 refactor/baselines/setting-ownership-validation.json create mode 100644 refactor/baselines/setting-panels-validation.json create mode 100644 refactor/baselines/setting-resources-validation.json create mode 100644 refactor/baselines/setting-update-validation.json create mode 100644 refactor/baselines/setting-validation.json create mode 100644 refactor/changes/2026-09-11-CORE-14-setting.md create mode 100644 test/browser/setting-interaction.spec.js create mode 100644 test/browser/setting-ownership.spec.js create mode 100644 test/browser/setting-update.spec.js create mode 100644 test/browser/setting.spec.js create mode 100644 test/setting-layout.test.js create mode 100644 test/setting-model.test.js create mode 100644 test/setting-resources.test.js create mode 100644 test/types/setting-manager.ts create mode 100644 test/types/setting-model.ts diff --git a/docs/compiled/artplayer.js b/docs/compiled/artplayer.js index 4782ac7ff..504bc2dc9 100644 --- a/docs/compiled/artplayer.js +++ b/docs/compiled/artplayer.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var o=(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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function h(t){return p(t).scope}function u(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,o,n=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};o&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,n||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),n&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=h(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=v(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 z(t,e=document){return e.querySelector(t)}function S(t,e=document){return Array.from(e.querySelectorAll(t))}function L(t,e){return t.classList.add(e)}function M(t,e){return t.classList.remove(e)}function A(t,e){return t.classList.contains(e)}function P(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function I(t){return t.parentNode.removeChild(t)}function O(t,e,r){return t.style[e]=r,t}function R(t,e){for(const r in e)O(t,r,e[r]);return t}function _(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function V(t,e){_(t).forEach(t=>M(t,e)),L(t,e)}function Y(t,e,r="top"){E||(t.setAttribute("aria-label",e),L(t,"hint--rounded"),L(t,`hint--${r}`))}function D(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function N(t,e){return U(t).includes(e)}function F(t,e){return e.parentNode.replaceChild(t,e),t}function H(t){return document.createElement(t)}function B(t="",e=""){const r=H("i");return L(r,"art-icon"),L(r,`art-icon-${t}`),P(r,e),r}function W(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function j(t){return t.getBoundingClientRect()}function q(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function U(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}function X(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class G extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function K(t,e){if(!t)throw new G(e);return t}function Z(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function J(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function Q(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function tt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function et(t){return t.charAt(0).toUpperCase()+t.slice(1)}function rt(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ot={"&":"&","<":"<",">":">","'":"'",'"':"""},nt={"&":"&","<":"<",">":">","'":"'",""":'"'},at=/(&|<|>|'|")/g;function it(t){return t.replace(/[&<>'"]/g,t=>ot[t]||t)}const st=Object.defineProperty,{hasOwnProperty:lt}=Object.prototype;function ct(t,e){return lt.call(t,e)}function dt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function pt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?pt(n,a):a,st(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function ht(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 ut(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ft(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 mt(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const gt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:G,addClass:L,append:P,assToVtt:ft,capitalize:et,clamp:tt,createElement:H,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:st,download:Q,errorHandle:K,escape:it,get:dt,getComposedPath:U,getExt:J,getIcon:B,getRect:j,getSafeAreaInsets:X,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:ct,hasClass:A,includeFromEvent:N,inverseClass:V,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:D,isMobile:E,isSafari:x,loadImg:q,mergeDeep:pt,query:z,queryAll:S,remove:I,removeClass:M,replaceElement:F,secondToTime:rt,setStyle:O,setStyleText:C,setStyles:R,siblings:_,silencePromise:Z,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:ht,supportsFlex:W,throttle:mt,tooltip:Y,unescape:function(t){return t.replace(at,t=>nt[t]||t)},userAgent:w,vttToBlob:ut},Symbol.toStringTag,{value:"Module"}));function vt(t,e){return P(t,e)}function yt(t,e){return e.querySelector(t)}const bt="array",wt="boolean",xt="string",kt="number",$t="object",Et="function";function Tt(t,e,r){return K(e===xt||e===kt||t instanceof Element,`${r.join(".")} require '${xt}' or 'Element' type`)}const Ct={html:Tt,disable:`?${wt}`,name:`?${xt}`,index:`?${kt}`,style:`?${$t}`,click:`?${Et}`,mounted:`?${Et}`,tooltip:`?${xt}|${kt}`,width:`?${kt}`,selector:`?${bt}`,onSelect:`?${Et}`,switch:`?${wt}`,onSwitch:`?${Et}`,range:`?${bt}`,onRange:`?${Et}`,onChange:`?${Et}`},zt={id:xt,container:Tt,url:xt,poster:xt,type:xt,theme:xt,lang:xt,volume:kt,isLive:wt,muted:wt,autoplay:wt,autoSize:wt,autoMini:wt,loop:wt,flip:wt,playbackRate:wt,aspectRatio:wt,screenshot:wt,setting:wt,hotkey:wt,pip:wt,mutex:wt,backdrop:wt,fullscreen:wt,fullscreenWeb:wt,subtitleOffset:wt,miniProgressBar:wt,useSSR:wt,playsInline:wt,lock:wt,gesture:wt,fastForward:wt,autoPlayback:wt,autoOrientation:wt,airplay:wt,proxy:`?${Et}`,plugins:[Et],layers:[Ct],contextmenu:[Ct],settings:[Ct],controls:[{...Ct,position:(t,e,r)=>{const o=["top","left","right"];return K("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}}],quality:[{default:`?${wt}`,html:xt,url:xt}],highlight:[{time:kt,text:xt}],thumbnails:{url:xt,number:kt,column:kt,width:kt,height:kt,scale:kt},subtitle:{url:xt,name:xt,type:xt,style:$t,escape:wt,encoding:xt,onVttLoad:Et},moreVideoAttr:$t,i18n:$t,icons:$t,cssVar:$t,customType:$t},St=new WeakSet;class Lt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return A(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?L(e,r):M(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(u(this.art))return;const e="function"===typeof t?t(this.art):t;if(u(this.art))return;if(e.html=e.html||"",n(e,Ct),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,o=this.cache;K(!o.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){L(t,`art-${r}`),L(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):P(e,t),a.html&&P(t,a.html),a.style&&R(t,a.style),a.tooltip&&Y(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,r,a),c=!0,o.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw o.get(r)?.$ref===a&&o.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){K(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!St.has(e)){St.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{St.delete(e)}}}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 Mt extends Lt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=z('[data-value="1"]',t);o&&V(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&V(r,"art-current")})}}}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=z('[data-value="default"]',t);o&&V(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(r,"art-current")})}}}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:o}}=e,n=o.map(t=>`${r.get(et(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=z('[data-value="normal"]',t);o&&V(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=j(e),{height:c,width:d}=j(r);let p=o-s,h=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(h=a-c),R(r,{top:`${h}px`,left:`${p}px`})}),n(e,"click",t=>{N(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function At(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function Pt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function It(t,e){const{$progress:r}=t.template,{left:o}=j(r),n=tt((E?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:rt(a),width:n,percentage:tt(n/r.clientWidth,0,1)}}function Ot(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=It(t,e);t.emit("setBar","played",o,e),t.seek=r}}function Rt(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=yt(".art-progress-hover",e),c=yt(".art-progress-loaded",e),d=yt(".art-progress-played",e),p=yt(".art-progress-highlight",e),h=yt(".art-progress-indicator",e),u=yt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||It(t,r);u.textContent=a||"00:00";const i=u.clientWidth;n<=i/2?O(u,"left",0):n>e.clientWidth-i/2?O(u,"left",e.clientWidth-i+"px"):O(u,"left",n-i/2+"px")}r.indicator?P(h,r.indicator):O(h,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&E;if("loaded"===r&&O(c,"width",100*o+"%"),"hover"===r&&(O(l,"width",100*o+"%"),N(i,p)?function(r){const{width:o}=It(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;u.textContent=n??"";const a=u.clientWidth;o<=a/2?O(u,"left",0):o>e.clientWidth-a/2?O(u,"left",e.clientWidth-a+"px"):O(u,"left",o-a/2+"px")}(i):f(i),0===o?M(n,"art-progress-hover"):L(n,"art-progress-hover")),"played"===r&&(O(d,"width",100*o+"%"),O(h,"left",100*o+"%")),m){L(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:rt(o*t.duration)}),s(),s=At(a,()=>{M(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function _t(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{Rt(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==o&&Ot(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=It(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=It(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Vt(t){const{option:e}=t.art;e.isLive||t.add(_t({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.play),s=vt(t,n.pause);function l(){O(i,"display","flex"),O(s,"display","none")}function c(){O(i,"display","none"),O(s,"display","flex")}Y(i,a.get("Play")),Y(s,a.get("Pause")),o(i,"click",()=>{Z(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n}=e,a=vt(t,n.volume),i=vt(t,n.volumeClose),s=vt(t,'
'),l=vt(s,'
'),c=vt(l,'
'),d=vt(l,'
'),p=vt(d,'
'),h=vt(p,'
'),u=vt(d,'
');function f(t){const{top:e,height:r}=j(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)O(a,"display","none"),O(i,"display","flex"),O(u,"top","100%"),O(h,"top","100%"),c.textContent="0";else{const t=100*e.volume;O(a,"display","flex"),O(i,"display","none"),O(u,"top",100-t+"%"),O(h,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),E)O(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function o(){const r=`${rt(e.currentTime)} / ${rt(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!h(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{Y(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{Y(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenWebOn),s=vt(t,n.fullscreenWebOff);O(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(Y(t,a.get("Exit Web Fullscreen")),O(i,"display","none"),O(s,"display","inline-flex")):(Y(t,a.get("Web Fullscreen")),O(i,"display","inline-flex"),O(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenOn),s=vt(t,n.fullscreenOff);O(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(Y(t,a.get("Exit Fullscreen")),O(i,"display","none"),O(s,"display","inline-flex")):(Y(t,a.get("Fullscreen")),O(i,"display","inline-flex"),O(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rDt.get(t).option.selector}),st(t,"$control_item",{get:()=>Dt.get(t).item}),st(t,"$control_value",{get:()=>Dt.get(t).value})),Dt.set(t,e)}function Ft(t,e){t.innerHTML=e}function Ht(t,e,r,o,n){const{proxy:a}=t.events,i=v(o),s=r.selector;L(o,"art-control-selector");const l=document.createElement("div");L(l,"art-selector-value"),P(l,r.html),o.textContent="",P(o,l);const c=vt(o,'
');for(let h=0;h{if(i.closed)return;const n=U(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Yt.set(t,e),()=>{Yt.get(t)===e&&Yt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,o);c()&&Ft(l,e)}}catch(h){console.warn("ArtPlayer selector failed:",h)}finally{p()}});n.push(p)}class Bt extends Lt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;g(t,o);const{on:n}=b(t,o);n("mousemove",()=>{E||(this.show=!0)}),n("click",()=>{E?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=N(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(M(r,"art-hide-cursor"),L(r,"art-hover"),this.timer=Date.now()):(L(r,"art-hide-cursor"),M(r,"art-hover"))}),this.init(),h(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=v(e),{on:a}=b(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){Vt(this)}add(t){if(u(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:K(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Ft(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Wt(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function jt(t){if(t.constructor.USE_RAF){const e=h(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const qt=new WeakMap;class Ut{constructor(t){this.destroyEvents=new Set;const e=h(t);qt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){N(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&n&&Z(t.toggle()):Z(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&Z(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=>{L(r,"art-hover"),t.emit("hover",!0,e)},e=>{M(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=h(t);let a=()=>{};const i=()=>{a(),a=At(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&Ot(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=Wt(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=tt((o-i)/t.width,-1,1),d=tt((a-s)/t.height,-1,1),p=t.isRotate?d:c,h=n===r?t.constructor.TOUCH_MOVE_RATIO:1,u=tt(l+t.duration*p*h,0,t.duration);t.seek=u,t.emit("setBar","played",tt(u/t.duration,0,1),e),t.notice.show=`${rt(u)} / ${rt(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=mt(()=>{t.emit("view",D(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{const o=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(o,r,e=>{t.emit(`window:${r}`,e)});n.push(s)})}a(),e.bindGlobalEvents=a}(t,this),jt(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(qt.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 Xt{constructor(t){this.art=t,this.keys={},E||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",()=>{Z(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Jt{constructor(t){const e={...Zt,...t.option.icons};for(const r in e)st(this,r,{get:()=>B(r,e[r])})}}class Qt extends Lt{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=S("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=h(this.art);!function t(){for(let e=0;e{O(n,"display","none"),O(a,"display",null)}),o.proxy(e.$state,"click",()=>Z(t.play()))}}class oe{constructor(t){this.art=t,this.timer=null,h(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(h(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,L(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.textContent="",M(r,"art-notice-show")},e.NOTICE_TIME)):M(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function ne(t,e,r,o=!1){const n=e=>{u(t)||r(e)};t[o?"once":"on"](e,n),h(t).add(()=>{t.off(e,n)})}function ae(t,e,r){for(const[o,n]of e){if(u(t)||r&&!r())return;t[o].show=n}}const ie=new WeakMap,se=new WeakMap,le=new WeakMap;function ce(t){return le.get(t)||h(t)}function de(t){const e=ie.get(t),r=le.get(t);return()=>ie.get(t)===e&&(!e||e.active())&&le.get(t)===r&&(!r||!r.closed)}function pe(t){const e=le.get(t),r=h(t).child(),o=r.child();le.set(t,r),r.add(()=>{le.get(t)===r&&le.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!u(t)&&!o.closed&&ie.get(t)===n};return ie.set(t,n),o.add(()=>{ie.get(t)===n&&ie.delete(t),n.onAssigned=void 0,n.onError=void 0}),e?.dispose(),n}function he(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function ue(t,e,r){se.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{se.get(t)===e&&(se.delete(t),he(e))}}function fe(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function me(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=ce(t),l=0;return{reset(){l=0,i?.dispose(),M(a,"art-error")},loadStart(){M(a,"art-error")},schedule(c){(async c=>{if(u(t))return;const d=ce(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const h=()=>!u(t)&&!p.closed&&d===ce(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function ge(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{u(t)||t.emit(`video:${e.type}`,e)})}(t);const e=me(t);!function(t,e){ne(t,"video:canplay",()=>{e.reset(),ae(t,[["loading",!1]])}),ne(t,"video:canplay",()=>{ae(t,[["loading",!1],["controls",!0],["mask",!0]]),u(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;ne(t,"video:ended",()=>{if(e.loop){const e=de(t);if(t.seek=0,u(t)||!e())return;Z(t.play()),e()&&ae(t,[["controls",!1],["mask",!1]],e)}else ae(t,[["controls",!0],["mask",!0]])})}(t),ne(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;ne(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&ae(t,[["loading",!1],["controls",!0],["mask",!0]])}),ne(t,"video:loadstart",()=>{e.loadStart(),ae(t,[["loading",!0],["mask",!1],["controls",!0]])}),ne(t,"video:pause",()=>{ae(t,[["controls",!0],["mask",!0]])}),ne(t,"video:play",()=>{ae(t,[["mask",!1]]),u(t)||O(r,"display","none")}),ne(t,"video:playing",()=>ae(t,[["mask",!1]])),ne(t,"video:progress",()=>{t.playing&&ae(t,[["loading",!1]])}),ne(t,"video:seeked",()=>ae(t,[["loading",!1],["mask",!0]])),ne(t,"video:seeking",()=>ae(t,[["loading",!0],["mask",!1]])),ne(t,"video:timeupdate",()=>ae(t,[["mask",!1]])),ne(t,"video:waiting",()=>ae(t,[["loading",!0],["mask",!1]]))}(t,e)}const ve=[["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"]],ye=(()=>{if("undefined"===typeof document)return!1;const t=ve[0],e={};for(const r of ve){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),be={change:ye.fullscreenchange,error:ye.fullscreenerror},we={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{we.off("change",n),r()};we.on("change",n);const a=t[ye.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!we.isFullscreen)return void t();const r=()=>{we.off("change",r),t()};we.on("change",r);const o=document[ye.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>we.isFullscreen?we.exit():we.request(t,e),onchange(t){we.on("change",t)},onerror(t){we.on("error",t)},on(t,e){const r=be[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=be[t];r&&document.removeEventListener(r,e,!1)},raw:ye};function xe(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;t.once("video:loadedmetadata",()=>{var a;we.isEnabled?(a=t,we.on("change",()=>{a.emit("fullscreen",we.isFullscreen),we.isFullscreen?(a.state="fullscreen",L(n,"art-fullscreen")):M(n,"art-fullscreen"),a.emit("resize")}),we.on("error",t=>{a.emit("fullscreenError",t)}),st(a,"fullscreen",{get:()=>we.isFullscreen,async set(t){t?await we.request(n):await we.exit()}})):o.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),st(t,"fullscreen",{get:()=>document.fullscreenElement===o,set(e){e?(t.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})})(t):st(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),st(t,"fullscreen",dt(t,"fullscreen"))})}function ke(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(M(n,"art-mini"),O(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(O(e,"display","none"),O(r,"display","flex")):(O(e,"display","flex"),O(r,"display","none"))}function p(){const{$mini:e}=t.template,r=j(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),O(e,"top",`${n}px`),O(e,"left",`${a}px`)}st(t,"mini",{get:()=>A(n,"art-mini"),set(h){if(h){t.state="mini",L(n,"art-mini");const h=function(){const{$mini:n}=t.template;if(n)return P(n,a),O(n,"display","flex");{const n=H("div");L(n,"art-mini-popup"),P(document.body,n),t.template.$mini=n,P(n,a);const p=P(n,'
');P(p,e.close),r(p,"click",c);const h=P(n,'
'),u=P(h,e.play),f=P(h,e.pause);return r(u,"click",()=>Z(t.play())),r(f,"click",()=>t.pause()),d(u,f),t.on("video:playing",()=>d(u,f)),t.on("video:pause",()=>d(u,f)),t.on("video:timeupdate",()=>d(u,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){L(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;O(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,M(n,"art-mini-dragging");const t=j(n);o.set("left",t.left),o.set("top",t.top),O(n,"left",`${t.left}px`),O(n,"top",`${t.top}px`),O(n,"transform",null)}}),n}}(),u=o.get("top"),f=o.get("left");"number"===typeof u&&"number"===typeof f?(O(h,"top",`${u}px`),O(h,"left",`${f}px`),D(h)||p()):p(),t.emit("mini",!0)}else c()}})}function $e(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,st(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),st(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):st(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Ee(t){st(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Yt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!u(t)&&i()){const r=`${n.get("Switch Video")}: ${e.html}`;!u(t)&&i()&&(o.show=r)}return e.html}})}})}function Te(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ce(t,e,r){return new Promise((o,n)=>{if(u(t)||e===t.url)return void o();const a=pe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),h={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},u=i.child(),f=[],m=Object.keys(h);for(const e of m)Te(u,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(ue(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(u.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Te(p,t,e,h[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function ze(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",async(n,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===n||"played"===n&&l&&E){if(i||a||(a=!0,i=await q(d,p),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-h/2?O(a,"left",r.clientWidth-h+"px"):O(a,"left",n-h/2+"px")}(n)}}),st(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function Se(t){const{option:e,template:{$video:r}}=t;st(t,"url",{get:()=>r.src,async set(o){if(u(t))return;const n=function(t){const e=se.get(t);return se.delete(t),e||pe(t)}(t);n.acceptingEvents=!1;try{if(!o)return void(await Pt(n.scope)&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||J(o),s=e.customType[i];if(i&&s){if(!(await Pt(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;Te(l,t,"video:canplay",()=>{c=!d}),Te(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>fe(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||Te(n.scope,t,"video:canplay",e)}}catch(a){fe(n,a)}finally{he(n)}}})}Object.defineProperties(we,{isFullscreen:{get:()=>Boolean(document[ye.fullscreenElement])},element:{enumerable:!0,get:()=>document[ye.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ye.fullscreenEnabled])}});class Le{constructor(t){Se(t),function(t){const{template:{$video:e}}=t;st(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;st(t,"play",{async value(){const i=de(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;st(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${rt(t.currentTime)} / ${rt(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;st(t,"forward",{set(e){r.seek=t.currentTime+e}}),st(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;st(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=tt(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),st(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;st(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=tt(o,0,t.duration))}})}(t),function(t){st(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ce(t,e,0);st(t,"switchQuality",{value:e=>Ce(t,e,t.currentTime)}),st(t,"switchUrl",{value:e}),st(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;st(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;st(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)O(o,"width",null),O(o,"height",null),O(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(O(o,"width",s*r+"px"),O(o,"height","100%"),O(o,"margin","0 auto")):(O(o,"width","100%"),O(o,"height",e/s+"px"),O(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=H("canvas");st(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),st(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),st(t,"screenshot",{value:async e=>{const o=await t.getDataURL();return Q(o,`${e||`artplayer_${rt(r.currentTime)}`}.png`),t.emit("screenshot",o),o}})}(t),xe(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";st(t,"fullscreenWeb",{get:()=>A(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&P(document.body,o),t.state="fullscreenWeb",O(o,"width","100%"),O(o,"height","100%"),L(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&P(r,o),n&&(o.style.cssText=n,n=""),M(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),$e(t),function(t){const{$video:e}=t.template,r=t;st(t,"loaded",{get:()=>r.loadedTime/e.duration}),st(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){st(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;st(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:o}=t.template;st(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=j(e),l=n/a;if(i/s>l)O(r,"width",s*l/i*100+"%"),O(r,"height","100%");else{const t=i/l/s*100;O(r,"width","100%"),O(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;st(t,"rect",{get:()=>j(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}st(t,"x",{get:()=>e.left+window.pageXOffset}),st(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;st(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(et(n))}`,t.emit("flip",n)}})}(t),ke(t),function(t){const{template:{$poster:e}}=t;st(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){O(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;st(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);O(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;st(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){st(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){st(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];st(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;oo.$track?.offset||0,set(n){const{cues:a}=t.subtitle;if(!o.$track||0===a.length)return;const i=tt(n,-10,10);o.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,st(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ee(t),ze(t),ge(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=tt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=tt(a,0,1)),e.poster&&O(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Me(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!A(o,a)&&function(){const e=X(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;O(o,"width",`${n}px`),O(o,"height",`${i}px`),O(o,"transform-origin","0 0"),O(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),L(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else A(o,a)&&(O(o,"width",""),O(o,"height",""),O(o,"transform-origin",""),O(o,"transform",""),M(o,a),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,L(o,i)}catch(n){s=!1,e.show=n}}else if(A(o,i)&&M(o,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return A(o,a)}}}function Ae(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=z(".art-auto-playback-last",s),c=z(".art-auto-playback-jump",s),d=z(".art-auto-playback-close",s);P(d,r.close);let p=null;function h(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),O(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(O(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${rt(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{O(s,"display","none")}),a(c,"click",()=>{t.seek=r,Z(t.play()),O(i,"display","none"),O(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{O(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",h),t.on("restart",h),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Pe(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,M(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,L(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return A(o,"art-fast-forward")}}}function Ie(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return A(o,"art-lock")}function a(){L(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){M(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=P(e,r.lock),n=P(e,r.unlock);O(o,"display","none"),t.on("lock",t=>{t?(O(o,"display","inline-flex"),O(n,"display","none")):(O(o,"display","none"),O(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function Oe(t){return t.on("control",e=>{e?M(t.template.$player,"art-mini-progress-bar"):L(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Re{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){u(t.art)||!e.miniProgressBar||e.isLive||t.add(Oe),!u(t.art)&&e.lock&&E&&t.add(Ie),u(t.art)||!e.autoPlayback||e.isLive||t.add(Ae),!u(t.art)&&e.autoOrientation&&E&&t.add(Me),!u(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(Pe)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){K(!u(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(u(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(u(t.art))return t;let n=o;const a=ct(t,n);if(u(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return u(t.art)||(K(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),u(t.art)||st(t,n,{value:r})),t}(this,t,e)}}class _e extends Lt{constructor(t){super(t);const{option:e,controls:r,template:{$setting:o}}=t;this.name="setting",this.$parent=o,this.id=0,this.active=null,this.cache=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=N(t,r.setting),o=N(t,this.$parent);!this.show||e||o||(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:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(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:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(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:o,FLIP:n}}=t;function a(t){return e.get(et(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(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:o}=t;return{width:o.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&&V(e.$item,"art-current")},t.$option),this.render(t.$parents))}format(t=this.option,e,r,o=[]){for(let n=0;ne}),st(a,"$parents",{get:()=>r}),st(a,"$option",{get:()=>t});const o=[];st(a,"$events",{get:()=>o}),st(a,"$formatted",{get:()=>!0})}this.format(a.selector||[],a,t,o)}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:o,$setting:n}}=this.art;if(t.setting&&this.show){const a=this.active[0]?.$parent?.width||e,{left:i,width:s}=j(t.setting),{left:l,width:c}=j(o),d=i-l+s/2-a/2;if(O(n,"height",`${this.active===this.option?this.active.length*r:(this.active.length+1)*r}px`),O(n,"width",`${a}px`),this.art.isRotate||E)return;d+a>c?(O(n,"left",null),O(n,"right",null)):(O(n,"left",`${d}px`),O(n,"right","auto"))}}inactivate(t){for(let e=0;e'),s=H("div");L(s,"art-setting-item-left-icon"),P(s,o),P(i,s),P(i,t.$parent.html);const l=r(a,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),P(e,a)}createItem(t,e=!1){if(!this.cache.has(t.$option))return;const r=this.cache.get(t.$option),o=t.$item;let n="selector";ct(t,"switch")&&(n="switch"),ct(t,"range")&&(n="range"),ct(t,"onClick")&&(n="button");const{icons:a,proxy:i,constructor:s}=this.art,l=H("div");L(l,"art-setting-item"),O(l,"height",`${s.SETTING_ITEM_HEIGHT}px`),l.dataset.name=t.name||"",l.dataset.value=t.value||"";const c=P(l,'
'),d=P(l,'
'),p=H("div");switch(L(p,"art-setting-item-left-icon"),n){case"button":case"switch":case"range":P(p,t.icon||a.config);break;case"selector":t.selector?.length?P(p,t.icon||a.config):P(p,a.check)}P(c,p),st(t,"$icon",{configurable:!0,get:()=>p}),st(t,"icon",{configurable:!0,get:()=>p.innerHTML,set(t){p.innerHTML="",P(p,t)}});const u=H("div");L(u,"art-setting-item-left-text"),P(u,t.html||""),P(c,u),st(t,"$html",{configurable:!0,get:()=>u}),st(t,"html",{configurable:!0,get:()=>u.innerHTML,set(t){u.innerHTML="",P(u,t)}});const f=H("div");switch(L(f,"art-setting-item-right-tooltip"),P(f,t.tooltip||""),P(d,f),st(t,"$tooltip",{configurable:!0,get:()=>f}),st(t,"tooltip",{configurable:!0,get:()=>f.innerHTML,set(t){f.innerHTML="",P(f,t)}}),n){case"switch":{const e=H("div");L(e,"art-setting-item-right-icon");const r=P(e,a.switchOn),o=P(e,a.switchOff);O(t.switch?o:r,"display","none"),P(d,e),st(t,"$switch",{configurable:!0,get:()=>e});let n=t.switch;st(t,"switch",{configurable:!0,get:()=>n,set(t){n=t,t?(O(o,"display","none"),O(r,"display",null)):(O(o,"display",null),O(r,"display","none"))}});break}case"range":{const e=H("div");L(e,"art-setting-item-right-icon");const r=P(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],L(r,"art-setting-range"),P(d,e),st(t,"$range",{configurable:!0,get:()=>r});let o=[...t.range];st(t,"range",{configurable:!0,get:()=>o,set(t){o=[...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=H("div");L(t,"art-setting-item-right-icon"),P(t,a.arrowRight),P(d,t)}}switch(n){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&&L(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)}}st(t,"$item",{configurable:!0,get:()=>l}),e?F(l,o):P(r,l),t.mounted&&At(h(this.art),()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){if(this.active=t,this.cache.has(t)){V(this.cache.get(t),"art-current")}else{const e=H("div");this.cache.set(t,e),L(e,"art-setting-panel"),P(this.$parent,e),V(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?R(r,t):O(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?it(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=await this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=H("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,I(i),P(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(n(t,zt.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||J(t.url)){case"srt":{const e=ht(r);return ut(t.onVttLoad(e))}case"ass":{const e=ft(r);return ut(t.onVttLoad(e))}case"vtt":return ut(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}}const Ne=`\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
${a}
\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 `;class Fe{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=z(e.container),K(this.$container,`No container element found by ${e.container}`)),K(W(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();K("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),K(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,function(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Ne}query(t){return z(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Fe.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){K(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),F(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&L(this.$player,"art-backdrop"),E&&L(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":L(this.$player,"art-destroy")}}const He=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Be{on(t,e,r){const o=this.e||(this.e={});let n=He(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(He(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=He(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),qe.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${qe.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&je.push(this)}catch(o){try{f(this,je,!0,qe.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return je}static get version(){return a}static get config(){return i}static get utils(){return gt}static get scheme(){return zt}static get Emitter(){return Be}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return Fe.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:x?"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){f(this,je,t,qe.REMOVE_SRC_WHEN_DESTROY)}}return qe.STYLE=Ye,qe.DEBUG=!1,qe.CONTEXTMENU=!0,qe.NOTICE_TIME=2e3,qe.SETTING_WIDTH=250,qe.SETTING_ITEM_WIDTH=200,qe.SETTING_ITEM_HEIGHT=35,qe.RESIZE_TIME=200,qe.SCROLL_TIME=200,qe.SCROLL_GAP=50,qe.AUTO_PLAYBACK_MAX=10,qe.AUTO_PLAYBACK_MIN=5,qe.AUTO_PLAYBACK_TIMEOUT=3e3,qe.RECONNECT_TIME_MAX=5,qe.RECONNECT_SLEEP_TIME=1e3,qe.CONTROL_HIDE_TIME=3e3,qe.DBCLICK_TIME=300,qe.DBCLICK_FULLSCREEN=!0,qe.MOBILE_DBCLICK_PLAY=!0,qe.MOBILE_CLICK_PLAY=!1,qe.AUTO_ORIENTATION_TIME=200,qe.INFO_LOOP_TIME=1e3,qe.FAST_FORWARD_VALUE=3,qe.FAST_FORWARD_TIME=1e3,qe.TOUCH_MOVE_RATIO=.5,qe.VOLUME_STEP=.1,qe.SEEK_STEP=5,qe.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],qe.ASPECT_RATIO=["default","4:3","16:9"],qe.FLIP=["normal","horizontal","vertical"],qe.FULLSCREEN_WEB_IN_BODY=!0,qe.LOG_VERSION=!0,qe.USE_RAF=!1,qe.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=qe,C("artplayer-style",Ye),setTimeout(()=>{qe.LOG_VERSION&&console.log(`%c ArtPlayer %c ${qe.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),qe}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var o=(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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,o,n=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};o&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,n||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),n&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=v(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 S(t,e=document){return e.querySelector(t)}function z(t,e=document){return Array.from(e.querySelectorAll(t))}function M(t,e){return t.classList.add(e)}function L(t,e){return t.classList.remove(e)}function P(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function O(t){return t.parentNode.removeChild(t)}function R(t,e,r){return t.style[e]=r,t}function I(t,e){for(const r in e)R(t,r,e[r]);return t}function _(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function V(t,e){_(t).forEach(t=>L(t,e)),M(t,e)}function N(t,e,r="top"){E||(t.setAttribute("aria-label",e),M(t,"hint--rounded"),M(t,`hint--${r}`))}function D(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function Y(t,e){return U(t).includes(e)}function W(t,e){return e.parentNode.replaceChild(t,e),t}function F(t){return document.createElement(t)}function B(t="",e=""){const r=F("i");return M(r,"art-icon"),M(r,`art-icon-${t}`),A(r,e),r}function H(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function j(t){return t.getBoundingClientRect()}function q(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function U(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}function X(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class G extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function K(t,e){if(!t)throw new G(e);return t}function Z(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function J(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function Q(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function tt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function et(t){return t.charAt(0).toUpperCase()+t.slice(1)}function rt(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ot={"&":"&","<":"<",">":">","'":"'",'"':"""},nt={"&":"&","<":"<",">":">","'":"'",""":'"'},at=/(&|<|>|'|")/g;function it(t){return t.replace(/[&<>'"]/g,t=>ot[t]||t)}const st=Object.defineProperty,{hasOwnProperty:lt}=Object.prototype;function ct(t,e){return lt.call(t,e)}function dt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function pt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?pt(n,a):a,st(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function ut(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 ht(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ft(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 mt(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const gt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:G,addClass:M,append:A,assToVtt:ft,capitalize:et,clamp:tt,createElement:F,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:st,download:Q,errorHandle:K,escape:it,get:dt,getComposedPath:U,getExt:J,getIcon:B,getRect:j,getSafeAreaInsets:X,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:ct,hasClass:P,includeFromEvent:Y,inverseClass:V,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:D,isMobile:E,isSafari:x,loadImg:q,mergeDeep:pt,query:S,queryAll:z,remove:O,removeClass:L,replaceElement:W,secondToTime:rt,setStyle:R,setStyleText:C,setStyles:I,siblings:_,silencePromise:Z,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:ut,supportsFlex:H,throttle:mt,tooltip:N,unescape:function(t){return t.replace(at,t=>nt[t]||t)},userAgent:w,vttToBlob:ht},Symbol.toStringTag,{value:"Module"}));function vt(t,e){return A(t,e)}function yt(t,e){return e.querySelector(t)}const bt="array",wt="boolean",xt="string",kt="number",$t="object",Et="function";function Tt(t,e,r){return K(e===xt||e===kt||t instanceof Element,`${r.join(".")} require '${xt}' or 'Element' type`)}const Ct={html:Tt,disable:`?${wt}`,name:`?${xt}`,index:`?${kt}`,style:`?${$t}`,click:`?${Et}`,mounted:`?${Et}`,tooltip:`?${xt}|${kt}`,width:`?${kt}`,selector:`?${bt}`,onSelect:`?${Et}`,switch:`?${wt}`,onSwitch:`?${Et}`,range:`?${bt}`,onRange:`?${Et}`,onChange:`?${Et}`},St={id:xt,container:Tt,url:xt,poster:xt,type:xt,theme:xt,lang:xt,volume:kt,isLive:wt,muted:wt,autoplay:wt,autoSize:wt,autoMini:wt,loop:wt,flip:wt,playbackRate:wt,aspectRatio:wt,screenshot:wt,setting:wt,hotkey:wt,pip:wt,mutex:wt,backdrop:wt,fullscreen:wt,fullscreenWeb:wt,subtitleOffset:wt,miniProgressBar:wt,useSSR:wt,playsInline:wt,lock:wt,gesture:wt,fastForward:wt,autoPlayback:wt,autoOrientation:wt,airplay:wt,proxy:`?${Et}`,plugins:[Et],layers:[Ct],contextmenu:[Ct],settings:[Ct],controls:[{...Ct,position:(t,e,r)=>{const o=["top","left","right"];return K("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}}],quality:[{default:`?${wt}`,html:xt,url:xt}],highlight:[{time:kt,text:xt}],thumbnails:{url:xt,number:kt,column:kt,width:kt,height:kt,scale:kt},subtitle:{url:xt,name:xt,type:xt,style:$t,escape:wt,encoding:xt,onVttLoad:Et},moreVideoAttr:$t,i18n:$t,icons:$t,cssVar:$t,customType:$t},zt=new WeakSet;class Mt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return P(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):L(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",n(e,Ct),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,o=this.cache;K(!o.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){M(t,`art-${r}`),M(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&I(t,a.style),a.tooltip&&N(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,r,a),c=!0,o.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw o.get(r)?.$ref===a&&o.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){K(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!zt.has(e)){zt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{zt.delete(e)}}}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 Lt extends Mt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="1"]',t);o&&V(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&V(r,"art-current")})}}}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="default"]',t);o&&V(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(r,"art-current")})}}}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:o}}=e,n=o.map(t=>`${r.get(et(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="normal"]',t);o&&V(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=j(e),{height:c,width:d}=j(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),I(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{Y(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Pt(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function At(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function Ot(t,e){const{$progress:r}=t.template,{left:o}=j(r),n=tt((E?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:rt(a),width:n,percentage:tt(n/r.clientWidth,0,1)}}function Rt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=Ot(t,e);t.emit("setBar","played",o,e),t.seek=r}}function It(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=yt(".art-progress-hover",e),c=yt(".art-progress-loaded",e),d=yt(".art-progress-played",e),p=yt(".art-progress-highlight",e),u=yt(".art-progress-indicator",e),h=yt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||Ot(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?R(h,"left",0):n>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",n-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*o+"%"),"hover"===r&&(R(l,"width",100*o+"%"),Y(i,p)?function(r){const{width:o}=Ot(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=n??"";const a=h.clientWidth;o<=a/2?R(h,"left",0):o>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",o-a/2+"px")}(i):f(i),0===o?L(n,"art-progress-hover"):M(n,"art-progress-hover")),"played"===r&&(R(d,"width",100*o+"%"),R(u,"left",100*o+"%")),m){M(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:rt(o*t.duration)}),s(),s=Pt(a,()=>{L(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function _t(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{It(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==o&&Rt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Ot(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=Ot(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Vt(t){const{option:e}=t.art;e.isLive||t.add(_t({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.play),s=vt(t,n.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}N(i,a.get("Play")),N(s,a.get("Pause")),o(i,"click",()=>{Z(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n}=e,a=vt(t,n.volume),i=vt(t,n.volumeClose),s=vt(t,'
'),l=vt(s,'
'),c=vt(l,'
'),d=vt(l,'
'),p=vt(d,'
'),u=vt(p,'
'),h=vt(d,'
');function f(t){const{top:e,height:r}=j(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function o(){const r=`${rt(e.currentTime)} / ${rt(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{N(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{N(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenWebOn),s=vt(t,n.fullscreenWebOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(N(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenOn),s=vt(t,n.fullscreenOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(N(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rDt.get(t).option.selector}),st(t,"$control_item",{get:()=>Dt.get(t).item}),st(t,"$control_value",{get:()=>Dt.get(t).value})),Dt.set(t,e)}function Wt(t,e){t.innerHTML=e}function Ft(t,e,r,o,n){const{proxy:a}=t.events,i=v(o),s=r.selector;M(o,"art-control-selector");const l=document.createElement("div");M(l,"art-selector-value"),A(l,r.html),o.textContent="",A(o,l);const c=vt(o,'
');for(let u=0;u{if(i.closed)return;const n=U(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Nt.set(t,e),()=>{Nt.get(t)===e&&Nt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,o);c()&&Wt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});n.push(p)}class Bt extends Mt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;g(t,o);const{on:n}=b(t,o);n("mousemove",()=>{E||(this.show=!0)}),n("click",()=>{E?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=Y(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(L(r,"art-hide-cursor"),M(r,"art-hover"),this.timer=Date.now()):(M(r,"art-hide-cursor"),L(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=v(e),{on:a}=b(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){Vt(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:K(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Wt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Ht(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function jt(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const qt=new WeakMap;class Ut{constructor(t){this.destroyEvents=new Set;const e=u(t);qt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){Y(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&n&&Z(t.toggle()):Z(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&Z(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=>{L(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=u(t);let a=()=>{};const i=()=>{a(),a=Pt(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&Rt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=Ht(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=tt((o-i)/t.width,-1,1),d=tt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=tt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",tt(h/t.duration,0,1),e),t.notice.show=`${rt(h)} / ${rt(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=mt(()=>{t.emit("view",D(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{const o=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(o,r,e=>{t.emit(`window:${r}`,e)});n.push(s)})}a(),e.bindGlobalEvents=a}(t,this),jt(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(qt.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 Xt{constructor(t){this.art=t,this.keys={},E||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",()=>{Z(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Jt{constructor(t){const e={...Zt,...t.option.icons};for(const r in e)st(this,r,{get:()=>B(r,e[r])})}}class Qt extends Mt{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=z("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(n,"display","none"),R(a,"display",null)}),o.proxy(e.$state,"click",()=>Z(t.play()))}}class oe{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,M(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.textContent="",L(r,"art-notice-show")},e.NOTICE_TIME)):L(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function ne(t,e,r,o=!1){const n=e=>{h(t)||r(e)};t[o?"once":"on"](e,n),u(t).add(()=>{t.off(e,n)})}function ae(t,e,r){for(const[o,n]of e){if(h(t)||r&&!r())return;t[o].show=n}}const ie=new WeakMap,se=new WeakMap,le=new WeakMap;function ce(t){return le.get(t)||u(t)}function de(t){const e=ie.get(t),r=le.get(t);return()=>ie.get(t)===e&&(!e||e.active())&&le.get(t)===r&&(!r||!r.closed)}function pe(t){const e=le.get(t),r=u(t).child(),o=r.child();le.set(t,r),r.add(()=>{le.get(t)===r&&le.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!o.closed&&ie.get(t)===n};return ie.set(t,n),o.add(()=>{ie.get(t)===n&&ie.delete(t),n.onAssigned=void 0,n.onError=void 0}),e?.dispose(),n}function ue(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function he(t,e,r){se.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{se.get(t)===e&&(se.delete(t),ue(e))}}function fe(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function me(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=ce(t),l=0;return{reset(){l=0,i?.dispose(),L(a,"art-error")},loadStart(){L(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=ce(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===ce(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function ge(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=me(t);!function(t,e){ne(t,"video:canplay",()=>{e.reset(),ae(t,[["loading",!1]])}),ne(t,"video:canplay",()=>{ae(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;ne(t,"video:ended",()=>{if(e.loop){const e=de(t);if(t.seek=0,h(t)||!e())return;Z(t.play()),e()&&ae(t,[["controls",!1],["mask",!1]],e)}else ae(t,[["controls",!0],["mask",!0]])})}(t),ne(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;ne(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&ae(t,[["loading",!1],["controls",!0],["mask",!0]])}),ne(t,"video:loadstart",()=>{e.loadStart(),ae(t,[["loading",!0],["mask",!1],["controls",!0]])}),ne(t,"video:pause",()=>{ae(t,[["controls",!0],["mask",!0]])}),ne(t,"video:play",()=>{ae(t,[["mask",!1]]),h(t)||R(r,"display","none")}),ne(t,"video:playing",()=>ae(t,[["mask",!1]])),ne(t,"video:progress",()=>{t.playing&&ae(t,[["loading",!1]])}),ne(t,"video:seeked",()=>ae(t,[["loading",!1],["mask",!0]])),ne(t,"video:seeking",()=>ae(t,[["loading",!0],["mask",!1]])),ne(t,"video:timeupdate",()=>ae(t,[["mask",!1]])),ne(t,"video:waiting",()=>ae(t,[["loading",!0],["mask",!1]]))}(t,e)}const ve=[["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"]],ye=(()=>{if("undefined"===typeof document)return!1;const t=ve[0],e={};for(const r of ve){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),be={change:ye.fullscreenchange,error:ye.fullscreenerror},we={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{we.off("change",n),r()};we.on("change",n);const a=t[ye.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!we.isFullscreen)return void t();const r=()=>{we.off("change",r),t()};we.on("change",r);const o=document[ye.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>we.isFullscreen?we.exit():we.request(t,e),onchange(t){we.on("change",t)},onerror(t){we.on("error",t)},on(t,e){const r=be[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=be[t];r&&document.removeEventListener(r,e,!1)},raw:ye};function xe(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;t.once("video:loadedmetadata",()=>{var a;we.isEnabled?(a=t,we.on("change",()=>{a.emit("fullscreen",we.isFullscreen),we.isFullscreen?(a.state="fullscreen",M(n,"art-fullscreen")):L(n,"art-fullscreen"),a.emit("resize")}),we.on("error",t=>{a.emit("fullscreenError",t)}),st(a,"fullscreen",{get:()=>we.isFullscreen,async set(t){t?await we.request(n):await we.exit()}})):o.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),st(t,"fullscreen",{get:()=>document.fullscreenElement===o,set(e){e?(t.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})})(t):st(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),st(t,"fullscreen",dt(t,"fullscreen"))})}function ke(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(L(n,"art-mini"),R(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(R(e,"display","none"),R(r,"display","flex")):(R(e,"display","flex"),R(r,"display","none"))}function p(){const{$mini:e}=t.template,r=j(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),R(e,"top",`${n}px`),R(e,"left",`${a}px`)}st(t,"mini",{get:()=>P(n,"art-mini"),set(u){if(u){t.state="mini",M(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return A(n,a),R(n,"display","flex");{const n=F("div");M(n,"art-mini-popup"),A(document.body,n),t.template.$mini=n,A(n,a);const p=A(n,'
');A(p,e.close),r(p,"click",c);const u=A(n,'
'),h=A(u,e.play),f=A(u,e.pause);return r(h,"click",()=>Z(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){M(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;R(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,L(n,"art-mini-dragging");const t=j(n);o.set("left",t.left),o.set("top",t.top),R(n,"left",`${t.left}px`),R(n,"top",`${t.top}px`),R(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(R(u,"top",`${h}px`),R(u,"left",`${f}px`),D(u)||p()):p(),t.emit("mini",!0)}else c()}})}function $e(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,st(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),st(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):st(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Ee(t){st(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Nt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${n.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(o.show=r)}return e.html}})}})}function Te(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ce(t,e,r){return new Promise((o,n)=>{if(h(t)||e===t.url)return void o();const a=pe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Te(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(he(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Te(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Se(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",async(n,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===n||"played"===n&&l&&E){if(i||a||(a=!0,i=await q(d,p),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",n-u/2+"px")}(n)}}),st(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function ze(t){const{option:e,template:{$video:r}}=t;st(t,"url",{get:()=>r.src,async set(o){if(h(t))return;const n=function(t){const e=se.get(t);return se.delete(t),e||pe(t)}(t);n.acceptingEvents=!1;try{if(!o)return void(await At(n.scope)&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||J(o),s=e.customType[i];if(i&&s){if(!(await At(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;Te(l,t,"video:canplay",()=>{c=!d}),Te(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>fe(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||Te(n.scope,t,"video:canplay",e)}}catch(a){fe(n,a)}finally{ue(n)}}})}Object.defineProperties(we,{isFullscreen:{get:()=>Boolean(document[ye.fullscreenElement])},element:{enumerable:!0,get:()=>document[ye.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ye.fullscreenEnabled])}});class Me{constructor(t){ze(t),function(t){const{template:{$video:e}}=t;st(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;st(t,"play",{async value(){const i=de(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;st(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${rt(t.currentTime)} / ${rt(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;st(t,"forward",{set(e){r.seek=t.currentTime+e}}),st(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;st(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=tt(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),st(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;st(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=tt(o,0,t.duration))}})}(t),function(t){st(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ce(t,e,0);st(t,"switchQuality",{value:e=>Ce(t,e,t.currentTime)}),st(t,"switchUrl",{value:e}),st(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;st(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;st(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)R(o,"width",null),R(o,"height",null),R(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(R(o,"width",s*r+"px"),R(o,"height","100%"),R(o,"margin","0 auto")):(R(o,"width","100%"),R(o,"height",e/s+"px"),R(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=F("canvas");st(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),st(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),st(t,"screenshot",{value:async e=>{const o=await t.getDataURL();return Q(o,`${e||`artplayer_${rt(r.currentTime)}`}.png`),t.emit("screenshot",o),o}})}(t),xe(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";st(t,"fullscreenWeb",{get:()=>P(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&A(document.body,o),t.state="fullscreenWeb",R(o,"width","100%"),R(o,"height","100%"),M(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&A(r,o),n&&(o.style.cssText=n,n=""),L(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),$e(t),function(t){const{$video:e}=t.template,r=t;st(t,"loaded",{get:()=>r.loadedTime/e.duration}),st(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){st(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;st(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:o}=t.template;st(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=j(e),l=n/a;if(i/s>l)R(r,"width",s*l/i*100+"%"),R(r,"height","100%");else{const t=i/l/s*100;R(r,"width","100%"),R(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;st(t,"rect",{get:()=>j(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}st(t,"x",{get:()=>e.left+window.pageXOffset}),st(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;st(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(et(n))}`,t.emit("flip",n)}})}(t),ke(t),function(t){const{template:{$poster:e}}=t;st(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;st(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);R(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;st(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){st(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){st(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];st(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;oo.$track?.offset||0,set(n){const{cues:a}=t.subtitle;if(!o.$track||0===a.length)return;const i=tt(n,-10,10);o.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,st(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ee(t),Se(t),ge(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=tt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=tt(a,0,1)),e.poster&&R(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Le(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!P(o,a)&&function(){const e=X(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;R(o,"width",`${n}px`),R(o,"height",`${i}px`),R(o,"transform-origin","0 0"),R(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),M(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else P(o,a)&&(R(o,"width",""),R(o,"height",""),R(o,"transform-origin",""),R(o,"transform",""),L(o,a),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(o,i)}catch(n){s=!1,e.show=n}}else if(P(o,i)&&L(o,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return P(o,a)}}}function Pe(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=S(".art-auto-playback-last",s),c=S(".art-auto-playback-jump",s),d=S(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${rt(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,Z(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Ae(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,L(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,M(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return P(o,"art-fast-forward")}}}function Oe(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return P(o,"art-lock")}function a(){M(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){L(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=A(e,r.lock),n=A(e,r.unlock);R(o,"display","none"),t.on("lock",t=>{t?(R(o,"display","inline-flex"),R(n,"display","none")):(R(o,"display","none"),R(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function Re(t){return t.on("control",e=>{e?L(t.template.$player,"art-mini-progress-bar"):M(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Ie{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(Re),!h(t.art)&&e.lock&&E&&t.add(Oe),h(t.art)||!e.autoPlayback||e.isLive||t.add(Pe),!h(t.art)&&e.autoOrientation&&E&&t.add(Le),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(Ae)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){K(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let n=o;const a=ct(t,n);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return h(t.art)||(K(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),h(t.art)||st(t,n,{value:r})),t}(this,t,e)}}const _e=new WeakMap;function Ve(t){return!t.closed&&!_e.get(t)}function Ne(t){_e.set(t,(_e.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(_e.get(t)||1)-1;r?_e.set(t,r):_e.delete(t)}}const De=new WeakMap,Ye=new WeakMap,We=["$parent","$parents","$option","$events","$formatted"];function Fe(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=De.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(De.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function Be(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function He(t){const e=De.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function je(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Je(t,n)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(n.push(...a.splice(0)),Ze.set(r,n),Ge.set(e,r),Ke.set(e,o)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function or(t,e,r,o,n,a){const i=a||tr(e);if(!Ve(i)||h(t))return;const s=t.proxy(r,o,e=>{if(Ve(i)&&!h(t))try{return n(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Ve(i)||h(t)?t.events.remove(s):(He(e).events.push(s),a&&a!==Ge.get(e)&&a.add(()=>{const r=He(e).events,o=r.indexOf(s);o>=0&&(r.splice(o,1),t.events.remove(s))}))}function nr(t,e,r,o){const n=tr(e);if(!Ve(n)||h(t))return;const a=(...e)=>{if(Ve(n)&&!h(t))return o(...e)};t.on(r,a),n.add(()=>{t.off(r,a)})}function ar(t){const{art:e,active:r}=t,{controls:o,constructor:{SETTING_WIDTH:n,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!o.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=o.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:o,rows:n,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,o),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,n*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||n,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const ir=new WeakMap;function sr(t){ir.delete(t)}const lr=new WeakMap;function cr(t,e){e?lr.set(t,e):lr.delete(t)}function dr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],o=lr.get(t),n=o?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,o]of e)Object.defineProperty(t,r,o);n?.(),cr(t,o);for(const{node:t,parent:e,next:o}of r)e?e.insertBefore(t,o?.parentNode===e?o:null):t.parentNode?.removeChild(t)}}const pr=new WeakMap;async function ur(t,e,r,o,n,a,i,s){try{const l=tr(e),c=tr(a),d=(pr.get(a)||0)+1;pr.set(a,d);const p=()=>Ve(l)&&Ve(c)&&!h(t.art)&&pr.get(a)===d;if(s?.(),!p())return;const u=await n.call(t.art,e,r,o);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function hr(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}const fr=new WeakMap;function mr(t){const e=[];for(const o of t)try{o()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function gr(t){fr.get(t)?.()}function vr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);sr(r),gr(r);const o=dr(r),n=r.$item,a=n?.parentNode,i=n?.nextSibling,s=n?hr(n):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,o=new Set,n=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&o.add(r),e.selector.forEach(n)}};n(e);const a=[],i=[];try{for(const e of r){const r=rr(t.art,e);r&&a.push(r)}for(const t of o)i.push(Ne(Ue(t)))}catch(l){try{mr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,mr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,mr([...a.reverse().map(t=>t.dispose),...Array.from(o).reverse().map(t=>()=>Xe(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{mr([d.resume,()=>{e&&e!==n&&e.remove()},o,()=>s?.(),()=>{a&&n&&a.insertBefore(n,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&V(t.cache.get(l),"art-current");for(const[e,r,o]of c)t.$parent.style.setProperty(e,r,o)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&fr.get(r)===m;for(const u of d.items)fr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);d.dispose()});try{if(function(t,e,r){for(const o of Reflect.ownKeys(e)){if(!r())return;const n=Object.getOwnPropertyDescriptor(e,o);if(!n?.enumerable||!r())continue;const a=Reflect.get(e,o);if(!r())return;if(!Reflect.set(t,o,a))throw new TypeError(`Cannot assign setting item property [${String(o)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const yr=new WeakMap;function br(t,e,r){st(t,`$${e}`,{configurable:!0,get:()=>r}),st(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function wr(t,e,r=!1){const o=function(t){const e=fr.get(t);return()=>!e||fr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const n=t.cache.get(e.$option),a=e.$item;let i="selector";ct(e,"switch")&&(i="switch"),ct(e,"range")&&(i="range"),ct(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!o())return;const c=function(t,e,r=u(t)){const o=Ge.get(e);(!o||Ve(o)||o.closed)&&er(t,e);const n=r.child();return Ge.set(e,n),Ke.set(e,r),Ze.set(n,He(e).events),n.add(()=>{Je(t,Ze.get(n))}),n}(t.art,e,Ue(n)),d=()=>Ve(c)&&!h(t.art)&&o();if(!d())return;const p=document.createElement("div");try{if(cr(e),M(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const o=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(M(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(o,f),!d())return;br(e,"icon",f);const m=document.createElement("div");M(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(o,m),br(e,"html",m);const v=document.createElement("div");M(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),br(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");M(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),o=A(t,s.switchOff),n=e.switch;if(!d())return;R(n?o:r,"display","none"),A(u,t),st(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;cr(e,()=>{const t=a;return()=>{a=t}}),st(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(o,"display","none"),R(r,"display",null)):(R(o,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");M(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[n,a]of["value","min","max","step"].entries()){const t=e.range[n];if(!d())return;Reflect.set(r,a,String(t))}M(r,"art-setting-range"),A(u,t),st(e,"$range",{configurable:!0,get:()=>r});let o=[...e.range];if(!d())return;cr(e,()=>{const t=o,e=[...t],n={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),o=t,Object.assign(r,n)}}),st(e,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");M(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,o){const{art:n}=t,a=tr(e),i=(t,r,o)=>or(n,e,t,r,o,a);switch(o){case"switch":e.onSwitch&&i(r,"click",o=>ur(t,e,r,o,e.onSwitch,e,"switch"));break;case"range":{const o=e.$range;if(o)for(const[n,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(o,n,n=>ur(t,e,r,n,e[a],e,"tooltip",()=>{e.range[0]=o.valueAsNumber}));break}case"selector":i(r,"click",o=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return ur(t,e,r,o,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&M(r,"art-current");break;case"button":e.onClick&&i(r,"click",o=>ur(t,e,r,o,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;st(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(n,p),e.mounted&&d()&&Pt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function xr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!Ve(Ue(r)))return;const o=(yr.get(t)||0)+1;yr.set(t,o);const n=()=>yr.get(t)===o&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&V(t.cache.get(a),"art-current");for(const[e,r,o]of i)t.$parent.style.setProperty(e,r,o)};if(t.active=e,r)try{V(r,"art-current"),t.resize()}catch(l){throw n()&&t.cache.get(e)===r&&!Ue(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const o=function(t,e,r){const o=u(t.art).child();return qe.set(r,o),o.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),o}(t,e,r),a=()=>!o.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;M(r,"art-setting-panel"),A(t.$parent,r),V(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ye.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),o=(t,o)=>{if(r.closed||h(e))return;const n=(...t)=>{if(!r.closed&&!h(e))return o(...t)};e.on(t,n),r.add(()=>{e.off(t,n)})};o("blur",()=>{t.show&&(t.show=!1,t.render())}),o("focus",r=>{const o=Y(r,e.controls.setting),n=Y(r,t.$parent);!t.show||o||n||(t.show=!1,t.render())}),o("resize",()=>t.resize());const n=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&n()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(n);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(n);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,FLIP:n}}=t;function a(t){return e.get(et(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:o}=t;return{width:o.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)=>{nr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){je(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&V(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,o=[]){this.option=function(t,e,r,o,n=[]){const a=Ye.get(t)||{active:!0},i=[],s=new Set,l=new Set(n),c=(t,e,r)=>{for(let o=0;oHe(t).parent},$parents:{get:()=>He(t).parents},$option:{get:()=>He(t).option},$events:{get:()=>He(t).events},$formatted:{get:()=>!0}}),De.set(t,{parent:r,parents:o,option:n,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||n.push(p.name);return t.id=d,e}(this,t,e,r,o)}find(t=""){return function(t,e=""){let r=null;return je(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){ar(this)}inactivate(t){!function(t,e){const r=[],o=new Set,n=e=>{if(!o.has(e)){o.add(e);for(const t of e.selector||[])n(t);if(e.selector){const o=t.cache.get(e.selector);t.cache.delete(e.selector);try{o&&Xe(o)}catch(a){r.push(a)}}try{er(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(n(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);K(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{sr(t),gr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const o=e.$item,n=[];for(const i of[()=>this.inactivate(e),()=>o?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?n.push(...a.errors):n.push(a)}if(n.length)throw new s(n)}update(t){return vr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const o=e.length,n=r?void 0:function(t){const e={};ir.set(t,e);const r=()=>ir.get(t)===e;return{current:r,finish(){r()&&ir.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||n&&!n.current())throw i;if(e[o]===t&&e.splice(o,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{n?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:o},constructor:{SETTING_ITEM_HEIGHT:n}}=t.art,a=document.createElement("div");R(a,"height",`${n}px`),M(a,"art-setting-item"),M(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");M(s,"art-setting-item-left-icon"),A(s,o),A(i,s),A(i,e.$parent.html),or(t.art,e.$parent,a,"click",()=>t.render(e.$parents),Ue(r)),A(r,a)}(this,t)}createItem(t,e=!1){wr(this,t,e)}render(t=this.option){xr(this,t)}}class Er{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const Tr='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Cr extends Mt{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null,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?I(r,t):R(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?it(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=await this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=F("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,O(i),A(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(n(t,St.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||J(t.url)){case"srt":{const e=ut(r);return ht(t.onVttLoad(e))}case"ass":{const e=ft(r);return ht(t.onVttLoad(e))}case"vtt":return ht(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}}const Sr=`\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
${a}
\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 `;class zr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=S(e.container),K(this.$container,`No container element found by ${e.container}`)),K(H(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();K("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),K(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,hr(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Sr}query(t){return S(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=zr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){K(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),W(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&M(this.$player,"art-backdrop"),E&&M(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":M(this.$player,"art-destroy")}}const Mr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Lr{on(t,e,r){const o=this.e||(this.e={});let n=Mr(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Mr(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Mr(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),Or.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Or.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&Ar.push(this)}catch(o){try{f(this,Ar,!0,Or.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return Ar}static get version(){return a}static get config(){return i}static get utils(){return gt}static get scheme(){return St}static get Emitter(){return Lr}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return zr.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:x?"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){f(this,Ar,t,Or.REMOVE_SRC_WHEN_DESTROY)}}return Or.STYLE=Tr,Or.DEBUG=!1,Or.CONTEXTMENU=!0,Or.NOTICE_TIME=2e3,Or.SETTING_WIDTH=250,Or.SETTING_ITEM_WIDTH=200,Or.SETTING_ITEM_HEIGHT=35,Or.RESIZE_TIME=200,Or.SCROLL_TIME=200,Or.SCROLL_GAP=50,Or.AUTO_PLAYBACK_MAX=10,Or.AUTO_PLAYBACK_MIN=5,Or.AUTO_PLAYBACK_TIMEOUT=3e3,Or.RECONNECT_TIME_MAX=5,Or.RECONNECT_SLEEP_TIME=1e3,Or.CONTROL_HIDE_TIME=3e3,Or.DBCLICK_TIME=300,Or.DBCLICK_FULLSCREEN=!0,Or.MOBILE_DBCLICK_PLAY=!0,Or.MOBILE_CLICK_PLAY=!1,Or.AUTO_ORIENTATION_TIME=200,Or.INFO_LOOP_TIME=1e3,Or.FAST_FORWARD_VALUE=3,Or.FAST_FORWARD_TIME=1e3,Or.TOUCH_MOVE_RATIO=.5,Or.VOLUME_STEP=.1,Or.SEEK_STEP=5,Or.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Or.ASPECT_RATIO=["default","4:3","16:9"],Or.FLIP=["normal","horizontal","vertical"],Or.FULLSCREEN_WEB_IN_BODY=!0,Or.LOG_VERSION=!0,Or.USE_RAF=!1,Or.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=Or,C("artplayer-style",Tr),setTimeout(()=>{Or.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Or.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Or}); diff --git a/docs/compiled/artplayer.legacy.js b/docs/compiled/artplayer.legacy.js index bd1b8d802..808439d0a 100644 --- a/docs/compiled/artplayer.legacy.js +++ b/docs/compiled/artplayer.legacy.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,o=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(n)for(var r of n(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,o(e)),d=(t,e,r)=>new Promise((o,n)=>{var a=t=>{try{s(r.next(t))}catch(e){n(e)}},i=t=>{try{s(r.throw(t))}catch(e){n(e)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,o,n=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};o&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,n||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),n&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function z(t,e){const r=$(t).child();return C.set(e,r),r}function S(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function L(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=S(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=S(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const A=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",P=/^(?:(?!chrome|android).)*safari/i.test(A),O=/iPad|iPhone|iPod/i.test(A)&&!window.MSStream,I=O||A.includes("Macintosh")&&navigator.maxTouchPoints>=1,R=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(A)||I,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 Y(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function N(t,e){return t.classList.add(e)}function F(t,e){return t.classList.remove(e)}function H(t,e){return t.classList.contains(e)}function B(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function W(t){return t.parentNode.removeChild(t)}function j(t,e,r){return t.style[e]=r,t}function q(t,e){for(const r in e)j(t,r,e[r]);return t}function U(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function X(t,e){U(t).forEach(t=>F(t,e)),N(t,e)}function G(t,e,r="top"){R||(t.setAttribute("aria-label",e),N(t,"hint--rounded"),N(t,`hint--${r}`))}function K(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function Z(t,e){return nt(t).includes(e)}function J(t,e){return e.parentNode.replaceChild(t,e),t}function Q(t){return document.createElement(t)}function tt(t="",e=""){const r=Q("i");return N(r,"art-icon"),N(r,`art-icon-${t}`),B(r,e),r}function et(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function rt(t){return t.getBoundingClientRect()}function ot(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function nt(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}function at(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function st(t,e){if(!t)throw new it(e);return t}function lt(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function ct(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function dt(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function pt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ht(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ft={"&":"&","<":"<",">":">","'":"'",'"':"""},mt={"&":"&","<":"<",">":">","'":"'",""":'"'},gt=/(&|<|>|'|")/g;function vt(t){return t.replace(/[&<>'"]/g,t=>ft[t]||t)}const yt=Object.defineProperty,{hasOwnProperty:bt}=Object.prototype;function wt(t,e){return bt.call(t,e)}function xt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function kt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?kt(n,a):a,yt(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function $t(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 Et(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Tt(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Ct(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const zt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:N,append:B,assToVtt:Tt,capitalize:ut,clamp:pt,createElement:Q,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:yt,download:dt,errorHandle:st,escape:vt,get:xt,getComposedPath:nt,getExt:ct,getIcon:tt,getRect:rt,getSafeAreaInsets:at,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:wt,hasClass:H,includeFromEvent:Z,inverseClass:X,isBrowser:_,isIOS:O,isIOS13:I,isInViewport:K,isMobile:R,isSafari:P,loadImg:ot,mergeDeep:kt,query:Y,queryAll:D,remove:W,removeClass:F,replaceElement:J,secondToTime:ht,setStyle:j,setStyleText:V,setStyles:q,siblings:U,silencePromise:lt,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:$t,supportsFlex:et,throttle:Ct,tooltip:G,unescape:function(t){return t.replace(gt,t=>mt[t]||t)},userAgent:A,vttToBlob:Et},Symbol.toStringTag,{value:"Module"}));function St(t,e){return B(t,e)}function Lt(t,e){return e.querySelector(t)}const Mt="array",At="boolean",Pt="string",Ot="number",It="object",Rt="function";function _t(t,e,r){return st(e===Pt||e===Ot||t instanceof Element,`${r.join(".")} require '${Pt}' or 'Element' type`)}const Vt={html:_t,disable:`?${At}`,name:`?${Pt}`,index:`?${Ot}`,style:`?${It}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${Pt}|${Ot}`,width:`?${Ot}`,selector:`?${Mt}`,onSelect:`?${Rt}`,switch:`?${At}`,onSwitch:`?${Rt}`,range:`?${Mt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Yt={id:Pt,container:_t,url:Pt,poster:Pt,type:Pt,theme:Pt,lang:Pt,volume:Ot,isLive:At,muted:At,autoplay:At,autoSize:At,autoMini:At,loop:At,flip:At,playbackRate:At,aspectRatio:At,screenshot:At,setting:At,hotkey:At,pip:At,mutex:At,backdrop:At,fullscreen:At,fullscreenWeb:At,subtitleOffset:At,miniProgressBar:At,useSSR:At,playsInline:At,lock:At,gesture:At,fastForward:At,autoPlayback:At,autoOrientation:At,airplay:At,proxy:`?${Rt}`,plugins:[Rt],layers:[Vt],contextmenu:[Vt],settings:[Vt],controls:[c(l({},Vt),{position:(t,e,r)=>{const o=["top","left","right"];return st("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}})],quality:[{default:`?${At}`,html:Pt,url:Pt}],highlight:[{time:Ot,text:Pt}],thumbnails:{url:Pt,number:Ot,column:Ot,width:Ot,height:Ot,scale:Ot},subtitle:{url:Pt,name:Pt,type:Pt,style:It,escape:At,encoding:Pt,onVttLoad:Rt},moreVideoAttr:It,i18n:It,icons:It,cssVar:It,customType:It},Dt=new WeakSet;class Nt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return H(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?N(e,r):F(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,Vt),!this.$parent||!this.name||r.disable)return;const o=r.name||`${this.name}${this.id}`,n=this.cache;st(!n.has(o),`Can't add an existing [${o}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=z(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,o);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){N(t,`art-${r}`),N(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):B(e,t),a.html&&B(t,a.html),a.style&&q(t,a.style),a.tooltip&&G(t,a.tooltip)}(a,this.$parent,this.name,o,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,o,a),c=!0,n.set(o,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{L(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=n.get(o))?void 0:e.$ref)===a&&n.delete(o),c&&this[o]===a&&(l?Object.defineProperty(this,o,l):delete this[o]),a.remove(),d}}remove(t){st(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{L(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Ft extends Nt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,z(t,this.$parent),R||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="1"]',t);o&&X(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&X(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="default"]',t);o&&X(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:o}}=e,n=o.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="normal"]',t);o&&X(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=rt(e),{height:c,width:d}=rt(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),q(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{Z(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Ht(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function Bt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function Wt(t,e){const{$progress:r}=t.template,{left:o}=rt(r),n=pt((R?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:ht(a),width:n,percentage:pt(n/r.clientWidth,0,1)}}function jt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=Wt(t,e);t.emit("setBar","played",o,e),t.seek=r}}function qt(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=S(e),{on:i}=M(t,e);let s=()=>{};const l=Lt(".art-progress-hover",e),c=Lt(".art-progress-loaded",e),d=Lt(".art-progress-played",e),p=Lt(".art-progress-highlight",e),u=Lt(".art-progress-indicator",e),h=Lt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||Wt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?j(h,"left",0):n>e.clientWidth-i/2?j(h,"left",e.clientWidth-i+"px"):j(h,"left",n-i/2+"px")}r.indicator?B(u,r.indicator):j(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&R;if("loaded"===r&&j(c,"width",100*o+"%"),"hover"===r&&(j(l,"width",100*o+"%"),Z(i,p)?function(r){const{width:o}=Wt(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=n?n:"";const a=h.clientWidth;o<=a/2?j(h,"left",0):o>e.clientWidth-a/2?j(h,"left",e.clientWidth-a+"px"):j(h,"left",o-a/2+"px")}(i):f(i),0===o?F(n,"art-progress-hover"):N(n,"art-progress-hover")),"played"===r&&(j(d,"width",100*o+"%"),j(u,"left",100*o+"%")),m){N(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:ht(o*t.duration)}),s(),s=Ht(a,()=>{F(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=M(t,e);if(!R){let e=!1;a(r,"click",e=>{e.target!==o&&jt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Wt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=Wt(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.play),s=St(t,n.pause);function l(){j(i,"display","flex"),j(s,"display","none")}function c(){j(i,"display","none"),j(s,"display","flex")}G(i,a.get("Play")),G(s,a.get("Pause")),o(i,"click",()=>{lt(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n}=e,a=St(t,n.volume),i=St(t,n.volumeClose),s=St(t,'
'),l=St(s,'
'),c=St(l,'
'),d=St(l,'
'),p=St(d,'
'),u=St(p,'
'),h=St(d,'
');function f(t){const{top:e,height:r}=rt(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)j(a,"display","none"),j(i,"display","flex"),j(h,"top","100%"),j(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;j(a,"display","flex"),j(i,"display","none"),j(h,"top",100-t+"%"),j(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),R)j(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:R?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function o(){const r=`${ht(e.currentTime)} / ${ht(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!R&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:o}=e;St(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e;St(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{G(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e;St(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{G(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:o}=e;St(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.fullscreenWebOn),s=St(t,n.fullscreenWebOff);j(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(G(t,a.get("Exit Web Fullscreen")),j(i,"display","none"),j(s,"display","inline-flex")):(G(t,a.get("Web Fullscreen")),j(i,"display","inline-flex"),j(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.fullscreenOn),s=St(t,n.fullscreenOff);j(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(G(t,a.get("Exit Fullscreen")),j(i,"display","none"),j(s,"display","inline-flex")):(G(t,a.get("Fullscreen")),j(i,"display","inline-flex"),j(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),yt(t,"$control_item",{get:()=>Kt.get(t).item}),yt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,o,n){const{proxy:a}=t.events,i=S(o),s=r.selector;N(o,"art-control-selector");const l=document.createElement("div");N(l,"art-selector-value"),B(l,r.html),o.textContent="",B(o,l);const c=St(o,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const n=nt(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,o);c()&&Jt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));n.push(u)}class te extends Nt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;z(t,o);const{on:n}=M(t,o);n("mousemove",()=>{R||(this.show=!0)}),n("click",()=>{R?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=Z(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(F(r,"art-hide-cursor"),N(r,"art-hover"),this.timer=Date.now()):(N(r,"art-hide-cursor"),F(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=S(e),{on:a}=M(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:st(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const oe=new WeakMap;class ne{constructor(t){this.destroyEvents=new Set;const e=$(t);oe.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){Z(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),R?!t.isLock&&n&<(t.toggle()):lt(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),R?!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=>{N(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=$(t);let a=()=>{};const i=()=>{a(),a=Ht(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(R&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&jt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=ee(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=pt((o-i)/t.width,-1,1),d=pt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=pt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",pt(h/t.duration,0,1),e),t.notice.show=`${ht(h)} / ${ht(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=Ct(()=>{t.emit("view",K(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{var o;const s=a.window||(null==(o=i.ownerDocument)?void 0:o.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});n.push(l)})}a(),e.bindGlobalEvents=a}(t,this),re(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(oe.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 ae{constructor(t){this.art=t,this.keys={},R||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",()=>{lt(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)yt(this,r,{get:()=>tt(r,e[r])})}}class de extends Nt{constructor(t){super(t),this.name="info",R||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{j(n,"display","none"),j(a,"display",null)}),o.proxy(e.$state,"click",()=>lt(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,N(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.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")}}function me(t,e,r,o=!1){const n=e=>{E(t)||r(e)};t[o?"once":"on"](e,n),$(t).add(()=>{t.off(e,n)})}function ge(t,e,r){for(const[o,n]of e){if(E(t)||r&&!r())return;t[o].show=n}}const ve=new WeakMap,ye=new WeakMap,be=new WeakMap;function we(t){return be.get(t)||$(t)}function xe(t){const e=ve.get(t),r=be.get(t);return()=>ve.get(t)===e&&(!e||e.active())&&be.get(t)===r&&(!r||!r.closed)}function ke(t){const e=be.get(t),r=$(t).child(),o=r.child();be.set(t,r),r.add(()=>{be.get(t)===r&&be.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!o.closed&&ve.get(t)===n};return ve.set(t,n),o.add(()=>{ve.get(t)===n&&ve.delete(t),n.onAssigned=void 0,n.onError=void 0}),null==e||e.dispose(),n}function $e(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Ee(t,e,r){ye.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ye.get(t)===e&&(ye.delete(t),$e(e))}}function Te(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Ce(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=we(t),l=0;return{reset(){l=0,null==i||i.dispose(),F(a,"art-error")},loadStart(){F(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=we(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===we(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function ze(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Ce(t);!function(t,e){me(t,"video:canplay",()=>{e.reset(),ge(t,[["loading",!1]])}),me(t,"video:canplay",()=>{ge(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;me(t,"video:ended",()=>{if(e.loop){const e=xe(t);if(t.seek=0,E(t)||!e())return;lt(t.play()),e()&&ge(t,[["controls",!1],["mask",!1]],e)}else ge(t,[["controls",!0],["mask",!0]])})}(t),me(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;me(t,"video:loadedmetadata",()=>{t.emit("resize"),R&&ge(t,[["loading",!1],["controls",!0],["mask",!0]])}),me(t,"video:loadstart",()=>{e.loadStart(),ge(t,[["loading",!0],["mask",!1],["controls",!0]])}),me(t,"video:pause",()=>{ge(t,[["controls",!0],["mask",!0]])}),me(t,"video:play",()=>{ge(t,[["mask",!1]]),E(t)||j(r,"display","none")}),me(t,"video:playing",()=>ge(t,[["mask",!1]])),me(t,"video:progress",()=>{t.playing&&ge(t,[["loading",!1]])}),me(t,"video:seeked",()=>ge(t,[["loading",!1],["mask",!0]])),me(t,"video:seeking",()=>ge(t,[["loading",!0],["mask",!1]])),me(t,"video:timeupdate",()=>ge(t,[["mask",!1]])),me(t,"video:waiting",()=>ge(t,[["loading",!0],["mask",!1]]))}(t,e)}const Se=[["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"]],Le=(()=>{if("undefined"===typeof document)return!1;const t=Se[0],e={};for(const r of Se){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),Me={change:Le.fullscreenchange,error:Le.fullscreenerror},Ae={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{Ae.off("change",n),r()};Ae.on("change",n);const a=t[Le.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!Ae.isFullscreen)return void t();const r=()=>{Ae.off("change",r),t()};Ae.on("change",r);const o=document[Le.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>Ae.isFullscreen?Ae.exit():Ae.request(t,e),onchange(t){Ae.on("change",t)},onerror(t){Ae.on("error",t)},on(t,e){const r=Me[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Me[t];r&&document.removeEventListener(r,e,!1)},raw:Le};function Pe(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t,a=t=>{Ae.on("change",()=>{t.emit("fullscreen",Ae.isFullscreen),Ae.isFullscreen?(t.state="fullscreen",N(n,"art-fullscreen")):F(n,"art-fullscreen"),t.emit("resize")}),Ae.on("error",e=>{t.emit("fullscreenError",e)}),yt(t,"fullscreen",{get:()=>Ae.isFullscreen,set(t){return d(this,null,function*(){t?yield Ae.request(n):yield Ae.exit()})}})};t.once("video:loadedmetadata",()=>{var n;Ae.isEnabled?a(t):o.webkitSupportsFullscreen?((n=t).on("document:webkitfullscreenchange",()=>{n.emit("fullscreen",n.fullscreen),n.emit("resize")}),yt(n,"fullscreen",{get:()=>document.fullscreenElement===o,set(t){t?(n.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})):yt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),yt(t,"fullscreen",xt(t,"fullscreen"))})}function Oe(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(F(n,"art-mini"),j(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(j(e,"display","none"),j(r,"display","flex")):(j(e,"display","flex"),j(r,"display","none"))}function p(){const{$mini:e}=t.template,r=rt(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),j(e,"top",`${n}px`),j(e,"left",`${a}px`)}yt(t,"mini",{get:()=>H(n,"art-mini"),set(u){if(u){t.state="mini",N(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return B(n,a),j(n,"display","flex");{const n=Q("div");N(n,"art-mini-popup"),B(document.body,n),t.template.$mini=n,B(n,a);const p=B(n,'
');B(p,e.close),r(p,"click",c);const u=B(n,'
'),h=B(u,e.play),f=B(u,e.pause);return r(h,"click",()=>lt(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){N(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;j(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,F(n,"art-mini-dragging");const t=rt(n);o.set("left",t.left),o.set("top",t.top),j(n,"left",`${t.left}px`),j(n,"top",`${t.top}px`),j(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(j(u,"top",`${h}px`),j(u,"left",`${f}px`),K(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Ie(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,yt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),yt(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):yt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Re(t){yt(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${n.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(o.show=a)}return e.html})}})}})}function _e(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ve(t,e,r){return new Promise((o,n)=>{if(E(t)||e===t.url)return void o();const a=ke(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)_e(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if(Ee(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=_e(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ye(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",(n,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===n||"played"===n&&l&&R){if(i||a||(a=!0,i=yield ot(p,u),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-h/2?j(s,"left",r.clientWidth-h+"px"):j(s,"left",n-h/2+"px")}(n)}})),yt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function De(t){const{option:e,template:{$video:r}}=t;yt(t,"url",{get:()=>r.src,set(o){return d(this,null,function*(){if(E(t))return;const n=function(t){const e=ye.get(t);return ye.delete(t),e||ke(t)}(t);n.acceptingEvents=!1;try{if(!o)return void((yield Bt(n.scope))&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||ct(o),s=e.customType[i];if(i&&s){if(!(yield Bt(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;_e(l,t,"video:canplay",()=>{c=!d}),_e(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>Te(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||_e(n.scope,t,"video:canplay",e)}}catch(a){Te(n,a)}finally{$e(n)}})}})}Object.defineProperties(Ae,{isFullscreen:{get:()=>Boolean(document[Le.fullscreenElement])},element:{enumerable:!0,get:()=>document[Le.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Le.fullscreenEnabled])}});class Ne{constructor(t){De(t),function(t){const{template:{$video:e}}=t;yt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;yt(t,"play",{value(){return d(this,null,function*(){const i=xe(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;yt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ht(t.currentTime)} / ${ht(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;yt(t,"forward",{set(e){r.seek=t.currentTime+e}}),yt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;yt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=pt(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),yt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;yt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=pt(o,0,t.duration))}})}(t),function(t){yt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ve(t,e,0);yt(t,"switchQuality",{value:e=>Ve(t,e,t.currentTime)}),yt(t,"switchUrl",{value:e}),yt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;yt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;yt(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)j(o,"width",null),j(o,"height",null),j(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(j(o,"width",s*r+"px"),j(o,"height","100%"),j(o,"margin","0 auto")):(j(o,"width","100%"),j(o,"height",e/s+"px"),j(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=Q("canvas");yt(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),yt(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),yt(t,"screenshot",{value:e=>d(null,null,function*(){const o=yield t.getDataURL();return dt(o,`${e||`artplayer_${ht(r.currentTime)}`}.png`),t.emit("screenshot",o),o})})}(t),Pe(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";yt(t,"fullscreenWeb",{get:()=>H(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&B(document.body,o),t.state="fullscreenWeb",j(o,"width","100%"),j(o,"height","100%"),N(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&B(r,o),n&&(o.style.cssText=n,n=""),F(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Ie(t),function(t){const{$video:e}=t.template,r=t;yt(t,"loaded",{get:()=>r.loadedTime/e.duration}),yt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){yt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;yt(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:o}=t.template;yt(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=rt(e),l=n/a;if(i/s>l)j(r,"width",s*l/i*100+"%"),j(r,"height","100%");else{const t=i/l/s*100;j(r,"width","100%"),j(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;yt(t,"rect",{get:()=>rt(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}yt(t,"x",{get:()=>e.left+window.pageXOffset}),yt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;yt(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(ut(n))}`,t.emit("flip",n)}})}(t),Oe(t),function(t){const{template:{$poster:e}}=t;yt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){j(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;yt(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);j(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;yt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){yt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){yt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];yt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;o{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,yt(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Re(t),Ye(t),ze(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=pt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=pt(a,0,1)),e.poster&&j(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Fe(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{var n;if(e){if(l()){const e=Number(null!=(n=r.AUTO_ORIENTATION_TIME)?n:0);setTimeout(()=>{t.fullscreenWeb&&!H(o,a)&&function(){const e=at(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;j(o,"width",`${n}px`),j(o,"height",`${i}px`),j(o,"transform-origin","0 0"),j(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),N(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else H(o,a)&&(j(o,"width",""),j(o,"height",""),j(o,"transform-origin",""),j(o,"transform",""),F(o,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const n=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(n&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,N(o,i)}catch(a){s=!1,e.show=a}}else if(H(o,i)&&F(o,i),n&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return H(o,a)}}}function He(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=Y(".art-auto-playback-last",s),c=Y(".art-auto-playback-jump",s),d=Y(".art-auto-playback-close",s);B(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),j(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(j(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ht(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{j(s,"display","none")}),a(c,"click",()=>{t.seek=r,lt(t.play()),j(i,"display","none"),j(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{j(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Be(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,F(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,N(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return H(o,"art-fast-forward")}}}function We(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return H(o,"art-lock")}function a(){N(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){F(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=B(e,r.lock),n=B(e,r.unlock);j(o,"display","none"),t.on("lock",t=>{t?(j(o,"display","inline-flex"),j(n,"display","none")):(j(o,"display","none"),j(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function je(t){return t.on("control",e=>{e?F(t.template.$player,"art-mini-progress-bar"):N(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class qe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(je),!E(t.art)&&e.lock&&R&&t.add(We),E(t.art)||!e.autoPlayback||e.isLive||t.add(He),!E(t.art)&&e.autoOrientation&&R&&t.add(Fe),!E(t.art)&&e.fastForward&&R&&!e.isLive&&t.add(Be)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){st(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let n=o;const a=wt(t,n);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return E(t.art)||(st(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),E(t.art)||yt(t,n,{value:r})),t}(this,t,e)}}class Ue extends Nt{constructor(t){super(t);const{option:e,controls:r,template:{$setting:o}}=t;this.name="setting",this.$parent=o,this.id=0,this.active=null,this.cache=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=Z(t,r.setting),o=Z(t,this.$parent);!this.show||e||o||(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:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(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:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(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:o,FLIP:n}}=t;function a(t){return e.get(ut(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(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:o}=t;return{width:o.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){var r;for(let o=0;o{e.default=e===t,e.default&&e.$item&&X(e.$item,"art-current")},t.$option),this.render(t.$parents))}format(t=this.option,e,r,o=[]){for(let n=0;ne}),yt(a,"$parents",{get:()=>r}),yt(a,"$option",{get:()=>t});const o=[];yt(a,"$events",{get:()=>o}),yt(a,"$formatted",{get:()=>!0})}this.format(a.selector||[],a,t,o)}this.option=t}find(t=""){let e=null;return this.traverse(r=>{r.name===t&&(e=r)}),e}resize(){var t,e;const{controls:r,constructor:{SETTING_WIDTH:o,SETTING_ITEM_HEIGHT:n},template:{$player:a,$setting:i}}=this.art;if(r.setting&&this.show){const s=(null==(e=null==(t=this.active[0])?void 0:t.$parent)?void 0:e.width)||o,{left:l,width:c}=rt(r.setting),{left:d,width:p}=rt(a),u=l-d+c/2-s/2;if(j(i,"height",`${this.active===this.option?this.active.length*n:(this.active.length+1)*n}px`),j(i,"width",`${s}px`),this.art.isRotate||R)return;u+s>p?(j(i,"left",null),j(i,"right",null)):(j(i,"left",`${u}px`),j(i,"right","auto"))}}inactivate(t){for(let e=0;e'),s=Q("div");N(s,"art-setting-item-left-icon"),B(s,o),B(i,s),B(i,t.$parent.html);const l=r(a,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),B(e,a)}createItem(t,e=!1){var r,o;if(!this.cache.has(t.$option))return;const n=this.cache.get(t.$option),a=t.$item;let i="selector";wt(t,"switch")&&(i="switch"),wt(t,"range")&&(i="range"),wt(t,"onClick")&&(i="button");const{icons:s,proxy:l,constructor:c}=this.art,p=Q("div");N(p,"art-setting-item"),j(p,"height",`${c.SETTING_ITEM_HEIGHT}px`),p.dataset.name=t.name||"",p.dataset.value=t.value||"";const u=B(p,'
'),h=B(p,'
'),f=Q("div");switch(N(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":B(f,t.icon||s.config);break;case"selector":(null==(r=t.selector)?void 0:r.length)?B(f,t.icon||s.config):B(f,s.check)}B(u,f),yt(t,"$icon",{configurable:!0,get:()=>f}),yt(t,"icon",{configurable:!0,get:()=>f.innerHTML,set(t){f.innerHTML="",B(f,t)}});const m=Q("div");N(m,"art-setting-item-left-text"),B(m,t.html||""),B(u,m),yt(t,"$html",{configurable:!0,get:()=>m}),yt(t,"html",{configurable:!0,get:()=>m.innerHTML,set(t){m.innerHTML="",B(m,t)}});const g=Q("div");switch(N(g,"art-setting-item-right-tooltip"),B(g,t.tooltip||""),B(h,g),yt(t,"$tooltip",{configurable:!0,get:()=>g}),yt(t,"tooltip",{configurable:!0,get:()=>g.innerHTML,set(t){g.innerHTML="",B(g,t)}}),i){case"switch":{const e=Q("div");N(e,"art-setting-item-right-icon");const r=B(e,s.switchOn),o=B(e,s.switchOff);j(t.switch?o:r,"display","none"),B(h,e),yt(t,"$switch",{configurable:!0,get:()=>e});let n=t.switch;yt(t,"switch",{configurable:!0,get:()=>n,set(t){n=t,t?(j(o,"display","none"),j(r,"display",null)):(j(o,"display",null),j(r,"display","none"))}});break}case"range":{const e=Q("div");N(e,"art-setting-item-right-icon");const r=B(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],N(r,"art-setting-range"),B(h,e),yt(t,"$range",{configurable:!0,get:()=>r});let o=[...t.range];yt(t,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=t[0],r.min=t[1],r.max=t[2],r.step=t[3]}})}break;case"selector":if(null==(o=t.selector)?void 0:o.length){const t=Q("div");N(t,"art-setting-item-right-icon"),B(t,s.arrowRight),B(h,t)}}switch(i){case"switch":if(t.onSwitch){const e=l(p,"click",e=>d(this,null,function*(){t.switch=yield t.onSwitch.call(this.art,t,p,e)}));t.$events.push(e)}break;case"range":if(t.$range){if(t.onRange){const e=l(t.$range,"change",e=>d(this,null,function*(){t.range[0]=t.$range.valueAsNumber,t.tooltip=yield t.onRange.call(this.art,t,p,e)}));t.$events.push(e)}if(t.onChange){const e=l(t.$range,"input",e=>d(this,null,function*(){t.range[0]=t.$range.valueAsNumber,t.tooltip=yield t.onChange.call(this.art,t,p,e)}));t.$events.push(e)}}break;case"selector":{const e=l(p,"click",e=>d(this,null,function*(){var r;(null==(r=t.selector)?void 0:r.length)?this.render(t.selector):(this.check(t),t.$parent.onSelect&&(t.$parent.tooltip=yield t.$parent.onSelect.call(this.art,t,p,e)))}));t.$events.push(e),t.default&&N(p,"art-current")}break;case"button":if(t.onClick){const e=l(p,"click",e=>d(this,null,function*(){t.tooltip=yield t.onClick.call(this.art,t,p,e)}));t.$events.push(e)}}yt(t,"$item",{configurable:!0,get:()=>p}),e?J(p,a):B(n,p),t.mounted&&Ht($(this.art),()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){var e;if(this.active=t,this.cache.has(t)){X(this.cache.get(t),"art-current")}else{const r=Q("div");this.cache.set(t,r),N(r,"art-setting-panel"),B(this.$parent,r),X(r,"art-current"),(null==(e=t[0])?void 0:e.$parent)&&this.createHeader(t[0]);for(let e=0;enull,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(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[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?q(r,t):j(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?vt(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a=c(l(l({},n.subtitle),e),{url:t}),i=yield this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i})}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=Q("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,W(i),B(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}init(t){return d(this,null,function*(){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(m(t,Yt.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||ct(t.url)){case"srt":{const e=$t(r);return Et(t.onVttLoad(e))}case"ass":{const e=Tt(r);return Et(t.onVttLoad(e))}case"vtt":return Et(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})}}const Ze=`\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
${g}
\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 `;class Je{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=Y(e.container),st(this.$container,`No container element found by ${e.container}`)),st(et(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();st("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),st(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=x.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=k(t);n.rollback=r,x.set(e,t),n.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,function(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Ze}query(t){return Y(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Je.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){st(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),J(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&N(this.$player,"art-backdrop"),R&&N(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":N(this.$player,"art-destroy")}}const Qe=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class tr{on(t,e,r){const o=this.e||(this.e={});let n=Qe(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Qe(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Qe(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),or.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${or.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&rr.push(this)}catch(o){try{T(this,rr,!0,or.REMOVE_SRC_WHEN_DESTROY,!0)}catch(n){console.warn("Failed to clean up ArtPlayer initialization:",n)}throw o}}static get instances(){return rr}static get version(){return g}static get config(){return v}static get utils(){return zt}static get scheme(){return Yt}static get Emitter(){return tr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return Je.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:P?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,rr,t,or.REMOVE_SRC_WHEN_DESTROY)}}return or.STYLE=Ge,or.DEBUG=!1,or.CONTEXTMENU=!0,or.NOTICE_TIME=2e3,or.SETTING_WIDTH=250,or.SETTING_ITEM_WIDTH=200,or.SETTING_ITEM_HEIGHT=35,or.RESIZE_TIME=200,or.SCROLL_TIME=200,or.SCROLL_GAP=50,or.AUTO_PLAYBACK_MAX=10,or.AUTO_PLAYBACK_MIN=5,or.AUTO_PLAYBACK_TIMEOUT=3e3,or.RECONNECT_TIME_MAX=5,or.RECONNECT_SLEEP_TIME=1e3,or.CONTROL_HIDE_TIME=3e3,or.DBCLICK_TIME=300,or.DBCLICK_FULLSCREEN=!0,or.MOBILE_DBCLICK_PLAY=!0,or.MOBILE_CLICK_PLAY=!1,or.AUTO_ORIENTATION_TIME=200,or.INFO_LOOP_TIME=1e3,or.FAST_FORWARD_VALUE=3,or.FAST_FORWARD_TIME=1e3,or.TOUCH_MOVE_RATIO=.5,or.VOLUME_STEP=.1,or.SEEK_STEP=5,or.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],or.ASPECT_RATIO=["default","4:3","16:9"],or.FLIP=["normal","horizontal","vertical"],or.FULLSCREEN_WEB_IN_BODY=!0,or.LOG_VERSION=!0,or.USE_RAF=!1,or.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=or,V("artplayer-style",Ge),setTimeout(()=>{or.LOG_VERSION&&console.log(`%c ArtPlayer %c ${or.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),or}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var a=t=>{try{s(r.next(t))}catch(e){o(e)}},i=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,o||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function S(t,e){const r=$(t).child();return C.set(e,r),r}function z(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function M(t){var e;null==(e=C.get(t))||e.dispose()}function P(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=z(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=z(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const L=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(L),O=/iPad|iPhone|iPod/i.test(L)&&!window.MSStream,R=O||L.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(L)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 N(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function Y(t,e){return t.classList.add(e)}function W(t,e){return t.classList.remove(e)}function F(t,e){return t.classList.contains(e)}function j(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function B(t){return t.parentNode.removeChild(t)}function H(t,e,r){return t.style[e]=r,t}function q(t,e){for(const r in e)H(t,r,e[r]);return t}function U(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function X(t,e){U(t).forEach(t=>W(t,e)),Y(t,e)}function G(t,e,r="top"){I||(t.setAttribute("aria-label",e),Y(t,"hint--rounded"),Y(t,`hint--${r}`))}function K(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function Z(t,e){return ot(t).includes(e)}function J(t,e){return e.parentNode.replaceChild(t,e),t}function Q(t){return document.createElement(t)}function tt(t="",e=""){const r=Q("i");return Y(r,"art-icon"),Y(r,`art-icon-${t}`),j(r,e),r}function et(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function rt(t){return t.getBoundingClientRect()}function nt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function ot(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}function at(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function st(t,e){if(!t)throw new it(e);return t}function lt(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function ct(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function dt(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function pt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ht(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ft={"&":"&","<":"<",">":">","'":"'",'"':"""},mt={"&":"&","<":"<",">":">","'":"'",""":'"'},gt=/(&|<|>|'|")/g;function vt(t){return t.replace(/[&<>'"]/g,t=>ft[t]||t)}const yt=Object.defineProperty,{hasOwnProperty:bt}=Object.prototype;function wt(t,e){return bt.call(t,e)}function xt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function kt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?kt(o,a):a,yt(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function $t(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 Et(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Tt(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Ct(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const St=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:Y,append:j,assToVtt:Tt,capitalize:ut,clamp:pt,createElement:Q,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:yt,download:dt,errorHandle:st,escape:vt,get:xt,getComposedPath:ot,getExt:ct,getIcon:tt,getRect:rt,getSafeAreaInsets:at,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:wt,hasClass:F,includeFromEvent:Z,inverseClass:X,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:K,isMobile:I,isSafari:A,loadImg:nt,mergeDeep:kt,query:N,queryAll:D,remove:B,removeClass:W,replaceElement:J,secondToTime:ht,setStyle:H,setStyleText:V,setStyles:q,siblings:U,silencePromise:lt,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:$t,supportsFlex:et,throttle:Ct,tooltip:G,unescape:function(t){return t.replace(gt,t=>mt[t]||t)},userAgent:L,vttToBlob:Et},Symbol.toStringTag,{value:"Module"}));function zt(t,e){return j(t,e)}function Mt(t,e){return e.querySelector(t)}const Pt="array",Lt="boolean",At="string",Ot="number",Rt="object",It="function";function _t(t,e,r){return st(e===At||e===Ot||t instanceof Element,`${r.join(".")} require '${At}' or 'Element' type`)}const Vt={html:_t,disable:`?${Lt}`,name:`?${At}`,index:`?${Ot}`,style:`?${Rt}`,click:`?${It}`,mounted:`?${It}`,tooltip:`?${At}|${Ot}`,width:`?${Ot}`,selector:`?${Pt}`,onSelect:`?${It}`,switch:`?${Lt}`,onSwitch:`?${It}`,range:`?${Pt}`,onRange:`?${It}`,onChange:`?${It}`},Nt={id:At,container:_t,url:At,poster:At,type:At,theme:At,lang:At,volume:Ot,isLive:Lt,muted:Lt,autoplay:Lt,autoSize:Lt,autoMini:Lt,loop:Lt,flip:Lt,playbackRate:Lt,aspectRatio:Lt,screenshot:Lt,setting:Lt,hotkey:Lt,pip:Lt,mutex:Lt,backdrop:Lt,fullscreen:Lt,fullscreenWeb:Lt,subtitleOffset:Lt,miniProgressBar:Lt,useSSR:Lt,playsInline:Lt,lock:Lt,gesture:Lt,fastForward:Lt,autoPlayback:Lt,autoOrientation:Lt,airplay:Lt,proxy:`?${It}`,plugins:[It],layers:[Vt],contextmenu:[Vt],settings:[Vt],controls:[c(l({},Vt),{position:(t,e,r)=>{const n=["top","left","right"];return st("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Lt}`,html:At,url:At}],highlight:[{time:Ot,text:At}],thumbnails:{url:At,number:Ot,column:Ot,width:Ot,height:Ot,scale:Ot},subtitle:{url:At,name:At,type:At,style:Rt,escape:Lt,encoding:At,onVttLoad:It},moreVideoAttr:Rt,i18n:Rt,icons:Rt,cssVar:Rt,customType:Rt},Dt=new WeakSet;class Yt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return F(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?Y(e,r):W(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,Vt),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;st(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=S(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){Y(t,`art-${r}`),Y(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):j(e,t),a.html&&j(t,a.html),a.style&&q(t,a.style),a.tooltip&&G(t,a.tooltip)}(a,this.$parent,this.name,n,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,a),c=!0,o.set(n,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{M(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=o.get(n))?void 0:e.$ref)===a&&o.delete(n),c&&this[n]===a&&(l?Object.defineProperty(this,n,l):delete this[n]),a.remove(),d}}remove(t){st(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{M(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Wt extends Yt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,S(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=P(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="1"]',t);n&&X(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&X(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="default"]',t);n&&X(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="normal"]',t);n&&X(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=rt(e),{height:c,width:d}=rt(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),q(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{Z(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Ft(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function jt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function Bt(t,e){const{$progress:r}=t.template,{left:n}=rt(r),o=pt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:ht(a),width:o,percentage:pt(o/r.clientWidth,0,1)}}function Ht(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Bt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function qt(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=z(e),{on:i}=P(t,e);let s=()=>{};const l=Mt(".art-progress-hover",e),c=Mt(".art-progress-loaded",e),d=Mt(".art-progress-played",e),p=Mt(".art-progress-highlight",e),u=Mt(".art-progress-indicator",e),h=Mt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||Bt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?H(h,"left",0):o>e.clientWidth-i/2?H(h,"left",e.clientWidth-i+"px"):H(h,"left",o-i/2+"px")}r.indicator?j(u,r.indicator):H(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&I;if("loaded"===r&&H(c,"width",100*n+"%"),"hover"===r&&(H(l,"width",100*n+"%"),Z(i,p)?function(r){const{width:n}=Bt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const a=h.clientWidth;n<=a/2?H(h,"left",0):n>e.clientWidth-a/2?H(h,"left",e.clientWidth-a+"px"):H(h,"left",n-a/2+"px")}(i):f(i),0===n?W(o,"art-progress-hover"):Y(o,"art-progress-hover")),"played"===r&&(H(d,"width",100*n+"%"),H(u,"left",100*n+"%")),m){Y(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:ht(n*t.duration)}),s(),s=Ft(a,()=>{W(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=P(t,e);if(!I){let e=!1;a(r,"click",e=>{e.target!==n&&Ht(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Bt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Bt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.play),s=zt(t,o.pause);function l(){H(i,"display","flex"),H(s,"display","none")}function c(){H(i,"display","none"),H(s,"display","flex")}G(i,a.get("Play")),G(s,a.get("Pause")),n(i,"click",()=>{lt(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o}=e,a=zt(t,o.volume),i=zt(t,o.volumeClose),s=zt(t,'
'),l=zt(s,'
'),c=zt(l,'
'),d=zt(l,'
'),p=zt(d,'
'),u=zt(p,'
'),h=zt(d,'
');function f(t){const{top:e,height:r}=rt(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)H(a,"display","none"),H(i,"display","flex"),H(h,"top","100%"),H(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;H(a,"display","flex"),H(i,"display","none"),H(h,"top",100-t+"%"),H(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),I)H(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=P(e,t);function n(){const r=`${ht(e.currentTime)} / ${ht(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=P(e,t),{icons:n}=e;zt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e;zt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{G(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e;zt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{G(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=P(e,t),{icons:n}=e;zt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.fullscreenWebOn),s=zt(t,o.fullscreenWebOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(G(t,a.get("Exit Web Fullscreen")),H(i,"display","none"),H(s,"display","inline-flex")):(G(t,a.get("Web Fullscreen")),H(i,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.fullscreenOn),s=zt(t,o.fullscreenOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(G(t,a.get("Exit Fullscreen")),H(i,"display","none"),H(s,"display","inline-flex")):(G(t,a.get("Fullscreen")),H(i,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),yt(t,"$control_item",{get:()=>Kt.get(t).item}),yt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,n,o){const{proxy:a}=t.events,i=z(n),s=r.selector;Y(n,"art-control-selector");const l=document.createElement("div");Y(l,"art-selector-value"),j(l,r.html),n.textContent="",j(n,l);const c=zt(n,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const o=ot(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,n);c()&&Jt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));o.push(u)}class te extends Yt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;S(t,n);const{on:o}=P(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=Z(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(W(r,"art-hide-cursor"),Y(r,"art-hover"),this.timer=Date.now()):(Y(r,"art-hide-cursor"),W(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=z(e),{on:a}=P(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:st(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const ne=new WeakMap;class oe{constructor(t){this.destroyEvents=new Set;const e=$(t);ne.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){Z(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&<(t.toggle()):lt(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),I?!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=>{Y(r,"art-hover"),t.emit("hover",!0,e)},e=>{W(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let a=()=>{};const i=()=>{a(),a=Ft(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Ht(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=ee(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=pt((n-i)/t.width,-1,1),d=pt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=pt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",pt(h/t.duration,0,1),e),t.notice.show=`${ht(h)} / ${ht(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Ct(()=>{t.emit("view",K(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=a.window||(null==(n=i.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}a(),e.bindGlobalEvents=a}(t,this),re(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(ne.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 ae{constructor(t){this.art=t,this.keys={},I||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",()=>{lt(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)yt(this,r,{get:()=>tt(r,e[r])})}}class de extends Yt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{H(o,"display","none"),H(a,"display",null)}),n.proxy(e.$state,"click",()=>lt(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,Y(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",W(r,"art-notice-show")},e.NOTICE_TIME)):W(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function me(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function ge(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const ve=new WeakMap,ye=new WeakMap,be=new WeakMap;function we(t){return be.get(t)||$(t)}function xe(t){const e=ve.get(t),r=be.get(t);return()=>ve.get(t)===e&&(!e||e.active())&&be.get(t)===r&&(!r||!r.closed)}function ke(t){const e=be.get(t),r=$(t).child(),n=r.child();be.set(t,r),r.add(()=>{be.get(t)===r&&be.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&ve.get(t)===o};return ve.set(t,o),n.add(()=>{ve.get(t)===o&&ve.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function $e(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Ee(t,e,r){ye.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ye.get(t)===e&&(ye.delete(t),$e(e))}}function Te(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Ce(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=we(t),l=0;return{reset(){l=0,null==i||i.dispose(),W(a,"art-error")},loadStart(){W(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=we(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===we(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Se(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Ce(t);!function(t,e){me(t,"video:canplay",()=>{e.reset(),ge(t,[["loading",!1]])}),me(t,"video:canplay",()=>{ge(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;me(t,"video:ended",()=>{if(e.loop){const e=xe(t);if(t.seek=0,E(t)||!e())return;lt(t.play()),e()&&ge(t,[["controls",!1],["mask",!1]],e)}else ge(t,[["controls",!0],["mask",!0]])})}(t),me(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;me(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&ge(t,[["loading",!1],["controls",!0],["mask",!0]])}),me(t,"video:loadstart",()=>{e.loadStart(),ge(t,[["loading",!0],["mask",!1],["controls",!0]])}),me(t,"video:pause",()=>{ge(t,[["controls",!0],["mask",!0]])}),me(t,"video:play",()=>{ge(t,[["mask",!1]]),E(t)||H(r,"display","none")}),me(t,"video:playing",()=>ge(t,[["mask",!1]])),me(t,"video:progress",()=>{t.playing&&ge(t,[["loading",!1]])}),me(t,"video:seeked",()=>ge(t,[["loading",!1],["mask",!0]])),me(t,"video:seeking",()=>ge(t,[["loading",!0],["mask",!1]])),me(t,"video:timeupdate",()=>ge(t,[["mask",!1]])),me(t,"video:waiting",()=>ge(t,[["loading",!0],["mask",!1]]))}(t,e)}const ze=[["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"]],Me=(()=>{if("undefined"===typeof document)return!1;const t=ze[0],e={};for(const r of ze){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Pe={change:Me.fullscreenchange,error:Me.fullscreenerror},Le={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Le.off("change",o),r()};Le.on("change",o);const a=t[Me.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Le.isFullscreen)return void t();const r=()=>{Le.off("change",r),t()};Le.on("change",r);const n=document[Me.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Le.isFullscreen?Le.exit():Le.request(t,e),onchange(t){Le.on("change",t)},onerror(t){Le.on("error",t)},on(t,e){const r=Pe[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Pe[t];r&&document.removeEventListener(r,e,!1)},raw:Me};function Ae(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=t=>{Le.on("change",()=>{t.emit("fullscreen",Le.isFullscreen),Le.isFullscreen?(t.state="fullscreen",Y(o,"art-fullscreen")):W(o,"art-fullscreen"),t.emit("resize")}),Le.on("error",e=>{t.emit("fullscreenError",e)}),yt(t,"fullscreen",{get:()=>Le.isFullscreen,set(t){return d(this,null,function*(){t?yield Le.request(o):yield Le.exit()})}})};t.once("video:loadedmetadata",()=>{var o;Le.isEnabled?a(t):n.webkitSupportsFullscreen?((o=t).on("document:webkitfullscreenchange",()=>{o.emit("fullscreen",o.fullscreen),o.emit("resize")}),yt(o,"fullscreen",{get:()=>document.fullscreenElement===n,set(t){t?(o.state="fullscreen",n.webkitEnterFullscreen()):n.webkitExitFullscreen()}})):yt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),yt(t,"fullscreen",xt(t,"fullscreen"))})}function Oe(t){const{icons:e,proxy:r,storage:n,template:{$player:o,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(W(o,"art-mini"),H(e,"display","none"),o.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(H(e,"display","none"),H(r,"display","flex")):(H(e,"display","flex"),H(r,"display","none"))}function p(){const{$mini:e}=t.template,r=rt(e),o=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;n.set("top",o),n.set("left",a),H(e,"top",`${o}px`),H(e,"left",`${a}px`)}yt(t,"mini",{get:()=>F(o,"art-mini"),set(u){if(u){t.state="mini",Y(o,"art-mini");const u=function(){const{$mini:o}=t.template;if(o)return j(o,a),H(o,"display","flex");{const o=Q("div");Y(o,"art-mini-popup"),j(document.body,o),t.template.$mini=o,j(o,a);const p=j(o,'
');j(p,e.close),r(p,"click",c);const u=j(o,'
'),h=j(u,e.play),f=j(u,e.pause);return r(h,"click",()=>lt(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){Y(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;H(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,W(o,"art-mini-dragging");const t=rt(o);n.set("left",t.left),n.set("top",t.top),H(o,"left",`${t.left}px`),H(o,"top",`${t.top}px`),H(o,"transform",null)}}),o}}(),h=n.get("top"),f=n.get("left");"number"===typeof h&&"number"===typeof f?(H(u,"top",`${h}px`),H(u,"left",`${f}px`),K(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Re(t){const{i18n:e,notice:r,template:{$video:n}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:n}=t;e.disablePictureInPicture=!1,yt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw n.show=t,t})):document.exitPictureInPicture().catch(t=>{throw n.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):n.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),yt(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):yt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Ie(t){yt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=a)}return e.html})}})}})}function _e(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ve(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const a=ke(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)_e(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if(Ee(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=_e(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ne(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===o||"played"===o&&l&&I){if(i||a||(a=!0,i=yield nt(p,u),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?H(s,"left",r.clientWidth-h+"px"):H(s,"left",o-h/2+"px")}(o)}})),yt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function De(t){const{option:e,template:{$video:r}}=t;yt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=ye.get(t);return ye.delete(t),e||ke(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield jt(o.scope))&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||ct(n),s=e.customType[i];if(i&&s){if(!(yield jt(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;_e(l,t,"video:canplay",()=>{c=!d}),_e(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Te(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||_e(o.scope,t,"video:canplay",e)}}catch(a){Te(o,a)}finally{$e(o)}})}})}Object.defineProperties(Le,{isFullscreen:{get:()=>Boolean(document[Me.fullscreenElement])},element:{enumerable:!0,get:()=>document[Me.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Me.fullscreenEnabled])}});class Ye{constructor(t){De(t),function(t){const{template:{$video:e}}=t;yt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;yt(t,"play",{value(){return d(this,null,function*(){const i=xe(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;yt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ht(t.currentTime)} / ${ht(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;yt(t,"forward",{set(e){r.seek=t.currentTime+e}}),yt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;yt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=pt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),yt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;yt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=pt(n,0,t.duration))}})}(t),function(t){yt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ve(t,e,0);yt(t,"switchQuality",{value:e=>Ve(t,e,t.currentTime)}),yt(t,"switchUrl",{value:e}),yt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;yt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;yt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)H(n,"width",null),H(n,"height",null),H(n,"margin",null),delete o.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(H(n,"width",s*r+"px"),H(n,"height","100%"),H(n,"margin","0 auto")):(H(n,"width","100%"),H(n,"height",e/s+"px"),H(n,"margin","auto 0")),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=Q("canvas");yt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),yt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),yt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return dt(n,`${e||`artplayer_${ht(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Ae(t),function(t){const{constructor:e,template:{$container:r,$player:n}}=t;let o="";yt(t,"fullscreenWeb",{get:()=>F(n,"art-fullscreen-web"),set(a){a?(o=n.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&j(document.body,n),t.state="fullscreenWeb",H(n,"width","100%"),H(n,"height","100%"),Y(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&j(r,n),o&&(n.style.cssText=o,o=""),W(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Re(t),function(t){const{$video:e}=t.template,r=t;yt(t,"loaded",{get:()=>r.loadedTime/e.duration}),yt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){yt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;yt(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:n}=t.template;yt(t,"autoSize",{value(){const{videoWidth:o,videoHeight:a}=n,{width:i,height:s}=rt(e),l=o/a;if(i/s>l)H(r,"width",s*l/i*100+"%"),H(r,"height","100%");else{const t=i/l/s*100;H(r,"width","100%"),H(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;yt(t,"rect",{get:()=>rt(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}yt(t,"x",{get:()=>e.left+window.pageXOffset}),yt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;yt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(ut(o))}`,t.emit("flip",o)}})}(t),Oe(t),function(t){const{template:{$poster:e}}=t;yt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){H(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;yt(t,"autoHeight",{value(){const{clientWidth:n}=e,{videoHeight:o,videoWidth:a}=r,i=o*(n/a);H(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;yt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){yt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){yt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];yt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,yt(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ie(t),Ne(t),Se(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=pt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=pt(a,0,1)),e.poster&&H(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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 We(t){const{notice:e,constructor:r,template:{$player:n,$video:o}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,n=document.documentElement.clientHeight;return t>e&&rn}return t.on("fullscreenWeb",e=>{var o;if(e){if(l()){const e=Number(null!=(o=r.AUTO_ORIENTATION_TIME)?o:0);setTimeout(()=>{t.fullscreenWeb&&!F(n,a)&&function(){const e=at(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;H(n,"width",`${o}px`),H(n,"height",`${i}px`),H(n,"transform-origin","0 0"),H(n,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),Y(n,a),t.isRotate=!0,t.emit("resize")}()},e)}}else F(n,a)&&(H(n,"width",""),H(n,"height",""),H(n,"transform-origin",""),H(n,"transform",""),W(n,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const o=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(o&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,Y(n,i)}catch(a){s=!1,e.show=a}}else if(F(n,i)&&W(n,i),o&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return F(n,a)}}}function Fe(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=N(".art-auto-playback-last",s),c=N(".art-auto-playback-jump",s),d=N(".art-auto-playback-close",s);j(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),H(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(H(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ht(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{H(s,"display","none")}),a(c,"click",()=>{t.seek=r,lt(t.play()),H(i,"display","none"),H(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{H(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function je(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,W(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,Y(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return F(n,"art-fast-forward")}}}function Be(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return F(n,"art-lock")}function a(){Y(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){W(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=j(e,r.lock),o=j(e,r.unlock);H(n,"display","none"),t.on("lock",t=>{t?(H(n,"display","inline-flex"),H(o,"display","none")):(H(n,"display","none"),H(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function He(t){return t.on("control",e=>{e?W(t.template.$player,"art-mini-progress-bar"):Y(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class qe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(He),!E(t.art)&&e.lock&&I&&t.add(Be),E(t.art)||!e.autoPlayback||e.isLive||t.add(Fe),!E(t.art)&&e.autoOrientation&&I&&t.add(We),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(je)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){st(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const a=wt(t,o);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(st(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||yt(t,o,{value:r})),t}(this,t,e)}}const Ue=new WeakMap;function Xe(t){return!t.closed&&!Ue.get(t)}function Ge(t){Ue.set(t,(Ue.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Ue.get(t)||1)-1;r?Ue.set(t,r):Ue.delete(t)}}const Ke=new WeakMap,Ze=new WeakMap,Je=["$parent","$parents","$option","$events","$formatted"];function Qe(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Ke.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Ke.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function tr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function er(t){const e=Ke.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function rr(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>cr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...a.splice(0)),lr.set(r,o),ir.set(e,r),sr.set(e,n)),i(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{i()}}}}}function fr(t,e,r,n,o,a){const i=a||pr(e);if(!Xe(i)||E(t))return;const s=t.proxy(r,n,e=>{if(Xe(i)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Xe(i)||E(t)?t.events.remove(s):(er(e).events.push(s),a&&a!==ir.get(e)&&a.add(()=>{const r=er(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function mr(t,e,r,n){const o=pr(e);if(!Xe(o)||E(t))return;const a=(...e)=>{if(Xe(o)&&!E(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function gr(t){var e,r;const{art:n,active:o}=t,{controls:a,constructor:{SETTING_WIDTH:i,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!a.setting||!t.show||!o)return;const p=l.getBoundingClientRect(),u=a.setting.getBoundingClientRect(),h=p.width/l.offsetWidth||1,f=(u.left-p.left+u.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||i,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const vr=new WeakMap;function yr(t){vr.delete(t)}const br=new WeakMap;function wr(t,e){e?br.set(t,e):br.delete(t)}function xr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=br.get(t),a=null==o?void 0:o();for(const i of["html","icon","tooltip"]){const t=null==(e=r.get(i))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,i;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==a||a(),wr(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(i=t.parentNode)||i.removeChild(t)}}const kr=new WeakMap;function $r(t,e,r,n,o,a,i,s){return d(this,null,function*(){try{const l=pr(e),c=pr(a),d=(kr.get(a)||0)+1;kr.set(a,d);const p=()=>Xe(l)&&Xe(c)&&!E(t.art)&&kr.get(a)===d;if(null==s||s(),!p())return;const u=yield o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function Er(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const Tr=new WeakMap;function Cr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function Sr(t){var e;null==(e=Tr.get(t))||e()}function zr(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);yr(r),Sr(r);const n=xr(r),o=r.$item,a=null==o?void 0:o.parentNode,i=null==o?void 0:o.nextSibling,s=o?Er(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=hr(t.art,e);r&&a.push(r)}for(const t of n)i.push(Ge(or(t)))}catch(l){try{Cr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,Cr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,Cr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>ar(t)),...i]))}}}(t,r);let p=!0,u=!1;const h=()=>{if(!p)return;p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{Cr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{a&&o&&a.insertBefore(o,(null==i?void 0:i.parentNode)===a?i:null)},()=>t.format(),()=>{if(u){t.active=l,l&&t.cache.has(l)&&X(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>p&&!E(t.art)&&Tr.get(r)===h;for(const v of d.items)Tr.set(v,h);const m=$(t.art).add(()=>{p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(u=!0,t.render(),!f())return r;p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const Mr=new WeakMap;function Pr(t,e,r){yt(t,`$${e}`,{configurable:!0,get:()=>r}),yt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",j(r,t)}})}function Lr(t,e,r=!1){var n,o;const a=function(t){const e=Tr.get(t);return()=>!e||Tr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const i=t.cache.get(e.$option),s=e.$item;let l="selector";wt(e,"switch")&&(l="switch"),wt(e,"range")&&(l="range"),wt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!a())return;const p=function(t,e,r=$(t)){const n=ir.get(e);(!n||Xe(n)||n.closed)&&ur(t,e);const o=r.child();return ir.set(e,o),sr.set(e,r),lr.set(o,er(e).events),o.add(()=>{cr(t,lr.get(o))}),o}(t.art,e,or(i)),u=()=>Xe(p)&&!E(t.art)&&a();if(!u())return;const h=document.createElement("div");try{if(wr(e),Y(h,"art-setting-item"),H(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!u())return;const a=j(h,'
'),f=j(h,'
'),m=document.createElement("div");switch(Y(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!u())return;j(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!u())return;j(m,t)}else j(m,c.check)}if(j(a,m),!u())return;Pr(e,"icon",m);const g=document.createElement("div");Y(g,"art-setting-item-left-text");const v=e.html||"";if(!u())return;j(g,v),j(a,g),Pr(e,"html",g);const y=document.createElement("div");Y(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!u())return;switch(j(y,b),j(f,y),Pr(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");Y(t,"art-setting-item-right-icon");const r=j(t,c.switchOn),n=j(t,c.switchOff),o=e.switch;if(!u())return;H(o?n:r,"display","none"),j(f,t),yt(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!u())return;wr(e,()=>{const t=a;return()=>{a=t}}),yt(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(H(n,"display","none"),H(r,"display",null)):(H(n,"display",null),H(r,"display","none"))}});break}case"range":{const t=document.createElement("div");Y(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",j(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!u())return;Reflect.set(r,a,String(t))}Y(r,"art-setting-range"),j(f,t),yt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!u())return;wr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),yt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");Y(t,"art-setting-item-right-icon"),j(t,c.arrowRight),j(f,t)}}if(!u())return;if(function(t,e,r,n){const{art:o}=t,a=pr(e),i=(t,r,n)=>fr(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>$r(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>$r(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{var o,a;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(a=e.$parent)?void 0:a.onSelect)return $r(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&Y(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>$r(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!u())return;yt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):j(i,h),e.mounted&&u()&&Ft(p,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{p.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function Ar(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Xe(or(n)))return;const o=(Mr.get(t)||0)+1;Mr.set(t,o);const a=()=>Mr.get(t)===o&&!E(t.art),i=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=i,i&&t.cache.has(i)&&X(t.cache.get(i),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{X(n,"art-current"),t.resize()}catch(c){throw a()&&t.cache.get(e)===n&&!or(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return nr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),i=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!i())return;Y(n,"art-setting-panel"),j(t.$parent,n),X(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ze.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=Z(r,e.controls.setting),o=Z(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(ut(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{mr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){rr(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&X(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=Ze.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;oer(t).parent},$parents:{get:()=>er(t).parents},$option:{get:()=>er(t).option},$events:{get:()=>er(t).events},$formatted:{get:()=>!0}}),Ke.set(t,{parent:r,parents:n,option:o,events:(null==i?void 0:i.events)||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return rr(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){gr(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&ar(n)}catch(a){r.push(a)}}try{ur(t.art,e)}catch(a){a instanceof y?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);st(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{yr(t),Sr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{i()}catch(a){a instanceof y?o.push(...a.errors):o.push(a)}if(o.length)throw new y(o)}update(t){return zr(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,a=n?void 0:function(t){const e={};vr.set(t,e);const r=()=>vr.get(t)===e;return{current:r,finish(){r()&&vr.delete(t)}}}(t);let i=!1;try{e.push(t),this.format(),i=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||a&&!a.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&i){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==a||a.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");H(a,"height",`${o}px`),Y(a,"art-setting-item"),Y(a,"art-setting-item-back");const i=j(a,'
'),s=document.createElement("div");Y(s,"art-setting-item-left-icon"),j(s,n),j(i,s),j(i,e.$parent.html),fr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),or(r)),j(r,a)}(this,t)}createItem(t,e=!1){Lr(this,t,e)}render(t=this.option){Ar(this,t)}}class Ir{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const _r='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Vr extends Yt{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null,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(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[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?q(r,t):H(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?vt(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a=c(l(l({},o.subtitle),e),{url:t}),i=yield this.init(a);return e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),i})}createTrack(t,e){const{template:r,proxy:n,option:o}=this.art,{$video:a,$track:i}=r,s=Q("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,B(i),j(a,s),r.$track=s,this.destroyEvent=n(this.textTrack,"cuechange",()=>this.update())}init(t){return d(this,null,function*(){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(m(t,Nt.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||ct(t.url)){case"srt":{const e=$t(r);return Et(t.onVttLoad(e))}case"ass":{const e=Tt(r);return Et(t.onVttLoad(e))}case"vtt":return Et(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})}}const Nr=`\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
${g}
\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 `;class Dr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=N(e.container),st(this.$container,`No container element found by ${e.container}`)),st(et(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();st("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),st(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,Er(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Nr}query(t){return N(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Dr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){st(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),J(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&Y(this.$player,"art-backdrop"),I&&Y(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":Y(this.$player,"art-destroy")}}const Yr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Wr{on(t,e,r){const n=this.e||(this.e={});let o=Yr(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(Yr(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=Yr(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),Br.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Br.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&jr.push(this)}catch(n){try{T(this,jr,!0,Br.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return jr}static get version(){return g}static get config(){return v}static get utils(){return St}static get scheme(){return Nt}static get Emitter(){return Wr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return Dr.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,jr,t,Br.REMOVE_SRC_WHEN_DESTROY)}}return Br.STYLE=_r,Br.DEBUG=!1,Br.CONTEXTMENU=!0,Br.NOTICE_TIME=2e3,Br.SETTING_WIDTH=250,Br.SETTING_ITEM_WIDTH=200,Br.SETTING_ITEM_HEIGHT=35,Br.RESIZE_TIME=200,Br.SCROLL_TIME=200,Br.SCROLL_GAP=50,Br.AUTO_PLAYBACK_MAX=10,Br.AUTO_PLAYBACK_MIN=5,Br.AUTO_PLAYBACK_TIMEOUT=3e3,Br.RECONNECT_TIME_MAX=5,Br.RECONNECT_SLEEP_TIME=1e3,Br.CONTROL_HIDE_TIME=3e3,Br.DBCLICK_TIME=300,Br.DBCLICK_FULLSCREEN=!0,Br.MOBILE_DBCLICK_PLAY=!0,Br.MOBILE_CLICK_PLAY=!1,Br.AUTO_ORIENTATION_TIME=200,Br.INFO_LOOP_TIME=1e3,Br.FAST_FORWARD_VALUE=3,Br.FAST_FORWARD_TIME=1e3,Br.TOUCH_MOVE_RATIO=.5,Br.VOLUME_STEP=.1,Br.SEEK_STEP=5,Br.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Br.ASPECT_RATIO=["default","4:3","16:9"],Br.FLIP=["normal","horizontal","vertical"],Br.FULLSCREEN_WEB_IN_BODY=!0,Br.LOG_VERSION=!0,Br.USE_RAF=!1,Br.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Br,V("artplayer-style",_r),setTimeout(()=>{Br.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Br.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Br}); diff --git a/docs/compiled/artplayer.mjs b/docs/compiled/artplayer.mjs index 86665e924..68ed295bb 100644 --- a/docs/compiled/artplayer.mjs +++ b/docs/compiled/artplayer.mjs @@ -361,13 +361,13 @@ class ResourceScope { throw new ResourceCleanupError(errors); } } -const states = /* @__PURE__ */ new WeakMap(); +const states$1 = /* @__PURE__ */ new WeakMap(); const containers = /* @__PURE__ */ new WeakMap(); function beginLifecycle(owner) { - states.set(owner, { scope: new ResourceScope(), destroying: false }); + states$1.set(owner, { scope: new ResourceScope(), destroying: false }); } function stateOf(owner) { - const state2 = states.get(owner); + const state2 = states$1.get(owner); if (!state2) throw new Error("ArtPlayer lifecycle has not been initialized"); return state2; @@ -432,20 +432,20 @@ function destroyInstance(owner, instances2, removeHtml, removeSource, failed = f if (errors.length) throw errors[0]; } -const scopes$1 = /* @__PURE__ */ new WeakMap(); +const scopes$3 = /* @__PURE__ */ new WeakMap(); function ownEntry(art, element) { const scope = getScope(art).child(); - scopes$1.set(element, scope); + scopes$3.set(element, scope); return scope; } function entryScope(element) { - const scope = scopes$1.get(element); + const scope = scopes$3.get(element); if (!scope) throw new Error("ArtPlayer component has not been registered"); return scope; } function releaseEntry(element) { - scopes$1.get(element)?.dispose(); + scopes$3.get(element)?.dispose(); } function proxyEntry(art, element, target, name, callback) { const scope = entryScope(element); @@ -1397,18 +1397,18 @@ function timeout(scope, callback, delay) { if (scope.closed) return () => { }; - let pending = true; + let pending2 = true; let release = () => { }; const timer = setTimeout(() => { - if (!pending) + if (!pending2) return; release(); if (!scope.closed) callback(); }, delay); release = scope.add(() => { - pending = false; + pending2 = false; clearTimeout(timer); }); return release; @@ -1417,18 +1417,18 @@ function animationFrame(scope, callback) { if (scope.closed) return () => { }; - let pending = true; + let pending2 = true; let release = () => { }; const frame = requestAnimationFrame((time2) => { - if (!pending) + if (!pending2) return; release(); if (!scope.closed) callback(time2); }); release = scope.add(() => { - pending = false; + pending2 = false; cancelAnimationFrame(frame); }); return release; @@ -2025,16 +2025,16 @@ function trackSelection(event, active) { function captureSelection(event) { return event && selections.get(event) || (() => true); } -const bindings = /* @__PURE__ */ new WeakMap(); +const bindings$1 = /* @__PURE__ */ new WeakMap(); function bind(item, binding) { - const previous = bindings.get(item); + const previous = bindings$1.get(item); errorHandle(!previous || entryScope(previous.owner).closed, "Cannot share selector items between active controls"); if (!previous) { - def(item, "$control_option", { get: () => bindings.get(item).option.selector }); - def(item, "$control_item", { get: () => bindings.get(item).item }); - def(item, "$control_value", { get: () => bindings.get(item).value }); + def(item, "$control_option", { get: () => bindings$1.get(item).option.selector }); + def(item, "$control_item", { get: () => bindings$1.get(item).item }); + def(item, "$control_value", { get: () => bindings$1.get(item).value }); } - bindings.set(item, binding); + bindings$1.set(item, binding); } function setHTML(element, value) { element.innerHTML = value; @@ -2436,12 +2436,12 @@ function viewInit(art) { } }); } -const scopes = /* @__PURE__ */ new WeakMap(); +const scopes$2 = /* @__PURE__ */ new WeakMap(); class Events { constructor(art) { this.destroyEvents = /* @__PURE__ */ new Set(); const scope = getScope(art); - scopes.set(this, scope); + scopes$2.set(this, scope); scope.add(() => this.destroy()); this.proxy = this.proxy.bind(this); this.hover = this.hover.bind(this); @@ -2458,7 +2458,7 @@ class Events { if (Array.isArray(name)) { return name.map((item) => this.proxy(target, item, callback, option)); } - if (scopes.get(this).closed) + if (scopes$2.get(this).closed) return () => { }; target.addEventListener(name, callback, option); @@ -3196,7 +3196,7 @@ function createReconnect(art) { const { option, constructor, i18n, notice, template: { $player } } = art; let source = getSourceScope(art); let attempts = 0; - let pending; + let pending2; const run = async (error2) => { if (isClosing(art)) return; @@ -3205,13 +3205,13 @@ function createReconnect(art) { source = current2; attempts = 0; } - if (pending && !pending.closed) + if (pending2 && !pending2.closed) return; const attempt = current2.child(); - pending = attempt; + pending2 = attempt; attempt.add(() => { - if (pending === attempt) - pending = void 0; + if (pending2 === attempt) + pending2 = void 0; }); const active = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); const retry = attempts < constructor.RECONNECT_TIME_MAX; @@ -3254,7 +3254,7 @@ function createReconnect(art) { return { reset() { attempts = 0; - pending?.dispose(); + pending2?.dispose(); removeClass($player, "art-error"); }, loadStart() { @@ -3902,9 +3902,9 @@ function rectMix(art) { return getRect(art.template.$player); } }); - const keys = ["bottom", "height", "left", "right", "top", "width"]; - for (let index = 0; index < keys.length; index++) { - const key = keys[index]; + const keys2 = ["bottom", "height", "left", "right", "top", "width"]; + for (let index = 0; index < keys2.length; index++) { + const key = keys2[index]; def(art, key, { get: () => { return host.rect[key]; @@ -4505,9 +4505,9 @@ function autoPlayback(art) { art.on("video:timeupdate", () => { if (art.playing) { const times = storage.get("times") || {}; - const keys = Object.keys(times); - if (keys.length > constructor.AUTO_PLAYBACK_MAX) { - delete times[keys[0]]; + const keys2 = Object.keys(times); + if (keys2.length > constructor.AUTO_PLAYBACK_MAX) { + delete times[keys2[0]]; } times[art.option.id || art.option.url] = art.currentTime; storage.set("times", times); @@ -4719,6 +4719,358 @@ class Plugins { return registerPlugin(this, plugin, result); } } +const pauses = /* @__PURE__ */ new WeakMap(); +function settingScopeActive(scope) { + return !scope.closed && !pauses.get(scope); +} +function pauseSettingScope(scope) { + pauses.set(scope, (pauses.get(scope) || 0) + 1); + let paused = true; + return () => { + if (!paused) + return; + paused = false; + const count = (pauses.get(scope) || 1) - 1; + if (count) + pauses.set(scope, count); + else + pauses.delete(scope); + }; +} +const bindings = /* @__PURE__ */ new WeakMap(); +const owners$1 = /* @__PURE__ */ new WeakMap(); +const keys = ["$parent", "$parents", "$option", "$events", "$formatted"]; +function hasTreeBinding(item) { + return bindings.has(item); +} +function registerTreeOwner(owner, scope) { + owners$1.set(owner, { active: true, scope }); +} +function releaseTreeOwner(owner) { + const state2 = owners$1.get(owner); + if (state2) { + state2.active = false; + state2.root = void 0; + state2.scope = void 0; + } +} +function activeBinding(item) { + const visited = /* @__PURE__ */ new Set(); + let current2 = item; + while (current2 && !visited.has(current2)) { + visited.add(current2); + const binding = bindings.get(current2); + if (!binding || !binding.owner.active || binding.owner.scope?.closed || !binding.option.includes(current2)) + return false; + if (!binding.parent) + return binding.owner.root === binding.option; + if (bindings.get(binding.parent)?.owner !== binding.owner) + return false; + current2 = binding.parent; + } + return false; +} +function canAssignName(item) { + let target = item; + while (target) { + const descriptor = Object.getOwnPropertyDescriptor(target, "name"); + if (descriptor) { + if ("set" in descriptor) + return typeof descriptor.set === "function"; + return Boolean(descriptor.writable && (target === item || Object.isExtensible(item))); + } + target = Object.getPrototypeOf(target); + } + return Object.isExtensible(item); +} +function treeBinding(item) { + const binding = bindings.get(item); + if (!binding) + throw new Error("Setting item has not been formatted"); + return binding; +} +function traverseTree(option, callback) { + for (let index = 0; index < option.length; index++) { + const item = option[index]; + callback(item); + if (item.selector?.length) + traverseTree(item.selector, callback); + } +} +function findItem(option, name = "") { + let result = null; + traverseTree(option, (item) => { + if (item.name === name) + result = item; + }); + return result; +} +function formatTree(owner, option, parent, parents, names = []) { + const ownerState = owners$1.get(owner) || { active: true }; + const placements = []; + const seen = /* @__PURE__ */ new Set(); + const used = new Set(names); + const collect = (list, parent2, parents2) => { + for (let index = 0; index < list.length; index++) { + const item = list[index]; + if (!item || typeof item !== "object") + throw new TypeError("Setting item must be an object"); + if (seen.has(item)) + throw new Error("Setting items must appear only once in a tree"); + seen.add(item); + const previous = bindings.get(item); + if (previous && previous.owner !== ownerState && activeBinding(item)) + errorHandle(false, `Setting item [${item.name || ""}] already belongs to another active player`); + if (item.name) { + errorHandle(!used.has(item.name), `The [${item.name}] already exists in [setting]`); + used.add(item.name); + } + if (!bindings.has(item)) { + for (const key of keys) { + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (descriptor ? !descriptor.configurable : !Object.isExtensible(item)) + throw new TypeError(`Cannot format setting item property [${key}]`); + } + } + if (!item.name && !canAssignName(item)) + throw new TypeError("Cannot assign an automatic setting item name"); + placements.push({ item, parent: parent2, parents: parents2, option: list, name: item.name || "", generated: !item.name }); + if (item.selector?.length) + collect(item.selector, item, list); + } + }; + collect(option, parent, parents); + let nextId = owner.id; + owners$1.set(owner, ownerState); + ownerState.root = option; + for (const placement of placements) { + if (!placement.name) { + do { + placement.name = `setting-${nextId++}`; + } while (used.has(placement.name)); + used.add(placement.name); + } + } + for (const placement of placements) { + const { item, name, parent: parent2, parents: parents2, option: option2 } = placement; + const previous = bindings.get(item); + if (!previous) { + Object.defineProperties(item, { + $parent: { get: () => treeBinding(item).parent }, + $parents: { get: () => treeBinding(item).parents }, + $option: { get: () => treeBinding(item).option }, + $events: { get: () => treeBinding(item).events }, + $formatted: { get: () => true } + }); + } + bindings.set(item, { parent: parent2, parents: parents2, option: option2, events: previous?.events || [], owner: ownerState }); + if (placement.generated) + item.name = name; + } + for (const placement of placements) { + if (!placement.generated) + names.push(placement.name); + } + owner.id = nextId; + return option; +} +const scopes$1 = /* @__PURE__ */ new WeakMap(); +function ownSettingPanel(setting2, option, panel) { + const scope = getScope(setting2.art).child(); + scopes$1.set(panel, scope); + scope.add(() => { + if (setting2.cache.get(option) === panel) + setting2.cache.delete(option); + panel.remove(); + }); + return scope; +} +function settingPanelScope(panel) { + const scope = scopes$1.get(panel); + if (!scope) + throw new Error("Setting panel has not been registered"); + return scope; +} +function releaseSettingPanel(panel) { + const scope = scopes$1.get(panel); + if (scope) + scope.dispose(); + else + panel.remove(); +} +const scopes = /* @__PURE__ */ new WeakMap(); +const owners = /* @__PURE__ */ new WeakMap(); +const eventLists = /* @__PURE__ */ new WeakMap(); +function releaseEvents(art, events) { + const pending2 = events.splice(0); + const failures = []; + for (const cleanup of pending2) { + try { + art.events.remove(cleanup); + } catch (error2) { + failures.push(error2); + } + } + if (failures.length) + throw new ResourceCleanupError(failures); +} +function ownSettingItem(art, item, owner = getScope(art)) { + const previous = scopes.get(item); + if (!previous || settingScopeActive(previous) || previous.closed) + releaseSettingItem(art, item); + const scope = owner.child(); + scopes.set(item, scope); + owners.set(item, owner); + eventLists.set(scope, treeBinding(item).events); + scope.add(() => { + releaseEvents(art, eventLists.get(scope)); + }); + return scope; +} +function settingItemOwner(item) { + return owners.get(item); +} +function settingScope(item) { + const scope = scopes.get(item); + if (!scope) + throw new Error("Setting item has not been rendered"); + return scope; +} +function releaseSettingItem(art, item) { + const scope = scopes.get(item); + if (scope && !scope.closed) + scope.dispose(); + else if (hasTreeBinding(item)) + releaseEvents(art, treeBinding(item).events); +} +function suspendSettingItem(art, item) { + const previous = scopes.get(item); + if (!previous || previous.closed) + return; + if (!settingScopeActive(previous)) + throw new Error("Setting item update is already in progress"); + const owner = owners.get(item); + const events = treeBinding(item).events; + const saved = events.splice(0); + eventLists.set(previous, saved); + const unpause = pauseSettingScope(previous); + let pending2 = true; + return { + resume() { + if (!pending2) + return; + pending2 = false; + const failures = []; + const current2 = scopes.get(item); + for (const cleanup of [() => { + if (current2 && current2 !== previous) + current2.dispose(); + }, () => releaseEvents(art, events)]) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + } + if (!previous.closed && !isClosing(art)) { + events.push(...saved.splice(0)); + eventLists.set(previous, events); + scopes.set(item, previous); + owners.set(item, owner); + } + unpause(); + if (failures.length) + throw new ResourceCleanupError(failures); + }, + dispose() { + if (!pending2) + return; + pending2 = false; + try { + previous.dispose(); + } finally { + unpause(); + } + } + }; +} +function proxySetting(art, item, target, name, callback, owner) { + const scope = owner || settingScope(item); + if (!settingScopeActive(scope) || isClosing(art)) + return; + const event = art.proxy(target, name, (event2) => { + if (settingScopeActive(scope) && !isClosing(art)) { + try { + return callback(event2); + } catch (error2) { + console.warn("ArtPlayer setting callback failed:", error2); + } + } + }); + if (!settingScopeActive(scope) || isClosing(art)) { + art.events.remove(event); + } else { + treeBinding(item).events.push(event); + if (owner && owner !== scopes.get(item)) { + owner.add(() => { + const events = treeBinding(item).events; + const index = events.indexOf(event); + if (index >= 0) { + events.splice(index, 1); + art.events.remove(event); + } + }); + } + } +} +function subscribeSetting(art, item, name, callback) { + const scope = settingScope(item); + if (!settingScopeActive(scope) || isClosing(art)) + return; + const guarded = (...args) => { + if (settingScopeActive(scope) && !isClosing(art)) + return callback(...args); + }; + art.on(name, guarded); + scope.add(() => { + art.off(name, guarded); + }); +} +function releaseSettingTree(setting2, item) { + const failures = []; + const visited = /* @__PURE__ */ new Set(); + const visit = (item2) => { + if (visited.has(item2)) + return; + visited.add(item2); + for (const child of item2.selector || []) + visit(child); + if (item2.selector) { + const panel = setting2.cache.get(item2.selector); + setting2.cache.delete(item2.selector); + try { + if (panel) + releaseSettingPanel(panel); + } catch (error2) { + failures.push(error2); + } + } + try { + releaseSettingItem(setting2.art, item2); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + }; + visit(item); + if (failures.length) + throw new ResourceCleanupError(failures); +} function aspectRatio(art) { const { i18n, @@ -4750,12 +5102,72 @@ function aspectRatio(art) { art.aspectRatio = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("aspectRatio", () => update()); + subscribeSetting(art, item, "aspectRatio", () => update()); } }; } +function installSettingEvents(setting2) { + const { art } = setting2; + const scope = getScope(art).child(); + const on = (name, callback) => { + if (scope.closed || isClosing(art)) + return; + const guarded = (...args) => { + if (!scope.closed && !isClosing(art)) + return callback(...args); + }; + art.on(name, guarded); + scope.add(() => { + art.off(name, guarded); + }); + }; + on("blur", () => { + if (setting2.show) { + setting2.show = false; + setting2.render(); + } + }); + on("focus", (event) => { + const isControl = includeFromEvent(event, art.controls.setting); + const isSetting = includeFromEvent(event, setting2.$parent); + if (setting2.show && !isControl && !isSetting) { + setting2.show = false; + setting2.render(); + } + }); + on("resize", () => setting2.resize()); + const resize = () => { + if (!scope.closed && !isClosing(art)) + setting2.resize(); + }; + const transitioned = art.proxy(setting2.$parent, "transitionend", (event) => { + if (event.target === setting2.$parent && event.propertyName === "bottom") + resize(); + }); + scope.add(() => { + art.events.remove(transitioned); + }); + const { $player, $controls } = art.template; + if (!scope.closed && typeof ResizeObserver !== "undefined") { + const observer = new ResizeObserver(resize); + observer.observe($player); + observer.observe($controls); + scope.add(() => { + observer.disconnect(); + }); + } + if (!scope.closed && typeof MutationObserver !== "undefined") { + const observer = new MutationObserver(resize); + if (typeof ResizeObserver === "undefined") + observer.observe($controls, { childList: true, subtree: true, attributes: true, characterData: true }); + observer.observe($player, { attributes: true, attributeFilter: ["class", "style"] }); + scope.add(() => { + observer.disconnect(); + }); + } +} function flip(art) { const { i18n, @@ -4787,12 +5199,51 @@ function flip(art) { art.flip = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("flip", () => update()); + subscribeSetting(art, item, "flip", () => update()); } }; } +function calculateSettingLayout(input) { + const { containerWidth, containerHeight, requestedWidth, rows, rowHeight, controlCenter, bottom, padding } = input; + const inset = Math.min(Math.max(0, padding), Math.max(0, containerWidth / 2)); + const width = Math.min(Math.max(0, requestedWidth), Math.max(0, containerWidth - 2 * inset)); + const height = Math.min(Math.max(0, rows * rowHeight), Math.max(0, containerHeight - bottom - inset)); + const left = Math.max(inset, Math.min(controlCenter - width / 2, containerWidth - inset - width)); + return { width, height, left }; +} +function resizeSetting(setting2) { + const { art, active } = setting2; + const { controls, constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, template: { $player, $setting, $bottom } } = art; + if (!controls.setting || !setting2.show || !active) + return; + const player = $player.getBoundingClientRect(); + const control = controls.setting.getBoundingClientRect(); + const scale = player.width / $player.offsetWidth || 1; + const controlCenter = (control.left - player.left + control.width / 2) / scale - $player.clientLeft; + const layout = calculateSettingLayout({ + containerWidth: $player.clientWidth, + containerHeight: $player.clientHeight, + requestedWidth: active[0]?.$parent?.width || SETTING_WIDTH, + rows: active.length + (active === setting2.option ? 0 : 1), + rowHeight: SETTING_ITEM_HEIGHT, + controlCenter, + bottom: Number.parseFloat(getComputedStyle($setting).bottom) || 0, + padding: Number.parseFloat(getComputedStyle($bottom).paddingLeft) || 0 + }); + $setting.style.height = `${layout.height}px`; + $setting.style.width = `${layout.width}px`; + if (art.isRotate || isMobile) + return; + if (controlCenter + layout.width / 2 > $player.clientWidth) { + $setting.style.left = ""; + $setting.style.right = ""; + } else { + $setting.style.left = `${layout.left}px`; + $setting.style.right = "auto"; + } +} function playbackRate(art) { const { i18n, @@ -4824,12 +5275,671 @@ function playbackRate(art) { art.playbackRate = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("video:ratechange", () => update()); + subscribeSetting(art, item, "video:ratechange", () => update()); } }; } +const registrations = /* @__PURE__ */ new WeakMap(); +function cancelSettingAdd(item) { + registrations.delete(item); +} +function beginSettingAdd(item) { + const token = {}; + registrations.set(item, token); + const current2 = () => registrations.get(item) === token; + return { + current: current2, + finish() { + if (current2()) + registrations.delete(item); + } + }; +} +const states = /* @__PURE__ */ new WeakMap(); +function rememberSettingState(item, capture) { + if (capture) + states.set(item, capture); + else + states.delete(item); +} +function captureSettingItem(item) { + const descriptors = new Map(Reflect.ownKeys(item).map((key) => [key, Object.getOwnPropertyDescriptor(item, key)])); + const nodes = []; + const state2 = states.get(item); + const restoreState = state2?.(); + for (const key of ["html", "icon", "tooltip"]) { + const value = descriptors.get(key)?.value; + if (value instanceof Node) + nodes.push({ node: value, parent: value.parentNode, next: value.nextSibling }); + } + return () => { + for (const key of Reflect.ownKeys(item)) { + if (!descriptors.has(key) && Object.getOwnPropertyDescriptor(item, key)?.configurable) + Reflect.deleteProperty(item, key); + } + for (const [key, descriptor] of descriptors) + Object.defineProperty(item, key, descriptor); + restoreState?.(); + rememberSettingState(item, state2); + for (const { node, parent, next } of nodes) { + if (parent) + parent.insertBefore(node, next?.parentNode === parent ? next : null); + else + node.parentNode?.removeChild(node); + } + }; +} +const generations = /* @__PURE__ */ new WeakMap(); +function checkSetting(setting2, target) { + if (!target?.$parent) + return; + target.$parent.tooltip = target.html; + setting2.traverse((item) => { + item.default = item === target; + if (item.default && item.$item) + inverseClass(item.$item, "art-current"); + }, target.$option); + setting2.render(target.$parents); +} +async function act(setting2, item, element, event, callback, target, property, before) { + try { + const scope = settingScope(item); + const targetScope = settingScope(target); + const generation = (generations.get(target) || 0) + 1; + generations.set(target, generation); + const active = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; + before?.(); + if (!active()) + return; + const value = await callback.call(setting2.art, item, element, event); + if (active()) + Reflect.set(target, property, value); + } catch (error2) { + console.warn("ArtPlayer setting callback failed:", error2); + } +} +function bindSettingActions(setting2, item, element, kind) { + const { art } = setting2; + const scope = settingScope(item); + const proxy = (target, name, callback) => proxySetting(art, item, target, name, callback, scope); + switch (kind) { + case "switch": + if (item.onSwitch) + proxy(element, "click", (event) => act(setting2, item, element, event, item.onSwitch, item, "switch")); + break; + case "range": { + const range = item.$range; + if (range) { + for (const [name, callback] of [["change", "onRange"], ["input", "onChange"]]) { + if (item[callback]) { + proxy(range, name, (event) => act(setting2, item, element, event, item[callback], item, "tooltip", () => { + item.range[0] = range.valueAsNumber; + })); + } + } + } + break; + } + case "selector": + proxy(element, "click", (event) => { + if (item.selector?.length) { + setting2.render(item.selector); + } else if (item.$parent?.onSelect) { + return act(setting2, item, element, event, item.$parent.onSelect, item.$parent, "tooltip", () => setting2.check(item)); + } else { + setting2.check(item); + } + }); + if (item.default) + addClass(element, "art-current"); + break; + case "button": + if (item.onClick) + proxy(element, "click", (event) => act(setting2, item, element, event, item.onClick, item, "tooltip")); + break; + } +} +function captureTemplate(container) { + const snapshots = []; + function capture(node) { + const children = Array.from(node.childNodes); + snapshots.push({ + node, + children, + attributes: node.nodeType === 1 ? Array.from(node.attributes, (attr) => [attr.name, attr.value]) : void 0, + value: node.nodeValue + }); + children.forEach(capture); + } + capture(container); + return () => { + for (const { node, children, attributes, value } of snapshots) { + while (node.firstChild) + node.removeChild(node.firstChild); + for (const child of children) + node.appendChild(child); + if (attributes) { + const element = node; + for (const attr of Array.from(element.attributes)) + element.removeAttribute(attr.name); + for (const [name, content] of attributes) + element.setAttribute(name, content); + } else { + node.nodeValue = value; + } + } + }; +} +const pending = /* @__PURE__ */ new WeakMap(); +function finish(cleanups) { + const errors = []; + for (const cleanup of cleanups) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + errors.push(...error2.errors); + else + errors.push(error2); + } + } + if (errors.length) + throw new ResourceCleanupError(errors); +} +function suspendTree(setting2, root) { + const items = /* @__PURE__ */ new Set(); + const panels = /* @__PURE__ */ new Set(); + const collect = (item) => { + if (items.has(item)) + return; + items.add(item); + if (item.selector) { + const panel = setting2.cache.get(item.selector); + if (panel) + panels.add(panel); + item.selector.forEach(collect); + } + }; + collect(root); + const suspended = []; + const unpause = []; + try { + for (const item of items) { + const suspension = suspendSettingItem(setting2.art, item); + if (suspension) + suspended.push(suspension); + } + for (const panel of panels) + unpause.push(pauseSettingScope(settingPanelScope(panel))); + } catch (error2) { + try { + finish([...suspended.reverse().map((item) => item.resume), ...unpause]); + } catch (cleanupError) { + console.warn("ArtPlayer setting restore failed:", cleanupError); + } + throw error2; + } + let active = true; + return { + items, + resume() { + if (!active) + return; + active = false; + finish([...suspended.reverse().map((item) => item.resume), ...unpause]); + }, + dispose() { + if (!active) + return; + active = false; + finish([...suspended.reverse().map((item) => item.dispose), ...Array.from(panels).reverse().map((panel) => () => releaseSettingPanel(panel)), ...unpause]); + } + }; +} +function cancelSettingUpdate(item) { + pending.get(item)?.(); +} +function captureSettingUpdate(item) { + const operation = pending.get(item); + return () => !operation || pending.get(item) === operation; +} +function assignSetting(item, target, current2) { + for (const key of Reflect.ownKeys(target)) { + if (!current2()) + return; + const descriptor = Object.getOwnPropertyDescriptor(target, key); + if (!descriptor?.enumerable || !current2()) + continue; + const value = Reflect.get(target, key); + if (!current2()) + return; + if (!Reflect.set(item, key, value)) + throw new TypeError(`Cannot assign setting item property [${String(key)}]`); + } +} +function updateSetting(setting2, target) { + const item = setting2.find(target.name); + if (isClosing(setting2.art)) + return item || target; + if (!item) + return setting2.add(target); + cancelSettingAdd(item); + cancelSettingUpdate(item); + const restoreItem = captureSettingItem(item); + const element = item.$item; + const parent = element?.parentNode; + const next = element?.nextSibling; + const restoreTemplate = element ? captureTemplate(element) : void 0; + const previous = setting2.active; + const layout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); + const tree = suspendTree(setting2, item); + let active = true; + let rendered = false; + const cancel = () => { + if (!active) + return; + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + if (isClosing(setting2.art)) { + tree.dispose(); + return; + } + const replacement = item.$item; + try { + finish([ + tree.resume, + () => { + if (replacement && replacement !== element) + replacement.remove(); + }, + restoreItem, + () => restoreTemplate?.(), + () => { + if (parent && element) + parent.insertBefore(element, next?.parentNode === parent ? next : null); + }, + () => setting2.format(), + () => { + if (rendered) { + setting2.active = previous; + if (previous && setting2.cache.has(previous)) + inverseClass(setting2.cache.get(previous), "art-current"); + for (const [key, value, priority] of layout) + setting2.$parent.style.setProperty(key, value, priority); + } + } + ]); + } catch (error2) { + console.warn("ArtPlayer setting restore failed:", error2); + } + }; + const current2 = () => active && !isClosing(setting2.art) && pending.get(item) === cancel; + for (const affected of tree.items) + pending.set(affected, cancel); + const release = getScope(setting2.art).add(() => { + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + tree.dispose(); + }); + try { + assignSetting(item, target, current2); + if (!current2()) + return item; + setting2.format(); + if (!current2()) + return item; + setting2.createItem(item, true); + if (!current2()) + return item; + rendered = true; + setting2.render(); + if (!current2()) + return item; + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + tree.dispose(); + return item; + } catch (error2) { + if (current2()) + cancel(); + throw error2; + } finally { + release(); + } +} +const navigations = /* @__PURE__ */ new WeakMap(); +function bindContent(item, key, element) { + def(item, `$${key}`, { configurable: true, get: () => element }); + def(item, key, { + configurable: true, + get: () => element.innerHTML, + set(value) { + element.innerHTML = ""; + append(element, value); + } + }); +} +function createSettingHeader(setting2, item) { + if (!setting2.cache.has(item.$option)) + return; + const $panel = setting2.cache.get(item.$option); + const { + icons: { arrowLeft: arrowLeft2 }, + constructor: { SETTING_ITEM_HEIGHT } + } = setting2.art; + const $item = document.createElement("div"); + setStyle($item, "height", `${SETTING_ITEM_HEIGHT}px`); + addClass($item, "art-setting-item"); + addClass($item, "art-setting-item-back"); + const $left = append($item, '
'); + const $icon = document.createElement("div"); + addClass($icon, "art-setting-item-left-icon"); + append($icon, arrowLeft2); + append($left, $icon); + append($left, item.$parent.html); + proxySetting(setting2.art, item.$parent, $item, "click", () => setting2.render(item.$parents), settingPanelScope($panel)); + append($panel, $item); +} +function createSettingItem(setting2, item, isUpdate = false) { + const currentUpdate = captureSettingUpdate(item); + if (!setting2.cache.has(item.$option)) + return; + const $panel = setting2.cache.get(item.$option); + const oldItem = item.$item; + let type = "selector"; + if (has(item, "switch")) { + type = "switch"; + } + if (has(item, "range")) { + type = "range"; + } + if (has(item, "onClick")) { + type = "button"; + } + const { icons, constructor } = setting2.art; + if (!currentUpdate()) + return; + const scope = ownSettingItem(setting2.art, item, settingPanelScope($panel)); + const current2 = () => settingScopeActive(scope) && !isClosing(setting2.art) && currentUpdate(); + if (!current2()) + return; + const $item = document.createElement("div"); + try { + rememberSettingState(item); + addClass($item, "art-setting-item"); + setStyle($item, "height", `${constructor.SETTING_ITEM_HEIGHT}px`); + $item.dataset.name = item.name || ""; + $item.dataset.value = String(item.value || ""); + if (!current2()) + return; + const $left = append($item, '
'); + const $right = append($item, '
'); + const $icon = document.createElement("div"); + addClass($icon, "art-setting-item-left-icon"); + switch (type) { + case "button": + case "switch": + case "range": { + const icon = item.icon || icons.config; + if (!current2()) + return; + append($icon, icon); + break; + } + case "selector": + if (item.selector?.length) { + const icon = item.icon || icons.config; + if (!current2()) + return; + append($icon, icon); + } else { + append($icon, icons.check); + } + break; + default: + break; + } + append($left, $icon); + if (!current2()) + return; + bindContent(item, "icon", $icon); + const $html = document.createElement("div"); + addClass($html, "art-setting-item-left-text"); + const html2 = item.html || ""; + if (!current2()) + return; + append($html, html2); + append($left, $html); + bindContent(item, "html", $html); + const $tooltip = document.createElement("div"); + addClass($tooltip, "art-setting-item-right-tooltip"); + const tooltip2 = item.tooltip || ""; + if (!current2()) + return; + append($tooltip, tooltip2); + append($right, $tooltip); + bindContent(item, "tooltip", $tooltip); + switch (type) { + case "switch": { + const $switch = document.createElement("div"); + addClass($switch, "art-setting-item-right-icon"); + const $switchOn = append($switch, icons.switchOn); + const $switchOff = append($switch, icons.switchOff); + const initialSwitch = item.switch; + if (!current2()) + return; + setStyle(initialSwitch ? $switchOff : $switchOn, "display", "none"); + append($right, $switch); + def(item, "$switch", { + configurable: true, + get: () => $switch + }); + let $switchValue = item.switch; + if (!current2()) + return; + rememberSettingState(item, () => { + const value = $switchValue; + return () => { + $switchValue = value; + }; + }); + def(item, "switch", { + configurable: true, + get: () => $switchValue, + set(value) { + $switchValue = value; + if (value) { + setStyle($switchOff, "display", "none"); + setStyle($switchOn, "display", null); + } else { + setStyle($switchOff, "display", null); + setStyle($switchOn, "display", "none"); + } + } + }); + break; + } + case "range": + { + const $state = document.createElement("div"); + addClass($state, "art-setting-item-right-icon"); + const $range = document.createElement("input"); + $range.type = "range"; + append($state, $range); + for (const [index, key] of ["value", "min", "max", "step"].entries()) { + const value = item.range[index]; + if (!current2()) + return; + Reflect.set($range, key, String(value)); + } + addClass($range, "art-setting-range"); + append($right, $state); + def(item, "$range", { + configurable: true, + get: () => $range + }); + let $rangeValue = [...item.range]; + if (!current2()) + return; + rememberSettingState(item, () => { + const value = $rangeValue; + const values = [...value]; + const input = { min: $range.min, max: $range.max, step: $range.step, value: $range.value }; + return () => { + value.splice(0, value.length, ...values); + $rangeValue = value; + Object.assign($range, input); + }; + }); + def(item, "range", { + configurable: true, + get: () => $rangeValue, + set(value) { + $rangeValue = [...value]; + $range.value = String(value[0]); + $range.min = String(value[1]); + $range.max = String(value[2]); + $range.step = String(value[3]); + } + }); + } + break; + case "selector": + if (item.selector?.length) { + const $state = document.createElement("div"); + addClass($state, "art-setting-item-right-icon"); + append($state, icons.arrowRight); + append($right, $state); + } + break; + default: + break; + } + if (!current2()) + return; + bindSettingActions(setting2, item, $item, type); + if (!current2()) + return; + def(item, "$item", { + configurable: true, + get: () => $item + }); + if (isUpdate) { + if (oldItem?.parentNode) + oldItem.replaceWith($item); + else + append($panel, $item); + } else { + append($panel, $item); + } + if (item.mounted && current2()) { + timeout(scope, () => { + if (isClosing(setting2.art)) + return; + try { + const result = item.mounted?.call(setting2.art, $item, item); + void Promise.resolve(result).catch((error2) => console.warn("ArtPlayer setting mounted failed:", error2)); + } catch (error2) { + console.warn("ArtPlayer setting mounted failed:", error2); + } + }, 0); + } + } catch (error2) { + try { + scope.dispose(); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + $item.remove(); + throw error2; + } +} +function renderSetting(setting2, option = setting2.option) { + if (isClosing(setting2.art)) + return; + const cached = setting2.cache.get(option); + if (cached && !settingScopeActive(settingPanelScope(cached))) + return; + const navigation = (navigations.get(setting2) || 0) + 1; + navigations.set(setting2, navigation); + const currentNavigation = () => navigations.get(setting2) === navigation && !isClosing(setting2.art); + const previous = setting2.active; + const previousLayout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); + const restoreNavigation = () => { + setting2.active = previous; + if (previous && setting2.cache.has(previous)) + inverseClass(setting2.cache.get(previous), "art-current"); + for (const [key, value, priority] of previousLayout) + setting2.$parent.style.setProperty(key, value, priority); + }; + setting2.active = option; + if (cached) { + try { + inverseClass(cached, "art-current"); + setting2.resize(); + } catch (error2) { + if (currentNavigation() && setting2.cache.get(option) === cached && !settingPanelScope(cached).closed) + restoreNavigation(); + throw error2; + } + } else { + const $panel = document.createElement("div"); + setting2.cache.set(option, $panel); + const scope = ownSettingPanel(setting2, option, $panel); + const current2 = () => !scope.closed && !isClosing(setting2.art) && setting2.cache.get(option) === $panel; + const checkpoints = []; + try { + if (!current2()) + return; + addClass($panel, "art-setting-panel"); + append(setting2.$parent, $panel); + inverseClass($panel, "art-current"); + if (option[0]?.$parent) + setting2.createHeader(option[0]); + for (let index = 0; index < option.length && current2(); index++) { + const item = option[index]; + checkpoints.push({ item, restore: captureSettingItem(item) }); + setting2.createItem(item); + } + if (!current2()) + return; + setting2.resize(); + } catch (error2) { + const restore = current2(); + const restoreActive = setting2.active === option && currentNavigation(); + try { + releaseSettingPanel($panel); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + if (restore && !isClosing(setting2.art)) { + for (const checkpoint of checkpoints.reverse()) { + if (settingItemOwner(checkpoint.item) === scope) { + try { + checkpoint.restore(); + } catch (restoreError) { + console.warn("ArtPlayer setting restore failed:", restoreError); + } + } + } + if (restoreActive) + restoreNavigation(); + } + throw error2; + } + } +} function subtitleOffset(art) { const { i18n, icons, constructor } = art; return { @@ -4844,19 +5954,19 @@ function subtitleOffset(art) { return `${item.range[0]}s`; }, mounted: (_, item) => { - art.on("subtitleOffset", (value) => { - item.$range.value = value; + subscribeSetting(art, item, "subtitleOffset", (value) => { + item.$range.value = String(value); item.tooltip = `${value}s`; }); } }; } -class Setting extends Component { +const SettingBase = Component; +class Setting extends SettingBase { constructor(art) { super(art); const { option, - controls, template: { $setting } } = art; this.name = "setting"; @@ -4865,24 +5975,15 @@ class Setting extends Component { this.active = null; this.cache = /* @__PURE__ */ new Map(); this.option = [...this.builtin, ...option.settings]; + const scope = getScope(art); + registerTreeOwner(this, scope); + scope.add(() => { + releaseTreeOwner(this); + }); if (option.setting) { this.format(); this.render(); - art.on("blur", () => { - if (this.show) { - this.show = false; - this.render(); - } - }); - art.on("focus", (event) => { - const isControl = includeFromEvent(event, controls.setting); - const isSetting = includeFromEvent(event, this.$parent); - if (this.show && !isControl && !isSetting) { - this.show = false; - this.render(); - } - }); - art.on("resize", () => this.resize()); + installSettingEvents(this); } } get builtin() { @@ -4903,396 +6004,93 @@ class Setting extends Component { return result; } traverse(callback, option = this.option) { - for (let index = 0; index < option.length; index++) { - const item = option[index]; - callback(item); - if (item.selector?.length) { - this.traverse(callback, item.selector); - } - } + traverseTree(option, callback); } check(target) { - if (!target) { - return; - } - target.$parent.tooltip = target.html; - this.traverse((item) => { - item.default = item === target; - if (item.default && item.$item) { - inverseClass(item.$item, "art-current"); - } - }, target.$option); - this.render(target.$parents); + checkSetting(this, target); } format(option = this.option, parent, parents, names = []) { - for (let index = 0; index < option.length; index++) { - const item = option[index]; - if (item?.name) { - errorHandle(!names.includes(item.name), `The [${item.name}] already exists in [setting]`); - names.push(item.name); - } else { - item.name = `setting-${this.id++}`; - } - if (!item.$formatted) { - def(item, "$parent", { - get: () => parent - }); - def(item, "$parents", { - get: () => parents - }); - def(item, "$option", { - get: () => option - }); - const $events = []; - def(item, "$events", { - get: () => $events - }); - def(item, "$formatted", { - get: () => true - }); - } - this.format(item.selector || [], item, option, names); - } - this.option = option; + this.option = formatTree(this, option, parent, parents, names); } find(name = "") { - let result = null; - this.traverse((item) => { - if (item.name === name) { - result = item; - } - }); - return result; + return findItem(this.option, name); } resize() { - const { - controls, - constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, - template: { $player, $setting } - } = this.art; - if (controls.setting && this.show) { - const settingWidth = this.active[0]?.$parent?.width || SETTING_WIDTH; - const { left: controlLeft, width: controlWidth } = getRect(controls.setting); - const { left: playerLeft, width: playerWidth } = getRect($player); - const settingLeft = controlLeft - playerLeft + controlWidth / 2 - settingWidth / 2; - const settingHeight = this.active === this.option ? this.active.length * SETTING_ITEM_HEIGHT : (this.active.length + 1) * SETTING_ITEM_HEIGHT; - setStyle($setting, "height", `${settingHeight}px`); - setStyle($setting, "width", `${settingWidth}px`); - if (this.art.isRotate || isMobile) - return; - if (settingLeft + settingWidth > playerWidth) { - setStyle($setting, "left", null); - setStyle($setting, "right", null); - } else { - setStyle($setting, "left", `${settingLeft}px`); - setStyle($setting, "right", "auto"); - } - } + resizeSetting(this); } inactivate(item) { - for (let index = 0; index < item.$events.length; index++) { - this.art.events.remove(item.$events[index]); - } - item.$events.length = 0; + releaseSettingTree(this, item); } remove(name) { const item = this.find(name); errorHandle(item, `Can't find [${name}] in the [setting]`); + this.traverse((item2) => { + cancelSettingAdd(item2); + cancelSettingUpdate(item2); + }, [item]); const index = item.$option.indexOf(item); item.$option.splice(index, 1); - this.inactivate(item); - if (item.$item) - remove(item.$item); - this.render(); + const element = item.$item; + const failures = []; + for (const cleanup of [() => this.inactivate(item), () => element?.remove(), () => this.render()]) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + } + if (failures.length) + throw new ResourceCleanupError(failures); } update(target) { - const item = this.find(target.name); - if (item) { - this.inactivate(item); - Object.assign(item, target); - this.format(); - this.createItem(item, true); - this.render(); - return item; - } else { - return this.add(target); - } + return updateSetting(this, target); } add(item, option = this.option) { - option.push(item); - this.format(); - this.createItem(item); - this.render(); + if (isClosing(this.art)) + return item; + let registered = false; + this.traverse((existing) => { + registered || (registered = existing === item); + }); + const index = option.length; + const registration = registered ? void 0 : beginSettingAdd(item); + let formatted = false; + try { + option.push(item); + this.format(); + formatted = true; + this.createItem(item); + this.render(); + } catch (error2) { + if (isClosing(this.art) || registration && !registration.current()) + throw error2; + if (option[index] === item) + option.splice(index, 1); + if (!registered && formatted) { + try { + this.inactivate(item); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + item.$item?.remove(); + } + throw error2; + } finally { + registration?.finish(); + } return item; } createHeader(item) { - if (!this.cache.has(item.$option)) - return; - const $panel = this.cache.get(item.$option); - const { - proxy, - icons: { arrowLeft: arrowLeft2 }, - constructor: { SETTING_ITEM_HEIGHT } - } = this.art; - const $item = createElement("div"); - setStyle($item, "height", `${SETTING_ITEM_HEIGHT}px`); - addClass($item, "art-setting-item"); - addClass($item, "art-setting-item-back"); - const $left = append($item, '
'); - const $icon = createElement("div"); - addClass($icon, "art-setting-item-left-icon"); - append($icon, arrowLeft2); - append($left, $icon); - append($left, item.$parent.html); - const event = proxy($item, "click", () => this.render(item.$parents)); - item.$parent.$events.push(event); - append($panel, $item); + createSettingHeader(this, item); } createItem(item, isUpdate = false) { - if (!this.cache.has(item.$option)) - return; - const $panel = this.cache.get(item.$option); - const oldItem = item.$item; - let type = "selector"; - if (has(item, "switch")) { - type = "switch"; - } - if (has(item, "range")) { - type = "range"; - } - if (has(item, "onClick")) { - type = "button"; - } - const { icons, proxy, constructor } = this.art; - const $item = createElement("div"); - addClass($item, "art-setting-item"); - setStyle($item, "height", `${constructor.SETTING_ITEM_HEIGHT}px`); - $item.dataset.name = item.name || ""; - $item.dataset.value = item.value || ""; - const $left = append($item, '
'); - const $right = append($item, '
'); - const $icon = createElement("div"); - addClass($icon, "art-setting-item-left-icon"); - switch (type) { - case "button": - case "switch": - case "range": - append($icon, item.icon || icons.config); - break; - case "selector": - if (item.selector?.length) { - append($icon, item.icon || icons.config); - } else { - append($icon, icons.check); - } - break; - } - append($left, $icon); - def(item, "$icon", { - configurable: true, - get: () => $icon - }); - def(item, "icon", { - configurable: true, - get() { - return $icon.innerHTML; - }, - set(value) { - $icon.innerHTML = ""; - append($icon, value); - } - }); - const $html = createElement("div"); - addClass($html, "art-setting-item-left-text"); - append($html, item.html || ""); - append($left, $html); - def(item, "$html", { - configurable: true, - get: () => $html - }); - def(item, "html", { - configurable: true, - get() { - return $html.innerHTML; - }, - set(value) { - $html.innerHTML = ""; - append($html, value); - } - }); - const $tooltip = createElement("div"); - addClass($tooltip, "art-setting-item-right-tooltip"); - append($tooltip, item.tooltip || ""); - append($right, $tooltip); - def(item, "$tooltip", { - configurable: true, - get: () => $tooltip - }); - def(item, "tooltip", { - configurable: true, - get() { - return $tooltip.innerHTML; - }, - set(value) { - $tooltip.innerHTML = ""; - append($tooltip, value); - } - }); - switch (type) { - case "switch": { - const $switch = createElement("div"); - addClass($switch, "art-setting-item-right-icon"); - const $switchOn = append($switch, icons.switchOn); - const $switchOff = append($switch, icons.switchOff); - setStyle(item.switch ? $switchOff : $switchOn, "display", "none"); - append($right, $switch); - def(item, "$switch", { - configurable: true, - get: () => $switch - }); - let $switchValue = item.switch; - def(item, "switch", { - configurable: true, - get: () => $switchValue, - set(value) { - $switchValue = value; - if (value) { - setStyle($switchOff, "display", "none"); - setStyle($switchOn, "display", null); - } else { - setStyle($switchOff, "display", null); - setStyle($switchOn, "display", "none"); - } - } - }); - break; - } - case "range": - { - const $state = createElement("div"); - addClass($state, "art-setting-item-right-icon"); - const $range = append($state, ''); - $range.value = item.range[0]; - $range.min = item.range[1]; - $range.max = item.range[2]; - $range.step = item.range[3]; - addClass($range, "art-setting-range"); - append($right, $state); - def(item, "$range", { - configurable: true, - get: () => $range - }); - let $rangeValue = [...item.range]; - def(item, "range", { - configurable: true, - get: () => $rangeValue, - set(value) { - $rangeValue = [...value]; - $range.value = value[0]; - $range.min = value[1]; - $range.max = value[2]; - $range.step = value[3]; - } - }); - } - break; - case "selector": - if (item.selector?.length) { - const $state = createElement("div"); - addClass($state, "art-setting-item-right-icon"); - append($state, icons.arrowRight); - append($right, $state); - } - break; - } - switch (type) { - case "switch": { - if (item.onSwitch) { - const event = proxy($item, "click", async (event2) => { - item.switch = await item.onSwitch.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - break; - } - case "range": { - if (item.$range) { - if (item.onRange) { - const event = proxy(item.$range, "change", async (event2) => { - item.range[0] = item.$range.valueAsNumber; - item.tooltip = await item.onRange.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - if (item.onChange) { - const event = proxy(item.$range, "input", async (event2) => { - item.range[0] = item.$range.valueAsNumber; - item.tooltip = await item.onChange.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - } - break; - } - case "selector": - { - const event = proxy($item, "click", async (event2) => { - if (item.selector?.length) { - this.render(item.selector); - } else { - this.check(item); - if (item.$parent.onSelect) { - item.$parent.tooltip = await item.$parent.onSelect.call(this.art, item, $item, event2); - } - } - }); - item.$events.push(event); - if (item.default) { - addClass($item, "art-current"); - } - } - break; - case "button": - if (item.onClick) { - const event = proxy($item, "click", async (event2) => { - item.tooltip = await item.onClick.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - break; - } - def(item, "$item", { - configurable: true, - get: () => $item - }); - if (isUpdate) { - replaceElement($item, oldItem); - } else { - append($panel, $item); - } - if (item.mounted) { - timeout(getScope(this.art), () => item.mounted.call(this.art, item.$item, item), 0); - } + createSettingItem(this, item, isUpdate); } render(option = this.option) { - this.active = option; - if (this.cache.has(option)) { - const $panel = this.cache.get(option); - inverseClass($panel, "art-current"); - } else { - const $panel = createElement("div"); - this.cache.set(option, $panel); - addClass($panel, "art-setting-panel"); - append(this.$parent, $panel); - inverseClass($panel, "art-current"); - if (option[0]?.$parent) { - this.createHeader(option[0]); - } - for (let index = 0; index < option.length; index++) { - this.createItem(option[index]); - } - } - this.resize(); + renderSetting(this, option); } } class Storage { @@ -5335,7 +6133,7 @@ class Storage { } } } -const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; +const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; class Subtitle extends Component { constructor(art) { super(art); @@ -5475,37 +6273,6 @@ class Subtitle extends Component { }); } } -function captureTemplate(container) { - const snapshots = []; - function capture(node) { - const children = Array.from(node.childNodes); - snapshots.push({ - node, - children, - attributes: node.nodeType === 1 ? Array.from(node.attributes, (attr) => [attr.name, attr.value]) : void 0, - value: node.nodeValue - }); - children.forEach(capture); - } - capture(container); - return () => { - for (const { node, children, attributes, value } of snapshots) { - while (node.firstChild) - node.removeChild(node.firstChild); - for (const child of children) - node.appendChild(child); - if (attributes) { - const element = node; - for (const attr of Array.from(element.attributes)) - element.removeAttribute(attr.name); - for (const [name, content] of attributes) - element.setAttribute(name, content); - } else { - node.nodeValue = value; - } - } - }; -} const html = `
'),s=H("div");L(s,"art-setting-item-left-icon"),P(s,o),P(i,s),P(i,t.$parent.html);const l=r(a,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),P(e,a)}createItem(t,e=!1){if(!this.cache.has(t.$option))return;const r=this.cache.get(t.$option),o=t.$item;let n="selector";ct(t,"switch")&&(n="switch"),ct(t,"range")&&(n="range"),ct(t,"onClick")&&(n="button");const{icons:a,proxy:i,constructor:s}=this.art,l=H("div");L(l,"art-setting-item"),O(l,"height",`${s.SETTING_ITEM_HEIGHT}px`),l.dataset.name=t.name||"",l.dataset.value=t.value||"";const c=P(l,'
'),d=P(l,'
'),p=H("div");switch(L(p,"art-setting-item-left-icon"),n){case"button":case"switch":case"range":P(p,t.icon||a.config);break;case"selector":t.selector?.length?P(p,t.icon||a.config):P(p,a.check)}P(c,p),st(t,"$icon",{configurable:!0,get:()=>p}),st(t,"icon",{configurable:!0,get:()=>p.innerHTML,set(t){p.innerHTML="",P(p,t)}});const u=H("div");L(u,"art-setting-item-left-text"),P(u,t.html||""),P(c,u),st(t,"$html",{configurable:!0,get:()=>u}),st(t,"html",{configurable:!0,get:()=>u.innerHTML,set(t){u.innerHTML="",P(u,t)}});const f=H("div");switch(L(f,"art-setting-item-right-tooltip"),P(f,t.tooltip||""),P(d,f),st(t,"$tooltip",{configurable:!0,get:()=>f}),st(t,"tooltip",{configurable:!0,get:()=>f.innerHTML,set(t){f.innerHTML="",P(f,t)}}),n){case"switch":{const e=H("div");L(e,"art-setting-item-right-icon");const r=P(e,a.switchOn),o=P(e,a.switchOff);O(t.switch?o:r,"display","none"),P(d,e),st(t,"$switch",{configurable:!0,get:()=>e});let n=t.switch;st(t,"switch",{configurable:!0,get:()=>n,set(t){n=t,t?(O(o,"display","none"),O(r,"display",null)):(O(o,"display",null),O(r,"display","none"))}});break}case"range":{const e=H("div");L(e,"art-setting-item-right-icon");const r=P(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],L(r,"art-setting-range"),P(d,e),st(t,"$range",{configurable:!0,get:()=>r});let o=[...t.range];st(t,"range",{configurable:!0,get:()=>o,set(t){o=[...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=H("div");L(t,"art-setting-item-right-icon"),P(t,a.arrowRight),P(d,t)}}switch(n){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&&L(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)}}st(t,"$item",{configurable:!0,get:()=>l}),e?F(l,o):P(r,l),t.mounted&&At(h(this.art),()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){if(this.active=t,this.cache.has(t)){V(this.cache.get(t),"art-current")}else{const e=H("div");this.cache.set(t,e),L(e,"art-setting-panel"),P(this.$parent,e),V(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?R(r,t):O(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?it(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=await this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=H("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,I(i),P(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(n(t,zt.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||J(t.url)){case"srt":{const e=ht(r);return ut(t.onVttLoad(e))}case"ass":{const e=ft(r);return ut(t.onVttLoad(e))}case"vtt":return ut(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}}const Ne=`\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
${a}
\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 `;class Fe{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=z(e.container),K(this.$container,`No container element found by ${e.container}`)),K(W(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();K("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),K(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,function(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Ne}query(t){return z(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Fe.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){K(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),F(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&L(this.$player,"art-backdrop"),E&&L(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":L(this.$player,"art-destroy")}}const He=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Be{on(t,e,r){const o=this.e||(this.e={});let n=He(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(He(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=He(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),qe.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${qe.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&je.push(this)}catch(o){try{f(this,je,!0,qe.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return je}static get version(){return a}static get config(){return i}static get utils(){return gt}static get scheme(){return zt}static get Emitter(){return Be}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return Fe.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:x?"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){f(this,je,t,qe.REMOVE_SRC_WHEN_DESTROY)}}return qe.STYLE=Ye,qe.DEBUG=!1,qe.CONTEXTMENU=!0,qe.NOTICE_TIME=2e3,qe.SETTING_WIDTH=250,qe.SETTING_ITEM_WIDTH=200,qe.SETTING_ITEM_HEIGHT=35,qe.RESIZE_TIME=200,qe.SCROLL_TIME=200,qe.SCROLL_GAP=50,qe.AUTO_PLAYBACK_MAX=10,qe.AUTO_PLAYBACK_MIN=5,qe.AUTO_PLAYBACK_TIMEOUT=3e3,qe.RECONNECT_TIME_MAX=5,qe.RECONNECT_SLEEP_TIME=1e3,qe.CONTROL_HIDE_TIME=3e3,qe.DBCLICK_TIME=300,qe.DBCLICK_FULLSCREEN=!0,qe.MOBILE_DBCLICK_PLAY=!0,qe.MOBILE_CLICK_PLAY=!1,qe.AUTO_ORIENTATION_TIME=200,qe.INFO_LOOP_TIME=1e3,qe.FAST_FORWARD_VALUE=3,qe.FAST_FORWARD_TIME=1e3,qe.TOUCH_MOVE_RATIO=.5,qe.VOLUME_STEP=.1,qe.SEEK_STEP=5,qe.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],qe.ASPECT_RATIO=["default","4:3","16:9"],qe.FLIP=["normal","horizontal","vertical"],qe.FULLSCREEN_WEB_IN_BODY=!0,qe.LOG_VERSION=!0,qe.USE_RAF=!1,qe.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=qe,C("artplayer-style",Ye),setTimeout(()=>{qe.LOG_VERSION&&console.log(`%c ArtPlayer %c ${qe.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),qe}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var o=(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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,o,n=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};o&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,n||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),n&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=v(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 S(t,e=document){return e.querySelector(t)}function z(t,e=document){return Array.from(e.querySelectorAll(t))}function M(t,e){return t.classList.add(e)}function L(t,e){return t.classList.remove(e)}function P(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function O(t){return t.parentNode.removeChild(t)}function R(t,e,r){return t.style[e]=r,t}function I(t,e){for(const r in e)R(t,r,e[r]);return t}function _(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function V(t,e){_(t).forEach(t=>L(t,e)),M(t,e)}function N(t,e,r="top"){E||(t.setAttribute("aria-label",e),M(t,"hint--rounded"),M(t,`hint--${r}`))}function D(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function Y(t,e){return U(t).includes(e)}function W(t,e){return e.parentNode.replaceChild(t,e),t}function F(t){return document.createElement(t)}function B(t="",e=""){const r=F("i");return M(r,"art-icon"),M(r,`art-icon-${t}`),A(r,e),r}function H(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function j(t){return t.getBoundingClientRect()}function q(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function U(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}function X(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class G extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function K(t,e){if(!t)throw new G(e);return t}function Z(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function J(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function Q(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function tt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function et(t){return t.charAt(0).toUpperCase()+t.slice(1)}function rt(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ot={"&":"&","<":"<",">":">","'":"'",'"':"""},nt={"&":"&","<":"<",">":">","'":"'",""":'"'},at=/(&|<|>|'|")/g;function it(t){return t.replace(/[&<>'"]/g,t=>ot[t]||t)}const st=Object.defineProperty,{hasOwnProperty:lt}=Object.prototype;function ct(t,e){return lt.call(t,e)}function dt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function pt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?pt(n,a):a,st(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function ut(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 ht(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ft(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 mt(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const gt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:G,addClass:M,append:A,assToVtt:ft,capitalize:et,clamp:tt,createElement:F,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:st,download:Q,errorHandle:K,escape:it,get:dt,getComposedPath:U,getExt:J,getIcon:B,getRect:j,getSafeAreaInsets:X,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:ct,hasClass:P,includeFromEvent:Y,inverseClass:V,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:D,isMobile:E,isSafari:x,loadImg:q,mergeDeep:pt,query:S,queryAll:z,remove:O,removeClass:L,replaceElement:W,secondToTime:rt,setStyle:R,setStyleText:C,setStyles:I,siblings:_,silencePromise:Z,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:ut,supportsFlex:H,throttle:mt,tooltip:N,unescape:function(t){return t.replace(at,t=>nt[t]||t)},userAgent:w,vttToBlob:ht},Symbol.toStringTag,{value:"Module"}));function vt(t,e){return A(t,e)}function yt(t,e){return e.querySelector(t)}const bt="array",wt="boolean",xt="string",kt="number",$t="object",Et="function";function Tt(t,e,r){return K(e===xt||e===kt||t instanceof Element,`${r.join(".")} require '${xt}' or 'Element' type`)}const Ct={html:Tt,disable:`?${wt}`,name:`?${xt}`,index:`?${kt}`,style:`?${$t}`,click:`?${Et}`,mounted:`?${Et}`,tooltip:`?${xt}|${kt}`,width:`?${kt}`,selector:`?${bt}`,onSelect:`?${Et}`,switch:`?${wt}`,onSwitch:`?${Et}`,range:`?${bt}`,onRange:`?${Et}`,onChange:`?${Et}`},St={id:xt,container:Tt,url:xt,poster:xt,type:xt,theme:xt,lang:xt,volume:kt,isLive:wt,muted:wt,autoplay:wt,autoSize:wt,autoMini:wt,loop:wt,flip:wt,playbackRate:wt,aspectRatio:wt,screenshot:wt,setting:wt,hotkey:wt,pip:wt,mutex:wt,backdrop:wt,fullscreen:wt,fullscreenWeb:wt,subtitleOffset:wt,miniProgressBar:wt,useSSR:wt,playsInline:wt,lock:wt,gesture:wt,fastForward:wt,autoPlayback:wt,autoOrientation:wt,airplay:wt,proxy:`?${Et}`,plugins:[Et],layers:[Ct],contextmenu:[Ct],settings:[Ct],controls:[{...Ct,position:(t,e,r)=>{const o=["top","left","right"];return K("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}}],quality:[{default:`?${wt}`,html:xt,url:xt}],highlight:[{time:kt,text:xt}],thumbnails:{url:xt,number:kt,column:kt,width:kt,height:kt,scale:kt},subtitle:{url:xt,name:xt,type:xt,style:$t,escape:wt,encoding:xt,onVttLoad:Et},moreVideoAttr:$t,i18n:$t,icons:$t,cssVar:$t,customType:$t},zt=new WeakSet;class Mt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return P(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):L(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",n(e,Ct),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,o=this.cache;K(!o.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){M(t,`art-${r}`),M(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&I(t,a.style),a.tooltip&&N(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,r,a),c=!0,o.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw o.get(r)?.$ref===a&&o.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){K(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!zt.has(e)){zt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{zt.delete(e)}}}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 Lt extends Mt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="1"]',t);o&&V(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&V(r,"art-current")})}}}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="default"]',t);o&&V(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(r,"art-current")})}}}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:o}}=e,n=o.map(t=>`${r.get(et(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="normal"]',t);o&&V(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&V(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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=j(e),{height:c,width:d}=j(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),I(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{Y(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Pt(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function At(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function Ot(t,e){const{$progress:r}=t.template,{left:o}=j(r),n=tt((E?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:rt(a),width:n,percentage:tt(n/r.clientWidth,0,1)}}function Rt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=Ot(t,e);t.emit("setBar","played",o,e),t.seek=r}}function It(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=yt(".art-progress-hover",e),c=yt(".art-progress-loaded",e),d=yt(".art-progress-played",e),p=yt(".art-progress-highlight",e),u=yt(".art-progress-indicator",e),h=yt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||Ot(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?R(h,"left",0):n>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",n-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*o+"%"),"hover"===r&&(R(l,"width",100*o+"%"),Y(i,p)?function(r){const{width:o}=Ot(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=n??"";const a=h.clientWidth;o<=a/2?R(h,"left",0):o>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",o-a/2+"px")}(i):f(i),0===o?L(n,"art-progress-hover"):M(n,"art-progress-hover")),"played"===r&&(R(d,"width",100*o+"%"),R(u,"left",100*o+"%")),m){M(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:rt(o*t.duration)}),s(),s=Pt(a,()=>{L(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function _t(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{It(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==o&&Rt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Ot(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=Ot(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Vt(t){const{option:e}=t.art;e.isLive||t.add(_t({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.play),s=vt(t,n.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}N(i,a.get("Play")),N(s,a.get("Pause")),o(i,"click",()=>{Z(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n}=e,a=vt(t,n.volume),i=vt(t,n.volumeClose),s=vt(t,'
'),l=vt(s,'
'),c=vt(l,'
'),d=vt(l,'
'),p=vt(d,'
'),u=vt(p,'
'),h=vt(d,'
');function f(t){const{top:e,height:r}=j(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function o(){const r=`${rt(e.currentTime)} / ${rt(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{N(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;vt(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{N(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;vt(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenWebOn),s=vt(t,n.fullscreenWebOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(N(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=vt(t,n.fullscreenOn),s=vt(t,n.fullscreenOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(N(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rDt.get(t).option.selector}),st(t,"$control_item",{get:()=>Dt.get(t).item}),st(t,"$control_value",{get:()=>Dt.get(t).value})),Dt.set(t,e)}function Wt(t,e){t.innerHTML=e}function Ft(t,e,r,o,n){const{proxy:a}=t.events,i=v(o),s=r.selector;M(o,"art-control-selector");const l=document.createElement("div");M(l,"art-selector-value"),A(l,r.html),o.textContent="",A(o,l);const c=vt(o,'
');for(let u=0;u{if(i.closed)return;const n=U(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Nt.set(t,e),()=>{Nt.get(t)===e&&Nt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,o);c()&&Wt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});n.push(p)}class Bt extends Mt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;g(t,o);const{on:n}=b(t,o);n("mousemove",()=>{E||(this.show=!0)}),n("click",()=>{E?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=Y(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(L(r,"art-hide-cursor"),M(r,"art-hover"),this.timer=Date.now()):(M(r,"art-hide-cursor"),L(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=v(e),{on:a}=b(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){Vt(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:K(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Wt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Ht(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function jt(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const qt=new WeakMap;class Ut{constructor(t){this.destroyEvents=new Set;const e=u(t);qt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){Y(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&n&&Z(t.toggle()):Z(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&Z(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=>{L(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=u(t);let a=()=>{};const i=()=>{a(),a=Pt(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&Rt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=Ht(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=tt((o-i)/t.width,-1,1),d=tt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=tt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",tt(h/t.duration,0,1),e),t.notice.show=`${rt(h)} / ${rt(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=mt(()=>{t.emit("view",D(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{const o=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(o,r,e=>{t.emit(`window:${r}`,e)});n.push(s)})}a(),e.bindGlobalEvents=a}(t,this),jt(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(qt.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 Xt{constructor(t){this.art=t,this.keys={},E||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",()=>{Z(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Jt{constructor(t){const e={...Zt,...t.option.icons};for(const r in e)st(this,r,{get:()=>B(r,e[r])})}}class Qt extends Mt{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=z("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(n,"display","none"),R(a,"display",null)}),o.proxy(e.$state,"click",()=>Z(t.play()))}}class oe{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,M(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.textContent="",L(r,"art-notice-show")},e.NOTICE_TIME)):L(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function ne(t,e,r,o=!1){const n=e=>{h(t)||r(e)};t[o?"once":"on"](e,n),u(t).add(()=>{t.off(e,n)})}function ae(t,e,r){for(const[o,n]of e){if(h(t)||r&&!r())return;t[o].show=n}}const ie=new WeakMap,se=new WeakMap,le=new WeakMap;function ce(t){return le.get(t)||u(t)}function de(t){const e=ie.get(t),r=le.get(t);return()=>ie.get(t)===e&&(!e||e.active())&&le.get(t)===r&&(!r||!r.closed)}function pe(t){const e=le.get(t),r=u(t).child(),o=r.child();le.set(t,r),r.add(()=>{le.get(t)===r&&le.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!o.closed&&ie.get(t)===n};return ie.set(t,n),o.add(()=>{ie.get(t)===n&&ie.delete(t),n.onAssigned=void 0,n.onError=void 0}),e?.dispose(),n}function ue(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function he(t,e,r){se.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{se.get(t)===e&&(se.delete(t),ue(e))}}function fe(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function me(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=ce(t),l=0;return{reset(){l=0,i?.dispose(),L(a,"art-error")},loadStart(){L(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=ce(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===ce(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function ge(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=me(t);!function(t,e){ne(t,"video:canplay",()=>{e.reset(),ae(t,[["loading",!1]])}),ne(t,"video:canplay",()=>{ae(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;ne(t,"video:ended",()=>{if(e.loop){const e=de(t);if(t.seek=0,h(t)||!e())return;Z(t.play()),e()&&ae(t,[["controls",!1],["mask",!1]],e)}else ae(t,[["controls",!0],["mask",!0]])})}(t),ne(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;ne(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&ae(t,[["loading",!1],["controls",!0],["mask",!0]])}),ne(t,"video:loadstart",()=>{e.loadStart(),ae(t,[["loading",!0],["mask",!1],["controls",!0]])}),ne(t,"video:pause",()=>{ae(t,[["controls",!0],["mask",!0]])}),ne(t,"video:play",()=>{ae(t,[["mask",!1]]),h(t)||R(r,"display","none")}),ne(t,"video:playing",()=>ae(t,[["mask",!1]])),ne(t,"video:progress",()=>{t.playing&&ae(t,[["loading",!1]])}),ne(t,"video:seeked",()=>ae(t,[["loading",!1],["mask",!0]])),ne(t,"video:seeking",()=>ae(t,[["loading",!0],["mask",!1]])),ne(t,"video:timeupdate",()=>ae(t,[["mask",!1]])),ne(t,"video:waiting",()=>ae(t,[["loading",!0],["mask",!1]]))}(t,e)}const ve=[["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"]],ye=(()=>{if("undefined"===typeof document)return!1;const t=ve[0],e={};for(const r of ve){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),be={change:ye.fullscreenchange,error:ye.fullscreenerror},we={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{we.off("change",n),r()};we.on("change",n);const a=t[ye.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!we.isFullscreen)return void t();const r=()=>{we.off("change",r),t()};we.on("change",r);const o=document[ye.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>we.isFullscreen?we.exit():we.request(t,e),onchange(t){we.on("change",t)},onerror(t){we.on("error",t)},on(t,e){const r=be[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=be[t];r&&document.removeEventListener(r,e,!1)},raw:ye};function xe(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;t.once("video:loadedmetadata",()=>{var a;we.isEnabled?(a=t,we.on("change",()=>{a.emit("fullscreen",we.isFullscreen),we.isFullscreen?(a.state="fullscreen",M(n,"art-fullscreen")):L(n,"art-fullscreen"),a.emit("resize")}),we.on("error",t=>{a.emit("fullscreenError",t)}),st(a,"fullscreen",{get:()=>we.isFullscreen,async set(t){t?await we.request(n):await we.exit()}})):o.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),st(t,"fullscreen",{get:()=>document.fullscreenElement===o,set(e){e?(t.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})})(t):st(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),st(t,"fullscreen",dt(t,"fullscreen"))})}function ke(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(L(n,"art-mini"),R(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(R(e,"display","none"),R(r,"display","flex")):(R(e,"display","flex"),R(r,"display","none"))}function p(){const{$mini:e}=t.template,r=j(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),R(e,"top",`${n}px`),R(e,"left",`${a}px`)}st(t,"mini",{get:()=>P(n,"art-mini"),set(u){if(u){t.state="mini",M(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return A(n,a),R(n,"display","flex");{const n=F("div");M(n,"art-mini-popup"),A(document.body,n),t.template.$mini=n,A(n,a);const p=A(n,'
');A(p,e.close),r(p,"click",c);const u=A(n,'
'),h=A(u,e.play),f=A(u,e.pause);return r(h,"click",()=>Z(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){M(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;R(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,L(n,"art-mini-dragging");const t=j(n);o.set("left",t.left),o.set("top",t.top),R(n,"left",`${t.left}px`),R(n,"top",`${t.top}px`),R(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(R(u,"top",`${h}px`),R(u,"left",`${f}px`),D(u)||p()):p(),t.emit("mini",!0)}else c()}})}function $e(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,st(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),st(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):st(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Ee(t){st(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Nt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${n.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(o.show=r)}return e.html}})}})}function Te(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ce(t,e,r){return new Promise((o,n)=>{if(h(t)||e===t.url)return void o();const a=pe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Te(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(he(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Te(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Se(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",async(n,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===n||"played"===n&&l&&E){if(i||a||(a=!0,i=await q(d,p),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",n-u/2+"px")}(n)}}),st(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function ze(t){const{option:e,template:{$video:r}}=t;st(t,"url",{get:()=>r.src,async set(o){if(h(t))return;const n=function(t){const e=se.get(t);return se.delete(t),e||pe(t)}(t);n.acceptingEvents=!1;try{if(!o)return void(await At(n.scope)&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||J(o),s=e.customType[i];if(i&&s){if(!(await At(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;Te(l,t,"video:canplay",()=>{c=!d}),Te(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>fe(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||Te(n.scope,t,"video:canplay",e)}}catch(a){fe(n,a)}finally{ue(n)}}})}Object.defineProperties(we,{isFullscreen:{get:()=>Boolean(document[ye.fullscreenElement])},element:{enumerable:!0,get:()=>document[ye.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ye.fullscreenEnabled])}});class Me{constructor(t){ze(t),function(t){const{template:{$video:e}}=t;st(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;st(t,"play",{async value(){const i=de(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;st(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${rt(t.currentTime)} / ${rt(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;st(t,"forward",{set(e){r.seek=t.currentTime+e}}),st(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;st(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=tt(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),st(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;st(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=tt(o,0,t.duration))}})}(t),function(t){st(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ce(t,e,0);st(t,"switchQuality",{value:e=>Ce(t,e,t.currentTime)}),st(t,"switchUrl",{value:e}),st(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;st(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;st(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)R(o,"width",null),R(o,"height",null),R(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(R(o,"width",s*r+"px"),R(o,"height","100%"),R(o,"margin","0 auto")):(R(o,"width","100%"),R(o,"height",e/s+"px"),R(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=F("canvas");st(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),st(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),st(t,"screenshot",{value:async e=>{const o=await t.getDataURL();return Q(o,`${e||`artplayer_${rt(r.currentTime)}`}.png`),t.emit("screenshot",o),o}})}(t),xe(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";st(t,"fullscreenWeb",{get:()=>P(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&A(document.body,o),t.state="fullscreenWeb",R(o,"width","100%"),R(o,"height","100%"),M(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&A(r,o),n&&(o.style.cssText=n,n=""),L(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),$e(t),function(t){const{$video:e}=t.template,r=t;st(t,"loaded",{get:()=>r.loadedTime/e.duration}),st(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){st(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;st(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:o}=t.template;st(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=j(e),l=n/a;if(i/s>l)R(r,"width",s*l/i*100+"%"),R(r,"height","100%");else{const t=i/l/s*100;R(r,"width","100%"),R(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;st(t,"rect",{get:()=>j(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}st(t,"x",{get:()=>e.left+window.pageXOffset}),st(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;st(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(et(n))}`,t.emit("flip",n)}})}(t),ke(t),function(t){const{template:{$poster:e}}=t;st(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;st(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);R(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;st(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){st(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){st(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];st(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;oo.$track?.offset||0,set(n){const{cues:a}=t.subtitle;if(!o.$track||0===a.length)return;const i=tt(n,-10,10);o.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,st(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ee(t),Se(t),ge(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=tt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=tt(a,0,1)),e.poster&&R(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Le(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!P(o,a)&&function(){const e=X(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;R(o,"width",`${n}px`),R(o,"height",`${i}px`),R(o,"transform-origin","0 0"),R(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),M(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else P(o,a)&&(R(o,"width",""),R(o,"height",""),R(o,"transform-origin",""),R(o,"transform",""),L(o,a),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(o,i)}catch(n){s=!1,e.show=n}}else if(P(o,i)&&L(o,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return P(o,a)}}}function Pe(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=S(".art-auto-playback-last",s),c=S(".art-auto-playback-jump",s),d=S(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${rt(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,Z(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Ae(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,L(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,M(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return P(o,"art-fast-forward")}}}function Oe(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return P(o,"art-lock")}function a(){M(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){L(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=A(e,r.lock),n=A(e,r.unlock);R(o,"display","none"),t.on("lock",t=>{t?(R(o,"display","inline-flex"),R(n,"display","none")):(R(o,"display","none"),R(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function Re(t){return t.on("control",e=>{e?L(t.template.$player,"art-mini-progress-bar"):M(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Ie{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(Re),!h(t.art)&&e.lock&&E&&t.add(Oe),h(t.art)||!e.autoPlayback||e.isLive||t.add(Pe),!h(t.art)&&e.autoOrientation&&E&&t.add(Le),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(Ae)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){K(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let n=o;const a=ct(t,n);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return h(t.art)||(K(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),h(t.art)||st(t,n,{value:r})),t}(this,t,e)}}const _e=new WeakMap;function Ve(t){return!t.closed&&!_e.get(t)}function Ne(t){_e.set(t,(_e.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(_e.get(t)||1)-1;r?_e.set(t,r):_e.delete(t)}}const De=new WeakMap,Ye=new WeakMap,We=["$parent","$parents","$option","$events","$formatted"];function Fe(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=De.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(De.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function Be(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function He(t){const e=De.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function je(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Je(t,n)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(n.push(...a.splice(0)),Ze.set(r,n),Ge.set(e,r),Ke.set(e,o)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function or(t,e,r,o,n,a){const i=a||tr(e);if(!Ve(i)||h(t))return;const s=t.proxy(r,o,e=>{if(Ve(i)&&!h(t))try{return n(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Ve(i)||h(t)?t.events.remove(s):(He(e).events.push(s),a&&a!==Ge.get(e)&&a.add(()=>{const r=He(e).events,o=r.indexOf(s);o>=0&&(r.splice(o,1),t.events.remove(s))}))}function nr(t,e,r,o){const n=tr(e);if(!Ve(n)||h(t))return;const a=(...e)=>{if(Ve(n)&&!h(t))return o(...e)};t.on(r,a),n.add(()=>{t.off(r,a)})}function ar(t){const{art:e,active:r}=t,{controls:o,constructor:{SETTING_WIDTH:n,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!o.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=o.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:o,rows:n,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,o),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,n*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||n,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const ir=new WeakMap;function sr(t){ir.delete(t)}const lr=new WeakMap;function cr(t,e){e?lr.set(t,e):lr.delete(t)}function dr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],o=lr.get(t),n=o?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,o]of e)Object.defineProperty(t,r,o);n?.(),cr(t,o);for(const{node:t,parent:e,next:o}of r)e?e.insertBefore(t,o?.parentNode===e?o:null):t.parentNode?.removeChild(t)}}const pr=new WeakMap;async function ur(t,e,r,o,n,a,i,s){try{const l=tr(e),c=tr(a),d=(pr.get(a)||0)+1;pr.set(a,d);const p=()=>Ve(l)&&Ve(c)&&!h(t.art)&&pr.get(a)===d;if(s?.(),!p())return;const u=await n.call(t.art,e,r,o);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function hr(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}const fr=new WeakMap;function mr(t){const e=[];for(const o of t)try{o()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function gr(t){fr.get(t)?.()}function vr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);sr(r),gr(r);const o=dr(r),n=r.$item,a=n?.parentNode,i=n?.nextSibling,s=n?hr(n):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,o=new Set,n=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&o.add(r),e.selector.forEach(n)}};n(e);const a=[],i=[];try{for(const e of r){const r=rr(t.art,e);r&&a.push(r)}for(const t of o)i.push(Ne(Ue(t)))}catch(l){try{mr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,mr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,mr([...a.reverse().map(t=>t.dispose),...Array.from(o).reverse().map(t=>()=>Xe(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{mr([d.resume,()=>{e&&e!==n&&e.remove()},o,()=>s?.(),()=>{a&&n&&a.insertBefore(n,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&V(t.cache.get(l),"art-current");for(const[e,r,o]of c)t.$parent.style.setProperty(e,r,o)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&fr.get(r)===m;for(const u of d.items)fr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);d.dispose()});try{if(function(t,e,r){for(const o of Reflect.ownKeys(e)){if(!r())return;const n=Object.getOwnPropertyDescriptor(e,o);if(!n?.enumerable||!r())continue;const a=Reflect.get(e,o);if(!r())return;if(!Reflect.set(t,o,a))throw new TypeError(`Cannot assign setting item property [${String(o)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)fr.get(t)===m&&fr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const yr=new WeakMap;function br(t,e,r){st(t,`$${e}`,{configurable:!0,get:()=>r}),st(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function wr(t,e,r=!1){const o=function(t){const e=fr.get(t);return()=>!e||fr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const n=t.cache.get(e.$option),a=e.$item;let i="selector";ct(e,"switch")&&(i="switch"),ct(e,"range")&&(i="range"),ct(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!o())return;const c=function(t,e,r=u(t)){const o=Ge.get(e);(!o||Ve(o)||o.closed)&&er(t,e);const n=r.child();return Ge.set(e,n),Ke.set(e,r),Ze.set(n,He(e).events),n.add(()=>{Je(t,Ze.get(n))}),n}(t.art,e,Ue(n)),d=()=>Ve(c)&&!h(t.art)&&o();if(!d())return;const p=document.createElement("div");try{if(cr(e),M(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const o=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(M(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(o,f),!d())return;br(e,"icon",f);const m=document.createElement("div");M(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(o,m),br(e,"html",m);const v=document.createElement("div");M(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),br(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");M(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),o=A(t,s.switchOff),n=e.switch;if(!d())return;R(n?o:r,"display","none"),A(u,t),st(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;cr(e,()=>{const t=a;return()=>{a=t}}),st(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(o,"display","none"),R(r,"display",null)):(R(o,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");M(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[n,a]of["value","min","max","step"].entries()){const t=e.range[n];if(!d())return;Reflect.set(r,a,String(t))}M(r,"art-setting-range"),A(u,t),st(e,"$range",{configurable:!0,get:()=>r});let o=[...e.range];if(!d())return;cr(e,()=>{const t=o,e=[...t],n={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),o=t,Object.assign(r,n)}}),st(e,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");M(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,o){const{art:n}=t,a=tr(e),i=(t,r,o)=>or(n,e,t,r,o,a);switch(o){case"switch":e.onSwitch&&i(r,"click",o=>ur(t,e,r,o,e.onSwitch,e,"switch"));break;case"range":{const o=e.$range;if(o)for(const[n,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(o,n,n=>ur(t,e,r,n,e[a],e,"tooltip",()=>{e.range[0]=o.valueAsNumber}));break}case"selector":i(r,"click",o=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return ur(t,e,r,o,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&M(r,"art-current");break;case"button":e.onClick&&i(r,"click",o=>ur(t,e,r,o,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;st(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(n,p),e.mounted&&d()&&Pt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function xr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!Ve(Ue(r)))return;const o=(yr.get(t)||0)+1;yr.set(t,o);const n=()=>yr.get(t)===o&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&V(t.cache.get(a),"art-current");for(const[e,r,o]of i)t.$parent.style.setProperty(e,r,o)};if(t.active=e,r)try{V(r,"art-current"),t.resize()}catch(l){throw n()&&t.cache.get(e)===r&&!Ue(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const o=function(t,e,r){const o=u(t.art).child();return qe.set(r,o),o.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),o}(t,e,r),a=()=>!o.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;M(r,"art-setting-panel"),A(t.$parent,r),V(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ye.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),o=(t,o)=>{if(r.closed||h(e))return;const n=(...t)=>{if(!r.closed&&!h(e))return o(...t)};e.on(t,n),r.add(()=>{e.off(t,n)})};o("blur",()=>{t.show&&(t.show=!1,t.render())}),o("focus",r=>{const o=Y(r,e.controls.setting),n=Y(r,t.$parent);!t.show||o||n||(t.show=!1,t.render())}),o("resize",()=>t.resize());const n=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&n()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(n);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(n);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,FLIP:n}}=t;function a(t){return e.get(et(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),nr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:o}=t;return{width:o.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)=>{nr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){je(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&V(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,o=[]){this.option=function(t,e,r,o,n=[]){const a=Ye.get(t)||{active:!0},i=[],s=new Set,l=new Set(n),c=(t,e,r)=>{for(let o=0;oHe(t).parent},$parents:{get:()=>He(t).parents},$option:{get:()=>He(t).option},$events:{get:()=>He(t).events},$formatted:{get:()=>!0}}),De.set(t,{parent:r,parents:o,option:n,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||n.push(p.name);return t.id=d,e}(this,t,e,r,o)}find(t=""){return function(t,e=""){let r=null;return je(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){ar(this)}inactivate(t){!function(t,e){const r=[],o=new Set,n=e=>{if(!o.has(e)){o.add(e);for(const t of e.selector||[])n(t);if(e.selector){const o=t.cache.get(e.selector);t.cache.delete(e.selector);try{o&&Xe(o)}catch(a){r.push(a)}}try{er(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(n(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);K(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{sr(t),gr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const o=e.$item,n=[];for(const i of[()=>this.inactivate(e),()=>o?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?n.push(...a.errors):n.push(a)}if(n.length)throw new s(n)}update(t){return vr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const o=e.length,n=r?void 0:function(t){const e={};ir.set(t,e);const r=()=>ir.get(t)===e;return{current:r,finish(){r()&&ir.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||n&&!n.current())throw i;if(e[o]===t&&e.splice(o,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{n?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:o},constructor:{SETTING_ITEM_HEIGHT:n}}=t.art,a=document.createElement("div");R(a,"height",`${n}px`),M(a,"art-setting-item"),M(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");M(s,"art-setting-item-left-icon"),A(s,o),A(i,s),A(i,e.$parent.html),or(t.art,e.$parent,a,"click",()=>t.render(e.$parents),Ue(r)),A(r,a)}(this,t)}createItem(t,e=!1){wr(this,t,e)}render(t=this.option){xr(this,t)}}class Er{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const Tr='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Cr extends Mt{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null,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?I(r,t):R(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?it(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=await this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=F("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,O(i),A(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(n(t,St.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||J(t.url)){case"srt":{const e=ut(r);return ht(t.onVttLoad(e))}case"ass":{const e=ft(r);return ht(t.onVttLoad(e))}case"vtt":return ht(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}}const Sr=`\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
${a}
\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 `;class zr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=S(e.container),K(this.$container,`No container element found by ${e.container}`)),K(H(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();K("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),K(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,hr(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Sr}query(t){return S(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=zr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){K(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),W(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&M(this.$player,"art-backdrop"),E&&M(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":M(this.$player,"art-destroy")}}const Mr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Lr{on(t,e,r){const o=this.e||(this.e={});let n=Mr(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Mr(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Mr(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),Or.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Or.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&Ar.push(this)}catch(o){try{f(this,Ar,!0,Or.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return Ar}static get version(){return a}static get config(){return i}static get utils(){return gt}static get scheme(){return St}static get Emitter(){return Lr}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return zr.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:x?"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){f(this,Ar,t,Or.REMOVE_SRC_WHEN_DESTROY)}}return Or.STYLE=Tr,Or.DEBUG=!1,Or.CONTEXTMENU=!0,Or.NOTICE_TIME=2e3,Or.SETTING_WIDTH=250,Or.SETTING_ITEM_WIDTH=200,Or.SETTING_ITEM_HEIGHT=35,Or.RESIZE_TIME=200,Or.SCROLL_TIME=200,Or.SCROLL_GAP=50,Or.AUTO_PLAYBACK_MAX=10,Or.AUTO_PLAYBACK_MIN=5,Or.AUTO_PLAYBACK_TIMEOUT=3e3,Or.RECONNECT_TIME_MAX=5,Or.RECONNECT_SLEEP_TIME=1e3,Or.CONTROL_HIDE_TIME=3e3,Or.DBCLICK_TIME=300,Or.DBCLICK_FULLSCREEN=!0,Or.MOBILE_DBCLICK_PLAY=!0,Or.MOBILE_CLICK_PLAY=!1,Or.AUTO_ORIENTATION_TIME=200,Or.INFO_LOOP_TIME=1e3,Or.FAST_FORWARD_VALUE=3,Or.FAST_FORWARD_TIME=1e3,Or.TOUCH_MOVE_RATIO=.5,Or.VOLUME_STEP=.1,Or.SEEK_STEP=5,Or.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Or.ASPECT_RATIO=["default","4:3","16:9"],Or.FLIP=["normal","horizontal","vertical"],Or.FULLSCREEN_WEB_IN_BODY=!0,Or.LOG_VERSION=!0,Or.USE_RAF=!1,Or.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=Or,C("artplayer-style",Tr),setTimeout(()=>{Or.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Or.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Or}); diff --git a/packages/artplayer/dist/artplayer.legacy.js b/packages/artplayer/dist/artplayer.legacy.js index bd1b8d802..808439d0a 100644 --- a/packages/artplayer/dist/artplayer.legacy.js +++ b/packages/artplayer/dist/artplayer.legacy.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,o=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(n)for(var r of n(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,o(e)),d=(t,e,r)=>new Promise((o,n)=>{var a=t=>{try{s(r.next(t))}catch(e){n(e)}},i=t=>{try{s(r.throw(t))}catch(e){n(e)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,o,n=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};o&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,n||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),n&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function z(t,e){const r=$(t).child();return C.set(e,r),r}function S(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function L(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=S(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=S(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const A=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",P=/^(?:(?!chrome|android).)*safari/i.test(A),O=/iPad|iPhone|iPod/i.test(A)&&!window.MSStream,I=O||A.includes("Macintosh")&&navigator.maxTouchPoints>=1,R=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(A)||I,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 Y(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function N(t,e){return t.classList.add(e)}function F(t,e){return t.classList.remove(e)}function H(t,e){return t.classList.contains(e)}function B(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function W(t){return t.parentNode.removeChild(t)}function j(t,e,r){return t.style[e]=r,t}function q(t,e){for(const r in e)j(t,r,e[r]);return t}function U(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function X(t,e){U(t).forEach(t=>F(t,e)),N(t,e)}function G(t,e,r="top"){R||(t.setAttribute("aria-label",e),N(t,"hint--rounded"),N(t,`hint--${r}`))}function K(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function Z(t,e){return nt(t).includes(e)}function J(t,e){return e.parentNode.replaceChild(t,e),t}function Q(t){return document.createElement(t)}function tt(t="",e=""){const r=Q("i");return N(r,"art-icon"),N(r,`art-icon-${t}`),B(r,e),r}function et(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function rt(t){return t.getBoundingClientRect()}function ot(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function nt(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}function at(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function st(t,e){if(!t)throw new it(e);return t}function lt(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function ct(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function dt(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function pt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ht(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ft={"&":"&","<":"<",">":">","'":"'",'"':"""},mt={"&":"&","<":"<",">":">","'":"'",""":'"'},gt=/(&|<|>|'|")/g;function vt(t){return t.replace(/[&<>'"]/g,t=>ft[t]||t)}const yt=Object.defineProperty,{hasOwnProperty:bt}=Object.prototype;function wt(t,e){return bt.call(t,e)}function xt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function kt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?kt(n,a):a,yt(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function $t(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 Et(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Tt(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Ct(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const zt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:N,append:B,assToVtt:Tt,capitalize:ut,clamp:pt,createElement:Q,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:yt,download:dt,errorHandle:st,escape:vt,get:xt,getComposedPath:nt,getExt:ct,getIcon:tt,getRect:rt,getSafeAreaInsets:at,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:wt,hasClass:H,includeFromEvent:Z,inverseClass:X,isBrowser:_,isIOS:O,isIOS13:I,isInViewport:K,isMobile:R,isSafari:P,loadImg:ot,mergeDeep:kt,query:Y,queryAll:D,remove:W,removeClass:F,replaceElement:J,secondToTime:ht,setStyle:j,setStyleText:V,setStyles:q,siblings:U,silencePromise:lt,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:$t,supportsFlex:et,throttle:Ct,tooltip:G,unescape:function(t){return t.replace(gt,t=>mt[t]||t)},userAgent:A,vttToBlob:Et},Symbol.toStringTag,{value:"Module"}));function St(t,e){return B(t,e)}function Lt(t,e){return e.querySelector(t)}const Mt="array",At="boolean",Pt="string",Ot="number",It="object",Rt="function";function _t(t,e,r){return st(e===Pt||e===Ot||t instanceof Element,`${r.join(".")} require '${Pt}' or 'Element' type`)}const Vt={html:_t,disable:`?${At}`,name:`?${Pt}`,index:`?${Ot}`,style:`?${It}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${Pt}|${Ot}`,width:`?${Ot}`,selector:`?${Mt}`,onSelect:`?${Rt}`,switch:`?${At}`,onSwitch:`?${Rt}`,range:`?${Mt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Yt={id:Pt,container:_t,url:Pt,poster:Pt,type:Pt,theme:Pt,lang:Pt,volume:Ot,isLive:At,muted:At,autoplay:At,autoSize:At,autoMini:At,loop:At,flip:At,playbackRate:At,aspectRatio:At,screenshot:At,setting:At,hotkey:At,pip:At,mutex:At,backdrop:At,fullscreen:At,fullscreenWeb:At,subtitleOffset:At,miniProgressBar:At,useSSR:At,playsInline:At,lock:At,gesture:At,fastForward:At,autoPlayback:At,autoOrientation:At,airplay:At,proxy:`?${Rt}`,plugins:[Rt],layers:[Vt],contextmenu:[Vt],settings:[Vt],controls:[c(l({},Vt),{position:(t,e,r)=>{const o=["top","left","right"];return st("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}})],quality:[{default:`?${At}`,html:Pt,url:Pt}],highlight:[{time:Ot,text:Pt}],thumbnails:{url:Pt,number:Ot,column:Ot,width:Ot,height:Ot,scale:Ot},subtitle:{url:Pt,name:Pt,type:Pt,style:It,escape:At,encoding:Pt,onVttLoad:Rt},moreVideoAttr:It,i18n:It,icons:It,cssVar:It,customType:It},Dt=new WeakSet;class Nt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return H(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?N(e,r):F(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,Vt),!this.$parent||!this.name||r.disable)return;const o=r.name||`${this.name}${this.id}`,n=this.cache;st(!n.has(o),`Can't add an existing [${o}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=z(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,o);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){N(t,`art-${r}`),N(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):B(e,t),a.html&&B(t,a.html),a.style&&q(t,a.style),a.tooltip&&G(t,a.tooltip)}(a,this.$parent,this.name,o,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,o,a),c=!0,n.set(o,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{L(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=n.get(o))?void 0:e.$ref)===a&&n.delete(o),c&&this[o]===a&&(l?Object.defineProperty(this,o,l):delete this[o]),a.remove(),d}}remove(t){st(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{L(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Ft extends Nt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,z(t,this.$parent),R||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="1"]',t);o&&X(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&X(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="default"]',t);o&&X(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:o}}=e,n=o.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),o=Y('[data-value="normal"]',t);o&&X(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=rt(e),{height:c,width:d}=rt(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),q(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{Z(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Ht(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function Bt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function Wt(t,e){const{$progress:r}=t.template,{left:o}=rt(r),n=pt((R?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:ht(a),width:n,percentage:pt(n/r.clientWidth,0,1)}}function jt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=Wt(t,e);t.emit("setBar","played",o,e),t.seek=r}}function qt(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=S(e),{on:i}=M(t,e);let s=()=>{};const l=Lt(".art-progress-hover",e),c=Lt(".art-progress-loaded",e),d=Lt(".art-progress-played",e),p=Lt(".art-progress-highlight",e),u=Lt(".art-progress-indicator",e),h=Lt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||Wt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?j(h,"left",0):n>e.clientWidth-i/2?j(h,"left",e.clientWidth-i+"px"):j(h,"left",n-i/2+"px")}r.indicator?B(u,r.indicator):j(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&R;if("loaded"===r&&j(c,"width",100*o+"%"),"hover"===r&&(j(l,"width",100*o+"%"),Z(i,p)?function(r){const{width:o}=Wt(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=n?n:"";const a=h.clientWidth;o<=a/2?j(h,"left",0):o>e.clientWidth-a/2?j(h,"left",e.clientWidth-a+"px"):j(h,"left",o-a/2+"px")}(i):f(i),0===o?F(n,"art-progress-hover"):N(n,"art-progress-hover")),"played"===r&&(j(d,"width",100*o+"%"),j(u,"left",100*o+"%")),m){N(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:ht(o*t.duration)}),s(),s=Ht(a,()=>{F(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=M(t,e);if(!R){let e=!1;a(r,"click",e=>{e.target!==o&&jt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Wt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=Wt(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.play),s=St(t,n.pause);function l(){j(i,"display","flex"),j(s,"display","none")}function c(){j(i,"display","none"),j(s,"display","flex")}G(i,a.get("Play")),G(s,a.get("Pause")),o(i,"click",()=>{lt(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n}=e,a=St(t,n.volume),i=St(t,n.volumeClose),s=St(t,'
'),l=St(s,'
'),c=St(l,'
'),d=St(l,'
'),p=St(d,'
'),u=St(p,'
'),h=St(d,'
');function f(t){const{top:e,height:r}=rt(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)j(a,"display","none"),j(i,"display","flex"),j(h,"top","100%"),j(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;j(a,"display","flex"),j(i,"display","none"),j(h,"top",100-t+"%"),j(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),R)j(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:R?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function o(){const r=`${ht(e.currentTime)} / ${ht(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!R&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:o}=e;St(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e;St(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{G(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e;St(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{G(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:o}=e;St(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.fullscreenWebOn),s=St(t,n.fullscreenWebOff);j(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(G(t,a.get("Exit Web Fullscreen")),j(i,"display","none"),j(s,"display","inline-flex")):(G(t,a.get("Web Fullscreen")),j(i,"display","inline-flex"),j(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=M(e,t),{icons:n,i18n:a}=e,i=St(t,n.fullscreenOn),s=St(t,n.fullscreenOff);j(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(G(t,a.get("Exit Fullscreen")),j(i,"display","none"),j(s,"display","inline-flex")):(G(t,a.get("Fullscreen")),j(i,"display","inline-flex"),j(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),yt(t,"$control_item",{get:()=>Kt.get(t).item}),yt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,o,n){const{proxy:a}=t.events,i=S(o),s=r.selector;N(o,"art-control-selector");const l=document.createElement("div");N(l,"art-selector-value"),B(l,r.html),o.textContent="",B(o,l);const c=St(o,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const n=nt(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,o);c()&&Jt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));n.push(u)}class te extends Nt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;z(t,o);const{on:n}=M(t,o);n("mousemove",()=>{R||(this.show=!0)}),n("click",()=>{R?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=Z(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(F(r,"art-hide-cursor"),N(r,"art-hover"),this.timer=Date.now()):(N(r,"art-hide-cursor"),F(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=S(e),{on:a}=M(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:st(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const oe=new WeakMap;class ne{constructor(t){this.destroyEvents=new Set;const e=$(t);oe.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){Z(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),R?!t.isLock&&n&<(t.toggle()):lt(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),R?!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=>{N(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=$(t);let a=()=>{};const i=()=>{a(),a=Ht(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(R&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&jt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=ee(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=pt((o-i)/t.width,-1,1),d=pt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=pt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",pt(h/t.duration,0,1),e),t.notice.show=`${ht(h)} / ${ht(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=Ct(()=>{t.emit("view",K(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{var o;const s=a.window||(null==(o=i.ownerDocument)?void 0:o.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});n.push(l)})}a(),e.bindGlobalEvents=a}(t,this),re(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(oe.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 ae{constructor(t){this.art=t,this.keys={},R||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",()=>{lt(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)yt(this,r,{get:()=>tt(r,e[r])})}}class de extends Nt{constructor(t){super(t),this.name="info",R||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{j(n,"display","none"),j(a,"display",null)}),o.proxy(e.$state,"click",()=>lt(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,N(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.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")}}function me(t,e,r,o=!1){const n=e=>{E(t)||r(e)};t[o?"once":"on"](e,n),$(t).add(()=>{t.off(e,n)})}function ge(t,e,r){for(const[o,n]of e){if(E(t)||r&&!r())return;t[o].show=n}}const ve=new WeakMap,ye=new WeakMap,be=new WeakMap;function we(t){return be.get(t)||$(t)}function xe(t){const e=ve.get(t),r=be.get(t);return()=>ve.get(t)===e&&(!e||e.active())&&be.get(t)===r&&(!r||!r.closed)}function ke(t){const e=be.get(t),r=$(t).child(),o=r.child();be.set(t,r),r.add(()=>{be.get(t)===r&&be.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!o.closed&&ve.get(t)===n};return ve.set(t,n),o.add(()=>{ve.get(t)===n&&ve.delete(t),n.onAssigned=void 0,n.onError=void 0}),null==e||e.dispose(),n}function $e(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Ee(t,e,r){ye.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ye.get(t)===e&&(ye.delete(t),$e(e))}}function Te(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Ce(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=we(t),l=0;return{reset(){l=0,null==i||i.dispose(),F(a,"art-error")},loadStart(){F(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=we(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===we(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function ze(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Ce(t);!function(t,e){me(t,"video:canplay",()=>{e.reset(),ge(t,[["loading",!1]])}),me(t,"video:canplay",()=>{ge(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;me(t,"video:ended",()=>{if(e.loop){const e=xe(t);if(t.seek=0,E(t)||!e())return;lt(t.play()),e()&&ge(t,[["controls",!1],["mask",!1]],e)}else ge(t,[["controls",!0],["mask",!0]])})}(t),me(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;me(t,"video:loadedmetadata",()=>{t.emit("resize"),R&&ge(t,[["loading",!1],["controls",!0],["mask",!0]])}),me(t,"video:loadstart",()=>{e.loadStart(),ge(t,[["loading",!0],["mask",!1],["controls",!0]])}),me(t,"video:pause",()=>{ge(t,[["controls",!0],["mask",!0]])}),me(t,"video:play",()=>{ge(t,[["mask",!1]]),E(t)||j(r,"display","none")}),me(t,"video:playing",()=>ge(t,[["mask",!1]])),me(t,"video:progress",()=>{t.playing&&ge(t,[["loading",!1]])}),me(t,"video:seeked",()=>ge(t,[["loading",!1],["mask",!0]])),me(t,"video:seeking",()=>ge(t,[["loading",!0],["mask",!1]])),me(t,"video:timeupdate",()=>ge(t,[["mask",!1]])),me(t,"video:waiting",()=>ge(t,[["loading",!0],["mask",!1]]))}(t,e)}const Se=[["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"]],Le=(()=>{if("undefined"===typeof document)return!1;const t=Se[0],e={};for(const r of Se){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),Me={change:Le.fullscreenchange,error:Le.fullscreenerror},Ae={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{Ae.off("change",n),r()};Ae.on("change",n);const a=t[Le.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!Ae.isFullscreen)return void t();const r=()=>{Ae.off("change",r),t()};Ae.on("change",r);const o=document[Le.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>Ae.isFullscreen?Ae.exit():Ae.request(t,e),onchange(t){Ae.on("change",t)},onerror(t){Ae.on("error",t)},on(t,e){const r=Me[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Me[t];r&&document.removeEventListener(r,e,!1)},raw:Le};function Pe(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t,a=t=>{Ae.on("change",()=>{t.emit("fullscreen",Ae.isFullscreen),Ae.isFullscreen?(t.state="fullscreen",N(n,"art-fullscreen")):F(n,"art-fullscreen"),t.emit("resize")}),Ae.on("error",e=>{t.emit("fullscreenError",e)}),yt(t,"fullscreen",{get:()=>Ae.isFullscreen,set(t){return d(this,null,function*(){t?yield Ae.request(n):yield Ae.exit()})}})};t.once("video:loadedmetadata",()=>{var n;Ae.isEnabled?a(t):o.webkitSupportsFullscreen?((n=t).on("document:webkitfullscreenchange",()=>{n.emit("fullscreen",n.fullscreen),n.emit("resize")}),yt(n,"fullscreen",{get:()=>document.fullscreenElement===o,set(t){t?(n.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})):yt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),yt(t,"fullscreen",xt(t,"fullscreen"))})}function Oe(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(F(n,"art-mini"),j(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(j(e,"display","none"),j(r,"display","flex")):(j(e,"display","flex"),j(r,"display","none"))}function p(){const{$mini:e}=t.template,r=rt(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),j(e,"top",`${n}px`),j(e,"left",`${a}px`)}yt(t,"mini",{get:()=>H(n,"art-mini"),set(u){if(u){t.state="mini",N(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return B(n,a),j(n,"display","flex");{const n=Q("div");N(n,"art-mini-popup"),B(document.body,n),t.template.$mini=n,B(n,a);const p=B(n,'
');B(p,e.close),r(p,"click",c);const u=B(n,'
'),h=B(u,e.play),f=B(u,e.pause);return r(h,"click",()=>lt(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){N(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;j(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,F(n,"art-mini-dragging");const t=rt(n);o.set("left",t.left),o.set("top",t.top),j(n,"left",`${t.left}px`),j(n,"top",`${t.top}px`),j(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(j(u,"top",`${h}px`),j(u,"left",`${f}px`),K(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Ie(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,yt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),yt(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):yt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Re(t){yt(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${n.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(o.show=a)}return e.html})}})}})}function _e(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ve(t,e,r){return new Promise((o,n)=>{if(E(t)||e===t.url)return void o();const a=ke(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)_e(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if(Ee(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=_e(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ye(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",(n,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===n||"played"===n&&l&&R){if(i||a||(a=!0,i=yield ot(p,u),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-h/2?j(s,"left",r.clientWidth-h+"px"):j(s,"left",n-h/2+"px")}(n)}})),yt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function De(t){const{option:e,template:{$video:r}}=t;yt(t,"url",{get:()=>r.src,set(o){return d(this,null,function*(){if(E(t))return;const n=function(t){const e=ye.get(t);return ye.delete(t),e||ke(t)}(t);n.acceptingEvents=!1;try{if(!o)return void((yield Bt(n.scope))&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||ct(o),s=e.customType[i];if(i&&s){if(!(yield Bt(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;_e(l,t,"video:canplay",()=>{c=!d}),_e(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>Te(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||_e(n.scope,t,"video:canplay",e)}}catch(a){Te(n,a)}finally{$e(n)}})}})}Object.defineProperties(Ae,{isFullscreen:{get:()=>Boolean(document[Le.fullscreenElement])},element:{enumerable:!0,get:()=>document[Le.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Le.fullscreenEnabled])}});class Ne{constructor(t){De(t),function(t){const{template:{$video:e}}=t;yt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;yt(t,"play",{value(){return d(this,null,function*(){const i=xe(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;yt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ht(t.currentTime)} / ${ht(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;yt(t,"forward",{set(e){r.seek=t.currentTime+e}}),yt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;yt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=pt(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),yt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;yt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=pt(o,0,t.duration))}})}(t),function(t){yt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ve(t,e,0);yt(t,"switchQuality",{value:e=>Ve(t,e,t.currentTime)}),yt(t,"switchUrl",{value:e}),yt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;yt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;yt(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)j(o,"width",null),j(o,"height",null),j(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(j(o,"width",s*r+"px"),j(o,"height","100%"),j(o,"margin","0 auto")):(j(o,"width","100%"),j(o,"height",e/s+"px"),j(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=Q("canvas");yt(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),yt(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),yt(t,"screenshot",{value:e=>d(null,null,function*(){const o=yield t.getDataURL();return dt(o,`${e||`artplayer_${ht(r.currentTime)}`}.png`),t.emit("screenshot",o),o})})}(t),Pe(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";yt(t,"fullscreenWeb",{get:()=>H(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&B(document.body,o),t.state="fullscreenWeb",j(o,"width","100%"),j(o,"height","100%"),N(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&B(r,o),n&&(o.style.cssText=n,n=""),F(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Ie(t),function(t){const{$video:e}=t.template,r=t;yt(t,"loaded",{get:()=>r.loadedTime/e.duration}),yt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){yt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;yt(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:o}=t.template;yt(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=rt(e),l=n/a;if(i/s>l)j(r,"width",s*l/i*100+"%"),j(r,"height","100%");else{const t=i/l/s*100;j(r,"width","100%"),j(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;yt(t,"rect",{get:()=>rt(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}yt(t,"x",{get:()=>e.left+window.pageXOffset}),yt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;yt(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(ut(n))}`,t.emit("flip",n)}})}(t),Oe(t),function(t){const{template:{$poster:e}}=t;yt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){j(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;yt(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);j(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;yt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){yt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){yt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];yt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;o{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,yt(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Re(t),Ye(t),ze(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=pt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=pt(a,0,1)),e.poster&&j(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Fe(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{var n;if(e){if(l()){const e=Number(null!=(n=r.AUTO_ORIENTATION_TIME)?n:0);setTimeout(()=>{t.fullscreenWeb&&!H(o,a)&&function(){const e=at(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;j(o,"width",`${n}px`),j(o,"height",`${i}px`),j(o,"transform-origin","0 0"),j(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),N(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else H(o,a)&&(j(o,"width",""),j(o,"height",""),j(o,"transform-origin",""),j(o,"transform",""),F(o,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const n=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(n&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,N(o,i)}catch(a){s=!1,e.show=a}}else if(H(o,i)&&F(o,i),n&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return H(o,a)}}}function He(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=Y(".art-auto-playback-last",s),c=Y(".art-auto-playback-jump",s),d=Y(".art-auto-playback-close",s);B(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),j(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(j(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ht(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{j(s,"display","none")}),a(c,"click",()=>{t.seek=r,lt(t.play()),j(i,"display","none"),j(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{j(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Be(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,F(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,N(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return H(o,"art-fast-forward")}}}function We(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return H(o,"art-lock")}function a(){N(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){F(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=B(e,r.lock),n=B(e,r.unlock);j(o,"display","none"),t.on("lock",t=>{t?(j(o,"display","inline-flex"),j(n,"display","none")):(j(o,"display","none"),j(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function je(t){return t.on("control",e=>{e?F(t.template.$player,"art-mini-progress-bar"):N(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class qe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(je),!E(t.art)&&e.lock&&R&&t.add(We),E(t.art)||!e.autoPlayback||e.isLive||t.add(He),!E(t.art)&&e.autoOrientation&&R&&t.add(Fe),!E(t.art)&&e.fastForward&&R&&!e.isLive&&t.add(Be)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){st(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let n=o;const a=wt(t,n);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return E(t.art)||(st(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),E(t.art)||yt(t,n,{value:r})),t}(this,t,e)}}class Ue extends Nt{constructor(t){super(t);const{option:e,controls:r,template:{$setting:o}}=t;this.name="setting",this.$parent=o,this.id=0,this.active=null,this.cache=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=Z(t,r.setting),o=Z(t,this.$parent);!this.show||e||o||(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:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(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:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(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:o,FLIP:n}}=t;function a(t){return e.get(ut(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(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:o}=t;return{width:o.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){var r;for(let o=0;o{e.default=e===t,e.default&&e.$item&&X(e.$item,"art-current")},t.$option),this.render(t.$parents))}format(t=this.option,e,r,o=[]){for(let n=0;ne}),yt(a,"$parents",{get:()=>r}),yt(a,"$option",{get:()=>t});const o=[];yt(a,"$events",{get:()=>o}),yt(a,"$formatted",{get:()=>!0})}this.format(a.selector||[],a,t,o)}this.option=t}find(t=""){let e=null;return this.traverse(r=>{r.name===t&&(e=r)}),e}resize(){var t,e;const{controls:r,constructor:{SETTING_WIDTH:o,SETTING_ITEM_HEIGHT:n},template:{$player:a,$setting:i}}=this.art;if(r.setting&&this.show){const s=(null==(e=null==(t=this.active[0])?void 0:t.$parent)?void 0:e.width)||o,{left:l,width:c}=rt(r.setting),{left:d,width:p}=rt(a),u=l-d+c/2-s/2;if(j(i,"height",`${this.active===this.option?this.active.length*n:(this.active.length+1)*n}px`),j(i,"width",`${s}px`),this.art.isRotate||R)return;u+s>p?(j(i,"left",null),j(i,"right",null)):(j(i,"left",`${u}px`),j(i,"right","auto"))}}inactivate(t){for(let e=0;e'),s=Q("div");N(s,"art-setting-item-left-icon"),B(s,o),B(i,s),B(i,t.$parent.html);const l=r(a,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),B(e,a)}createItem(t,e=!1){var r,o;if(!this.cache.has(t.$option))return;const n=this.cache.get(t.$option),a=t.$item;let i="selector";wt(t,"switch")&&(i="switch"),wt(t,"range")&&(i="range"),wt(t,"onClick")&&(i="button");const{icons:s,proxy:l,constructor:c}=this.art,p=Q("div");N(p,"art-setting-item"),j(p,"height",`${c.SETTING_ITEM_HEIGHT}px`),p.dataset.name=t.name||"",p.dataset.value=t.value||"";const u=B(p,'
'),h=B(p,'
'),f=Q("div");switch(N(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":B(f,t.icon||s.config);break;case"selector":(null==(r=t.selector)?void 0:r.length)?B(f,t.icon||s.config):B(f,s.check)}B(u,f),yt(t,"$icon",{configurable:!0,get:()=>f}),yt(t,"icon",{configurable:!0,get:()=>f.innerHTML,set(t){f.innerHTML="",B(f,t)}});const m=Q("div");N(m,"art-setting-item-left-text"),B(m,t.html||""),B(u,m),yt(t,"$html",{configurable:!0,get:()=>m}),yt(t,"html",{configurable:!0,get:()=>m.innerHTML,set(t){m.innerHTML="",B(m,t)}});const g=Q("div");switch(N(g,"art-setting-item-right-tooltip"),B(g,t.tooltip||""),B(h,g),yt(t,"$tooltip",{configurable:!0,get:()=>g}),yt(t,"tooltip",{configurable:!0,get:()=>g.innerHTML,set(t){g.innerHTML="",B(g,t)}}),i){case"switch":{const e=Q("div");N(e,"art-setting-item-right-icon");const r=B(e,s.switchOn),o=B(e,s.switchOff);j(t.switch?o:r,"display","none"),B(h,e),yt(t,"$switch",{configurable:!0,get:()=>e});let n=t.switch;yt(t,"switch",{configurable:!0,get:()=>n,set(t){n=t,t?(j(o,"display","none"),j(r,"display",null)):(j(o,"display",null),j(r,"display","none"))}});break}case"range":{const e=Q("div");N(e,"art-setting-item-right-icon");const r=B(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],N(r,"art-setting-range"),B(h,e),yt(t,"$range",{configurable:!0,get:()=>r});let o=[...t.range];yt(t,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=t[0],r.min=t[1],r.max=t[2],r.step=t[3]}})}break;case"selector":if(null==(o=t.selector)?void 0:o.length){const t=Q("div");N(t,"art-setting-item-right-icon"),B(t,s.arrowRight),B(h,t)}}switch(i){case"switch":if(t.onSwitch){const e=l(p,"click",e=>d(this,null,function*(){t.switch=yield t.onSwitch.call(this.art,t,p,e)}));t.$events.push(e)}break;case"range":if(t.$range){if(t.onRange){const e=l(t.$range,"change",e=>d(this,null,function*(){t.range[0]=t.$range.valueAsNumber,t.tooltip=yield t.onRange.call(this.art,t,p,e)}));t.$events.push(e)}if(t.onChange){const e=l(t.$range,"input",e=>d(this,null,function*(){t.range[0]=t.$range.valueAsNumber,t.tooltip=yield t.onChange.call(this.art,t,p,e)}));t.$events.push(e)}}break;case"selector":{const e=l(p,"click",e=>d(this,null,function*(){var r;(null==(r=t.selector)?void 0:r.length)?this.render(t.selector):(this.check(t),t.$parent.onSelect&&(t.$parent.tooltip=yield t.$parent.onSelect.call(this.art,t,p,e)))}));t.$events.push(e),t.default&&N(p,"art-current")}break;case"button":if(t.onClick){const e=l(p,"click",e=>d(this,null,function*(){t.tooltip=yield t.onClick.call(this.art,t,p,e)}));t.$events.push(e)}}yt(t,"$item",{configurable:!0,get:()=>p}),e?J(p,a):B(n,p),t.mounted&&Ht($(this.art),()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){var e;if(this.active=t,this.cache.has(t)){X(this.cache.get(t),"art-current")}else{const r=Q("div");this.cache.set(t,r),N(r,"art-setting-panel"),B(this.$parent,r),X(r,"art-current"),(null==(e=t[0])?void 0:e.$parent)&&this.createHeader(t[0]);for(let e=0;enull,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(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[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?q(r,t):j(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?vt(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a=c(l(l({},n.subtitle),e),{url:t}),i=yield this.init(a);return e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),i})}createTrack(t,e){const{template:r,proxy:o,option:n}=this.art,{$video:a,$track:i}=r,s=Q("track");s.default=!0,s.kind=t,s.src=e,s.label=n.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,W(i),B(a,s),r.$track=s,this.destroyEvent=o(this.textTrack,"cuechange",()=>this.update())}init(t){return d(this,null,function*(){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(m(t,Yt.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||ct(t.url)){case"srt":{const e=$t(r);return Et(t.onVttLoad(e))}case"ass":{const e=Tt(r);return Et(t.onVttLoad(e))}case"vtt":return Et(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})}}const Ze=`\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
${g}
\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 `;class Je{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=Y(e.container),st(this.$container,`No container element found by ${e.container}`)),st(et(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();st("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),st(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=x.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=k(t);n.rollback=r,x.set(e,t),n.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,function(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Ze}query(t){return Y(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Je.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){st(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),J(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&N(this.$player,"art-backdrop"),R&&N(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":N(this.$player,"art-destroy")}}const Qe=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class tr{on(t,e,r){const o=this.e||(this.e={});let n=Qe(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Qe(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Qe(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),or.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${or.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&rr.push(this)}catch(o){try{T(this,rr,!0,or.REMOVE_SRC_WHEN_DESTROY,!0)}catch(n){console.warn("Failed to clean up ArtPlayer initialization:",n)}throw o}}static get instances(){return rr}static get version(){return g}static get config(){return v}static get utils(){return zt}static get scheme(){return Yt}static get Emitter(){return tr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return Je.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:P?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,rr,t,or.REMOVE_SRC_WHEN_DESTROY)}}return or.STYLE=Ge,or.DEBUG=!1,or.CONTEXTMENU=!0,or.NOTICE_TIME=2e3,or.SETTING_WIDTH=250,or.SETTING_ITEM_WIDTH=200,or.SETTING_ITEM_HEIGHT=35,or.RESIZE_TIME=200,or.SCROLL_TIME=200,or.SCROLL_GAP=50,or.AUTO_PLAYBACK_MAX=10,or.AUTO_PLAYBACK_MIN=5,or.AUTO_PLAYBACK_TIMEOUT=3e3,or.RECONNECT_TIME_MAX=5,or.RECONNECT_SLEEP_TIME=1e3,or.CONTROL_HIDE_TIME=3e3,or.DBCLICK_TIME=300,or.DBCLICK_FULLSCREEN=!0,or.MOBILE_DBCLICK_PLAY=!0,or.MOBILE_CLICK_PLAY=!1,or.AUTO_ORIENTATION_TIME=200,or.INFO_LOOP_TIME=1e3,or.FAST_FORWARD_VALUE=3,or.FAST_FORWARD_TIME=1e3,or.TOUCH_MOVE_RATIO=.5,or.VOLUME_STEP=.1,or.SEEK_STEP=5,or.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],or.ASPECT_RATIO=["default","4:3","16:9"],or.FLIP=["normal","horizontal","vertical"],or.FULLSCREEN_WEB_IN_BODY=!0,or.LOG_VERSION=!0,or.USE_RAF=!1,or.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=or,V("artplayer-style",Ge),setTimeout(()=>{or.LOG_VERSION&&console.log(`%c ArtPlayer %c ${or.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),or}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var a=t=>{try{s(r.next(t))}catch(e){o(e)}},i=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,o||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function S(t,e){const r=$(t).child();return C.set(e,r),r}function z(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function M(t){var e;null==(e=C.get(t))||e.dispose()}function P(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=z(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=z(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const L=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(L),O=/iPad|iPhone|iPod/i.test(L)&&!window.MSStream,R=O||L.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(L)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 N(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function Y(t,e){return t.classList.add(e)}function W(t,e){return t.classList.remove(e)}function F(t,e){return t.classList.contains(e)}function j(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function B(t){return t.parentNode.removeChild(t)}function H(t,e,r){return t.style[e]=r,t}function q(t,e){for(const r in e)H(t,r,e[r]);return t}function U(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function X(t,e){U(t).forEach(t=>W(t,e)),Y(t,e)}function G(t,e,r="top"){I||(t.setAttribute("aria-label",e),Y(t,"hint--rounded"),Y(t,`hint--${r}`))}function K(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function Z(t,e){return ot(t).includes(e)}function J(t,e){return e.parentNode.replaceChild(t,e),t}function Q(t){return document.createElement(t)}function tt(t="",e=""){const r=Q("i");return Y(r,"art-icon"),Y(r,`art-icon-${t}`),j(r,e),r}function et(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function rt(t){return t.getBoundingClientRect()}function nt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function ot(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}function at(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function st(t,e){if(!t)throw new it(e);return t}function lt(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function ct(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function dt(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function pt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ht(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ft={"&":"&","<":"<",">":">","'":"'",'"':"""},mt={"&":"&","<":"<",">":">","'":"'",""":'"'},gt=/(&|<|>|'|")/g;function vt(t){return t.replace(/[&<>'"]/g,t=>ft[t]||t)}const yt=Object.defineProperty,{hasOwnProperty:bt}=Object.prototype;function wt(t,e){return bt.call(t,e)}function xt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function kt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?kt(o,a):a,yt(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function $t(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 Et(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Tt(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Ct(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const St=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:Y,append:j,assToVtt:Tt,capitalize:ut,clamp:pt,createElement:Q,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:yt,download:dt,errorHandle:st,escape:vt,get:xt,getComposedPath:ot,getExt:ct,getIcon:tt,getRect:rt,getSafeAreaInsets:at,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:wt,hasClass:F,includeFromEvent:Z,inverseClass:X,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:K,isMobile:I,isSafari:A,loadImg:nt,mergeDeep:kt,query:N,queryAll:D,remove:B,removeClass:W,replaceElement:J,secondToTime:ht,setStyle:H,setStyleText:V,setStyles:q,siblings:U,silencePromise:lt,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:$t,supportsFlex:et,throttle:Ct,tooltip:G,unescape:function(t){return t.replace(gt,t=>mt[t]||t)},userAgent:L,vttToBlob:Et},Symbol.toStringTag,{value:"Module"}));function zt(t,e){return j(t,e)}function Mt(t,e){return e.querySelector(t)}const Pt="array",Lt="boolean",At="string",Ot="number",Rt="object",It="function";function _t(t,e,r){return st(e===At||e===Ot||t instanceof Element,`${r.join(".")} require '${At}' or 'Element' type`)}const Vt={html:_t,disable:`?${Lt}`,name:`?${At}`,index:`?${Ot}`,style:`?${Rt}`,click:`?${It}`,mounted:`?${It}`,tooltip:`?${At}|${Ot}`,width:`?${Ot}`,selector:`?${Pt}`,onSelect:`?${It}`,switch:`?${Lt}`,onSwitch:`?${It}`,range:`?${Pt}`,onRange:`?${It}`,onChange:`?${It}`},Nt={id:At,container:_t,url:At,poster:At,type:At,theme:At,lang:At,volume:Ot,isLive:Lt,muted:Lt,autoplay:Lt,autoSize:Lt,autoMini:Lt,loop:Lt,flip:Lt,playbackRate:Lt,aspectRatio:Lt,screenshot:Lt,setting:Lt,hotkey:Lt,pip:Lt,mutex:Lt,backdrop:Lt,fullscreen:Lt,fullscreenWeb:Lt,subtitleOffset:Lt,miniProgressBar:Lt,useSSR:Lt,playsInline:Lt,lock:Lt,gesture:Lt,fastForward:Lt,autoPlayback:Lt,autoOrientation:Lt,airplay:Lt,proxy:`?${It}`,plugins:[It],layers:[Vt],contextmenu:[Vt],settings:[Vt],controls:[c(l({},Vt),{position:(t,e,r)=>{const n=["top","left","right"];return st("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Lt}`,html:At,url:At}],highlight:[{time:Ot,text:At}],thumbnails:{url:At,number:Ot,column:Ot,width:Ot,height:Ot,scale:Ot},subtitle:{url:At,name:At,type:At,style:Rt,escape:Lt,encoding:At,onVttLoad:It},moreVideoAttr:Rt,i18n:Rt,icons:Rt,cssVar:Rt,customType:Rt},Dt=new WeakSet;class Yt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return F(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?Y(e,r):W(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,Vt),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;st(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=S(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){Y(t,`art-${r}`),Y(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):j(e,t),a.html&&j(t,a.html),a.style&&q(t,a.style),a.tooltip&&G(t,a.tooltip)}(a,this.$parent,this.name,n,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,a),c=!0,o.set(n,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{M(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=o.get(n))?void 0:e.$ref)===a&&o.delete(n),c&&this[n]===a&&(l?Object.defineProperty(this,n,l):delete this[n]),a.remove(),d}}remove(t){st(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{M(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Wt extends Yt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,S(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=P(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="1"]',t);n&&X(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&X(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="default"]',t);n&&X(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=P(e,t),n=N('[data-value="normal"]',t);n&&X(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&X(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=rt(e),{height:c,width:d}=rt(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),q(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{Z(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Ft(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function jt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function Bt(t,e){const{$progress:r}=t.template,{left:n}=rt(r),o=pt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:ht(a),width:o,percentage:pt(o/r.clientWidth,0,1)}}function Ht(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Bt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function qt(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=z(e),{on:i}=P(t,e);let s=()=>{};const l=Mt(".art-progress-hover",e),c=Mt(".art-progress-loaded",e),d=Mt(".art-progress-played",e),p=Mt(".art-progress-highlight",e),u=Mt(".art-progress-indicator",e),h=Mt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||Bt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?H(h,"left",0):o>e.clientWidth-i/2?H(h,"left",e.clientWidth-i+"px"):H(h,"left",o-i/2+"px")}r.indicator?j(u,r.indicator):H(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&I;if("loaded"===r&&H(c,"width",100*n+"%"),"hover"===r&&(H(l,"width",100*n+"%"),Z(i,p)?function(r){const{width:n}=Bt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const a=h.clientWidth;n<=a/2?H(h,"left",0):n>e.clientWidth-a/2?H(h,"left",e.clientWidth-a+"px"):H(h,"left",n-a/2+"px")}(i):f(i),0===n?W(o,"art-progress-hover"):Y(o,"art-progress-hover")),"played"===r&&(H(d,"width",100*n+"%"),H(u,"left",100*n+"%")),m){Y(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:ht(n*t.duration)}),s(),s=Ft(a,()=>{W(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=P(t,e);if(!I){let e=!1;a(r,"click",e=>{e.target!==n&&Ht(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Bt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Bt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.play),s=zt(t,o.pause);function l(){H(i,"display","flex"),H(s,"display","none")}function c(){H(i,"display","none"),H(s,"display","flex")}G(i,a.get("Play")),G(s,a.get("Pause")),n(i,"click",()=>{lt(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o}=e,a=zt(t,o.volume),i=zt(t,o.volumeClose),s=zt(t,'
'),l=zt(s,'
'),c=zt(l,'
'),d=zt(l,'
'),p=zt(d,'
'),u=zt(p,'
'),h=zt(d,'
');function f(t){const{top:e,height:r}=rt(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)H(a,"display","none"),H(i,"display","flex"),H(h,"top","100%"),H(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;H(a,"display","flex"),H(i,"display","none"),H(h,"top",100-t+"%"),H(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),I)H(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=P(e,t);function n(){const r=`${ht(e.currentTime)} / ${ht(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=P(e,t),{icons:n}=e;zt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e;zt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{G(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e;zt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{G(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=P(e,t),{icons:n}=e;zt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.fullscreenWebOn),s=zt(t,o.fullscreenWebOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(G(t,a.get("Exit Web Fullscreen")),H(i,"display","none"),H(s,"display","inline-flex")):(G(t,a.get("Web Fullscreen")),H(i,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=P(e,t),{icons:o,i18n:a}=e,i=zt(t,o.fullscreenOn),s=zt(t,o.fullscreenOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(G(t,a.get("Exit Fullscreen")),H(i,"display","none"),H(s,"display","inline-flex")):(G(t,a.get("Fullscreen")),H(i,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),yt(t,"$control_item",{get:()=>Kt.get(t).item}),yt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,n,o){const{proxy:a}=t.events,i=z(n),s=r.selector;Y(n,"art-control-selector");const l=document.createElement("div");Y(l,"art-selector-value"),j(l,r.html),n.textContent="",j(n,l);const c=zt(n,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const o=ot(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,n);c()&&Jt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));o.push(u)}class te extends Yt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;S(t,n);const{on:o}=P(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=Z(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(W(r,"art-hide-cursor"),Y(r,"art-hover"),this.timer=Date.now()):(Y(r,"art-hide-cursor"),W(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=z(e),{on:a}=P(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:st(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const ne=new WeakMap;class oe{constructor(t){this.destroyEvents=new Set;const e=$(t);ne.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){Z(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&<(t.toggle()):lt(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),I?!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=>{Y(r,"art-hover"),t.emit("hover",!0,e)},e=>{W(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let a=()=>{};const i=()=>{a(),a=Ft(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Ht(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=ee(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=pt((n-i)/t.width,-1,1),d=pt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=pt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",pt(h/t.duration,0,1),e),t.notice.show=`${ht(h)} / ${ht(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Ct(()=>{t.emit("view",K(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=a.window||(null==(n=i.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}a(),e.bindGlobalEvents=a}(t,this),re(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(ne.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 ae{constructor(t){this.art=t,this.keys={},I||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",()=>{lt(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)yt(this,r,{get:()=>tt(r,e[r])})}}class de extends Yt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{H(o,"display","none"),H(a,"display",null)}),n.proxy(e.$state,"click",()=>lt(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,Y(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",W(r,"art-notice-show")},e.NOTICE_TIME)):W(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function me(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function ge(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const ve=new WeakMap,ye=new WeakMap,be=new WeakMap;function we(t){return be.get(t)||$(t)}function xe(t){const e=ve.get(t),r=be.get(t);return()=>ve.get(t)===e&&(!e||e.active())&&be.get(t)===r&&(!r||!r.closed)}function ke(t){const e=be.get(t),r=$(t).child(),n=r.child();be.set(t,r),r.add(()=>{be.get(t)===r&&be.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&ve.get(t)===o};return ve.set(t,o),n.add(()=>{ve.get(t)===o&&ve.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function $e(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Ee(t,e,r){ye.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ye.get(t)===e&&(ye.delete(t),$e(e))}}function Te(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Ce(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=we(t),l=0;return{reset(){l=0,null==i||i.dispose(),W(a,"art-error")},loadStart(){W(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=we(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===we(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Se(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Ce(t);!function(t,e){me(t,"video:canplay",()=>{e.reset(),ge(t,[["loading",!1]])}),me(t,"video:canplay",()=>{ge(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;me(t,"video:ended",()=>{if(e.loop){const e=xe(t);if(t.seek=0,E(t)||!e())return;lt(t.play()),e()&&ge(t,[["controls",!1],["mask",!1]],e)}else ge(t,[["controls",!0],["mask",!0]])})}(t),me(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;me(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&ge(t,[["loading",!1],["controls",!0],["mask",!0]])}),me(t,"video:loadstart",()=>{e.loadStart(),ge(t,[["loading",!0],["mask",!1],["controls",!0]])}),me(t,"video:pause",()=>{ge(t,[["controls",!0],["mask",!0]])}),me(t,"video:play",()=>{ge(t,[["mask",!1]]),E(t)||H(r,"display","none")}),me(t,"video:playing",()=>ge(t,[["mask",!1]])),me(t,"video:progress",()=>{t.playing&&ge(t,[["loading",!1]])}),me(t,"video:seeked",()=>ge(t,[["loading",!1],["mask",!0]])),me(t,"video:seeking",()=>ge(t,[["loading",!0],["mask",!1]])),me(t,"video:timeupdate",()=>ge(t,[["mask",!1]])),me(t,"video:waiting",()=>ge(t,[["loading",!0],["mask",!1]]))}(t,e)}const ze=[["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"]],Me=(()=>{if("undefined"===typeof document)return!1;const t=ze[0],e={};for(const r of ze){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Pe={change:Me.fullscreenchange,error:Me.fullscreenerror},Le={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Le.off("change",o),r()};Le.on("change",o);const a=t[Me.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Le.isFullscreen)return void t();const r=()=>{Le.off("change",r),t()};Le.on("change",r);const n=document[Me.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Le.isFullscreen?Le.exit():Le.request(t,e),onchange(t){Le.on("change",t)},onerror(t){Le.on("error",t)},on(t,e){const r=Pe[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Pe[t];r&&document.removeEventListener(r,e,!1)},raw:Me};function Ae(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=t=>{Le.on("change",()=>{t.emit("fullscreen",Le.isFullscreen),Le.isFullscreen?(t.state="fullscreen",Y(o,"art-fullscreen")):W(o,"art-fullscreen"),t.emit("resize")}),Le.on("error",e=>{t.emit("fullscreenError",e)}),yt(t,"fullscreen",{get:()=>Le.isFullscreen,set(t){return d(this,null,function*(){t?yield Le.request(o):yield Le.exit()})}})};t.once("video:loadedmetadata",()=>{var o;Le.isEnabled?a(t):n.webkitSupportsFullscreen?((o=t).on("document:webkitfullscreenchange",()=>{o.emit("fullscreen",o.fullscreen),o.emit("resize")}),yt(o,"fullscreen",{get:()=>document.fullscreenElement===n,set(t){t?(o.state="fullscreen",n.webkitEnterFullscreen()):n.webkitExitFullscreen()}})):yt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),yt(t,"fullscreen",xt(t,"fullscreen"))})}function Oe(t){const{icons:e,proxy:r,storage:n,template:{$player:o,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(W(o,"art-mini"),H(e,"display","none"),o.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(H(e,"display","none"),H(r,"display","flex")):(H(e,"display","flex"),H(r,"display","none"))}function p(){const{$mini:e}=t.template,r=rt(e),o=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;n.set("top",o),n.set("left",a),H(e,"top",`${o}px`),H(e,"left",`${a}px`)}yt(t,"mini",{get:()=>F(o,"art-mini"),set(u){if(u){t.state="mini",Y(o,"art-mini");const u=function(){const{$mini:o}=t.template;if(o)return j(o,a),H(o,"display","flex");{const o=Q("div");Y(o,"art-mini-popup"),j(document.body,o),t.template.$mini=o,j(o,a);const p=j(o,'
');j(p,e.close),r(p,"click",c);const u=j(o,'
'),h=j(u,e.play),f=j(u,e.pause);return r(h,"click",()=>lt(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){Y(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;H(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,W(o,"art-mini-dragging");const t=rt(o);n.set("left",t.left),n.set("top",t.top),H(o,"left",`${t.left}px`),H(o,"top",`${t.top}px`),H(o,"transform",null)}}),o}}(),h=n.get("top"),f=n.get("left");"number"===typeof h&&"number"===typeof f?(H(u,"top",`${h}px`),H(u,"left",`${f}px`),K(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Re(t){const{i18n:e,notice:r,template:{$video:n}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:n}=t;e.disablePictureInPicture=!1,yt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw n.show=t,t})):document.exitPictureInPicture().catch(t=>{throw n.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):n.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),yt(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):yt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Ie(t){yt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=a)}return e.html})}})}})}function _e(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Ve(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const a=ke(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)_e(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if(Ee(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=_e(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ne(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===o||"played"===o&&l&&I){if(i||a||(a=!0,i=yield nt(p,u),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?H(s,"left",r.clientWidth-h+"px"):H(s,"left",o-h/2+"px")}(o)}})),yt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function De(t){const{option:e,template:{$video:r}}=t;yt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=ye.get(t);return ye.delete(t),e||ke(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield jt(o.scope))&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||ct(n),s=e.customType[i];if(i&&s){if(!(yield jt(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;_e(l,t,"video:canplay",()=>{c=!d}),_e(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Te(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||_e(o.scope,t,"video:canplay",e)}}catch(a){Te(o,a)}finally{$e(o)}})}})}Object.defineProperties(Le,{isFullscreen:{get:()=>Boolean(document[Me.fullscreenElement])},element:{enumerable:!0,get:()=>document[Me.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Me.fullscreenEnabled])}});class Ye{constructor(t){De(t),function(t){const{template:{$video:e}}=t;yt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;yt(t,"play",{value(){return d(this,null,function*(){const i=xe(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;yt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ht(t.currentTime)} / ${ht(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;yt(t,"forward",{set(e){r.seek=t.currentTime+e}}),yt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;yt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=pt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),yt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;yt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=pt(n,0,t.duration))}})}(t),function(t){yt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Ve(t,e,0);yt(t,"switchQuality",{value:e=>Ve(t,e,t.currentTime)}),yt(t,"switchUrl",{value:e}),yt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;yt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;yt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)H(n,"width",null),H(n,"height",null),H(n,"margin",null),delete o.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(H(n,"width",s*r+"px"),H(n,"height","100%"),H(n,"margin","0 auto")):(H(n,"width","100%"),H(n,"height",e/s+"px"),H(n,"margin","auto 0")),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=Q("canvas");yt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),yt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),yt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return dt(n,`${e||`artplayer_${ht(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Ae(t),function(t){const{constructor:e,template:{$container:r,$player:n}}=t;let o="";yt(t,"fullscreenWeb",{get:()=>F(n,"art-fullscreen-web"),set(a){a?(o=n.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&j(document.body,n),t.state="fullscreenWeb",H(n,"width","100%"),H(n,"height","100%"),Y(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&j(r,n),o&&(n.style.cssText=o,o=""),W(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Re(t),function(t){const{$video:e}=t.template,r=t;yt(t,"loaded",{get:()=>r.loadedTime/e.duration}),yt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){yt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;yt(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:n}=t.template;yt(t,"autoSize",{value(){const{videoWidth:o,videoHeight:a}=n,{width:i,height:s}=rt(e),l=o/a;if(i/s>l)H(r,"width",s*l/i*100+"%"),H(r,"height","100%");else{const t=i/l/s*100;H(r,"width","100%"),H(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;yt(t,"rect",{get:()=>rt(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}yt(t,"x",{get:()=>e.left+window.pageXOffset}),yt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;yt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(ut(o))}`,t.emit("flip",o)}})}(t),Oe(t),function(t){const{template:{$poster:e}}=t;yt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){H(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;yt(t,"autoHeight",{value(){const{clientWidth:n}=e,{videoHeight:o,videoWidth:a}=r,i=o*(n/a);H(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;yt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){yt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){yt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];yt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,yt(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ie(t),Ne(t),Se(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=pt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=pt(a,0,1)),e.poster&&H(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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 We(t){const{notice:e,constructor:r,template:{$player:n,$video:o}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,n=document.documentElement.clientHeight;return t>e&&rn}return t.on("fullscreenWeb",e=>{var o;if(e){if(l()){const e=Number(null!=(o=r.AUTO_ORIENTATION_TIME)?o:0);setTimeout(()=>{t.fullscreenWeb&&!F(n,a)&&function(){const e=at(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;H(n,"width",`${o}px`),H(n,"height",`${i}px`),H(n,"transform-origin","0 0"),H(n,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),Y(n,a),t.isRotate=!0,t.emit("resize")}()},e)}}else F(n,a)&&(H(n,"width",""),H(n,"height",""),H(n,"transform-origin",""),H(n,"transform",""),W(n,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const o=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(o&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,Y(n,i)}catch(a){s=!1,e.show=a}}else if(F(n,i)&&W(n,i),o&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return F(n,a)}}}function Fe(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=N(".art-auto-playback-last",s),c=N(".art-auto-playback-jump",s),d=N(".art-auto-playback-close",s);j(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),H(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(H(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ht(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{H(s,"display","none")}),a(c,"click",()=>{t.seek=r,lt(t.play()),H(i,"display","none"),H(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{H(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function je(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,W(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,Y(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return F(n,"art-fast-forward")}}}function Be(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return F(n,"art-lock")}function a(){Y(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){W(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=j(e,r.lock),o=j(e,r.unlock);H(n,"display","none"),t.on("lock",t=>{t?(H(n,"display","inline-flex"),H(o,"display","none")):(H(n,"display","none"),H(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function He(t){return t.on("control",e=>{e?W(t.template.$player,"art-mini-progress-bar"):Y(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class qe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(He),!E(t.art)&&e.lock&&I&&t.add(Be),E(t.art)||!e.autoPlayback||e.isLive||t.add(Fe),!E(t.art)&&e.autoOrientation&&I&&t.add(We),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(je)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){st(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const a=wt(t,o);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(st(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||yt(t,o,{value:r})),t}(this,t,e)}}const Ue=new WeakMap;function Xe(t){return!t.closed&&!Ue.get(t)}function Ge(t){Ue.set(t,(Ue.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Ue.get(t)||1)-1;r?Ue.set(t,r):Ue.delete(t)}}const Ke=new WeakMap,Ze=new WeakMap,Je=["$parent","$parents","$option","$events","$formatted"];function Qe(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Ke.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Ke.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function tr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function er(t){const e=Ke.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function rr(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>cr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...a.splice(0)),lr.set(r,o),ir.set(e,r),sr.set(e,n)),i(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{i()}}}}}function fr(t,e,r,n,o,a){const i=a||pr(e);if(!Xe(i)||E(t))return;const s=t.proxy(r,n,e=>{if(Xe(i)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Xe(i)||E(t)?t.events.remove(s):(er(e).events.push(s),a&&a!==ir.get(e)&&a.add(()=>{const r=er(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function mr(t,e,r,n){const o=pr(e);if(!Xe(o)||E(t))return;const a=(...e)=>{if(Xe(o)&&!E(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function gr(t){var e,r;const{art:n,active:o}=t,{controls:a,constructor:{SETTING_WIDTH:i,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!a.setting||!t.show||!o)return;const p=l.getBoundingClientRect(),u=a.setting.getBoundingClientRect(),h=p.width/l.offsetWidth||1,f=(u.left-p.left+u.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||i,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const vr=new WeakMap;function yr(t){vr.delete(t)}const br=new WeakMap;function wr(t,e){e?br.set(t,e):br.delete(t)}function xr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=br.get(t),a=null==o?void 0:o();for(const i of["html","icon","tooltip"]){const t=null==(e=r.get(i))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,i;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==a||a(),wr(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(i=t.parentNode)||i.removeChild(t)}}const kr=new WeakMap;function $r(t,e,r,n,o,a,i,s){return d(this,null,function*(){try{const l=pr(e),c=pr(a),d=(kr.get(a)||0)+1;kr.set(a,d);const p=()=>Xe(l)&&Xe(c)&&!E(t.art)&&kr.get(a)===d;if(null==s||s(),!p())return;const u=yield o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function Er(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const Tr=new WeakMap;function Cr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function Sr(t){var e;null==(e=Tr.get(t))||e()}function zr(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);yr(r),Sr(r);const n=xr(r),o=r.$item,a=null==o?void 0:o.parentNode,i=null==o?void 0:o.nextSibling,s=o?Er(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=hr(t.art,e);r&&a.push(r)}for(const t of n)i.push(Ge(or(t)))}catch(l){try{Cr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,Cr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,Cr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>ar(t)),...i]))}}}(t,r);let p=!0,u=!1;const h=()=>{if(!p)return;p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{Cr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{a&&o&&a.insertBefore(o,(null==i?void 0:i.parentNode)===a?i:null)},()=>t.format(),()=>{if(u){t.active=l,l&&t.cache.has(l)&&X(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>p&&!E(t.art)&&Tr.get(r)===h;for(const v of d.items)Tr.set(v,h);const m=$(t.art).add(()=>{p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(u=!0,t.render(),!f())return r;p=!1;for(const t of d.items)Tr.get(t)===h&&Tr.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const Mr=new WeakMap;function Pr(t,e,r){yt(t,`$${e}`,{configurable:!0,get:()=>r}),yt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",j(r,t)}})}function Lr(t,e,r=!1){var n,o;const a=function(t){const e=Tr.get(t);return()=>!e||Tr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const i=t.cache.get(e.$option),s=e.$item;let l="selector";wt(e,"switch")&&(l="switch"),wt(e,"range")&&(l="range"),wt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!a())return;const p=function(t,e,r=$(t)){const n=ir.get(e);(!n||Xe(n)||n.closed)&&ur(t,e);const o=r.child();return ir.set(e,o),sr.set(e,r),lr.set(o,er(e).events),o.add(()=>{cr(t,lr.get(o))}),o}(t.art,e,or(i)),u=()=>Xe(p)&&!E(t.art)&&a();if(!u())return;const h=document.createElement("div");try{if(wr(e),Y(h,"art-setting-item"),H(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!u())return;const a=j(h,'
'),f=j(h,'
'),m=document.createElement("div");switch(Y(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!u())return;j(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!u())return;j(m,t)}else j(m,c.check)}if(j(a,m),!u())return;Pr(e,"icon",m);const g=document.createElement("div");Y(g,"art-setting-item-left-text");const v=e.html||"";if(!u())return;j(g,v),j(a,g),Pr(e,"html",g);const y=document.createElement("div");Y(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!u())return;switch(j(y,b),j(f,y),Pr(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");Y(t,"art-setting-item-right-icon");const r=j(t,c.switchOn),n=j(t,c.switchOff),o=e.switch;if(!u())return;H(o?n:r,"display","none"),j(f,t),yt(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!u())return;wr(e,()=>{const t=a;return()=>{a=t}}),yt(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(H(n,"display","none"),H(r,"display",null)):(H(n,"display",null),H(r,"display","none"))}});break}case"range":{const t=document.createElement("div");Y(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",j(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!u())return;Reflect.set(r,a,String(t))}Y(r,"art-setting-range"),j(f,t),yt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!u())return;wr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),yt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");Y(t,"art-setting-item-right-icon"),j(t,c.arrowRight),j(f,t)}}if(!u())return;if(function(t,e,r,n){const{art:o}=t,a=pr(e),i=(t,r,n)=>fr(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>$r(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>$r(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{var o,a;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(a=e.$parent)?void 0:a.onSelect)return $r(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&Y(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>$r(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!u())return;yt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):j(i,h),e.mounted&&u()&&Ft(p,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{p.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function Ar(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Xe(or(n)))return;const o=(Mr.get(t)||0)+1;Mr.set(t,o);const a=()=>Mr.get(t)===o&&!E(t.art),i=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=i,i&&t.cache.has(i)&&X(t.cache.get(i),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{X(n,"art-current"),t.resize()}catch(c){throw a()&&t.cache.get(e)===n&&!or(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return nr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),i=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!i())return;Y(n,"art-setting-panel"),j(t.$parent,n),X(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ze.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=Z(r,e.controls.setting),o=Z(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(ut(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),mr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{mr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){rr(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&X(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=Ze.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;oer(t).parent},$parents:{get:()=>er(t).parents},$option:{get:()=>er(t).option},$events:{get:()=>er(t).events},$formatted:{get:()=>!0}}),Ke.set(t,{parent:r,parents:n,option:o,events:(null==i?void 0:i.events)||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return rr(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){gr(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&ar(n)}catch(a){r.push(a)}}try{ur(t.art,e)}catch(a){a instanceof y?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);st(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{yr(t),Sr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{i()}catch(a){a instanceof y?o.push(...a.errors):o.push(a)}if(o.length)throw new y(o)}update(t){return zr(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,a=n?void 0:function(t){const e={};vr.set(t,e);const r=()=>vr.get(t)===e;return{current:r,finish(){r()&&vr.delete(t)}}}(t);let i=!1;try{e.push(t),this.format(),i=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||a&&!a.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&i){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==a||a.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");H(a,"height",`${o}px`),Y(a,"art-setting-item"),Y(a,"art-setting-item-back");const i=j(a,'
'),s=document.createElement("div");Y(s,"art-setting-item-left-icon"),j(s,n),j(i,s),j(i,e.$parent.html),fr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),or(r)),j(r,a)}(this,t)}createItem(t,e=!1){Lr(this,t,e)}render(t=this.option){Ar(this,t)}}class Ir{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const _r='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Vr extends Yt{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null,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(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[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?q(r,t):H(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?vt(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a=c(l(l({},o.subtitle),e),{url:t}),i=yield this.init(a);return e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),i})}createTrack(t,e){const{template:r,proxy:n,option:o}=this.art,{$video:a,$track:i}=r,s=Q("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,B(i),j(a,s),r.$track=s,this.destroyEvent=n(this.textTrack,"cuechange",()=>this.update())}init(t){return d(this,null,function*(){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(m(t,Nt.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||ct(t.url)){case"srt":{const e=$t(r);return Et(t.onVttLoad(e))}case"ass":{const e=Tt(r);return Et(t.onVttLoad(e))}case"vtt":return Et(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})}}const Nr=`\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
${g}
\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 `;class Dr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=N(e.container),st(this.$container,`No container element found by ${e.container}`)),st(et(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();st("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),st(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,Er(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Nr}query(t){return N(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Dr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){st(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),J(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&Y(this.$player,"art-backdrop"),I&&Y(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":Y(this.$player,"art-destroy")}}const Yr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Wr{on(t,e,r){const n=this.e||(this.e={});let o=Yr(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(Yr(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=Yr(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),Br.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Br.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&jr.push(this)}catch(n){try{T(this,jr,!0,Br.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return jr}static get version(){return g}static get config(){return v}static get utils(){return St}static get scheme(){return Nt}static get Emitter(){return Wr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return Dr.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,jr,t,Br.REMOVE_SRC_WHEN_DESTROY)}}return Br.STYLE=_r,Br.DEBUG=!1,Br.CONTEXTMENU=!0,Br.NOTICE_TIME=2e3,Br.SETTING_WIDTH=250,Br.SETTING_ITEM_WIDTH=200,Br.SETTING_ITEM_HEIGHT=35,Br.RESIZE_TIME=200,Br.SCROLL_TIME=200,Br.SCROLL_GAP=50,Br.AUTO_PLAYBACK_MAX=10,Br.AUTO_PLAYBACK_MIN=5,Br.AUTO_PLAYBACK_TIMEOUT=3e3,Br.RECONNECT_TIME_MAX=5,Br.RECONNECT_SLEEP_TIME=1e3,Br.CONTROL_HIDE_TIME=3e3,Br.DBCLICK_TIME=300,Br.DBCLICK_FULLSCREEN=!0,Br.MOBILE_DBCLICK_PLAY=!0,Br.MOBILE_CLICK_PLAY=!1,Br.AUTO_ORIENTATION_TIME=200,Br.INFO_LOOP_TIME=1e3,Br.FAST_FORWARD_VALUE=3,Br.FAST_FORWARD_TIME=1e3,Br.TOUCH_MOVE_RATIO=.5,Br.VOLUME_STEP=.1,Br.SEEK_STEP=5,Br.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Br.ASPECT_RATIO=["default","4:3","16:9"],Br.FLIP=["normal","horizontal","vertical"],Br.FULLSCREEN_WEB_IN_BODY=!0,Br.LOG_VERSION=!0,Br.USE_RAF=!1,Br.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Br,V("artplayer-style",_r),setTimeout(()=>{Br.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Br.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Br}); diff --git a/packages/artplayer/dist/artplayer.mjs b/packages/artplayer/dist/artplayer.mjs index 86665e924..68ed295bb 100644 --- a/packages/artplayer/dist/artplayer.mjs +++ b/packages/artplayer/dist/artplayer.mjs @@ -361,13 +361,13 @@ class ResourceScope { throw new ResourceCleanupError(errors); } } -const states = /* @__PURE__ */ new WeakMap(); +const states$1 = /* @__PURE__ */ new WeakMap(); const containers = /* @__PURE__ */ new WeakMap(); function beginLifecycle(owner) { - states.set(owner, { scope: new ResourceScope(), destroying: false }); + states$1.set(owner, { scope: new ResourceScope(), destroying: false }); } function stateOf(owner) { - const state2 = states.get(owner); + const state2 = states$1.get(owner); if (!state2) throw new Error("ArtPlayer lifecycle has not been initialized"); return state2; @@ -432,20 +432,20 @@ function destroyInstance(owner, instances2, removeHtml, removeSource, failed = f if (errors.length) throw errors[0]; } -const scopes$1 = /* @__PURE__ */ new WeakMap(); +const scopes$3 = /* @__PURE__ */ new WeakMap(); function ownEntry(art, element) { const scope = getScope(art).child(); - scopes$1.set(element, scope); + scopes$3.set(element, scope); return scope; } function entryScope(element) { - const scope = scopes$1.get(element); + const scope = scopes$3.get(element); if (!scope) throw new Error("ArtPlayer component has not been registered"); return scope; } function releaseEntry(element) { - scopes$1.get(element)?.dispose(); + scopes$3.get(element)?.dispose(); } function proxyEntry(art, element, target, name, callback) { const scope = entryScope(element); @@ -1397,18 +1397,18 @@ function timeout(scope, callback, delay) { if (scope.closed) return () => { }; - let pending = true; + let pending2 = true; let release = () => { }; const timer = setTimeout(() => { - if (!pending) + if (!pending2) return; release(); if (!scope.closed) callback(); }, delay); release = scope.add(() => { - pending = false; + pending2 = false; clearTimeout(timer); }); return release; @@ -1417,18 +1417,18 @@ function animationFrame(scope, callback) { if (scope.closed) return () => { }; - let pending = true; + let pending2 = true; let release = () => { }; const frame = requestAnimationFrame((time2) => { - if (!pending) + if (!pending2) return; release(); if (!scope.closed) callback(time2); }); release = scope.add(() => { - pending = false; + pending2 = false; cancelAnimationFrame(frame); }); return release; @@ -2025,16 +2025,16 @@ function trackSelection(event, active) { function captureSelection(event) { return event && selections.get(event) || (() => true); } -const bindings = /* @__PURE__ */ new WeakMap(); +const bindings$1 = /* @__PURE__ */ new WeakMap(); function bind(item, binding) { - const previous = bindings.get(item); + const previous = bindings$1.get(item); errorHandle(!previous || entryScope(previous.owner).closed, "Cannot share selector items between active controls"); if (!previous) { - def(item, "$control_option", { get: () => bindings.get(item).option.selector }); - def(item, "$control_item", { get: () => bindings.get(item).item }); - def(item, "$control_value", { get: () => bindings.get(item).value }); + def(item, "$control_option", { get: () => bindings$1.get(item).option.selector }); + def(item, "$control_item", { get: () => bindings$1.get(item).item }); + def(item, "$control_value", { get: () => bindings$1.get(item).value }); } - bindings.set(item, binding); + bindings$1.set(item, binding); } function setHTML(element, value) { element.innerHTML = value; @@ -2436,12 +2436,12 @@ function viewInit(art) { } }); } -const scopes = /* @__PURE__ */ new WeakMap(); +const scopes$2 = /* @__PURE__ */ new WeakMap(); class Events { constructor(art) { this.destroyEvents = /* @__PURE__ */ new Set(); const scope = getScope(art); - scopes.set(this, scope); + scopes$2.set(this, scope); scope.add(() => this.destroy()); this.proxy = this.proxy.bind(this); this.hover = this.hover.bind(this); @@ -2458,7 +2458,7 @@ class Events { if (Array.isArray(name)) { return name.map((item) => this.proxy(target, item, callback, option)); } - if (scopes.get(this).closed) + if (scopes$2.get(this).closed) return () => { }; target.addEventListener(name, callback, option); @@ -3196,7 +3196,7 @@ function createReconnect(art) { const { option, constructor, i18n, notice, template: { $player } } = art; let source = getSourceScope(art); let attempts = 0; - let pending; + let pending2; const run = async (error2) => { if (isClosing(art)) return; @@ -3205,13 +3205,13 @@ function createReconnect(art) { source = current2; attempts = 0; } - if (pending && !pending.closed) + if (pending2 && !pending2.closed) return; const attempt = current2.child(); - pending = attempt; + pending2 = attempt; attempt.add(() => { - if (pending === attempt) - pending = void 0; + if (pending2 === attempt) + pending2 = void 0; }); const active = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); const retry = attempts < constructor.RECONNECT_TIME_MAX; @@ -3254,7 +3254,7 @@ function createReconnect(art) { return { reset() { attempts = 0; - pending?.dispose(); + pending2?.dispose(); removeClass($player, "art-error"); }, loadStart() { @@ -3902,9 +3902,9 @@ function rectMix(art) { return getRect(art.template.$player); } }); - const keys = ["bottom", "height", "left", "right", "top", "width"]; - for (let index = 0; index < keys.length; index++) { - const key = keys[index]; + const keys2 = ["bottom", "height", "left", "right", "top", "width"]; + for (let index = 0; index < keys2.length; index++) { + const key = keys2[index]; def(art, key, { get: () => { return host.rect[key]; @@ -4505,9 +4505,9 @@ function autoPlayback(art) { art.on("video:timeupdate", () => { if (art.playing) { const times = storage.get("times") || {}; - const keys = Object.keys(times); - if (keys.length > constructor.AUTO_PLAYBACK_MAX) { - delete times[keys[0]]; + const keys2 = Object.keys(times); + if (keys2.length > constructor.AUTO_PLAYBACK_MAX) { + delete times[keys2[0]]; } times[art.option.id || art.option.url] = art.currentTime; storage.set("times", times); @@ -4719,6 +4719,358 @@ class Plugins { return registerPlugin(this, plugin, result); } } +const pauses = /* @__PURE__ */ new WeakMap(); +function settingScopeActive(scope) { + return !scope.closed && !pauses.get(scope); +} +function pauseSettingScope(scope) { + pauses.set(scope, (pauses.get(scope) || 0) + 1); + let paused = true; + return () => { + if (!paused) + return; + paused = false; + const count = (pauses.get(scope) || 1) - 1; + if (count) + pauses.set(scope, count); + else + pauses.delete(scope); + }; +} +const bindings = /* @__PURE__ */ new WeakMap(); +const owners$1 = /* @__PURE__ */ new WeakMap(); +const keys = ["$parent", "$parents", "$option", "$events", "$formatted"]; +function hasTreeBinding(item) { + return bindings.has(item); +} +function registerTreeOwner(owner, scope) { + owners$1.set(owner, { active: true, scope }); +} +function releaseTreeOwner(owner) { + const state2 = owners$1.get(owner); + if (state2) { + state2.active = false; + state2.root = void 0; + state2.scope = void 0; + } +} +function activeBinding(item) { + const visited = /* @__PURE__ */ new Set(); + let current2 = item; + while (current2 && !visited.has(current2)) { + visited.add(current2); + const binding = bindings.get(current2); + if (!binding || !binding.owner.active || binding.owner.scope?.closed || !binding.option.includes(current2)) + return false; + if (!binding.parent) + return binding.owner.root === binding.option; + if (bindings.get(binding.parent)?.owner !== binding.owner) + return false; + current2 = binding.parent; + } + return false; +} +function canAssignName(item) { + let target = item; + while (target) { + const descriptor = Object.getOwnPropertyDescriptor(target, "name"); + if (descriptor) { + if ("set" in descriptor) + return typeof descriptor.set === "function"; + return Boolean(descriptor.writable && (target === item || Object.isExtensible(item))); + } + target = Object.getPrototypeOf(target); + } + return Object.isExtensible(item); +} +function treeBinding(item) { + const binding = bindings.get(item); + if (!binding) + throw new Error("Setting item has not been formatted"); + return binding; +} +function traverseTree(option, callback) { + for (let index = 0; index < option.length; index++) { + const item = option[index]; + callback(item); + if (item.selector?.length) + traverseTree(item.selector, callback); + } +} +function findItem(option, name = "") { + let result = null; + traverseTree(option, (item) => { + if (item.name === name) + result = item; + }); + return result; +} +function formatTree(owner, option, parent, parents, names = []) { + const ownerState = owners$1.get(owner) || { active: true }; + const placements = []; + const seen = /* @__PURE__ */ new Set(); + const used = new Set(names); + const collect = (list, parent2, parents2) => { + for (let index = 0; index < list.length; index++) { + const item = list[index]; + if (!item || typeof item !== "object") + throw new TypeError("Setting item must be an object"); + if (seen.has(item)) + throw new Error("Setting items must appear only once in a tree"); + seen.add(item); + const previous = bindings.get(item); + if (previous && previous.owner !== ownerState && activeBinding(item)) + errorHandle(false, `Setting item [${item.name || ""}] already belongs to another active player`); + if (item.name) { + errorHandle(!used.has(item.name), `The [${item.name}] already exists in [setting]`); + used.add(item.name); + } + if (!bindings.has(item)) { + for (const key of keys) { + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (descriptor ? !descriptor.configurable : !Object.isExtensible(item)) + throw new TypeError(`Cannot format setting item property [${key}]`); + } + } + if (!item.name && !canAssignName(item)) + throw new TypeError("Cannot assign an automatic setting item name"); + placements.push({ item, parent: parent2, parents: parents2, option: list, name: item.name || "", generated: !item.name }); + if (item.selector?.length) + collect(item.selector, item, list); + } + }; + collect(option, parent, parents); + let nextId = owner.id; + owners$1.set(owner, ownerState); + ownerState.root = option; + for (const placement of placements) { + if (!placement.name) { + do { + placement.name = `setting-${nextId++}`; + } while (used.has(placement.name)); + used.add(placement.name); + } + } + for (const placement of placements) { + const { item, name, parent: parent2, parents: parents2, option: option2 } = placement; + const previous = bindings.get(item); + if (!previous) { + Object.defineProperties(item, { + $parent: { get: () => treeBinding(item).parent }, + $parents: { get: () => treeBinding(item).parents }, + $option: { get: () => treeBinding(item).option }, + $events: { get: () => treeBinding(item).events }, + $formatted: { get: () => true } + }); + } + bindings.set(item, { parent: parent2, parents: parents2, option: option2, events: previous?.events || [], owner: ownerState }); + if (placement.generated) + item.name = name; + } + for (const placement of placements) { + if (!placement.generated) + names.push(placement.name); + } + owner.id = nextId; + return option; +} +const scopes$1 = /* @__PURE__ */ new WeakMap(); +function ownSettingPanel(setting2, option, panel) { + const scope = getScope(setting2.art).child(); + scopes$1.set(panel, scope); + scope.add(() => { + if (setting2.cache.get(option) === panel) + setting2.cache.delete(option); + panel.remove(); + }); + return scope; +} +function settingPanelScope(panel) { + const scope = scopes$1.get(panel); + if (!scope) + throw new Error("Setting panel has not been registered"); + return scope; +} +function releaseSettingPanel(panel) { + const scope = scopes$1.get(panel); + if (scope) + scope.dispose(); + else + panel.remove(); +} +const scopes = /* @__PURE__ */ new WeakMap(); +const owners = /* @__PURE__ */ new WeakMap(); +const eventLists = /* @__PURE__ */ new WeakMap(); +function releaseEvents(art, events) { + const pending2 = events.splice(0); + const failures = []; + for (const cleanup of pending2) { + try { + art.events.remove(cleanup); + } catch (error2) { + failures.push(error2); + } + } + if (failures.length) + throw new ResourceCleanupError(failures); +} +function ownSettingItem(art, item, owner = getScope(art)) { + const previous = scopes.get(item); + if (!previous || settingScopeActive(previous) || previous.closed) + releaseSettingItem(art, item); + const scope = owner.child(); + scopes.set(item, scope); + owners.set(item, owner); + eventLists.set(scope, treeBinding(item).events); + scope.add(() => { + releaseEvents(art, eventLists.get(scope)); + }); + return scope; +} +function settingItemOwner(item) { + return owners.get(item); +} +function settingScope(item) { + const scope = scopes.get(item); + if (!scope) + throw new Error("Setting item has not been rendered"); + return scope; +} +function releaseSettingItem(art, item) { + const scope = scopes.get(item); + if (scope && !scope.closed) + scope.dispose(); + else if (hasTreeBinding(item)) + releaseEvents(art, treeBinding(item).events); +} +function suspendSettingItem(art, item) { + const previous = scopes.get(item); + if (!previous || previous.closed) + return; + if (!settingScopeActive(previous)) + throw new Error("Setting item update is already in progress"); + const owner = owners.get(item); + const events = treeBinding(item).events; + const saved = events.splice(0); + eventLists.set(previous, saved); + const unpause = pauseSettingScope(previous); + let pending2 = true; + return { + resume() { + if (!pending2) + return; + pending2 = false; + const failures = []; + const current2 = scopes.get(item); + for (const cleanup of [() => { + if (current2 && current2 !== previous) + current2.dispose(); + }, () => releaseEvents(art, events)]) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + } + if (!previous.closed && !isClosing(art)) { + events.push(...saved.splice(0)); + eventLists.set(previous, events); + scopes.set(item, previous); + owners.set(item, owner); + } + unpause(); + if (failures.length) + throw new ResourceCleanupError(failures); + }, + dispose() { + if (!pending2) + return; + pending2 = false; + try { + previous.dispose(); + } finally { + unpause(); + } + } + }; +} +function proxySetting(art, item, target, name, callback, owner) { + const scope = owner || settingScope(item); + if (!settingScopeActive(scope) || isClosing(art)) + return; + const event = art.proxy(target, name, (event2) => { + if (settingScopeActive(scope) && !isClosing(art)) { + try { + return callback(event2); + } catch (error2) { + console.warn("ArtPlayer setting callback failed:", error2); + } + } + }); + if (!settingScopeActive(scope) || isClosing(art)) { + art.events.remove(event); + } else { + treeBinding(item).events.push(event); + if (owner && owner !== scopes.get(item)) { + owner.add(() => { + const events = treeBinding(item).events; + const index = events.indexOf(event); + if (index >= 0) { + events.splice(index, 1); + art.events.remove(event); + } + }); + } + } +} +function subscribeSetting(art, item, name, callback) { + const scope = settingScope(item); + if (!settingScopeActive(scope) || isClosing(art)) + return; + const guarded = (...args) => { + if (settingScopeActive(scope) && !isClosing(art)) + return callback(...args); + }; + art.on(name, guarded); + scope.add(() => { + art.off(name, guarded); + }); +} +function releaseSettingTree(setting2, item) { + const failures = []; + const visited = /* @__PURE__ */ new Set(); + const visit = (item2) => { + if (visited.has(item2)) + return; + visited.add(item2); + for (const child of item2.selector || []) + visit(child); + if (item2.selector) { + const panel = setting2.cache.get(item2.selector); + setting2.cache.delete(item2.selector); + try { + if (panel) + releaseSettingPanel(panel); + } catch (error2) { + failures.push(error2); + } + } + try { + releaseSettingItem(setting2.art, item2); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + }; + visit(item); + if (failures.length) + throw new ResourceCleanupError(failures); +} function aspectRatio(art) { const { i18n, @@ -4750,12 +5102,72 @@ function aspectRatio(art) { art.aspectRatio = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("aspectRatio", () => update()); + subscribeSetting(art, item, "aspectRatio", () => update()); } }; } +function installSettingEvents(setting2) { + const { art } = setting2; + const scope = getScope(art).child(); + const on = (name, callback) => { + if (scope.closed || isClosing(art)) + return; + const guarded = (...args) => { + if (!scope.closed && !isClosing(art)) + return callback(...args); + }; + art.on(name, guarded); + scope.add(() => { + art.off(name, guarded); + }); + }; + on("blur", () => { + if (setting2.show) { + setting2.show = false; + setting2.render(); + } + }); + on("focus", (event) => { + const isControl = includeFromEvent(event, art.controls.setting); + const isSetting = includeFromEvent(event, setting2.$parent); + if (setting2.show && !isControl && !isSetting) { + setting2.show = false; + setting2.render(); + } + }); + on("resize", () => setting2.resize()); + const resize = () => { + if (!scope.closed && !isClosing(art)) + setting2.resize(); + }; + const transitioned = art.proxy(setting2.$parent, "transitionend", (event) => { + if (event.target === setting2.$parent && event.propertyName === "bottom") + resize(); + }); + scope.add(() => { + art.events.remove(transitioned); + }); + const { $player, $controls } = art.template; + if (!scope.closed && typeof ResizeObserver !== "undefined") { + const observer = new ResizeObserver(resize); + observer.observe($player); + observer.observe($controls); + scope.add(() => { + observer.disconnect(); + }); + } + if (!scope.closed && typeof MutationObserver !== "undefined") { + const observer = new MutationObserver(resize); + if (typeof ResizeObserver === "undefined") + observer.observe($controls, { childList: true, subtree: true, attributes: true, characterData: true }); + observer.observe($player, { attributes: true, attributeFilter: ["class", "style"] }); + scope.add(() => { + observer.disconnect(); + }); + } +} function flip(art) { const { i18n, @@ -4787,12 +5199,51 @@ function flip(art) { art.flip = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("flip", () => update()); + subscribeSetting(art, item, "flip", () => update()); } }; } +function calculateSettingLayout(input) { + const { containerWidth, containerHeight, requestedWidth, rows, rowHeight, controlCenter, bottom, padding } = input; + const inset = Math.min(Math.max(0, padding), Math.max(0, containerWidth / 2)); + const width = Math.min(Math.max(0, requestedWidth), Math.max(0, containerWidth - 2 * inset)); + const height = Math.min(Math.max(0, rows * rowHeight), Math.max(0, containerHeight - bottom - inset)); + const left = Math.max(inset, Math.min(controlCenter - width / 2, containerWidth - inset - width)); + return { width, height, left }; +} +function resizeSetting(setting2) { + const { art, active } = setting2; + const { controls, constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, template: { $player, $setting, $bottom } } = art; + if (!controls.setting || !setting2.show || !active) + return; + const player = $player.getBoundingClientRect(); + const control = controls.setting.getBoundingClientRect(); + const scale = player.width / $player.offsetWidth || 1; + const controlCenter = (control.left - player.left + control.width / 2) / scale - $player.clientLeft; + const layout = calculateSettingLayout({ + containerWidth: $player.clientWidth, + containerHeight: $player.clientHeight, + requestedWidth: active[0]?.$parent?.width || SETTING_WIDTH, + rows: active.length + (active === setting2.option ? 0 : 1), + rowHeight: SETTING_ITEM_HEIGHT, + controlCenter, + bottom: Number.parseFloat(getComputedStyle($setting).bottom) || 0, + padding: Number.parseFloat(getComputedStyle($bottom).paddingLeft) || 0 + }); + $setting.style.height = `${layout.height}px`; + $setting.style.width = `${layout.width}px`; + if (art.isRotate || isMobile) + return; + if (controlCenter + layout.width / 2 > $player.clientWidth) { + $setting.style.left = ""; + $setting.style.right = ""; + } else { + $setting.style.left = `${layout.left}px`; + $setting.style.right = "auto"; + } +} function playbackRate(art) { const { i18n, @@ -4824,12 +5275,671 @@ function playbackRate(art) { art.playbackRate = item.value; return item.html; }, - mounted: () => { + mounted: (_element, item) => { update(); - art.on("video:ratechange", () => update()); + subscribeSetting(art, item, "video:ratechange", () => update()); } }; } +const registrations = /* @__PURE__ */ new WeakMap(); +function cancelSettingAdd(item) { + registrations.delete(item); +} +function beginSettingAdd(item) { + const token = {}; + registrations.set(item, token); + const current2 = () => registrations.get(item) === token; + return { + current: current2, + finish() { + if (current2()) + registrations.delete(item); + } + }; +} +const states = /* @__PURE__ */ new WeakMap(); +function rememberSettingState(item, capture) { + if (capture) + states.set(item, capture); + else + states.delete(item); +} +function captureSettingItem(item) { + const descriptors = new Map(Reflect.ownKeys(item).map((key) => [key, Object.getOwnPropertyDescriptor(item, key)])); + const nodes = []; + const state2 = states.get(item); + const restoreState = state2?.(); + for (const key of ["html", "icon", "tooltip"]) { + const value = descriptors.get(key)?.value; + if (value instanceof Node) + nodes.push({ node: value, parent: value.parentNode, next: value.nextSibling }); + } + return () => { + for (const key of Reflect.ownKeys(item)) { + if (!descriptors.has(key) && Object.getOwnPropertyDescriptor(item, key)?.configurable) + Reflect.deleteProperty(item, key); + } + for (const [key, descriptor] of descriptors) + Object.defineProperty(item, key, descriptor); + restoreState?.(); + rememberSettingState(item, state2); + for (const { node, parent, next } of nodes) { + if (parent) + parent.insertBefore(node, next?.parentNode === parent ? next : null); + else + node.parentNode?.removeChild(node); + } + }; +} +const generations = /* @__PURE__ */ new WeakMap(); +function checkSetting(setting2, target) { + if (!target?.$parent) + return; + target.$parent.tooltip = target.html; + setting2.traverse((item) => { + item.default = item === target; + if (item.default && item.$item) + inverseClass(item.$item, "art-current"); + }, target.$option); + setting2.render(target.$parents); +} +async function act(setting2, item, element, event, callback, target, property, before) { + try { + const scope = settingScope(item); + const targetScope = settingScope(target); + const generation = (generations.get(target) || 0) + 1; + generations.set(target, generation); + const active = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; + before?.(); + if (!active()) + return; + const value = await callback.call(setting2.art, item, element, event); + if (active()) + Reflect.set(target, property, value); + } catch (error2) { + console.warn("ArtPlayer setting callback failed:", error2); + } +} +function bindSettingActions(setting2, item, element, kind) { + const { art } = setting2; + const scope = settingScope(item); + const proxy = (target, name, callback) => proxySetting(art, item, target, name, callback, scope); + switch (kind) { + case "switch": + if (item.onSwitch) + proxy(element, "click", (event) => act(setting2, item, element, event, item.onSwitch, item, "switch")); + break; + case "range": { + const range = item.$range; + if (range) { + for (const [name, callback] of [["change", "onRange"], ["input", "onChange"]]) { + if (item[callback]) { + proxy(range, name, (event) => act(setting2, item, element, event, item[callback], item, "tooltip", () => { + item.range[0] = range.valueAsNumber; + })); + } + } + } + break; + } + case "selector": + proxy(element, "click", (event) => { + if (item.selector?.length) { + setting2.render(item.selector); + } else if (item.$parent?.onSelect) { + return act(setting2, item, element, event, item.$parent.onSelect, item.$parent, "tooltip", () => setting2.check(item)); + } else { + setting2.check(item); + } + }); + if (item.default) + addClass(element, "art-current"); + break; + case "button": + if (item.onClick) + proxy(element, "click", (event) => act(setting2, item, element, event, item.onClick, item, "tooltip")); + break; + } +} +function captureTemplate(container) { + const snapshots = []; + function capture(node) { + const children = Array.from(node.childNodes); + snapshots.push({ + node, + children, + attributes: node.nodeType === 1 ? Array.from(node.attributes, (attr) => [attr.name, attr.value]) : void 0, + value: node.nodeValue + }); + children.forEach(capture); + } + capture(container); + return () => { + for (const { node, children, attributes, value } of snapshots) { + while (node.firstChild) + node.removeChild(node.firstChild); + for (const child of children) + node.appendChild(child); + if (attributes) { + const element = node; + for (const attr of Array.from(element.attributes)) + element.removeAttribute(attr.name); + for (const [name, content] of attributes) + element.setAttribute(name, content); + } else { + node.nodeValue = value; + } + } + }; +} +const pending = /* @__PURE__ */ new WeakMap(); +function finish(cleanups) { + const errors = []; + for (const cleanup of cleanups) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + errors.push(...error2.errors); + else + errors.push(error2); + } + } + if (errors.length) + throw new ResourceCleanupError(errors); +} +function suspendTree(setting2, root) { + const items = /* @__PURE__ */ new Set(); + const panels = /* @__PURE__ */ new Set(); + const collect = (item) => { + if (items.has(item)) + return; + items.add(item); + if (item.selector) { + const panel = setting2.cache.get(item.selector); + if (panel) + panels.add(panel); + item.selector.forEach(collect); + } + }; + collect(root); + const suspended = []; + const unpause = []; + try { + for (const item of items) { + const suspension = suspendSettingItem(setting2.art, item); + if (suspension) + suspended.push(suspension); + } + for (const panel of panels) + unpause.push(pauseSettingScope(settingPanelScope(panel))); + } catch (error2) { + try { + finish([...suspended.reverse().map((item) => item.resume), ...unpause]); + } catch (cleanupError) { + console.warn("ArtPlayer setting restore failed:", cleanupError); + } + throw error2; + } + let active = true; + return { + items, + resume() { + if (!active) + return; + active = false; + finish([...suspended.reverse().map((item) => item.resume), ...unpause]); + }, + dispose() { + if (!active) + return; + active = false; + finish([...suspended.reverse().map((item) => item.dispose), ...Array.from(panels).reverse().map((panel) => () => releaseSettingPanel(panel)), ...unpause]); + } + }; +} +function cancelSettingUpdate(item) { + pending.get(item)?.(); +} +function captureSettingUpdate(item) { + const operation = pending.get(item); + return () => !operation || pending.get(item) === operation; +} +function assignSetting(item, target, current2) { + for (const key of Reflect.ownKeys(target)) { + if (!current2()) + return; + const descriptor = Object.getOwnPropertyDescriptor(target, key); + if (!descriptor?.enumerable || !current2()) + continue; + const value = Reflect.get(target, key); + if (!current2()) + return; + if (!Reflect.set(item, key, value)) + throw new TypeError(`Cannot assign setting item property [${String(key)}]`); + } +} +function updateSetting(setting2, target) { + const item = setting2.find(target.name); + if (isClosing(setting2.art)) + return item || target; + if (!item) + return setting2.add(target); + cancelSettingAdd(item); + cancelSettingUpdate(item); + const restoreItem = captureSettingItem(item); + const element = item.$item; + const parent = element?.parentNode; + const next = element?.nextSibling; + const restoreTemplate = element ? captureTemplate(element) : void 0; + const previous = setting2.active; + const layout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); + const tree = suspendTree(setting2, item); + let active = true; + let rendered = false; + const cancel = () => { + if (!active) + return; + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + if (isClosing(setting2.art)) { + tree.dispose(); + return; + } + const replacement = item.$item; + try { + finish([ + tree.resume, + () => { + if (replacement && replacement !== element) + replacement.remove(); + }, + restoreItem, + () => restoreTemplate?.(), + () => { + if (parent && element) + parent.insertBefore(element, next?.parentNode === parent ? next : null); + }, + () => setting2.format(), + () => { + if (rendered) { + setting2.active = previous; + if (previous && setting2.cache.has(previous)) + inverseClass(setting2.cache.get(previous), "art-current"); + for (const [key, value, priority] of layout) + setting2.$parent.style.setProperty(key, value, priority); + } + } + ]); + } catch (error2) { + console.warn("ArtPlayer setting restore failed:", error2); + } + }; + const current2 = () => active && !isClosing(setting2.art) && pending.get(item) === cancel; + for (const affected of tree.items) + pending.set(affected, cancel); + const release = getScope(setting2.art).add(() => { + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + tree.dispose(); + }); + try { + assignSetting(item, target, current2); + if (!current2()) + return item; + setting2.format(); + if (!current2()) + return item; + setting2.createItem(item, true); + if (!current2()) + return item; + rendered = true; + setting2.render(); + if (!current2()) + return item; + active = false; + for (const affected of tree.items) { + if (pending.get(affected) === cancel) + pending.delete(affected); + } + tree.dispose(); + return item; + } catch (error2) { + if (current2()) + cancel(); + throw error2; + } finally { + release(); + } +} +const navigations = /* @__PURE__ */ new WeakMap(); +function bindContent(item, key, element) { + def(item, `$${key}`, { configurable: true, get: () => element }); + def(item, key, { + configurable: true, + get: () => element.innerHTML, + set(value) { + element.innerHTML = ""; + append(element, value); + } + }); +} +function createSettingHeader(setting2, item) { + if (!setting2.cache.has(item.$option)) + return; + const $panel = setting2.cache.get(item.$option); + const { + icons: { arrowLeft: arrowLeft2 }, + constructor: { SETTING_ITEM_HEIGHT } + } = setting2.art; + const $item = document.createElement("div"); + setStyle($item, "height", `${SETTING_ITEM_HEIGHT}px`); + addClass($item, "art-setting-item"); + addClass($item, "art-setting-item-back"); + const $left = append($item, '
'); + const $icon = document.createElement("div"); + addClass($icon, "art-setting-item-left-icon"); + append($icon, arrowLeft2); + append($left, $icon); + append($left, item.$parent.html); + proxySetting(setting2.art, item.$parent, $item, "click", () => setting2.render(item.$parents), settingPanelScope($panel)); + append($panel, $item); +} +function createSettingItem(setting2, item, isUpdate = false) { + const currentUpdate = captureSettingUpdate(item); + if (!setting2.cache.has(item.$option)) + return; + const $panel = setting2.cache.get(item.$option); + const oldItem = item.$item; + let type = "selector"; + if (has(item, "switch")) { + type = "switch"; + } + if (has(item, "range")) { + type = "range"; + } + if (has(item, "onClick")) { + type = "button"; + } + const { icons, constructor } = setting2.art; + if (!currentUpdate()) + return; + const scope = ownSettingItem(setting2.art, item, settingPanelScope($panel)); + const current2 = () => settingScopeActive(scope) && !isClosing(setting2.art) && currentUpdate(); + if (!current2()) + return; + const $item = document.createElement("div"); + try { + rememberSettingState(item); + addClass($item, "art-setting-item"); + setStyle($item, "height", `${constructor.SETTING_ITEM_HEIGHT}px`); + $item.dataset.name = item.name || ""; + $item.dataset.value = String(item.value || ""); + if (!current2()) + return; + const $left = append($item, '
'); + const $right = append($item, '
'); + const $icon = document.createElement("div"); + addClass($icon, "art-setting-item-left-icon"); + switch (type) { + case "button": + case "switch": + case "range": { + const icon = item.icon || icons.config; + if (!current2()) + return; + append($icon, icon); + break; + } + case "selector": + if (item.selector?.length) { + const icon = item.icon || icons.config; + if (!current2()) + return; + append($icon, icon); + } else { + append($icon, icons.check); + } + break; + default: + break; + } + append($left, $icon); + if (!current2()) + return; + bindContent(item, "icon", $icon); + const $html = document.createElement("div"); + addClass($html, "art-setting-item-left-text"); + const html2 = item.html || ""; + if (!current2()) + return; + append($html, html2); + append($left, $html); + bindContent(item, "html", $html); + const $tooltip = document.createElement("div"); + addClass($tooltip, "art-setting-item-right-tooltip"); + const tooltip2 = item.tooltip || ""; + if (!current2()) + return; + append($tooltip, tooltip2); + append($right, $tooltip); + bindContent(item, "tooltip", $tooltip); + switch (type) { + case "switch": { + const $switch = document.createElement("div"); + addClass($switch, "art-setting-item-right-icon"); + const $switchOn = append($switch, icons.switchOn); + const $switchOff = append($switch, icons.switchOff); + const initialSwitch = item.switch; + if (!current2()) + return; + setStyle(initialSwitch ? $switchOff : $switchOn, "display", "none"); + append($right, $switch); + def(item, "$switch", { + configurable: true, + get: () => $switch + }); + let $switchValue = item.switch; + if (!current2()) + return; + rememberSettingState(item, () => { + const value = $switchValue; + return () => { + $switchValue = value; + }; + }); + def(item, "switch", { + configurable: true, + get: () => $switchValue, + set(value) { + $switchValue = value; + if (value) { + setStyle($switchOff, "display", "none"); + setStyle($switchOn, "display", null); + } else { + setStyle($switchOff, "display", null); + setStyle($switchOn, "display", "none"); + } + } + }); + break; + } + case "range": + { + const $state = document.createElement("div"); + addClass($state, "art-setting-item-right-icon"); + const $range = document.createElement("input"); + $range.type = "range"; + append($state, $range); + for (const [index, key] of ["value", "min", "max", "step"].entries()) { + const value = item.range[index]; + if (!current2()) + return; + Reflect.set($range, key, String(value)); + } + addClass($range, "art-setting-range"); + append($right, $state); + def(item, "$range", { + configurable: true, + get: () => $range + }); + let $rangeValue = [...item.range]; + if (!current2()) + return; + rememberSettingState(item, () => { + const value = $rangeValue; + const values = [...value]; + const input = { min: $range.min, max: $range.max, step: $range.step, value: $range.value }; + return () => { + value.splice(0, value.length, ...values); + $rangeValue = value; + Object.assign($range, input); + }; + }); + def(item, "range", { + configurable: true, + get: () => $rangeValue, + set(value) { + $rangeValue = [...value]; + $range.value = String(value[0]); + $range.min = String(value[1]); + $range.max = String(value[2]); + $range.step = String(value[3]); + } + }); + } + break; + case "selector": + if (item.selector?.length) { + const $state = document.createElement("div"); + addClass($state, "art-setting-item-right-icon"); + append($state, icons.arrowRight); + append($right, $state); + } + break; + default: + break; + } + if (!current2()) + return; + bindSettingActions(setting2, item, $item, type); + if (!current2()) + return; + def(item, "$item", { + configurable: true, + get: () => $item + }); + if (isUpdate) { + if (oldItem?.parentNode) + oldItem.replaceWith($item); + else + append($panel, $item); + } else { + append($panel, $item); + } + if (item.mounted && current2()) { + timeout(scope, () => { + if (isClosing(setting2.art)) + return; + try { + const result = item.mounted?.call(setting2.art, $item, item); + void Promise.resolve(result).catch((error2) => console.warn("ArtPlayer setting mounted failed:", error2)); + } catch (error2) { + console.warn("ArtPlayer setting mounted failed:", error2); + } + }, 0); + } + } catch (error2) { + try { + scope.dispose(); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + $item.remove(); + throw error2; + } +} +function renderSetting(setting2, option = setting2.option) { + if (isClosing(setting2.art)) + return; + const cached = setting2.cache.get(option); + if (cached && !settingScopeActive(settingPanelScope(cached))) + return; + const navigation = (navigations.get(setting2) || 0) + 1; + navigations.set(setting2, navigation); + const currentNavigation = () => navigations.get(setting2) === navigation && !isClosing(setting2.art); + const previous = setting2.active; + const previousLayout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); + const restoreNavigation = () => { + setting2.active = previous; + if (previous && setting2.cache.has(previous)) + inverseClass(setting2.cache.get(previous), "art-current"); + for (const [key, value, priority] of previousLayout) + setting2.$parent.style.setProperty(key, value, priority); + }; + setting2.active = option; + if (cached) { + try { + inverseClass(cached, "art-current"); + setting2.resize(); + } catch (error2) { + if (currentNavigation() && setting2.cache.get(option) === cached && !settingPanelScope(cached).closed) + restoreNavigation(); + throw error2; + } + } else { + const $panel = document.createElement("div"); + setting2.cache.set(option, $panel); + const scope = ownSettingPanel(setting2, option, $panel); + const current2 = () => !scope.closed && !isClosing(setting2.art) && setting2.cache.get(option) === $panel; + const checkpoints = []; + try { + if (!current2()) + return; + addClass($panel, "art-setting-panel"); + append(setting2.$parent, $panel); + inverseClass($panel, "art-current"); + if (option[0]?.$parent) + setting2.createHeader(option[0]); + for (let index = 0; index < option.length && current2(); index++) { + const item = option[index]; + checkpoints.push({ item, restore: captureSettingItem(item) }); + setting2.createItem(item); + } + if (!current2()) + return; + setting2.resize(); + } catch (error2) { + const restore = current2(); + const restoreActive = setting2.active === option && currentNavigation(); + try { + releaseSettingPanel($panel); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + if (restore && !isClosing(setting2.art)) { + for (const checkpoint of checkpoints.reverse()) { + if (settingItemOwner(checkpoint.item) === scope) { + try { + checkpoint.restore(); + } catch (restoreError) { + console.warn("ArtPlayer setting restore failed:", restoreError); + } + } + } + if (restoreActive) + restoreNavigation(); + } + throw error2; + } + } +} function subtitleOffset(art) { const { i18n, icons, constructor } = art; return { @@ -4844,19 +5954,19 @@ function subtitleOffset(art) { return `${item.range[0]}s`; }, mounted: (_, item) => { - art.on("subtitleOffset", (value) => { - item.$range.value = value; + subscribeSetting(art, item, "subtitleOffset", (value) => { + item.$range.value = String(value); item.tooltip = `${value}s`; }); } }; } -class Setting extends Component { +const SettingBase = Component; +class Setting extends SettingBase { constructor(art) { super(art); const { option, - controls, template: { $setting } } = art; this.name = "setting"; @@ -4865,24 +5975,15 @@ class Setting extends Component { this.active = null; this.cache = /* @__PURE__ */ new Map(); this.option = [...this.builtin, ...option.settings]; + const scope = getScope(art); + registerTreeOwner(this, scope); + scope.add(() => { + releaseTreeOwner(this); + }); if (option.setting) { this.format(); this.render(); - art.on("blur", () => { - if (this.show) { - this.show = false; - this.render(); - } - }); - art.on("focus", (event) => { - const isControl = includeFromEvent(event, controls.setting); - const isSetting = includeFromEvent(event, this.$parent); - if (this.show && !isControl && !isSetting) { - this.show = false; - this.render(); - } - }); - art.on("resize", () => this.resize()); + installSettingEvents(this); } } get builtin() { @@ -4903,396 +6004,93 @@ class Setting extends Component { return result; } traverse(callback, option = this.option) { - for (let index = 0; index < option.length; index++) { - const item = option[index]; - callback(item); - if (item.selector?.length) { - this.traverse(callback, item.selector); - } - } + traverseTree(option, callback); } check(target) { - if (!target) { - return; - } - target.$parent.tooltip = target.html; - this.traverse((item) => { - item.default = item === target; - if (item.default && item.$item) { - inverseClass(item.$item, "art-current"); - } - }, target.$option); - this.render(target.$parents); + checkSetting(this, target); } format(option = this.option, parent, parents, names = []) { - for (let index = 0; index < option.length; index++) { - const item = option[index]; - if (item?.name) { - errorHandle(!names.includes(item.name), `The [${item.name}] already exists in [setting]`); - names.push(item.name); - } else { - item.name = `setting-${this.id++}`; - } - if (!item.$formatted) { - def(item, "$parent", { - get: () => parent - }); - def(item, "$parents", { - get: () => parents - }); - def(item, "$option", { - get: () => option - }); - const $events = []; - def(item, "$events", { - get: () => $events - }); - def(item, "$formatted", { - get: () => true - }); - } - this.format(item.selector || [], item, option, names); - } - this.option = option; + this.option = formatTree(this, option, parent, parents, names); } find(name = "") { - let result = null; - this.traverse((item) => { - if (item.name === name) { - result = item; - } - }); - return result; + return findItem(this.option, name); } resize() { - const { - controls, - constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, - template: { $player, $setting } - } = this.art; - if (controls.setting && this.show) { - const settingWidth = this.active[0]?.$parent?.width || SETTING_WIDTH; - const { left: controlLeft, width: controlWidth } = getRect(controls.setting); - const { left: playerLeft, width: playerWidth } = getRect($player); - const settingLeft = controlLeft - playerLeft + controlWidth / 2 - settingWidth / 2; - const settingHeight = this.active === this.option ? this.active.length * SETTING_ITEM_HEIGHT : (this.active.length + 1) * SETTING_ITEM_HEIGHT; - setStyle($setting, "height", `${settingHeight}px`); - setStyle($setting, "width", `${settingWidth}px`); - if (this.art.isRotate || isMobile) - return; - if (settingLeft + settingWidth > playerWidth) { - setStyle($setting, "left", null); - setStyle($setting, "right", null); - } else { - setStyle($setting, "left", `${settingLeft}px`); - setStyle($setting, "right", "auto"); - } - } + resizeSetting(this); } inactivate(item) { - for (let index = 0; index < item.$events.length; index++) { - this.art.events.remove(item.$events[index]); - } - item.$events.length = 0; + releaseSettingTree(this, item); } remove(name) { const item = this.find(name); errorHandle(item, `Can't find [${name}] in the [setting]`); + this.traverse((item2) => { + cancelSettingAdd(item2); + cancelSettingUpdate(item2); + }, [item]); const index = item.$option.indexOf(item); item.$option.splice(index, 1); - this.inactivate(item); - if (item.$item) - remove(item.$item); - this.render(); + const element = item.$item; + const failures = []; + for (const cleanup of [() => this.inactivate(item), () => element?.remove(), () => this.render()]) { + try { + cleanup(); + } catch (error2) { + if (error2 instanceof ResourceCleanupError) + failures.push(...error2.errors); + else + failures.push(error2); + } + } + if (failures.length) + throw new ResourceCleanupError(failures); } update(target) { - const item = this.find(target.name); - if (item) { - this.inactivate(item); - Object.assign(item, target); - this.format(); - this.createItem(item, true); - this.render(); - return item; - } else { - return this.add(target); - } + return updateSetting(this, target); } add(item, option = this.option) { - option.push(item); - this.format(); - this.createItem(item); - this.render(); + if (isClosing(this.art)) + return item; + let registered = false; + this.traverse((existing) => { + registered || (registered = existing === item); + }); + const index = option.length; + const registration = registered ? void 0 : beginSettingAdd(item); + let formatted = false; + try { + option.push(item); + this.format(); + formatted = true; + this.createItem(item); + this.render(); + } catch (error2) { + if (isClosing(this.art) || registration && !registration.current()) + throw error2; + if (option[index] === item) + option.splice(index, 1); + if (!registered && formatted) { + try { + this.inactivate(item); + } catch (cleanupError) { + console.warn("ArtPlayer setting cleanup failed:", cleanupError); + } + item.$item?.remove(); + } + throw error2; + } finally { + registration?.finish(); + } return item; } createHeader(item) { - if (!this.cache.has(item.$option)) - return; - const $panel = this.cache.get(item.$option); - const { - proxy, - icons: { arrowLeft: arrowLeft2 }, - constructor: { SETTING_ITEM_HEIGHT } - } = this.art; - const $item = createElement("div"); - setStyle($item, "height", `${SETTING_ITEM_HEIGHT}px`); - addClass($item, "art-setting-item"); - addClass($item, "art-setting-item-back"); - const $left = append($item, '
'); - const $icon = createElement("div"); - addClass($icon, "art-setting-item-left-icon"); - append($icon, arrowLeft2); - append($left, $icon); - append($left, item.$parent.html); - const event = proxy($item, "click", () => this.render(item.$parents)); - item.$parent.$events.push(event); - append($panel, $item); + createSettingHeader(this, item); } createItem(item, isUpdate = false) { - if (!this.cache.has(item.$option)) - return; - const $panel = this.cache.get(item.$option); - const oldItem = item.$item; - let type = "selector"; - if (has(item, "switch")) { - type = "switch"; - } - if (has(item, "range")) { - type = "range"; - } - if (has(item, "onClick")) { - type = "button"; - } - const { icons, proxy, constructor } = this.art; - const $item = createElement("div"); - addClass($item, "art-setting-item"); - setStyle($item, "height", `${constructor.SETTING_ITEM_HEIGHT}px`); - $item.dataset.name = item.name || ""; - $item.dataset.value = item.value || ""; - const $left = append($item, '
'); - const $right = append($item, '
'); - const $icon = createElement("div"); - addClass($icon, "art-setting-item-left-icon"); - switch (type) { - case "button": - case "switch": - case "range": - append($icon, item.icon || icons.config); - break; - case "selector": - if (item.selector?.length) { - append($icon, item.icon || icons.config); - } else { - append($icon, icons.check); - } - break; - } - append($left, $icon); - def(item, "$icon", { - configurable: true, - get: () => $icon - }); - def(item, "icon", { - configurable: true, - get() { - return $icon.innerHTML; - }, - set(value) { - $icon.innerHTML = ""; - append($icon, value); - } - }); - const $html = createElement("div"); - addClass($html, "art-setting-item-left-text"); - append($html, item.html || ""); - append($left, $html); - def(item, "$html", { - configurable: true, - get: () => $html - }); - def(item, "html", { - configurable: true, - get() { - return $html.innerHTML; - }, - set(value) { - $html.innerHTML = ""; - append($html, value); - } - }); - const $tooltip = createElement("div"); - addClass($tooltip, "art-setting-item-right-tooltip"); - append($tooltip, item.tooltip || ""); - append($right, $tooltip); - def(item, "$tooltip", { - configurable: true, - get: () => $tooltip - }); - def(item, "tooltip", { - configurable: true, - get() { - return $tooltip.innerHTML; - }, - set(value) { - $tooltip.innerHTML = ""; - append($tooltip, value); - } - }); - switch (type) { - case "switch": { - const $switch = createElement("div"); - addClass($switch, "art-setting-item-right-icon"); - const $switchOn = append($switch, icons.switchOn); - const $switchOff = append($switch, icons.switchOff); - setStyle(item.switch ? $switchOff : $switchOn, "display", "none"); - append($right, $switch); - def(item, "$switch", { - configurable: true, - get: () => $switch - }); - let $switchValue = item.switch; - def(item, "switch", { - configurable: true, - get: () => $switchValue, - set(value) { - $switchValue = value; - if (value) { - setStyle($switchOff, "display", "none"); - setStyle($switchOn, "display", null); - } else { - setStyle($switchOff, "display", null); - setStyle($switchOn, "display", "none"); - } - } - }); - break; - } - case "range": - { - const $state = createElement("div"); - addClass($state, "art-setting-item-right-icon"); - const $range = append($state, ''); - $range.value = item.range[0]; - $range.min = item.range[1]; - $range.max = item.range[2]; - $range.step = item.range[3]; - addClass($range, "art-setting-range"); - append($right, $state); - def(item, "$range", { - configurable: true, - get: () => $range - }); - let $rangeValue = [...item.range]; - def(item, "range", { - configurable: true, - get: () => $rangeValue, - set(value) { - $rangeValue = [...value]; - $range.value = value[0]; - $range.min = value[1]; - $range.max = value[2]; - $range.step = value[3]; - } - }); - } - break; - case "selector": - if (item.selector?.length) { - const $state = createElement("div"); - addClass($state, "art-setting-item-right-icon"); - append($state, icons.arrowRight); - append($right, $state); - } - break; - } - switch (type) { - case "switch": { - if (item.onSwitch) { - const event = proxy($item, "click", async (event2) => { - item.switch = await item.onSwitch.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - break; - } - case "range": { - if (item.$range) { - if (item.onRange) { - const event = proxy(item.$range, "change", async (event2) => { - item.range[0] = item.$range.valueAsNumber; - item.tooltip = await item.onRange.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - if (item.onChange) { - const event = proxy(item.$range, "input", async (event2) => { - item.range[0] = item.$range.valueAsNumber; - item.tooltip = await item.onChange.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - } - break; - } - case "selector": - { - const event = proxy($item, "click", async (event2) => { - if (item.selector?.length) { - this.render(item.selector); - } else { - this.check(item); - if (item.$parent.onSelect) { - item.$parent.tooltip = await item.$parent.onSelect.call(this.art, item, $item, event2); - } - } - }); - item.$events.push(event); - if (item.default) { - addClass($item, "art-current"); - } - } - break; - case "button": - if (item.onClick) { - const event = proxy($item, "click", async (event2) => { - item.tooltip = await item.onClick.call(this.art, item, $item, event2); - }); - item.$events.push(event); - } - break; - } - def(item, "$item", { - configurable: true, - get: () => $item - }); - if (isUpdate) { - replaceElement($item, oldItem); - } else { - append($panel, $item); - } - if (item.mounted) { - timeout(getScope(this.art), () => item.mounted.call(this.art, item.$item, item), 0); - } + createSettingItem(this, item, isUpdate); } render(option = this.option) { - this.active = option; - if (this.cache.has(option)) { - const $panel = this.cache.get(option); - inverseClass($panel, "art-current"); - } else { - const $panel = createElement("div"); - this.cache.set(option, $panel); - addClass($panel, "art-setting-panel"); - append(this.$parent, $panel); - inverseClass($panel, "art-current"); - if (option[0]?.$parent) { - this.createHeader(option[0]); - } - for (let index = 0; index < option.length; index++) { - this.createItem(option[index]); - } - } - this.resize(); + renderSetting(this, option); } } class Storage { @@ -5335,7 +6133,7 @@ class Storage { } } } -const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; +const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; class Subtitle extends Component { constructor(art) { super(art); @@ -5475,37 +6273,6 @@ class Subtitle extends Component { }); } } -function captureTemplate(container) { - const snapshots = []; - function capture(node) { - const children = Array.from(node.childNodes); - snapshots.push({ - node, - children, - attributes: node.nodeType === 1 ? Array.from(node.attributes, (attr) => [attr.name, attr.value]) : void 0, - value: node.nodeValue - }); - children.forEach(capture); - } - capture(container); - return () => { - for (const { node, children, attributes, value } of snapshots) { - while (node.firstChild) - node.removeChild(node.firstChild); - for (const child of children) - node.appendChild(child); - if (attributes) { - const element = node; - for (const attr of Array.from(element.attributes)) - element.removeAttribute(attr.name); - for (const [name, content] of attributes) - element.setAttribute(name, content); - } else { - node.nodeValue = value; - } - } - }; -} const html = `