Files
CloudFlare-ImgBed/js/667.bbd60d43.js
2026-01-29 21:15:15 +08:00

2 lines
159 KiB
JavaScript

(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[667],{1114:function(e,t,i){"use strict";function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function n(e,t){if("object"!=s(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function a(e){var t=n(e,"string");return"symbol"==s(t)?t:t+""}function r(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}i.d(t,{A:function(){return r}})},1583:function(e,t,i){var s,n,a;i(4114),function(i,r){n=[],s=r,a="function"===typeof s?s.apply(t,n):s,void 0===a||(e.exports=a)}(0,function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,r,o,l=[],c=e.length,h=c;n=function(e,i){i.length&&l.push(e),h--,h||t(l)};while(c--)a=e[c],r=i[a],r?n(a,r):(o=s[a]=s[a]||[],o.push(n))}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)while(n.length)n[0](e,t),n.splice(0,1)}}function r(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function o(t,i,s,n){var a,r,l,c=document,h=s.async,d=(s.numRetries||0)+1,u=s.before||e,p=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img|module|nomodule)!/,"");if(n=n||0,/(^css!|\.css$)/.test(p))l=c.createElement("link"),l.rel="stylesheet",l.href=m,a="hideFocus"in l,a&&l.relList&&(a=0,l.rel="preload",l.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(p))l=c.createElement("img"),l.src=m;else if(l=c.createElement("script"),l.src=m,l.async=void 0===h||h,r="noModule"in l,/^module!/.test(p)){if(!r)return i(t,"l");l.type="module"}else if(/^nomodule!/.test(p)&&r)return i(t,"l");l.onload=l.onerror=l.onbeforeload=function(e){var r=e.type[0];if(a)try{l.sheet.cssText.length||(r="e")}catch(c){18!=c.code&&(r="e")}if("e"==r){if(n+=1,n<d)return o(t,i,s,n)}else if("preload"==l.rel&&"style"==l.as)return l.rel="stylesheet";i(t,r,e.defaultPrevented)},!1!==u(t,l)&&c.head.appendChild(l)}function l(e,t,i){e=e.push?e:[e];var s,n,a=e.length,r=a,l=[];for(s=function(e,i,s){if("e"==i&&l.push(e),"b"==i){if(!s)return;l.push(e)}a--,a||t(l)},n=0;n<r;n++)o(e[n],s,i)}function c(e,i,s){var n,o;if(i&&i.trim&&(n=i),o=(n?s:i)||{},n){if(n in t)throw"LoadJS";t[n]=!0}function c(t,i){l(e,function(e){r(o,e),t&&r({success:t,error:i},e),a(n,e)},o)}if(o.returnPromise)return new Promise(c);c()}return c.ready=function(e,t){return n(e,function(e){r(t,e)}),c},c.done=function(e){a(e,[])},c.reset=function(){t={},i={},s={}},c.isDefined=function(e){return e in t},c})},3975:function(e,t,i){i(4114),i(8111),i(2489),i(7588),i(1701),function(t,i){e.exports=i()}(0,function(){"use strict";function e(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function t(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function i(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function s(e){for(var s=1;s<arguments.length;s++){var n=null!=arguments[s]?arguments[s]:{};s%2?i(Object(n),!0).forEach(function(i){t(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var n={addCSS:!0,thumbWidth:15,watch:!0};function a(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}var r=function(e){return null!=e?e.constructor:null},o=function(e,t){return!!(e&&t&&e instanceof t)},l=function(e){return null==e},c=function(e){return r(e)===Object},h=function(e){return r(e)===String},d=function(e){return Array.isArray(e)},u=function(e){return o(e,NodeList)},p=h,m=d,g=u,f=function(e){return o(e,Element)},y=function(e){return o(e,Event)},b=function(e){return l(e)||(h(e)||d(e)||u(e))&&!e.length||c(e)&&!Object.keys(e).length};function v(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}return function(){function t(e,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),f(e)?this.element=e:p(e)&&(this.element=document.querySelector(e)),f(this.element)&&b(this.element.rangeTouch)&&(this.config=s({},n,{},i),this.init())}return i=t,o=[{key:"setup",value:function(e){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=null;if(b(e)||p(e)?r=Array.from(document.querySelectorAll(p(e)?e:'input[type="range"]')):f(e)?r=[e]:g(e)?r=Array.from(e):m(e)&&(r=e.filter(f)),b(r))return null;var o=s({},n,{},i);if(p(e)&&o.watch){var l=new MutationObserver(function(i){Array.from(i).forEach(function(i){Array.from(i.addedNodes).forEach(function(i){f(i)&&a(i,e)&&new t(i,o)})})});l.observe(document.body,{childList:!0,subtree:!0})}return r.map(function(e){return new t(e,i)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(r=[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[i](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!y(e))return null;var i,s=e.target,n=e.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,r=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,l=s.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(n.clientX-l.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*c:50<i&&(i+=2*(i-50)*c),a+v(i/100*(r-a),o)}},{key:"set",value:function(e){t.enabled&&y(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var i=new Event(t,{bubbles:!0});e.dispatchEvent(i)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(i.prototype,r),o&&e(i,o),t;var i,r,o}()})},4453:function(e,t,i){"use strict";i.d(t,{A:function(){return m}});var s=i(6768),n=i(5130),a=i(4232);const r={id:"themeMask"},o=["cx","cy","r"],l=["r"],c=["opacity"];function h(e,t,i,h,d,u){const p=(0,s.g2)("font-awesome-icon");return(0,s.uX)(),(0,s.CE)("div",{id:"themeToggle",onClick:t[0]||(t[0]=(...e)=>u.handleToggleClick&&u.handleToggleClick(...e))},[(0,s.bF)(n.eB,{name:"icon-fade",mode:"out-in"},{default:(0,s.k6)(()=>[d.isAuto?((0,s.uX)(),(0,s.Wv)(p,{key:"auto-mode",icon:"circle-half-stroke",class:"auto-icon",style:{"font-size":"1.5em",color:"var(--theme-toggle-color)"}})):((0,s.uX)(),(0,s.CE)("svg",{key:"sun-moon",class:(0,a.C4)(["theme_toggle_svg",{dark:d.isDark}]),width:"1.5em",height:"1.5em",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",stroke:"currentColor"},[(0,s.Lk)("mask",r,[t[1]||(t[1]=(0,s.Lk)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"},null,-1)),(0,s.Lk)("circle",{class:"theme_toggle_circle1",fill:"black",cx:d.isDark?"50%":"100%",cy:d.isDark?"23%":"0%",r:d.isDark?"9":"5"},null,8,o)]),(0,s.Lk)("circle",{class:"theme_toggle_circle2",cx:"12",cy:"12",r:d.isDark?"9":"5",mask:"url(#themeMask)"},null,8,l),(0,s.Lk)("g",{class:"theme_toggle_g",stroke:"currentColor",opacity:d.isDark?0:1},[...t[2]||(t[2]=[(0,s.Lk)("line",{x1:"12",y1:"1",x2:"12",y2:"3"},null,-1),(0,s.Lk)("line",{x1:"12",y1:"21",x2:"12",y2:"23"},null,-1),(0,s.Lk)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"},null,-1),(0,s.Lk)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"},null,-1),(0,s.Lk)("line",{x1:"1",y1:"12",x2:"3",y2:"12"},null,-1),(0,s.Lk)("line",{x1:"21",y1:"12",x2:"23",y2:"12"},null,-1),(0,s.Lk)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"},null,-1),(0,s.Lk)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"},null,-1)])],8,c)],2))]),_:1})])}var d={name:"ToggleDark",data(){return{isDark:this.$store.getters.useDarkMode,isAuto:!this.$store.getters.cusDarkMode}},methods:{handleToggleClick(){this.isAuto?(this.isDark=!1,this.isAuto=!1,this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!1)):this.isDark?(this.isAuto=!0,this.$store.commit("setCusDarkMode",!1)):(this.isDark=!0,this.$store.commit("setCusDarkMode",!0),this.$store.commit("setUseDarkMode",!0))}}},u=i(1241);const p=(0,u.A)(d,[["render",h],["__scopeId","data-v-466b2b5c"]]);var m=p},9667:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return as}});var s=i(6768),n=i(5130),a=i(4232);const r=["src"],o=["src"],l={key:2,class:"video-placeholder"},c={class:"audio-cover"},h=["src"],d={key:1,class:"audio-icon-large",viewBox:"0 0 24 24",fill:"currentColor"},u={class:"audio-info"},p={class:"audio-title"},m={key:0,class:"audio-artist"},g=["src"],f={key:4,class:"audio-placeholder"},y={class:"audio-name"};function b(e,t,i,b,v,w){return(0,s.uX)(),(0,s.CE)("div",{class:"tm-viewport",ref:"viewport",onPointerdown:t[3]||(t[3]=(...e)=>w.onPointerDown&&w.onPointerDown(...e)),onPointermove:t[4]||(t[4]=(...e)=>w.onPointerMove&&w.onPointerMove(...e)),onPointerup:t[5]||(t[5]=(...e)=>w.onPointerUp&&w.onPointerUp(...e)),onPointercancel:t[6]||(t[6]=(...e)=>w.onPointerUp&&w.onPointerUp(...e)),onDblclick:t[7]||(t[7]=(0,n.D$)((...e)=>w.onDblClick&&w.onDblClick(...e),["prevent"]))},[i.isImage?((0,s.uX)(),(0,s.CE)("img",{key:0,class:"tm-media",src:i.src,draggable:"false",style:(0,a.Tr)(w.mediaStyle),onLoad:t[0]||(t[0]=(...e)=>w.onLoad&&w.onLoad(...e))},null,44,r)):i.isVideo&&i.isActive?((0,s.uX)(),(0,s.CE)("div",{key:1,class:"tm-video-wrap",onPointerdown:t[1]||(t[1]=(0,n.D$)(()=>{},["stop"]))},[(0,s.Lk)("video",{ref:"videoEl",class:"plyr-video",src:i.src,playsinline:""},null,8,o)],32)):i.isVideo?((0,s.uX)(),(0,s.CE)("div",l,[...t[8]||(t[8]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M8 5v14l11-7z"})],-1)])])):i.isAudio&&i.isActive?((0,s.uX)(),(0,s.CE)("div",{key:3,class:"tm-audio-wrap",onPointerdown:t[2]||(t[2]=(0,n.D$)(()=>{},["stop"]))},[(0,s.Lk)("div",c,[v.audioCover?((0,s.uX)(),(0,s.CE)("img",{key:0,src:v.audioCover,class:"cover-img"},null,8,h)):((0,s.uX)(),(0,s.CE)("svg",d,[...t[9]||(t[9]=[(0,s.Lk)("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"},null,-1)])]))]),(0,s.Lk)("div",u,[(0,s.Lk)("div",p,(0,a.v_)(v.audioTitle),1),v.audioArtist?((0,s.uX)(),(0,s.CE)("div",m,(0,a.v_)(v.audioArtist),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("audio",{ref:"audioEl",class:"plyr-audio",src:i.src},null,8,g)],32)):i.isAudio?((0,s.uX)(),(0,s.CE)("div",f,[t[10]||(t[10]=(0,s.Lk)("svg",{class:"audio-icon-large",viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"})],-1)),(0,s.Lk)("span",y,(0,a.v_)(v.audioTitle),1)])):(0,s.Q3)("",!0)],544)}i(6573),i(8100),i(7936),i(8111),i(7588),i(9577),i(1549),i(9797),i(9631),i(5623),i(4603),i(7566),i(8721);var v=i(1114),w=(i(2489),i(1701),i(8335),i(1148),i(116),i(4114),i(3579),i(3975));const k=e=>null!==e&&"undefined"!==typeof e?e.constructor:null,T=(e,t)=>Boolean(e&&t&&e instanceof t),C=e=>null===e||"undefined"===typeof e,A=e=>k(e)===Object,S=e=>k(e)===Number&&!Number.isNaN(e),x=e=>k(e)===String,E=e=>k(e)===Boolean,M=e=>"function"===typeof e,L=e=>Array.isArray(e),P=e=>T(e,WeakMap),I=e=>T(e,NodeList),$=e=>k(e)===Text,N=e=>T(e,Event),D=e=>T(e,KeyboardEvent),F=e=>T(e,window.TextTrackCue)||T(e,window.VTTCue),_=e=>T(e,TextTrack)||!C(e)&&x(e.kind),R=e=>T(e,Promise)&&M(e.then);function O(e){return null!==e&&"object"===typeof e&&1===e.nodeType&&"object"===typeof e.style&&"object"===typeof e.ownerDocument}function H(e){return C(e)||(x(e)||L(e)||I(e))&&!e.length||A(e)&&!Object.keys(e).length}function V(e){if(T(e,window.URL))return!0;if(!x(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!H(new URL(t).hostname)}catch{return!1}}var j={nullOrUndefined:C,object:A,number:S,string:x,boolean:E,function:M,array:L,weakMap:P,nodeList:I,element:O,textNode:$,event:N,keyboardEvent:D,cue:F,track:_,promise:R,url:V,empty:H};const q=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find(t=>void 0!==e.style[t]);return!!j.string(i)&&t[i]})();function B(e,t){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},t)}i(8237),i(3110);function U(e){return JSON.parse(JSON.stringify(e))}function X(e,t){return t.split(".").reduce((e,t)=>e&&e[t],e)}function z(e={},...t){if(!t.length)return e;const i=t.shift();return j.object(i)?(Object.keys(i).forEach(t=>{j.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),z(e[t],i[t])):Object.assign(e,{[t]:i[t]})}),z(e,...t)):e}function W(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)})}function K(e,t){j.element(e)&&!j.empty(t)&&Object.entries(t).filter(([,e])=>!j.nullOrUndefined(e)).forEach(([t,i])=>e.setAttribute(t,i))}function Y(e,t,i){const s=document.createElement(e);return j.object(t)&&K(s,t),j.string(i)&&(s.textContent=i),s}function Q(e,t){j.element(e)&&j.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)}function J(e,t,i,s){j.element(t)&&t.appendChild(Y(e,i,s))}function G(e){j.nodeList(e)||j.array(e)?Array.from(e).forEach(G):j.element(e)&&j.element(e.parentNode)&&e.parentNode.removeChild(e)}function Z(e){if(!j.element(e))return;let{length:t}=e.childNodes;while(t>0)e.removeChild(e.lastChild),t-=1}function ee(e,t){return j.element(t)&&j.element(t.parentNode)&&j.element(e)?(t.parentNode.replaceChild(e,t),e):null}function te(e,t){if(!j.string(e)||j.empty(e))return{};const i={},s=z({},t);return e.split(",").forEach(e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,""),r=a.split("="),[o]=r,l=r.length>1?r[1].replace(/["']/g,""):"",c=t.charAt(0);switch(c){case".":j.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[o]=l;break;default:break}}),z(s,i)}function ie(e,t){if(!j.element(e))return;let i=t;j.boolean(i)||(i=!e.hidden),e.hidden=i}function se(e,t,i){if(j.nodeList(e))return Array.from(e).map(e=>se(e,t,i));if(j.element(e)){let s="toggle";return"undefined"!==typeof i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function ne(e,t){return j.element(e)&&e.classList.contains(t)}function ae(e,t){const{prototype:i}=Element;function s(){return Array.from(document.querySelectorAll(t)).includes(this)}const n=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||s;return n.call(e,t)}function re(e,t){const{prototype:i}=Element;function s(){let e=this;do{if(ae.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}const n=i.closest||s;return n.call(e,t)}function oe(e){return this.elements.container.querySelectorAll(e)}function le(e){return this.elements.container.querySelector(e)}function ce(e=null,t=!1){j.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const he={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},de={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=de[e]||"html5"!==t,s=i&&de.rangeInput;return{api:i,ui:s}},pip:(()=>document.pictureInPictureEnabled&&!Y("video").disablePictureInPicture)(),airplay:j.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(j.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(he).includes(i)&&(i+=`; codecs="${he[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==q,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches};var ue=de;const pe=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return e})();function me(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||j.empty(t)||!j.function(i))return;const r=t.split(" ");let o=a;pe&&(o={passive:n,capture:a}),r.forEach(t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:o}),e[s?"addEventListener":"removeEventListener"](t,i,o)})}function ge(e,t="",i,s=!0,n=!1){me.call(this,e,t,i,!0,s,n)}function fe(e,t="",i,s=!0,n=!1){me.call(this,e,t,i,!1,s,n)}function ye(e,t="",i,s=!0,n=!1){const a=(...r)=>{fe(e,t,a,s,n),i.apply(this,r)};me.call(this,e,t,a,!0,s,n)}function be(e,t="",i=!1,s={}){if(!j.element(e)||j.empty(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function ve(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)}),this.eventListeners=[])}function we(){return new Promise(e=>this.ready?setTimeout(e,0):ge.call(this,this.elements.container,"ready",e)).then(()=>{})}function ke(e){j.promise(e)&&e.then(null,()=>{})}function Te(e){return j.array(e)?e.filter((t,i)=>e.indexOf(t)===i):e}function Ce(e,t){return j.array(e)&&e.length?e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e):null}function Ae(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const Se=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((e,[t,i])=>({...e,[t/i]:[t,i]}),{});function xe(e){if(!j.array(e)&&(!j.string(e)||!e.includes(":")))return!1;const t=j.array(e)?e:e.split(":");return t.map(Number).every(j.number)}function Ee(e){if(!j.array(e)||!e.every(j.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function Me(e){const t=e=>xe(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!j.empty(this.embed)&&j.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return Ee(i)}function Le(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=Me.call(this,e);if(!j.array(i))return{};const[s,n]=Ee(i),a=Ae(`aspect-ratio: ${s}/${n}`),r=100/s*n;if(a?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${r}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*Number.parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-r)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:r,ratio:i}}function Pe(e,t,i=.05){const s=e/t,n=Ce(Object.keys(Se),s);return Math.abs(n-s)<=i?Se[n]:[e,t]}function Ie(){const e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);return[e,t]}const $e={getSources(){if(!this.isHTML5)return[];const e=Array.from(this.media.querySelectorAll("source"));return e.filter(e=>{const t=e.getAttribute("type");return!!j.empty(t)||ue.mime.call(this,t)})},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:$e.getSources.call(this).map(e=>Number(e.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,j.empty(this.config.ratio)||Le.call(e),Object.defineProperty(e.media,"quality",{get(){const t=$e.getSources.call(e),i=t.find(t=>t.getAttribute("src")===e.source);return i&&Number(i.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&j.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=$e.getSources.call(e),s=i.find(e=>Number(e.getAttribute("size"))===t);if(!s)return;const{currentTime:n,paused:a,preload:r,readyState:o,playbackRate:l}=e.media;e.media.src=s.getAttribute("src"),("none"!==r||o)&&(e.once("loadedmetadata",()=>{e.speed=l,e.currentTime=n,a||ke(e.play())}),e.media.load())}be.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(G($e.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};var Ne=$e;const De=Boolean(window.document.documentMode),Fe=/Edge/.test(navigator.userAgent),_e="WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),Re=/iPhone|iPod/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1,Oe="MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,He=/iPad|iPhone|iPod/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1;var Ve={isIE:De,isEdge:Fe,isWebKit:_e,isIPhone:Re,isIPadOS:Oe,isIos:He};function je(e){return`${e}-${Math.floor(1e4*Math.random())}`}function qe(e,...t){return j.empty(e)?e:e.toString().replace(/\{(\d+)\}/g,(e,i)=>t[i].toString())}function Be(e,t){return 0===e||0===t||Number.isNaN(e)||Number.isNaN(t)?0:(e/t*100).toFixed(2)}function Ue(e="",t="",i=""){return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString())}function Xe(e=""){return e.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())}function ze(e=""){let t=e.toString();return t=Ue(t,"-"," "),t=Ue(t,"_"," "),t=Xe(t),Ue(t," ","")}function We(e=""){let t=e.toString();return t=ze(t),t.charAt(0).toLowerCase()+t.slice(1)}function Ke(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.textContent}function Ye(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const Qe={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},Je={get(e="",t={}){if(j.empty(e)||j.empty(t))return"";let i=X(t.i18n,e);if(j.empty(i))return Object.keys(Qe).includes(e)?Qe[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach(([e,t])=>{i=Ue(i,e,t)}),i}};var Ge=Je;class Ze{constructor(e){(0,v.A)(this,"get",e=>{if(!Ze.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(j.empty(t))return null;const i=JSON.parse(t);return j.string(e)&&e.length?i[e]:i}),(0,v.A)(this,"set",e=>{if(!Ze.supported||!this.enabled)return;if(!j.object(e))return;let t=this.get();j.empty(t)&&(t={}),z(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch{}}),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}}var et=Ze;function tt(e,t="text",i=!1){return new Promise((s,n)=>{try{const n=new XMLHttpRequest;if(!("withCredentials"in n))return;i&&(n.withCredentials=!0),n.addEventListener("load",()=>{if("text"===t)try{s(JSON.parse(n.responseText))}catch{s(n.responseText)}else s(n.response)}),n.addEventListener("error",()=>{throw new Error(n.status)}),n.open("GET",e,!0),n.responseType=t,n.send()}catch(a){n(a)}})}function it(e,t){if(!j.string(e))return;const i="cache",s=j.string(t);let n=!1;const a=()=>null!==document.getElementById(t),r=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=et.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),s&&o.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);r(o,t.content)}}tt(e).then(e=>{if(!j.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch{}r(o,e)}}).catch(()=>{})}}const st=e=>Math.trunc(e/60/60%60,10),nt=e=>Math.trunc(e/60%60,10),at=e=>Math.trunc(e%60,10);function rt(e=0,t=!1,i=!1){if(!j.number(e))return rt(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=st(e);const a=nt(e),r=at(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(r)}`}const ot={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||Ve.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=le.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:oe.call(this,this.config.selectors.buttons.play),pause:le.call(this,this.config.selectors.buttons.pause),restart:le.call(this,this.config.selectors.buttons.restart),rewind:le.call(this,this.config.selectors.buttons.rewind),fastForward:le.call(this,this.config.selectors.buttons.fastForward),mute:le.call(this,this.config.selectors.buttons.mute),pip:le.call(this,this.config.selectors.buttons.pip),airplay:le.call(this,this.config.selectors.buttons.airplay),settings:le.call(this,this.config.selectors.buttons.settings),captions:le.call(this,this.config.selectors.buttons.captions),fullscreen:le.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=le.call(this,this.config.selectors.progress),this.elements.inputs={seek:le.call(this,this.config.selectors.inputs.seek),volume:le.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:le.call(this,this.config.selectors.display.buffer),currentTime:le.call(this,this.config.selectors.display.currentTime),duration:le.call(this,this.config.selectors.display.duration)},j.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon(e,t){const i="http://www.w3.org/2000/svg",s=ot.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");K(a,z(t,{"aria-hidden":"true",focusable:"false"}));const r=document.createElementNS(i,"use"),o=`${n}-${e}`;return"href"in r&&r.setAttributeNS("http://www.w3.org/1999/xlink","href",o),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(r),a},createLabel(e,t={}){const i=Ge.get(e,this.config),s={...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")};return Y("span",s,i)},createBadge(e){if(j.empty(e))return null;const t=Y("span",{class:this.config.classNames.menu.value});return t.appendChild(Y("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=z({},t);let s=We(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])}),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").includes(this.config.classNames.control)||z(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:j.empty(n.label)&&(n.label=s),j.empty(n.icon)&&(n.icon=e)}const a=Y(n.element);return n.toggle?(a.appendChild(ot.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(ot.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(ot.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(ot.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(ot.createIcon.call(this,n.icon)),a.appendChild(ot.createLabel.call(this,n.label))),z(i,te(this.config.selectors.buttons[s],i)),K(a,i),"play"===s?(j.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=Y("input",z(te(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":Ge.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,ot.updateRangeFill.call(this,i),w.setup(i),i},createProgress(e,t){const i=Y("progress",z(te(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(Y("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?Ge.get(t,this.config):"";i.textContent=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=te(this.config.selectors.display[e],t),s=Y("div",z(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":Ge.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){ge.call(this,e,"keydown keyup",i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=ae(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))ot.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,j.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,j.element(t)||(t=e.parentNode.lastElementChild)),ce.call(this,t,!0))}},!1),ge.call(this,e,"keyup",e=>{"Return"===e.key&&ot.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const r=te(this.config.selectors.inputs[i]),o=Y("button",z(r,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${r.class?r.class:""}`.trim(),"aria-checked":a,value:e})),l=Y("span");l.innerHTML=s,j.element(n)&&l.appendChild(n),o.appendChild(l),Object.defineProperty(o,"checked",{enumerable:!0,get(){return"true"===o.getAttribute("aria-checked")},set(e){e&&Array.from(o.parentNode.children).filter(e=>ae(e,'[role="menuitemradio"]')).forEach(e=>e.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(o,"click keyup",t=>{if(!j.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=Number.parseFloat(e);break;default:break}ot.showMenuPanel.call(this,"home",j.keyboardEvent(t))}},i,!1),ot.bindMenuItemShortcuts.call(this,o,i),t.appendChild(o)},formatTime(e=0,t=!1){if(!j.number(e))return e;const i=st(this.duration)>0;return rt(e,i,t)},updateTimeDisplay(e=null,t=0,i=!1){j.element(e)&&j.number(t)&&(e.textContent=ot.formatTime(t,i))},updateVolume(){this.supported.ui&&(j.element(this.elements.inputs.volume)&&ot.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),j.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){j.element(e)&&(e.value=t,ot.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!j.event(e))return;let t=0;const i=(e,t)=>{const i=j.number(t)?t:0,s=j.element(e)?e:this.elements.display.buffer;if(j.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];j.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":t=Be(this.currentTime,this.duration),"timeupdate"===e.type&&ot.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered);break;default:break}},updateRangeFill(e){const t=j.event(e)?e.target:e;if(j.element(t)&&"range"===t.getAttribute("type")){if(ae(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=ot.formatTime(this.currentTime),i=ot.formatTime(this.duration),s=Ge.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(ae(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(Ve.isWebKit||Ve.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){if(!this.config.tooltips.seek||!j.element(this.elements.inputs.seek)||!j.element(this.elements.display.seekTooltip)||0===this.duration)return;const t=this.elements.display.seekTooltip,i=`${this.config.classNames.tooltip}--visible`,s=e=>se(t,i,e);if(this.touch)return void s(!1);let n=0;const a=this.elements.progress.getBoundingClientRect();if(j.event(e)){const t=e.pageX-e.clientX;n=100/a.width*(e.pageX-a.left-t)}else{if(!ne(t,i))return;n=Number.parseFloat(t.style.left,10)}n<0?n=0:n>100&&(n=100);const r=this.duration/100*n;t.textContent=ot.formatTime(r);const o=this.config.markers?.points?.find(({time:e})=>e===Math.round(r));o&&t.insertAdjacentHTML("afterbegin",`${o.label}<br>`),t.style.left=`${n}%`,j.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&s("mouseenter"===e.type)},timeUpdate(e){const t=!j.element(this.elements.display.duration)&&this.config.invertTime;ot.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||ot.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return ie(this.elements.display.currentTime,!0),void ie(this.elements.progress,!0);j.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=j.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&ot.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&ot.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&ot.setMarkers.call(this),ot.updateSeekTooltip.call(this)},toggleMenuButton(e,t){ie(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=j.empty(i)?this[e]:i,j.empty(n)&&(n=this.config[e].default),!j.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(j.element(a)||(a=s&&s.querySelector('[role="menu"]')),!j.element(a))return;const r=this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`);r.innerHTML=ot.getLabel.call(this,e,n);const o=a&&a.querySelector(`[value="${n}"]`);j.element(o)&&(o.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?Ge.get("normal",this.config):`${t}&times;`;case"quality":if(j.number(t)){const e=Ge.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return Xe(t);case"captions":return ut.getLabel.call(this);default:return null}},setQualityMenu(e){if(!j.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');j.array(e)&&(this.options.quality=Te(e).filter(e=>this.config.quality.options.includes(e)));const s=!j.empty(this.options.quality)&&this.options.quality.length>1;if(ot.toggleMenuButton.call(this,t,s),Z(i),ot.checkMenu.call(this),!s)return;const n=e=>{const t=Ge.get(`qualityBadge.${e}`,this.config);return t.length?ot.createBadge.call(this,t):null};this.options.quality.sort((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1}).forEach(e=>{ot.createMenuItem.call(this,{value:e,list:i,type:t,title:ot.getLabel.call(this,"quality",e),badge:n(e)})}),ot.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!j.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=ut.getTracks.call(this),s=Boolean(i.length);if(ot.toggleMenuButton.call(this,e,s),Z(t),ot.checkMenu.call(this),!s)return;const n=i.map((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:ut.getLabel.call(this,e),badge:e.language&&ot.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"}));n.unshift({value:-1,checked:!this.captions.toggled,title:Ge.get("disabled",this.config),list:t,type:"language"}),n.forEach(ot.createMenuItem.bind(this)),ot.updateSetting.call(this,e,t)},setSpeedMenu(){if(!j.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(e=>e>=this.minimumSpeed&&e<=this.maximumSpeed);const i=!j.empty(this.options.speed)&&this.options.speed.length>1;ot.toggleMenuButton.call(this,e,i),Z(t),ot.checkMenu.call(this),i&&(this.options.speed.forEach(i=>{ot.createMenuItem.call(this,{value:i,list:t,type:e,title:ot.getLabel.call(this,"speed",i)})}),ot.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!j.empty(e)&&Object.values(e).some(e=>!e.hidden);ie(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;j.element(i)||(i=Object.values(this.elements.settings.panels).find(e=>!e.hidden));const s=i.querySelector('[role^="menuitem"]');ce.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!j.element(t)||!j.element(i))return;const{hidden:s}=t;let n=s;if(j.boolean(e))n=e;else if(j.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(j.event(e)){const s=j.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),ie(t,!n),se(this.elements.container,this.config.classNames.menu.open,n),n&&j.keyboardEvent(e)?ot.focusFirstMenuItem.call(this,null,!0):n||s||ce.call(this,i,j.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return G(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!j.element(i))return;const s=i.parentNode,n=Array.from(s.children).find(e=>!e.hidden);if(ue.transitions&&!ue.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=ot.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",fe.call(this,s,q,t))};ge.call(this,s,q,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}ie(n,!0),ie(i,!1),ot.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;j.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:r,setSpeedMenu:o,showMenuPanel:l}=ot;this.elements.controls=null,j.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=Y("div",te(this.config.selectors.controls.wrapper));this.elements.controls=c;const h={class:"plyr__controls__item"};return Te(j.array(this.config.controls)?this.config.controls:[]).forEach(r=>{if("restart"===r&&c.appendChild(i.call(this,"restart",h)),"rewind"===r&&c.appendChild(i.call(this,"rewind",h)),"play"===r&&c.appendChild(i.call(this,"play",h)),"fast-forward"===r&&c.appendChild(i.call(this,"fast-forward",h)),"progress"===r){const t=Y("div",{class:`${h.class} plyr__progress__container`}),i=Y("div",te(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=Y("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===r&&c.appendChild(a.call(this,"currentTime",h)),"duration"===r&&c.appendChild(a.call(this,"duration",h)),"mute"===r||"volume"===r){let{volume:t}=this.elements;if(j.element(t)&&c.contains(t)||(t=Y("div",z({},h,{class:`${h.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===r&&t.appendChild(i.call(this,"mute")),"volume"===r&&!Ve.isIos&&!Ve.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",z(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===r&&c.appendChild(i.call(this,"captions",h)),"settings"===r&&!j.empty(this.config.settings)){const s=Y("div",z({},h,{class:`${h.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=Y("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=Y("div"),r=Y("div",{id:`plyr-settings-${e.id}-home`}),o=Y("div",{role:"menu"});r.appendChild(o),a.appendChild(r),this.elements.settings.panels.home=r,this.config.settings.forEach(i=>{const s=Y("button",z(te(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),ge.call(this,s,"click",()=>{l.call(this,i,!1)});const n=Y("span",null,Ge.get(i,this.config)),r=Y("span",{class:this.config.classNames.menu.value});r.innerHTML=e[i],n.appendChild(r),s.appendChild(n),o.appendChild(s);const c=Y("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),h=Y("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});h.appendChild(Y("span",{"aria-hidden":!0},Ge.get(i,this.config))),h.appendChild(Y("span",{class:this.config.classNames.hidden},Ge.get("menuBack",this.config))),ge.call(this,c,"keydown",e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),l.call(this,"home",!0))},!1),ge.call(this,h,"click",()=>{l.call(this,"home",!1)}),c.appendChild(h),c.appendChild(Y("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c}),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===r&&ue.pip&&c.appendChild(i.call(this,"pip",h)),"airplay"===r&&ue.airplay&&c.appendChild(i.call(this,"airplay",h)),"download"===r){const e=z({},h,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!j.url(t)&&this.isEmbed&&z(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===r&&c.appendChild(i.call(this,"fullscreen",h))}),this.isHTML5&&r.call(this,Ne.getQualityOptions.call(this)),o.call(this),c},inject(){if(this.config.loadSprite){const e=ot.getIconUrl.call(this);e.cors&&it(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;j.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),j.element(this.config.controls)||j.string(this.config.controls)?e=this.config.controls:(e=ot.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:ut.getLabel.call(this)}),i=!1);const s=e=>{let i=e;return Object.entries(t).forEach(([e,t])=>{i=Ue(i,`{${e}}`,t)}),i};let n;i&&j.string(this.config.controls)&&(e=s(e)),j.string(this.config.selectors.controls.container)&&(n=document.querySelector(this.config.selectors.controls.container)),j.element(n)||(n=this.elements.container);const a=j.element(e)?"insertAdjacentElement":"insertAdjacentHTML";if(n[a]("afterbegin",e),j.element(this.elements.controls)||ot.findElements.call(this),!j.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get(){return ne(e,t)},set(i=!1){se(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach(t=>{j.array(t)||j.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)})}if(Ve.isEdge&&B(n),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=oe.call(this,i);Array.from(s).forEach(e=>{se(e,this.config.classNames.hidden,!1),se(e,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){if(!this.duration||this.elements.markers)return;const e=this.config.markers?.points?.filter(({time:e})=>e>0&&e<this.duration);if(!e?.length)return;const t=document.createDocumentFragment(),i=document.createDocumentFragment();let s=null;const n=`${this.config.classNames.tooltip}--visible`,a=e=>se(s,n,e);e.forEach(e=>{const t=Y("span",{class:this.config.classNames.marker},""),n=e.time/this.duration*100+"%";s&&(t.addEventListener("mouseenter",()=>{e.label||(s.style.left=n,s.innerHTML=e.label,a(!0))}),t.addEventListener("mouseleave",()=>{a(!1)})),t.addEventListener("click",()=>{this.currentTime=e.time}),t.style.left=n,i.appendChild(t)}),t.appendChild(i),this.config.tooltips.seek||(s=Y("span",{class:this.config.classNames.tooltip},""),t.appendChild(s)),this.elements.markers={points:i,tip:s},this.elements.progress.appendChild(t)}};var lt=ot;function ct(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch{return null}}function ht(e){const t=new URLSearchParams;return j.object(e)&&Object.entries(e).forEach(([e,i])=>{t.set(e,i)}),t}const dt={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!ue.textTracks)return void(j.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&lt.setCaptionsMenu.call(this));if(j.element(this.elements.captions)||(this.elements.captions=Y("div",te(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),Q(this.elements.captions,this.elements.wrapper)),Ve.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach(e=>{const t=e.getAttribute("src"),i=ct(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&tt(t,"blob").then(t=>{e.setAttribute("src",window.URL.createObjectURL(t))}).catch(()=>{G(e)})})}const e=navigator.languages||[navigator.language||navigator.userLanguage||"en"],t=Te(e.map(e=>e.split("-")[0]));let i=(this.storage.get("language")||this.captions.language||this.config.captions.language||"auto").toLowerCase();"auto"===i&&([i]=t);let s=this.storage.get("captions")||this.captions.active;if(j.boolean(s)||({active:s}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:s,language:i,languages:t}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";ge.call(this,this.media.textTracks,e,dt.update.bind(this))}setTimeout(dt.update.bind(this),0)},update(){const e=dt.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find(e=>e.language===i));this.isHTML5&&this.isVideo&&e.filter(e=>!s.get(e)).forEach(e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),ge.call(this,e,"cuechange",()=>dt.updateCues.call(this))}),(a&&this.language!==i||!e.includes(n))&&(dt.setLanguage.call(this,i),dt.toggle.call(this,t&&a)),this.elements&&se(this.elements.container,this.config.classNames.captions.enabled,!j.empty(e)),j.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&lt.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=j.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=dt.getTracks.call(this),t=dt.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void dt.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),se(this.elements.container,s,n),this.captions.toggled=n,lt.updateSetting.call(this,"captions"),be.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout(()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,t=!0){const i=dt.getTracks.call(this);if(-1!==e)if(j.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,lt.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),be.call(this,this.media,"languagechange")}dt.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&dt.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else dt.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!j.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=dt.getTracks.call(this),n=dt.findTrack.call(this,[i]);dt.set.call(this,s.indexOf(n),t)},getTracks(e=!1){const t=Array.from((this.media||{}).textTracks||[]);return t.filter(t=>!this.isHTML5||e||this.captions.meta.has(t)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(e,t=!1){const i=dt.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort((e,t)=>s(t)-s(e));let a;return e.every(e=>(a=n.find(t=>t.language===e),!a)),a||(t?n[0]:void 0)},getCurrentTrack(){return dt.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!j.track(t)&&ue.textTracks&&this.captions.toggled&&(t=dt.getCurrentTrack.call(this)),j.track(t)?j.empty(t.label)?j.empty(t.language)?Ge.get("enabled",this.config):e.language.toUpperCase():t.label:Ge.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!j.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!j.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=dt.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map(e=>e.getCueAsHTML()).map(Ye)}const i=t.map(e=>e.trim()).join("\n"),s=i!==this.elements.captions.innerHTML;if(s){Z(this.elements.captions);const e=Y("span",te(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),be.call(this,this.media,"cuechange")}}};var ut=dt;const pt={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.8.3/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:"",withCredentials:!1},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}};var mt=pt;const gt={active:"picture-in-picture",inactive:"inline"};const ft={html5:"html5",youtube:"youtube",vimeo:"vimeo"},yt={audio:"audio",video:"video"};function bt(e){return/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?ft.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?ft.vimeo:null}function vt(){}class wt{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):vt}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):vt}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):vt}}class kt{constructor(e){(0,v.A)(this,"onChange",()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;j.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;be.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)}),(0,v.A)(this,"toggleFallback",(e=!1)=>{if(e?this.scrollPosition={x:window.scrollX??0,y:window.scrollY??0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",se(this.target,this.player.config.classNames.fullscreen.fallback,e),Ve.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=j.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter(e=>e.trim()!==i).join(","))}this.onChange()}),(0,v.A)(this,"trapFocus",e=>{if(Ve.isIos||Ve.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=oe.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())}),(0,v.A)(this,"update",()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":kt.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");se(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)}),(0,v.A)(this,"enter",()=>{this.supported&&(Ve.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!kt.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?j.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),(0,v.A)(this,"exit",()=>{if(this.supported)if(Ve.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),ke(this.player.play());else if(!kt.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!j.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),(0,v.A)(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=e,this.prefix=kt.prefix,this.property=kt.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===e.config.fullscreen.fallback,this.player.elements.fullscreen=e.config.fullscreen.container&&re(this.player.elements.container,e.config.fullscreen.container),ge.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),ge.call(this.player,this.player.elements.container,"dblclick",e=>{j.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")}),ge.call(this,this.player.elements.container,"keydown",e=>this.trapFocus(e)),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return kt.nativeSupported&&!this.forceFallback}static get prefix(){if(j.function(document.exitFullscreen))return"";let e="";const t=["webkit","moz","ms"];return t.some(t=>!(!j.function(document[`${t}ExitFullscreen`])&&!j.function(document[`${t}CancelFullScreen`]))&&(e=t,!0)),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,kt.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||kt.nativeSupported||!Ve.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!kt.nativeSupported||this.forceFallback)return ne(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return Ve.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}var Tt=kt;function Ct(e,t=1){return new Promise((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})})}const At={addStyleHook(){se(this.elements.container,this.config.selectors.container.replace(".",""),!0),se(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void At.toggleNativeControls.call(this,!0);j.element(this.elements.controls)||(lt.inject.call(this),this.listeners.controls()),At.toggleNativeControls.call(this),this.isHTML5&&ut.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,lt.updateVolume.call(this),lt.timeUpdate.call(this),lt.durationUpdate.call(this),At.checkPlaying.call(this),se(this.elements.container,this.config.classNames.pip.supported,ue.pip&&this.isHTML5&&this.isVideo),se(this.elements.container,this.config.classNames.airplay.supported,ue.airplay&&this.isHTML5),se(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{be.call(this,this.media,"ready")},0),At.setTitle.call(this),this.poster&&At.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&lt.durationUpdate.call(this),this.config.mediaMetadata&&lt.setMediaMetadata.call(this)},setTitle(){let e=Ge.get("play",this.config);if(j.string(this.config.title)&&!j.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(t=>{t.setAttribute("aria-label",e)}),this.isEmbed){const e=le.call(this,"iframe");if(!j.element(e))return;const t=j.empty(this.config.title)?"video":this.config.title,i=Ge.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){se(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),we.call(this).then(()=>Ct(e)).catch(t=>{throw e===this.poster&&At.togglePoster.call(this,!1),t}).then(()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),At.togglePoster.call(this,!0),e)))},checkPlaying(e){se(this.elements.container,this.config.classNames.playing,this.playing),se(this.elements.container,this.config.classNames.paused,this.paused),se(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",Ge.get(this.playing?"pause":"play",this.config))}),j.event(e)&&"timeupdate"===e.type||At.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{se(this.elements.container,this.config.classNames.loading,this.loading),At.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!j.empty(e)&&j.string(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),j.empty(this.media.style)&&this.media.removeAttribute("style")}};var St=At;class xt{constructor(e){(0,v.A)(this,"firstTouch",()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,se(t.container,e.config.classNames.isTouch,!0)}),(0,v.A)(this,"global",(e=!0)=>{const{player:t}=this;t.config.keyboard.global&&me.call(t,window,"keydown keyup",this.handleKey,e,!1),me.call(t,document.body,"click",this.toggleMenu,e),ye.call(t,document.body,"touchstart",this.firstTouch)}),(0,v.A)(this,"container",()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&ge.call(e,i.container,"keydown keyup",this.handleKey,!1),ge.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);const a=["touchstart","touchmove","mousemove"].includes(t.type);let r=0;a&&(St.toggleControls.call(e,!0),r=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout(()=>St.toggleControls.call(e,!1),r)});const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=Me.call(e),r=Ae(`aspect-ratio: ${n} / ${a}`);if(!s)return void(r?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[o,l]=Ie(),c=o/l>n/a;r?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?l/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};ge.call(e,i.container,"enterfullscreen exitfullscreen",t=>{const{target:s}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&j.empty(e.config.ratio))return;n();const r="enterfullscreen"===t.type?ge:fe;r.call(e,window,"resize",a)})}),(0,v.A)(this,"media",()=>{const{player:e}=this,{elements:t}=e;if(ge.call(e,e.media,"timeupdate seeking seeked",t=>lt.timeUpdate.call(e,t)),ge.call(e,e.media,"durationchange loadeddata loadedmetadata",t=>lt.durationUpdate.call(e,t)),ge.call(e,e.media,"ended",()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())}),ge.call(e,e.media,"progress playing seeking seeked",t=>lt.updateProgress.call(e,t)),ge.call(e,e.media,"volumechange",t=>lt.updateVolume.call(e,t)),ge.call(e,e.media,"playing play pause ended emptied timeupdate",t=>St.checkPlaying.call(e,t)),ge.call(e,e.media,"waiting canplay seeked playing",t=>St.checkLoading.call(e,t)),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=le.call(e,`.${e.config.classNames.video}`);if(!j.element(i))return;ge.call(e,t.container,"click",s=>{const n=[t.container,i];(n.includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,()=>{ke(e.play())},"play")):this.proxy(s,()=>{ke(e.togglePlay())},"play")))})}e.supported.ui&&e.config.disableContextMenu&&ge.call(e,t.wrapper,"contextmenu",e=>{e.preventDefault()},!1),ge.call(e,e.media,"volumechange",()=>{e.storage.set({volume:e.volume,muted:e.muted})}),ge.call(e,e.media,"ratechange",()=>{lt.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})}),ge.call(e,e.media,"qualitychange",t=>{lt.updateSetting.call(e,"quality",null,t.detail.quality)}),ge.call(e,e.media,"ready qualitychange",()=>{lt.setDownloadUrl.call(e)});const i=e.config.events.concat(["keyup","keydown"]).join(" ");ge.call(e,e.media,i,i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),be.call(e,t.container,i.type,!0,s)})}),(0,v.A)(this,"proxy",(e,t,i)=>{const{player:s}=this,n=s.config.listeners[i],a=j.function(n);let r=!0;a&&(r=n.call(s,e)),!1!==r&&j.function(t)&&t.call(s,e)}),(0,v.A)(this,"bind",(e,t,i,s,n=!0)=>{const{player:a}=this,r=a.config.listeners[s],o=j.function(r);ge.call(a,e,t,e=>this.proxy(e,i,s),n&&!o)}),(0,v.A)(this,"controls",()=>{const{player:e}=this,{elements:t}=e,i=Ve.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach(t=>{this.bind(t,"click",()=>{ke(e.togglePlay())},"play")}),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",()=>{e.lastSeekTime=Date.now(),e.rewind()},"rewind"),this.bind(t.buttons.fastForward,"click",()=>{e.lastSeekTime=Date.now(),e.forward()},"fastForward"),this.bind(t.buttons.mute,"click",()=>{e.muted=!e.muted},"mute"),this.bind(t.buttons.captions,"click",()=>e.toggleCaptions()),this.bind(t.buttons.download,"click",()=>{be.call(e,e.media,"download")},"download"),this.bind(t.buttons.fullscreen,"click",()=>{e.fullscreen.toggle()},"fullscreen"),this.bind(t.buttons.pip,"click",()=>{e.pip="toggle"},"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",t=>{t.stopPropagation(),t.preventDefault(),lt.toggleMenu.call(e,t)},null,!1),this.bind(t.buttons.settings,"keyup",t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),lt.toggleMenu.call(e,t)):lt.focusFirstMenuItem.call(e,null,!0))},null,!1),this.bind(t.settings.menu,"keydown",t=>{"Escape"===t.key&&lt.toggleMenu.call(e,t)}),this.bind(t.inputs.seek,"mousedown mousemove",e=>{const i=t.progress.getBoundingClientRect(),s=e.pageX-e.clientX,n=100/i.width*(e.pageX-i.left-s);e.currentTarget.setAttribute("seek-value",n)}),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",t=>{const i=t.currentTarget,s="play-on-seeked";if(j.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),ke(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())}),Ve.isIos){const t=oe.call(e,'input[type="range"]');Array.from(t).forEach(e=>this.bind(e,i,e=>B(e.target)))}this.bind(t.inputs.seek,i,t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");j.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration},"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",t=>lt.updateSeekTooltip.call(e,t)),this.bind(t.progress,"mousemove touchmove",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)}),this.bind(t.progress,"mouseleave touchend click",()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)}),this.bind(t.progress,"mousedown touchstart",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)}),this.bind(t.progress,"mouseup touchend",t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)}),Ve.isWebKit&&Array.from(oe.call(e,'input[type="range"]')).forEach(t=>{this.bind(t,"input",t=>lt.updateRangeFill.call(e,t.target))}),e.config.toggleInvert&&!j.element(t.display.duration)&&this.bind(t.display.currentTime,"click",()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,lt.timeUpdate.call(e))}),this.bind(t.inputs.volume,i,t=>{e.volume=t.target.value},"volume"),this.bind(t.controls,"mouseenter mouseleave",i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type}),t.fullscreen&&Array.from(t.fullscreen.children).filter(e=>!e.contains(t.container)).forEach(i=>{this.bind(i,"mouseenter mouseleave",i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)})}),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)}),this.bind(t.controls,"focusin",()=>{const{config:i,timers:s}=e;se(t.controls,i.classNames.noTransition,!0),St.toggleControls.call(e,!0),setTimeout(()=>{se(t.controls,i.classNames.noTransition,!1)},0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout(()=>St.toggleControls.call(e,!1),n)}),this.bind(t.inputs.volume,"wheel",t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map(e=>i?-e:e),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:r}=e.media;(1===a&&r<1||-1===a&&r>0)&&t.preventDefault()},"volume",!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:r,metaKey:o,shiftKey:l}=e,c="keydown"===n,h=c&&s===this.lastKey;if(a||r||o||l)return;if(!s)return;const d=e=>{t.currentTime=t.duration/10*e};if(c){const n=document.activeElement;if(j.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&ae(n,s))return;if(" "===e.key&&ae(n,'button, [role^="menuitem"]'))return}const a=[" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"];switch(a.includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":h||d(Number.parseInt(s,10));break;case" ":case"k":h||ke(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":h||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":h||t.toggleCaptions();break;case"l":t.loop=!t.loop;break;default:break}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null}toggleMenu(e){lt.toggleMenu.call(this.player,e)}}var Et=xt,Mt=i(1583);function Lt(e){return new Promise((t,i)=>{Mt(e,{success:t,error:i})})}function Pt(e){if(j.empty(e))return null;if(j.number(Number(e)))return e;const t=/^.*(vimeo.com\/|video\/)(\d+).*/,i=e.match(t);return i?i[2]:e}function It(e){const t=/^.*(vimeo.com\/|video\/)(\d+)(\?.*h=|\/)+([\d,a-f]+)/,i=e.match(t);return i&&5===i.length?i[4]:null}function $t(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,be.call(this,this.media,e?"play":"pause"))}const Nt={setup(){const e=this;se(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,Le.call(e),j.object(window.Vimeo)?Nt.ready.call(e):Lt(e.config.urls.vimeo.sdk).then(()=>{Nt.ready.call(e)}).catch(t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)})},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;let a=e.media.getAttribute("src"),r="";j.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),r=e.media.getAttribute(e.config.attributes.embed.hash)):r=It(a);const o=r?{h:r}:{};i&&Object.assign(n,{controls:!1,sidedock:!1});const l=ht({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...o,...n}),c=Pt(a),h=Y("iframe"),d=qe(e.config.urls.vimeo.iframe,c,l);if(h.setAttribute("src",d),h.setAttribute("allowfullscreen",""),h.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),j.empty(s)||h.setAttribute("referrerPolicy",s),i||!t.customControls)h.setAttribute("data-poster",e.poster),e.media=ee(h,e.media);else{const t=Y("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(h),e.media=ee(t,e.media)}t.customControls||tt(qe(e.config.urls.vimeo.api,d)).then(t=>{!j.empty(t)&&t.thumbnail_url&&St.setPoster.call(e,t.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(h,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>($t.call(e,!0),e.embed.play()),e.media.pause=()=>($t.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:u}=e.media;Object.defineProperty(e.media,"currentTime",{get(){return u},set(t){const{embed:i,media:s,paused:n,volume:a}=e,r=n&&!i.hasPlayed;s.seeking=!0,be.call(e,s,"seeking"),Promise.resolve(r&&i.setVolume(0)).then(()=>i.setCurrentTime(t)).then(()=>r&&i.pause()).then(()=>r&&i.setVolume(a)).catch(()=>{})}});let p=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get(){return p},set(t){e.embed.setPlaybackRate(t).then(()=>{p=t,be.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:m}=e.config;Object.defineProperty(e.media,"volume",{get(){return m},set(t){e.embed.setVolume(t).then(()=>{m=t,be.call(e,e.media,"volumechange")})}});let{muted:g}=e.config;Object.defineProperty(e.media,"muted",{get(){return g},set(t){const i=!!j.boolean(t)&&t;e.embed.setMuted(!!i||e.config.muted).then(()=>{g=i,be.call(e,e.media,"volumechange")})}});let f,{loop:y}=e.config;Object.defineProperty(e.media,"loop",{get(){return y},set(t){const i=j.boolean(t)?t:e.config.loop.active;e.embed.setLoop(i).then(()=>{y=i})}}),e.embed.getVideoUrl().then(t=>{f=t,lt.setDownloadUrl.call(e)}).catch(e=>{this.debug.warn(e)}),Object.defineProperty(e.media,"currentSrc",{get(){return f}}),Object.defineProperty(e.media,"ended",{get(){return e.currentTime===e.duration}}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(t=>{const[i,s]=t;e.embed.ratio=Pe(i,s),Le.call(this)}),e.embed.setAutopause(e.config.autopause).then(t=>{e.config.autopause=t}),e.embed.getVideoTitle().then(t=>{e.config.title=t,St.setTitle.call(this)}),e.embed.getCurrentTime().then(t=>{u=t,be.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(t=>{e.media.duration=t,be.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(t=>{e.media.textTracks=t,ut.setup.call(e)}),e.embed.on("cuechange",({cues:t=[]})=>{const i=t.map(e=>Ke(e.text));ut.updateCues.call(e,i)}),e.embed.on("loaded",()=>{if(e.embed.getPaused().then(t=>{$t.call(e,!t),t||be.call(e,e.media,"playing")}),j.element(e.embed.element)&&e.supported.ui){const t=e.embed.element;t.setAttribute("tabindex",-1)}}),e.embed.on("bufferstart",()=>{be.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{be.call(e,e.media,"playing")}),e.embed.on("play",()=>{$t.call(e,!0),be.call(e,e.media,"playing")}),e.embed.on("pause",()=>{$t.call(e,!1)}),e.embed.on("timeupdate",t=>{e.media.seeking=!1,u=t.seconds,be.call(e,e.media,"timeupdate")}),e.embed.on("progress",t=>{e.media.buffered=t.percent,be.call(e,e.media,"progress"),1===Number.parseInt(t.percent,10)&&be.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(t=>{t!==e.media.duration&&(e.media.duration=t,be.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,be.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,be.call(e,e.media,"ended")}),e.embed.on("error",t=>{e.media.error=t,be.call(e,e.media,"error")}),t.customControls&&setTimeout(()=>St.build.call(e),0)}};var Dt=Nt;function Ft(e){if(j.empty(e))return null;const t=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/,i=e.match(t);return i&&i[2]?i[2]:e}function _t(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,be.call(this,this.media,e?"play":"pause"))}function Rt(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const Ot={setup(){if(se(this.elements.wrapper,this.config.classNames.embed,!0),j.object(window.YT)&&j.function(window.YT.Player))Ot.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{j.function(e)&&e(),Ot.ready.call(this)},Lt(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(e){const t=qe(this.config.urls.youtube.api,e);tt(t).then(e=>{if(j.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,St.setTitle.call(this),this.embed.ratio=Pe(s,i)}Le.call(this)}).catch(()=>{Le.call(this)})},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!j.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");j.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=Ft(s),a=je(e.provider),r=Y("div",{id:a,"data-poster":t.customControls?e.poster:void 0});if(e.media=ee(r,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;Ct(t("maxres"),121).catch(()=>Ct(t("sd"),121)).catch(()=>Ct(t("hq"))).then(t=>St.setPoster.call(e,t.src)).then(t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:n,host:Rt(t),playerVars:z({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occurred";e.media.error={code:i,message:s},be.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),be.call(e,e.media,"ratechange")},onReady(i){if(j.function(e.media.play))return;const s=i.target;Ot.getTitle.call(e,n),e.media.play=()=>{_t.call(e,!0),s.playVideo()},e.media.pause=()=>{_t.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get(){return Number(s.getCurrentTime())},set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,be.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get(){return s.getPlaybackRate()},set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get(){return a},set(t){a=t,s.setVolume(100*a),be.call(e,e.media,"volumechange")}});let{muted:r}=e.config;Object.defineProperty(e.media,"muted",{get(){return r},set(t){const i=j.boolean(t)?t:r;r=i,s[i?"mute":"unMute"](),s.setVolume(100*a),be.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get(){return s.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get(){return e.currentTime===e.duration}});const o=s.getAvailablePlaybackRates();e.options.speed=o.filter(t=>e.config.speed.options.includes(t)),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),be.call(e,e.media,"timeupdate"),be.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBuffered<e.media.buffered)&&be.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,1===e.media.buffered&&(clearInterval(e.timers.buffering),be.call(e,e.media,"canplaythrough"))},200),t.customControls&&setTimeout(()=>St.build.call(e),50)},onStateChange(i){const s=i.target;clearInterval(e.timers.playing);const n=e.media.seeking&&[1,2].includes(i.data);switch(n&&(e.media.seeking=!1,be.call(e,e.media,"seeked")),i.data){case-1:be.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),be.call(e,e.media,"progress");break;case 0:_t.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):be.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(_t.call(e,!0),be.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{be.call(e,e.media,"timeupdate")},50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),be.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),_t.call(e,!1);break;case 3:be.call(e,e.media,"waiting");break;default:break}be.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}};var Ht=Ot;const Vt={setup(){this.media?(se(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),se(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&se(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=Y("div",{class:this.config.classNames.video}),W(this.media,this.elements.wrapper),this.elements.poster=Y("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ne.setup.call(this):this.isYouTube?Ht.setup.call(this):this.isVimeo&&Dt.setup.call(this)):this.debug.warn("No media element found!")}};var jt=Vt;function qt(e){e.manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()}class Bt{constructor(e){(0,v.A)(this,"load",()=>{this.enabled&&(j.object(window.google)&&j.object(window.google.ima)?this.ready():Lt(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),(0,v.A)(this,"ready",()=>{this.enabled||qt(this),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),(0,v.A)(this,"setupIMA",()=>{this.elements.container=Y("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>this.onAdsManagerLoaded(e),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e),!1),this.requestAds()}),(0,v.A)(this,"requestAds",()=>{const{container:e}=this.player.elements;try{const t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(t){this.onAdError(t)}}),(0,v.A)(this,"pollCountdown",(e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");const t=()=>{const e=rt(Math.max(this.manager.getRemainingTime(),0)),t=`${Ge.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)};this.countdownTimer=setInterval(t,100)}),(0,v.A)(this,"onAdsManagerLoaded",e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,e=>this.onAdError(e)),Object.keys(google.ima.AdEvent.Type).forEach(e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],e=>this.onAdEvent(e))}),this.trigger("loaded")}),(0,v.A)(this,"addCuePoints",()=>{j.empty(this.cuePoints)||this.cuePoints.forEach(e=>{if(0!==e&&-1!==e&&e<this.player.duration){const t=this.player.elements.progress;if(j.element(t)){const i=100/this.player.duration*e,s=Y("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,t.appendChild(s)}}})}),(0,v.A)(this,"onAdEvent",e=>{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData(),n=e=>{be.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)};switch(n(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`);break;default:break}}),(0,v.A)(this,"onAdError",e=>{this.cancel(),this.player.debug.warn("Ads error",e)}),(0,v.A)(this,"listeners",()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{t=this.player.currentTime}),this.player.on("seeked",()=>{const e=this.player.currentTime;j.empty(this.cuePoints)||this.cuePoints.forEach((i,s)=>{t<i&&i<e&&(this.manager.discardAdBreak(),this.cuePoints.splice(s,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)})}),(0,v.A)(this,"play",()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(t){this.onAdError(t)}}).catch(()=>{})}),(0,v.A)(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,ke(this.player.media.play())}),(0,v.A)(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),(0,v.A)(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),(0,v.A)(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(e=>{this.on("loaded",e),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),(0,v.A)(this,"trigger",(e,...t)=>{const i=this.events[e];j.array(i)&&i.forEach(e=>{j.function(e)&&e.apply(this,t)})}),(0,v.A)(this,"on",(e,t)=>(j.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this)),(0,v.A)(this,"startSafetyTimer",(e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},e)}),(0,v.A)(this,"clearSafetyTimer",e=>{j.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((e,t)=>{this.on("loaded",e),this.on("error",t)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!j.empty(e.publisherId)||j.url(e.tagUrl))}get tagUrl(){const{config:e}=this;if(j.url(e.tagUrl))return e.tagUrl;const t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId},i="https://go.aniview.com/api/adserver6/vast/";return`${i}?${ht(t)}`}}var Ut=Bt;function Xt(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}function zt(e){const t=[],i=e.split(/\r\n\r\n|\n\n|\r\r/);return i.forEach(e=>{const i={},s=e.split(/\r\n|\n|\r/);s.forEach(e=>{if(j.number(i.startTime)){if(!j.empty(e.trim())&&j.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=e.match(/(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})( ?--> ?)(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}}),i.text&&t.push(i)}),t}function Wt(e,t){const i=t.width/t.height,s={};return e>i?(s.width=t.width,s.height=1/e*t.width):(s.height=t.height,s.width=e*t.height),s}class Kt{constructor(e){(0,v.A)(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)})}),(0,v.A)(this,"getThumbnails",()=>new Promise(e=>{const{src:t}=this.player.config.previewThumbnails;if(j.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort((e,t)=>e.height-t.height),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(j.function(t))t(e=>{this.thumbnails=e,i()});else{const e=j.string(t)?[t]:t,s=e.map(e=>this.getThumbnail(e));Promise.all(s).then(i)}})),(0,v.A)(this,"getThumbnail",e=>new Promise(t=>{tt(e,void 0,this.player.config.previewThumbnails.withCredentials).then(i=>{const s={frames:zt(i),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text})})),(0,v.A)(this,"startMove",e=>{if(this.loaded&&j.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{const t=this.player.elements.progress.getBoundingClientRect(),i=100/t.width*(e.pageX-t.left);this.seekTime=this.player.media.duration*(i/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.textContent=rt(this.seekTime);const s=this.player.config.markers?.points?.find(({time:e})=>e===Math.round(this.seekTime));s&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${s.label}<br>`)}this.showImageAtCurrentTime()}}),(0,v.A)(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),(0,v.A)(this,"startScrubbing",e=>{(j.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),(0,v.A)(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):ye.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),(0,v.A)(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),(0,v.A)(this,"render",()=>{this.elements.thumb.container=Y("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=Y("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=Y("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=Y("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),j.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=Y("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),(0,v.A)(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),(0,v.A)(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex(e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)}),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))}),(0,v.A)(this,"loadImage",(e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,r=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=r,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${r}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}}),(0,v.A)(this,"showImage",(e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))}),(0,v.A)(this,"removeOldImages",e=>{Array.from(this.currentImageContainer.children).forEach(t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout(()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)},i)}})}),(0,v.A)(this,"preloadNearby",(e,t=!0)=>new Promise(i=>{setTimeout(()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach(e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}}),a||i()}},300)})),(0,v.A)(this,"getHigherQuality",(e,t,i,s)=>{if(e<this.thumbnails.length-1){let n=t.naturalHeight;this.usingSprites&&(n=i.h),n<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))},300)}}),(0,v.A)(this,"toggleThumbContainer",(e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)}),(0,v.A)(this,"toggleScrubbingContainer",(e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)}),(0,v.A)(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),(0,v.A)(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()}),(0,v.A)(this,"setThumbContainerPos",()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,r=Xt(a,s,n);i.style.left=`${r}px`,i.style.setProperty("--preview-arrow-offset",a-r+"px")}),(0,v.A)(this,"setScrubbingContainerSize",()=>{const{width:e,height:t}=Wt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`}),(0,v.A)(this,"setImageSizeAndOffset",(e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=Wt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}var Yt=Kt;const Qt={insertElements(e,t){j.string(t)?J(e,this.media,{src:t}):j.array(t)&&t.forEach(t=>{J(e,this.media,t)})},change(e){X(e,"sources.length")?(Ne.cancelRequests.call(this),this.destroy(()=>{this.options.quality=[],G(this.media),this.media=null,j.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=ft.html5,src:n}]=t,a="html5"===s?i:"div",r="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:ue.check(i,s,this.config.playsinline),media:Y(a,r)}),this.elements.container.appendChild(this.media),j.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),j.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),St.addStyleHook.call(this),this.isHTML5&&Qt.insertElements.call(this,"source",t),this.config.title=e.title,jt.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&Qt.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&St.build.call(this),this.isHTML5&&this.media.load(),j.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Yt(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};var Jt=Qt;class Gt{constructor(e,t){if((0,v.A)(this,"play",()=>j.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>ke(this.media.play())),this.media.play()):null),(0,v.A)(this,"pause",()=>this.playing&&j.function(this.media.pause)?this.media.pause():null),(0,v.A)(this,"togglePlay",e=>{const t=j.boolean(e)?e:!this.playing;return t?this.play():this.pause()}),(0,v.A)(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):j.function(this.media.stop)&&this.media.stop()}),(0,v.A)(this,"restart",()=>{this.currentTime=0}),(0,v.A)(this,"rewind",e=>{this.currentTime-=j.number(e)?e:this.config.seekTime}),(0,v.A)(this,"forward",e=>{this.currentTime+=j.number(e)?e:this.config.seekTime}),(0,v.A)(this,"increaseVolume",e=>{const t=this.media.muted?0:this.volume;this.volume=t+(j.number(e)?e:0)}),(0,v.A)(this,"decreaseVolume",e=>{this.increaseVolume(-e)}),(0,v.A)(this,"airplay",()=>{ue.airplay&&this.media.webkitShowPlaybackTargetPicker()}),(0,v.A)(this,"toggleControls",e=>{if(this.supported.ui&&!this.isAudio){const t=ne(this.elements.container,this.config.classNames.hideControls),i="undefined"===typeof e?void 0:!e,s=se(this.elements.container,this.config.classNames.hideControls,i);if(s&&j.array(this.config.controls)&&this.config.controls.includes("settings")&&!j.empty(this.config.settings)&&lt.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";be.call(this,this.media,e)}return!s}return!1}),(0,v.A)(this,"on",(e,t)=>{ge.call(this,this.elements.container,e,t)}),(0,v.A)(this,"once",(e,t)=>{ye.call(this,this.elements.container,e,t)}),(0,v.A)(this,"off",(e,t)=>{fe(this.elements.container,e,t)}),(0,v.A)(this,"destroy",(e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(G(this.elements.buttons.play),G(this.elements.captions),G(this.elements.controls),G(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),j.function(e)&&e()):(ve.call(this),Ne.cancelRequests.call(this),ee(this.elements.original,this.elements.container),be.call(this,this.elements.original,"destroyed",!0),j.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(St.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&j.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))}),(0,v.A)(this,"supports",e=>ue.mime.call(this,e)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=ue.touch,this.media=e,j.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||j.nodeList(this.media)||j.array(this.media))&&(this.media=this.media[0]),this.config=z({},mt,Gt.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new wt(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",ue),j.nullOrUndefined(this.media)||!j.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!ue.check().api)return void this.debug.error("Setup failed: no support");const i=this.media.cloneNode(!0);i.autoplay=!1,this.elements.original=i;const s=this.media.tagName.toLowerCase();let n=null,a=null;switch(s){case"div":if(n=this.media.querySelector("iframe"),j.element(n)){if(a=ct(n.getAttribute("src")),this.provider=bt(a.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",a.search.length){const e=["1","true"];e.includes(a.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(a.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(a.searchParams.get("playsinline")),this.config.youtube.hl=a.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(j.empty(this.provider)||!Object.values(ft).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=yt.video;break;case"video":case"audio":this.type=s,this.provider=ft.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=ue.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new Et(this),this.storage=new et(this),this.media.plyr=this,j.element(this.elements.container)||(this.elements.container=Y("div"),W(this.media,this.elements.container)),St.migrateStyles.call(this),St.addStyleHook.call(this),jt.setup.call(this),this.config.debug&&ge.call(this,this.elements.container,this.config.events.join(" "),e=>{this.debug.log(`event: ${e.type}`)}),this.fullscreen=new Tt(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&St.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ut(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>ke(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Yt(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===ft.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===ft.youtube}get isVimeo(){return this.provider===ft.vimeo}get isVideo(){return this.type===yt.video}get isAudio(){return this.type===yt.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=j.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return j.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=Number.parseFloat(this.config.duration),t=(this.media||{}).duration,i=j.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;const i=1,s=0;j.string(t)&&(t=Number(t)),j.number(t)||(t=this.storage.get("volume")),j.number(t)||({volume:t}=this.config),t>i&&(t=i),t<s&&(t=s),this.config.volume=t,this.media.volume=t,!j.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;j.boolean(t)||(t=this.storage.get("muted")),j.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;j.number(e)&&(t=e),j.number(t)||(t=this.storage.get("speed")),j.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=Xt(t,i,s),this.config.speed.selected=t,setTimeout(()=>{this.media&&(this.media.playbackRate=t)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!j.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(j.number),n=!0;if(!i.includes(s)){const e=Ce(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=j.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){Jt.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return j.url(e)?e:this.source}set download(e){j.url(e)&&(this.config.urls.download=e,lt.setDownloadUrl.call(this))}set poster(e){this.isVideo?St.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Ee(Me.call(this));return j.array(e)?e.join(":"):e}set ratio(e){this.isVideo?j.string(e)&&xe(e)?(this.config.ratio=Ee(e),Le.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=j.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){ut.toggle.call(this,e,!1)}set currentTrack(e){ut.set.call(this,e,!1),ut.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){ut.setLanguage.call(this,e,!1)}get language(){return(ut.getCurrentTrack.call(this)||{}).language}set pip(e){if(!ue.pip)return;const t=j.boolean(e)?e:!this.pip;j.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?gt.active:gt.inactive),j.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return ue.pip?j.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===gt.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Yt(this))}static supported(e,t){return ue.check(e,t)}static loadSprite(e,t){return it(e,t)}static setup(e,t={}){let i=null;return j.string(e)?i=Array.from(document.querySelectorAll(e)):j.nodeList(e)?i=Array.from(e):j.array(e)&&(i=e.filter(j.element)),j.empty(i)?null:i.map(e=>new Gt(e,t))}}Gt.defaults=U(mt);var Zt=Gt;i(7642),i(8004),i(3853),i(5876),i(2475),i(5024),i(1698);const ei=new Set;let ti=null,ii="stop";function si(e){return e&&("AUDIO"===e.tagName||"VIDEO"===e.tagName)}function ni(e){if(si(e)){try{e.pause()}catch(t){}try{e.currentTime=0}catch(t){}try{e.removeAttribute("src")}catch(t){}try{e.load?.()}catch(t){}}}function ai(e=null){for(const t of ei)e&&t===e||ni(t);ti=e||null}let ri=!1;function oi(){ri||(ri=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&ai(null)}),window.addEventListener("pagehide",()=>ai(null)))}function li(){return ii}function ci(e){["stop","sequence","loop"].includes(e)&&(ii=e)}var hi={name:"TransformMedia",props:{file:{type:Object,required:!0},src:{type:String,required:!0},isImage:{type:Boolean,default:!0},isVideo:{type:Boolean,default:!1},isAudio:{type:Boolean,default:!1},isActive:{type:Boolean,default:!1}},data(){return{pointers:new Map,scale:1,rotation:0,rotatePreview:0,tx:0,ty:0,naturalWidth:0,naturalHeight:0,startScale:1,startRotation:0,startTx:0,startTy:0,startCenter:null,startDist:0,startAngle:0,dragging:!1,dragStart:null,viewportRect:null,minScale:1,maxScale:4,gestureMode:null,edgeOverflow:0,edgeDir:0,player:null,audioCover:null,audioTitle:"",audioArtist:"",menuAdded:!1}},computed:{isActiveTransform(){return this.scale>1.001||this.pointers.size>=2||this.dragging},displayRotation(){return this.rotation+this.rotatePreview},rotateShrink(){const e=Math.min(1,Math.abs(this.rotatePreview)/90),t=Math.sin(Math.PI*e);return 1-.12*t},mediaStyle(){const e=this.scale*this.rotateShrink,t=this.pointers.size>0;return{transform:`translate3d(${this.tx}px, ${this.ty}px, 0) scale(${e}) rotate(${this.displayRotation}deg)`,transition:t?"none":"transform 0.25s ease",transformOrigin:"center center"}}},watch:{isActiveTransform(e){this.$emit(e?"lock":"unlock")},isActive(e){e?this.$nextTick(()=>this.initPlayer()):this.destroyPlayer()}},mounted(){this.isAudio&&this.initAudioInfo(),this.isActive&&this.$nextTick(()=>this.initPlayer())},beforeUnmount(){this.destroyPlayer(),this.audioCover&&(URL.revokeObjectURL(this.audioCover),this.audioCover=null)},methods:{initPlayer(){if(this.player)return;const e=this.$refs.videoEl||this.$refs.audioEl;if(!e)return;this.retryCount=0,this.maxRetries=3;const t=this.isAudio?["play","progress","current-time","mute","volume"]:["play","progress","current-time","mute","volume","fullscreen"];this.player=new Zt(e,{controls:t,autoplay:this.isVideo,resetOnEnd:!0}),e.addEventListener("error",()=>{this.retryCount<this.maxRetries&&(this.retryCount++,console.warn(`Media load failed, retrying (${this.retryCount}/${this.maxRetries})...`),setTimeout(()=>{if(e&&this.src&&this.player){const t=this.src.split("?_retry=")[0],i=t+(t.includes("?")?"&":"?")+"_retry="+Date.now();e.src=i,e.load()}},500*this.retryCount))}),this.player.on("ready",()=>{this.tryAddCustomMenu()}),this.scheduleMenuRetry(),this.isAudio&&this.player.on("ended",this.onAudioEnded)},scheduleMenuRetry(){const e=t=>{t>=5||this.menuAdded||setTimeout(()=>{this.menuAdded||(this.tryAddCustomMenu(),e(t+1))},200*(t+1))};e(0)},tryAddCustomMenu(){if(this.menuAdded)return;if(!this.player?.elements?.controls)return;const e=this.player.elements.controls;e&&!e.querySelector(".plyr-custom-menu")&&(this.addCustomMenu(e),this.menuAdded=!0)},addCustomMenu(e){const t=li(),i=this.isAudio?`\n <div class="plyr-menu-item plyr-menu-playmode">\n <svg viewBox="0 0 24 24" fill="currentColor" width="18" height="18">\n <path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>\n </svg>\n <span>播放模式</span>\n <svg class="arrow" viewBox="0 0 24 24" fill="currentColor" width="14" height="14">\n <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>\n </svg>\n </div>\n <div class="plyr-playmode-submenu">\n <div class="plyr-menu-item plyr-playmode-option ${"stop"===t?"active":""}" data-mode="stop">播完停止</div>\n <div class="plyr-menu-item plyr-playmode-option ${"sequence"===t?"active":""}" data-mode="sequence">顺序播放</div>\n <div class="plyr-menu-item plyr-playmode-option ${"loop"===t?"active":""}" data-mode="loop">单曲循环</div>\n </div>\n `:"",s=document.createElement("div");s.className="plyr-custom-menu",s.innerHTML=`\n <button type="button" class="plyr__controls__item plyr__control plyr-menu-btn" aria-label="更多">\n <svg viewBox="0 0 24 24" fill="currentColor" width="18" height="18">\n <circle cx="12" cy="5" r="2"/>\n <circle cx="12" cy="12" r="2"/>\n <circle cx="12" cy="19" r="2"/>\n </svg>\n </button>\n <div class="plyr-menu-dropdown">\n <div class="plyr-menu-item" data-action="download">\n <svg viewBox="0 0 24 24" fill="currentColor" width="18" height="18">\n <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>\n </svg>\n <span>下载</span>\n </div>\n <div class="plyr-menu-item plyr-menu-speed">\n <svg viewBox="0 0 24 24" fill="currentColor" width="18" height="18">\n <path d="M10 8v8l6-4-6-4zm1.5 4l2-1.33v2.67l-2-1.34z"/>\n <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>\n </svg>\n <span>播放速度</span>\n <svg class="arrow" viewBox="0 0 24 24" fill="currentColor" width="14" height="14">\n <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>\n </svg>\n </div>\n <div class="plyr-speed-submenu">\n <div class="plyr-menu-item plyr-speed-option" data-speed="0.5">0.5x</div>\n <div class="plyr-menu-item plyr-speed-option" data-speed="0.75">0.75x</div>\n <div class="plyr-menu-item plyr-speed-option active" data-speed="1">正常</div>\n <div class="plyr-menu-item plyr-speed-option" data-speed="1.25">1.25x</div>\n <div class="plyr-menu-item plyr-speed-option" data-speed="1.5">1.5x</div>\n <div class="plyr-menu-item plyr-speed-option" data-speed="2">2x</div>\n </div>\n ${i}\n </div>\n `,e.appendChild(s),this.bindMenuEvents(s)},bindMenuEvents(e){const t=e.querySelector(".plyr-menu-btn"),i=e.querySelector(".plyr-menu-dropdown"),s=e.querySelector(".plyr-menu-speed"),n=e.querySelector(".plyr-speed-submenu"),a=e.querySelector('[data-action="download"]'),r=e.querySelector(".plyr-menu-playmode"),o=e.querySelector(".plyr-playmode-submenu");t.addEventListener("click",e=>{e.stopPropagation(),i.classList.toggle("show"),n.classList.remove("show"),o&&o.classList.remove("show")}),a.addEventListener("click",()=>{this.downloadMedia(),i.classList.remove("show")}),s.addEventListener("click",e=>{e.stopPropagation(),n.classList.toggle("show"),o&&o.classList.remove("show")}),e.querySelectorAll(".plyr-speed-option").forEach(t=>{t.addEventListener("click",()=>{const s=parseFloat(t.dataset.speed);this.player?.media&&(this.player.media.playbackRate=s),e.querySelectorAll(".plyr-speed-option").forEach(e=>e.classList.remove("active")),t.classList.add("active"),i.classList.remove("show"),n.classList.remove("show")})}),r&&o&&(r.addEventListener("click",e=>{e.stopPropagation(),o.classList.toggle("show"),n.classList.remove("show")}),e.querySelectorAll(".plyr-playmode-option").forEach(t=>{t.addEventListener("click",()=>{const s=t.dataset.mode;ci(s),e.querySelectorAll(".plyr-playmode-option").forEach(e=>e.classList.remove("active")),t.classList.add("active"),i.classList.remove("show"),o.classList.remove("show")})})),document.addEventListener("click",()=>{i.classList.remove("show"),n.classList.remove("show"),o&&o.classList.remove("show")})},downloadMedia(){const e=document.createElement("a");e.href=this.src,e.download=this.file?.name?.split("/").pop()||"download",e.click()},onAudioEnded(){const e=li();"loop"===e?this.player?.media&&(this.player.media.currentTime=0,this.player.play()):"sequence"===e&&this.$emit("audio-ended","next")},destroyPlayer(){const e=this.$refs.videoEl||this.$refs.audioEl;if(this.player){try{this.player.pause(),this.player.destroy()}catch(t){}this.player=null}if(e)try{e.pause(),e.currentTime=0,e.src="",e.load()}catch(t){}},stopAndCleanMedia(){this.destroyPlayer()},initAudioInfo(){const e=this.file?.name||this.src,t=e.split("/").pop().replace(/\.[^.]+$/,"");this.audioTitle=t,this.audioArtist="",this.audioCover=null,this.isActive&&this.tryReadMetadata()},async tryReadMetadata(){try{const e=await fetch(this.src),t=await e.blob(),i=await t.slice(0,131072).arrayBuffer(),s=new DataView(i);73===s.getUint8(0)&&68===s.getUint8(1)&&51===s.getUint8(2)&&this.parseID3v2(s,i)}catch(e){}},parseID3v2(e,t){const i=(127&e.getUint8(6))<<21|(127&e.getUint8(7))<<14|(127&e.getUint8(8))<<7|127&e.getUint8(9);let s=10;while(s<Math.min(i+10,t.byteLength-10)){const i=String.fromCharCode(e.getUint8(s),e.getUint8(s+1),e.getUint8(s+2),e.getUint8(s+3));if("\0\0\0\0"===i)break;const n=e.getUint8(s+4)<<24|e.getUint8(s+5)<<16|e.getUint8(s+6)<<8|e.getUint8(s+7);if(n<=0||n>t.byteLength)break;const a=new Uint8Array(t,s+10,Math.min(n,t.byteLength-s-10));"TIT2"===i?this.audioTitle=this.decodeText(a)||this.audioTitle:"TPE1"===i?this.audioArtist=this.decodeText(a):"APIC"===i&&this.extractCover(a),s+=10+n}},decodeText(e){if(e.length<2)return"";const t=e[0],i=e.slice(1);try{if(0===t)return new TextDecoder("iso-8859-1").decode(i).replace(/\0/g,"");if(1===t)return new TextDecoder("utf-16").decode(i).replace(/\0/g,"");if(3===t)return new TextDecoder("utf-8").decode(i).replace(/\0/g,"")}catch(s){}return""},extractCover(e){try{let t=1;while(t<e.length&&0!==e[t])t++;t+=2;while(t<e.length&&0!==e[t])t++;if(t++,t<e.length){const i=e.slice(t),s=new Blob([i],{type:"image/jpeg"});this.audioCover=URL.createObjectURL(s)}}catch(t){}},onLoad(e){const t=e.target;this.naturalWidth=t.naturalWidth,this.naturalHeight=t.naturalHeight},reset(){this.scale=1,this.rotation=0,this.rotatePreview=0,this.tx=0,this.ty=0,this.pointers.clear(),this.dragging=!1,this.edgeOverflow=0,this.edgeDir=0,this.$emit("unlock")},clamp(e,t,i){return Math.max(t,Math.min(i,e))},rubberBand(e,t,i=.55){return e*t*i/(t+i*e)},getViewportRect(){return this.$refs.viewport?.getBoundingClientRect()},getPanBounds(){const e=this.$refs.viewport?.getBoundingClientRect();if(!e)return{maxX:0,maxY:0,vw:0,vh:0};const t=e.width,i=e.height,s=this.$el.querySelector("img");let n=s?.clientWidth||t,a=s?.clientHeight||i;const r=this.rotation%360;90!==r&&270!==r||([n,a]=[a,n]);const o=n*this.scale,l=a*this.scale,c=Math.max(0,(o-t)/2),h=Math.max(0,(l-i)/2);return{maxX:c,maxY:h,vw:t,vh:i}},applyBoundWithRubber(e,t,i){return e>t?t+this.rubberBand(e-t,i,.55):e<-t?-t-this.rubberBand(-t-e,i,.55):e},calcTwoPointer(){const e=Array.from(this.pointers.entries()).sort((e,t)=>e[0]-t[0]),t=e[0][1],i=e[1][1],s=i.x-t.x,n=i.y-t.y,a=Math.hypot(s,n),r=Math.atan2(n,s)*(180/Math.PI),o={x:(t.x+i.x)/2,y:(t.y+i.y)/2};return{dist:a,angle:r,center:o}},normalizeAngle(e){return e=(e%360+360)%360,e>180?e-360:e},onPointerDown(e){if(this.isImage){if(e.currentTarget.setPointerCapture?.(e.pointerId),this.viewportRect=this.getViewportRect(),this.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),2===this.pointers.size){const{dist:e,angle:t,center:i}=this.calcTwoPointer();return this.startDist=e,this.startAngle=t,this.startCenter=i,this.startScale=this.scale,this.startRotation=this.rotation,this.startTx=this.tx,this.startTy=this.ty,this.dragging=!1,this.gestureMode=null,void(this.rotatePreview=0)}this.scale>1.001&&(this.dragging=!0,this.dragStart={x:e.clientX,y:e.clientY},this.startTx=this.tx,this.startTy=this.ty)}},onPointerMove(e){if(this.isImage&&this.pointers.has(e.pointerId)){if(this.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),2===this.pointers.size){e.preventDefault();const{dist:t,angle:i,center:s}=this.calcTwoPointer(),n=t/(this.startDist||t),a=Math.abs(n-1),r=this.normalizeAngle(i-this.startAngle),o=Math.abs(r);if(!this.gestureMode)if(o>=8)this.gestureMode="rotate";else{if(!(a>=.08))return;this.gestureMode="pinch"}if("rotate"===this.gestureMode)return this.scale=this.startScale,void(this.rotatePreview=this.clamp(r,-90,90));if("pinch"===this.gestureMode&&(this.scale=this.clamp(this.startScale*n,this.minScale,this.maxScale),this.rotatePreview=0),this.startCenter&&this.viewportRect){const e=this.startCenter.x-this.viewportRect.left-this.viewportRect.width/2,t=this.startCenter.y-this.viewportRect.top-this.viewportRect.height/2,i=s.x-this.viewportRect.left-this.viewportRect.width/2,n=s.y-this.viewportRect.top-this.viewportRect.height/2;this.tx=this.startTx+(i-e),this.ty=this.startTy+(n-t)}return}if(this.dragging&&this.scale>1.001){e.preventDefault();const t=e.clientX-this.dragStart.x,i=e.clientY-this.dragStart.y,s=this.startTx+t,n=this.startTy+i,{maxX:a,maxY:r,vw:o,vh:l}=this.getPanBounds();let c=0,h=0;s>a?(c=s-a,h=-1):s<-a&&(c=-a-s,h=1),this.edgeOverflow=c,this.edgeDir=h,this.tx=this.applyBoundWithRubber(s,a,o),this.ty=this.applyBoundWithRubber(n,r,l)}}},onPointerUp(e){if(this.isImage&&(this.pointers.has(e.pointerId)&&this.pointers.delete(e.pointerId),this.pointers.size<2&&"rotate"===this.gestureMode&&(this.finishRotate(),this.gestureMode=null),this.pointers.size<2&&(this.startCenter=null,this.startDist=0,this.startAngle=0,this.gestureMode=null),0===this.pointers.size)){if(this.dragging=!1,this.edgeOverflow>60&&0!==this.edgeDir){const e=this.edgeDir;return this.reset(),void this.$emit("edge-swipe",e)}if(this.edgeOverflow=0,this.edgeDir=0,this.scale<=1.001)this.scale=1,this.tx=0,this.ty=0;else{const{maxX:e,maxY:t}=this.getPanBounds();this.tx=Math.max(-e,Math.min(e,this.tx)),this.ty=Math.max(-t,Math.min(t,this.ty))}}},finishRotate(){const e=this.rotatePreview;let t=0;Math.abs(e)>=30&&(t=e>0?90:-90);const i=((this.rotation+t)%360+360)%360;this.rotation=i,this.rotatePreview=0,this.updateFillScale()},updateFillScale(){const e=this.rotation%360,t=90===e||270===e;t?(this.scale=2,this.tx=0,this.ty=0):(this.scale=1,this.tx=0,this.ty=0)},onDblClick(){this.isImage&&(this.scale>1.001?(this.scale=1,this.tx=0,this.ty=0):this.scale=2)}}},di=i(1241);const ui=(0,di.A)(hi,[["render",b],["__scopeId","data-v-b1094b14"]]);var pi=ui,mi=i(4453);const gi={class:"public-browse"},fi={class:"header"},yi={class:"header-left"},bi={class:"logo",href:"https://github.com/MarSeventh/CloudFlare-ImgBed",target:"_blank",rel:"noopener"},vi={class:"header-center"},wi={class:"breadcrumb"},ki=["onClick"],Ti={class:"header-right"},Ci={class:"file-count"},Ai={key:0,class:"loading-container"},Si={key:1,class:"error-container"},xi={key:2,class:"gallery-container",ref:"galleryContainer"},Ei={key:0,class:"folders-section"},Mi={class:"folders-grid"},Li=["onClick"],Pi={class:"folder-name"},Ii={class:"waterfall",ref:"waterfall"},$i=["onClick"],Ni=["src","alt","onLoad"],Di=["src","onLoadedmetadata"],Fi={key:2,class:"audio-placeholder"},_i={class:"audio-name"},Ri={key:3,class:"file-placeholder"},Oi={class:"file-name"},Hi={class:"overlay"},Vi={class:"overlay-actions"},ji=["onClick"],qi=["onClick"],Bi={key:1,class:"floating-page-indicator"},Ui={ref:"loadTrigger",class:"load-trigger"},Xi={key:0,class:"loading-more"},zi={key:1,class:"no-more"},Wi={key:2,class:"credit-link",href:"https://github.com/axibayuit-a11y",target:"_blank",rel:"noopener"},Ki=["src"],Yi=["src"],Qi=["src"],Ji={key:2,class:"other-file-preview"},Gi={class:"file-name"},Zi={class:"page-indicator"};function es(e,t,i,r,o,l){const c=mi.A,h=pi;return(0,s.uX)(),(0,s.CE)("div",gi,[(0,s.Lk)("header",fi,[(0,s.Lk)("div",yi,[(0,s.Lk)("a",bi,(0,a.v_)(l.siteName),1)]),(0,s.Lk)("div",vi,[(0,s.Lk)("div",wi,[(0,s.Lk)("span",{class:"breadcrumb-item",onClick:t[0]||(t[0]=(...e)=>l.goToRoot&&l.goToRoot(...e))},(0,a.v_)(l.rootDirName),1),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(l.pathParts,(e,i)=>((0,s.uX)(),(0,s.CE)(s.FK,{key:i},[t[32]||(t[32]=(0,s.Lk)("span",{class:"breadcrumb-sep"},"/",-1)),(0,s.Lk)("span",{class:"breadcrumb-item",onClick:e=>l.goToPath(i)},(0,a.v_)(e),9,ki)],64))),128))])]),(0,s.Lk)("div",Ti,[(0,s.Lk)("div",{class:(0,a.C4)(["search-box",{expanded:o.searchExpanded}])},[o.searchExpanded?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.bo)((0,s.Lk)("input",{type:"text","onUpdate:modelValue":t[2]||(t[2]=e=>o.searchInput=e),onKeyup:t[3]||(t[3]=(0,n.jR)((...e)=>l.handleSearch&&l.handleSearch(...e),["enter"])),placeholder:"搜索文件名 或 #页码",class:"search-input",ref:"searchInputRef"},null,544),[[n.Jo,o.searchInput]]),(0,s.Lk)("span",{class:"search-icon",onClick:t[4]||(t[4]=(...e)=>l.handleSearch&&l.handleSearch(...e))},[...t[34]||(t[34]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[(0,s.Lk)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})],-1)])])],64)):((0,s.uX)(),(0,s.CE)("span",{key:0,class:"search-icon",onClick:t[1]||(t[1]=(...e)=>l.toggleSearch&&l.toggleSearch(...e))},[...t[33]||(t[33]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20"},[(0,s.Lk)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})],-1)])]))],2),(0,s.bF)(c,{class:"theme-toggle-btn"}),(0,s.Lk)("span",Ci,(0,a.v_)(o.totalCount)+" 个文件",1)])]),o.loading&&0===o.files.length?((0,s.uX)(),(0,s.CE)("div",Ai,[...t[35]||(t[35]=[(0,s.Lk)("div",{class:"loading-spinner"},null,-1),(0,s.Lk)("p",null,"加载中...",-1)])])):o.error?((0,s.uX)(),(0,s.CE)("div",Si,[(0,s.Lk)("p",null,(0,a.v_)(o.error),1),o.canRetry?((0,s.uX)(),(0,s.CE)("button",{key:0,onClick:t[5]||(t[5]=(...e)=>l.loadFiles&&l.loadFiles(...e)),class:"retry-btn"},"重试")):(0,s.Q3)("",!0),t[36]||(t[36]=(0,s.Fv)('<div class="error-credit" data-v-40c0acc5><p data-v-40c0acc5>该图库由林酱贡献代码</p><div class="error-credit-links" data-v-40c0acc5><a href="https://github.com/axibayuit-a11y" target="_blank" rel="noopener" data-v-40c0acc5><svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20" data-v-40c0acc5><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" data-v-40c0acc5></path></svg> GitHub </a><a href="https://linux.do/u/yuit_axiba/summary" target="_blank" rel="noopener" data-v-40c0acc5><svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20" data-v-40c0acc5><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" data-v-40c0acc5></path></svg> Linux.do </a></div></div>',1))])):((0,s.uX)(),(0,s.CE)("div",xi,[l.folders.length>0?((0,s.uX)(),(0,s.CE)("div",Ei,[(0,s.Lk)("div",Mi,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(l.folders,e=>((0,s.uX)(),(0,s.CE)("div",{key:e.name,class:"folder-card",onClick:t=>l.enterFolder(e.name)},[t[37]||(t[37]=(0,s.Lk)("div",{class:"folder-icon"},[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})])],-1)),(0,s.Lk)("span",Pi,(0,a.v_)(l.getFolderName(e.name)),1)],8,Li))),128))])])):(0,s.Q3)("",!0),(0,s.Lk)("div",Ii,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(l.columns,(e,i)=>((0,s.uX)(),(0,s.CE)("div",{key:i,class:"waterfall-column"},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(e,e=>((0,s.uX)(),(0,s.CE)("div",{key:e.name,class:"waterfall-item",onClick:t=>l.openPreview(e)},[(0,s.Lk)("div",{class:(0,a.C4)(["image-wrapper",{loaded:e.loaded}])},[l.isImage(e)?((0,s.uX)(),(0,s.CE)("img",{key:0,src:l.getFileUrl(e.name),alt:e.name,loading:"lazy",onLoad:t=>l.onImageLoad(t,e),onError:t[6]||(t[6]=(...e)=>l.handleImageError&&l.handleImageError(...e))},null,40,Ni)):l.isVideo(e)?((0,s.uX)(),(0,s.CE)("video",{key:1,src:l.getFileUrl(e.name),muted:"",loop:"",preload:"metadata",onLoadedmetadata:t=>l.onVideoLoad(t,e),onPointerenter:t[7]||(t[7]=e=>"mouse"===e.pointerType&&e.target.play()),onPointerleave:t[8]||(t[8]=e=>"mouse"===e.pointerType&&e.target.pause())},null,40,Di)):l.isAudio(e)?((0,s.uX)(),(0,s.CE)("div",Fi,[t[38]||(t[38]=(0,s.Lk)("svg",{class:"audio-icon",viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"})],-1)),(0,s.Lk)("span",_i,(0,a.v_)(l.getFileName(e.name)),1)])):((0,s.uX)(),(0,s.CE)("div",Ri,[t[39]||(t[39]=(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13z"})],-1)),(0,s.Lk)("span",Oi,(0,a.v_)(l.getFileName(e.name)),1)])),(0,s.Lk)("div",Hi,[(0,s.Lk)("div",Vi,[(0,s.Lk)("button",{class:"action-btn",onClick:(0,n.D$)(t=>l.copyLink(e.name),["stop"]),title:"复制链接"},[...t[40]||(t[40]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})],-1)])],8,ji),(0,s.Lk)("button",{class:"action-btn",onClick:(0,n.D$)(t=>l.downloadFile(e.name),["stop"]),title:"下载"},[...t[41]||(t[41]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})],-1)])],8,qi)])])],2)],8,$i))),128))]))),128))],512),l.mediaFiles.length>o.pageSize?((0,s.uX)(),(0,s.CE)("div",Bi,[(0,s.Lk)("span",null,(0,a.v_)(l.displayCurrentPage)+" / "+(0,a.v_)(l.totalPages),1)])):(0,s.Q3)("",!0),(0,s.Lk)("div",Ui,[o.loading&&o.files.length>0?((0,s.uX)(),(0,s.CE)("div",Xi,[...t[42]||(t[42]=[(0,s.Lk)("div",{class:"loading-spinner-small"},null,-1),(0,s.Lk)("span",null,"加载中...",-1)])])):!o.hasMore&&l.mediaFiles.length>0?((0,s.uX)(),(0,s.CE)("div",zi," 已加载全部 ")):(0,s.Q3)("",!0),!o.hasMore&&l.mediaFiles.length>0?((0,s.uX)(),(0,s.CE)("a",Wi," 林酱贡献 ")):(0,s.Q3)("",!0)],512)],512)),o.previewVisible?((0,s.uX)(),(0,s.CE)("div",{key:3,class:"preview-modal",onClick:t[31]||(t[31]=(0,n.D$)((...e)=>l.closePreview&&l.closePreview(...e),["self"]))},[(0,s.Lk)("button",{class:"preview-close",onClick:t[9]||(t[9]=(0,n.D$)((...e)=>l.closePreview&&l.closePreview(...e),["stop"]))},[...t[43]||(t[43]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})],-1)])]),o.isMobile?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",{key:0,class:"preview-content",onClick:t[15]||(t[15]=(0,n.D$)(()=>{},["stop"])),onWheel:t[16]||(t[16]=(0,n.D$)((...e)=>l.handleWheel&&l.handleWheel(...e),["prevent"]))},[l.currentPreviewFile&&l.isImage(l.currentPreviewFile)?((0,s.uX)(),(0,s.CE)("img",{key:"img-"+l.currentPreviewFile.name,src:l.getFileUrl(l.currentPreviewFile.name),class:"preview-image",style:(0,a.Tr)(l.desktopImageStyle),draggable:"false",onMousedown:t[10]||(t[10]=(...e)=>l.onImageMouseDown&&l.onImageMouseDown(...e)),onMousemove:t[11]||(t[11]=(...e)=>l.onImageMouseMove&&l.onImageMouseMove(...e)),onMouseup:t[12]||(t[12]=(...e)=>l.onImageMouseUp&&l.onImageMouseUp(...e)),onMouseleave:t[13]||(t[13]=(...e)=>l.onImageMouseUp&&l.onImageMouseUp(...e))},null,44,Ki)):l.currentPreviewFile&&l.isVideo(l.currentPreviewFile)?((0,s.uX)(),(0,s.CE)("video",{ref:"desktopVideo",key:"video-"+l.currentPreviewFile.name,src:l.getFileUrl(l.currentPreviewFile.name),controls:"",class:"preview-video",style:(0,a.Tr)(l.desktopImageStyle),onPlay:t[14]||(t[14]=(...e)=>l.onDesktopVideoPlay&&l.onDesktopVideoPlay(...e))},null,44,Yi)):l.currentPreviewFile&&l.isAudio(l.currentPreviewFile)?((0,s.uX)(),(0,s.Wv)(h,{ref:"desktopAudio",key:"audio-"+l.currentPreviewFile.name,file:l.currentPreviewFile,src:l.getFileUrl(l.currentPreviewFile.name),"is-image":!1,"is-video":!1,"is-audio":!0,"is-active":!0,onAudioEnded:l.onAudioEnded},null,8,["file","src","onAudioEnded"])):(0,s.Q3)("",!0)],32)),o.isMobile?((0,s.uX)(),(0,s.CE)("div",{key:1,class:"preview-content preview-content-mobile",onClick:t[27]||(t[27]=(0,n.D$)(()=>{},["stop"]))},[l.currentPreviewFile&&l.isVideo(l.currentPreviewFile)?((0,s.uX)(),(0,s.CE)("video",{ref:"mobileVideo",key:"m-video-"+l.currentPreviewFile.name,src:l.getFileUrl(l.currentPreviewFile.name),controls:"",playsinline:"","webkit-playsinline":"","x5-video-player-type":"h5","x5-video-player-fullscreen":"true",class:"mobile-video-native",onPlay:t[17]||(t[17]=(...e)=>l.onMobileMediaPlay&&l.onMobileMediaPlay(...e))},null,40,Qi)):l.currentPreviewFile&&l.isAudio(l.currentPreviewFile)?((0,s.uX)(),(0,s.CE)("div",{key:1,class:"mobile-audio-wrap",onTouchstart:t[18]||(t[18]=(...e)=>l.onAudioSwipeStart&&l.onAudioSwipeStart(...e)),onTouchmove:t[19]||(t[19]=(...e)=>l.onAudioSwipeMove&&l.onAudioSwipeMove(...e)),onTouchend:t[20]||(t[20]=(...e)=>l.onAudioSwipeEnd&&l.onAudioSwipeEnd(...e))},[((0,s.uX)(),(0,s.Wv)(h,{ref:"mobileAudio",key:"m-audio-"+l.currentPreviewFile.name,file:l.currentPreviewFile,src:l.getFileUrl(l.currentPreviewFile.name),"is-image":!1,"is-video":!1,"is-audio":!0,"is-active":!0,onAudioEnded:l.onAudioEnded},null,8,["file","src","onAudioEnded"])),t[44]||(t[44]=(0,s.Lk)("div",{class:"swipe-hint"},"← 滑动切换 →",-1))],32)):l.currentPreviewFile&&!l.isImage(l.currentPreviewFile)?((0,s.uX)(),(0,s.CE)("div",Ji,[t[45]||(t[45]=(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13z"})],-1)),(0,s.Lk)("span",Gi,(0,a.v_)(l.getFileName(l.currentPreviewFile.name)),1)])):((0,s.uX)(),(0,s.CE)("div",{key:3,class:"swipe-viewport",ref:"mobileViewport",onTouchstart:t[24]||(t[24]=(...e)=>l.onSwipeStart&&l.onSwipeStart(...e)),onTouchmove:t[25]||(t[25]=(...e)=>l.onSwipeMove&&l.onSwipeMove(...e)),onTouchend:t[26]||(t[26]=(...e)=>l.onSwipeEnd&&l.onSwipeEnd(...e))},[(0,s.Lk)("div",{class:"swipe-track",style:(0,a.Tr)(l.swipeTrackStyle),onTransitionend:t[23]||(t[23]=(...e)=>l.onSwipeTransitionEnd&&l.onSwipeTransitionEnd(...e))},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(l.swipeWindow,(e,i)=>((0,s.uX)(),(0,s.CE)("div",{class:"swipe-slide",key:l.getSlideKey(e,i)},[e?((0,s.uX)(),(0,s.Wv)(h,{key:0,file:e,src:l.getFileUrl(e.name),"is-image":l.isImage(e),"is-video":!1,"is-audio":!1,"is-active":1===i,onLock:t[21]||(t[21]=e=>o.gestureLocked=!0),onUnlock:t[22]||(t[22]=e=>o.gestureLocked=!1),onEdgeSwipe:l.onEdgeSwipe},null,8,["file","src","is-image","is-active","onEdgeSwipe"])):(0,s.Q3)("",!0)]))),128))],36)],544))])):(0,s.Q3)("",!0),!o.isMobile&&o.previewIndex>0?((0,s.uX)(),(0,s.CE)("button",{key:2,class:"preview-prev",onClick:t[28]||(t[28]=(0,n.D$)((...e)=>l.prevImage&&l.prevImage(...e),["stop"]))},[...t[46]||(t[46]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})],-1)])])):(0,s.Q3)("",!0),!o.isMobile&&o.previewIndex<l.mediaFiles.length-1?((0,s.uX)(),(0,s.CE)("button",{key:3,class:"preview-next",onClick:t[29]||(t[29]=(0,n.D$)((...e)=>l.nextImage&&l.nextImage(...e),["stop"]))},[...t[47]||(t[47]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})],-1)])])):(0,s.Q3)("",!0),o.isMobile?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("button",{key:4,class:"rotate-btn",onClick:t[30]||(t[30]=(0,n.D$)((...e)=>l.rotateImage&&l.rotateImage(...e),["stop"])),title:"旋转90°"},[...t[48]||(t[48]=[(0,s.Lk)("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[(0,s.Lk)("path",{d:"M16.89 8.53l1.41-1.42C19.2 8.27 19.76 9.61 19.93 11h-2.02c-.14-.87-.49-1.72-1.02-2.47zM17.91 13h2.02c-.17 1.39-.72 2.73-1.62 3.89l-1.41-1.42c.52-.75.87-1.59 1.01-2.47zm-1.01 5.32c-1.16.9-2.51 1.44-3.9 1.61V17.9c.87-.15 1.71-.49 2.46-1.03l1.44 1.45zM11 4.07V1l4.55 4.55L11 10V6.09c-2.84.48-5 2.94-5 5.91s2.16 5.43 5 5.91v2.02c-3.95-.49-7-3.85-7-7.93s3.05-7.44 7-7.93z"})],-1)])])),(0,s.Lk)("div",Zi,(0,a.v_)(o.previewIndex+1)+" / "+(0,a.v_)(l.mediaFiles.length),1)])):(0,s.Q3)("",!0)])}var ts=i(4373),is=i(8401),ss={name:"PublicBrowse",components:{TransformMedia:pi,ToggleDark:mi.A},data(){return{files:[],allowedDirs:[],rootDir:"",currentPath:"",totalCount:0,loading:!1,error:null,canRetry:!0,hasMore:!0,previewVisible:!1,previewIndex:0,observer:null,pageSize:24,searchInput:"",searchKeyword:"",currentStartIndex:0,searchExpanded:!1,filterType:"",lastScrollY:0,scrollPage:0,columnCount:4,columnHeights:[0,0,0,0],imageRotation:0,imageScale:1,imageTx:0,imageTy:0,imageDragging:!1,imageDragStart:null,imageStartTx:0,imageStartTy:0,swipeX:0,swipeStartX:0,swipeStartY:0,swipeStartT:0,swipeActive:!1,swipeAnimating:!1,swipeDir:0,viewportW:0,gestureLocked:!1,audioSwipeStartX:0,audioSwipeStartT:0,audioSwipeActive:!1,isMobile:!1}},computed:{...(0,is.L8)(["userConfig"]),siteName(){return this.userConfig?.siteTitle||"Sanyue ImgHub"},rootDirName(){return this.rootDir.split("/").filter(Boolean).pop()||"根目录"},pathParts(){if(!this.currentPath||!this.rootDir)return[];const e=this.currentPath.replace(this.rootDir,"").replace(/^\/+/,"");return e.split("/").filter(Boolean)},folders(){return this.files.filter(e=>e.isFolder)},mediaFiles(){return this.files.filter(e=>!e.isFolder)},totalPages(){return Math.ceil(this.totalCount/this.pageSize)},displayCurrentPage(){const e=Math.floor(this.currentStartIndex/this.pageSize)+1,t=Math.ceil(this.mediaFiles.length/this.pageSize);return Math.min(e+Math.floor(this.scrollPage*t),this.totalPages)},columns(){const e=Array.from({length:this.columnCount},()=>[]);for(const t of this.mediaFiles){const i=t.columnIndex??0;i<this.columnCount?e[i].push(t):e[0].push(t)}return e},currentPreviewFile(){return this.mediaFiles[this.previewIndex]},prevPreviewFile(){return this.previewIndex>0?this.mediaFiles[this.previewIndex-1]:null},nextPreviewFile(){return this.previewIndex<this.mediaFiles.length-1?this.mediaFiles[this.previewIndex+1]:null},desktopImageStyle(){const e=this.imageDragging;return{transform:`translate(${this.imageTx}px, ${this.imageTy}px) rotate(${this.imageRotation}deg) scale(${this.imageScale})`,transition:e?"none":"transform 0.3s ease",cursor:this.imageScale>1?this.imageDragging?"grabbing":"grab":"default"}},swipeWindow(){return[this.prevPreviewFile,this.currentPreviewFile,this.nextPreviewFile]},swipeTrackStyle(){const e=-this.viewportW,t=e+this.swipeX;return{transform:`translate3d(${t}px, 0, 0)`,transition:this.swipeAnimating?"transform 0.28s ease":"none"}}},watch:{"$route.params.dir":{handler(){this.initFromRoute()}}},mounted(){oi(),this.checkMobile(),this.initFromRoute(),this.setupIntersectionObserver(),this.updateColumnCount(),window.addEventListener("resize",this.updateColumnCount),window.addEventListener("resize",this.checkMobile),window.addEventListener("scroll",this.handleScroll)},beforeUnmount(){this.observer&&this.observer.disconnect(),window.removeEventListener("resize",this.updateColumnCount),window.removeEventListener("resize",this.checkMobile),window.removeEventListener("scroll",this.handleScroll)},methods:{handleSearch(){const e=this.searchInput.trim();if(!e)return this.searchKeyword="",this.filterType="",this.currentStartIndex=0,void this.resetAndLoad();const t=e.match(/^#(\d+)$/);if(t){const e=parseInt(t[1],10),i=Math.ceil(this.totalCount/this.pageSize),s=Math.min(Math.max(1,e),i||1);return this.currentStartIndex=(s-1)*this.pageSize,this.searchKeyword="",this.filterType="",this.searchInput="",void this.resetAndLoad()}const i={"图片":"image","图":"image",image:"image",img:"image","照片":"image","视频":"video",video:"video","影片":"video","电影":"video","音乐":"audio","音频":"audio",audio:"audio",music:"audio","歌曲":"audio"},s=e.toLowerCase();if(i[s])return this.filterType=i[s],this.searchKeyword="",this.currentStartIndex=0,void this.resetAndLoad();this.filterType="",this.searchKeyword=e,this.currentStartIndex=0,this.resetAndLoad()},resetAndLoad(){this.files=[],this.hasMore=!0,this.columnHeights=new Array(this.columnCount).fill(0),this.loadFiles().then(()=>{this.observeLoadTrigger()})},toggleSearch(){this.searchExpanded=!this.searchExpanded,this.searchExpanded&&this.$nextTick(()=>{this.$refs.searchInputRef?.focus()})},handleScroll(){const e=window.scrollY;this.searchExpanded&&e>this.lastScrollY+20&&(this.searchExpanded=!1),this.lastScrollY=e;const t=this.$refs.galleryContainer;if(t&&this.mediaFiles.length>0){t.getBoundingClientRect();const i=t.offsetTop,s=t.scrollHeight-window.innerHeight;if(s>0){const t=Math.max(0,e-i);this.scrollPage=Math.min(1,t/s)}else this.scrollPage=0}},checkMobile(){this.isMobile=window.innerWidth<=600},getSlideKey(e,t){return e?1===t?`${e.name}-${this.previewIndex}`:e.name:`empty-${t}`},updateColumnCount(){const e=window.innerWidth;let t;t=e<600?2:e<900?3:4,t!==this.columnCount&&(this.columnCount=t,this.columnHeights=new Array(this.columnCount).fill(0),this.mediaFiles.forEach(e=>{e.columnIndex=void 0,this.assignToColumn(e)}))},getShortestColumn(){let e=0,t=this.columnHeights[0];for(let i=1;i<this.columnCount;i++)this.columnHeights[i]<t&&(t=this.columnHeights[i],e=i);return e},assignToColumn(e,t=200){const i=this.getShortestColumn();e.columnIndex=i,this.columnHeights[i]+=t,(this.isAudio(e)||!this.isImage(e)&&!this.isVideo(e))&&(e.loaded=!0)},onImageLoad(e,t){const i=e.target,s=i.naturalHeight/i.naturalWidth,n=280*s;void 0===t.columnIndex&&this.assignToColumn(t,n),t.loaded=!0},onVideoLoad(e,t){const i=e.target,s=i.videoHeight/i.videoWidth,n=280*s;void 0===t.columnIndex&&this.assignToColumn(t,n),t.loaded=!0},setupIntersectionObserver(){this.observer=new IntersectionObserver(e=>{const t=e[0];t.isIntersecting&&this.hasMore&&!this.loading&&this.loadMore()},{rootMargin:"200px"})},observeLoadTrigger(){this.$nextTick(()=>{this.$refs.loadTrigger&&this.observer&&this.observer.observe(this.$refs.loadTrigger)})},async initFromRoute(){const e=this.$route.params.dir||"",t=Array.isArray(e)?e.join("/"):e,i=t.split("/").filter(Boolean);this.rootDir=i[0]||"",this.currentPath=t,this.files=[],this.hasMore=!0,this.columnHeights=new Array(this.columnCount).fill(0),this.searchInput="",this.searchKeyword="",this.filterType="",this.currentStartIndex=0,await this.loadFiles(),this.observeLoadTrigger()},async loadFiles(){this.loading=!0,this.error=null,this.canRetry=!0;try{let e=`/api/public/list?dir=${encodeURIComponent(this.currentPath)}&start=${this.currentStartIndex}&count=${this.pageSize}`;this.searchKeyword&&(e+=`&search=${encodeURIComponent(this.searchKeyword)}`),this.filterType&&(e+=`&type=${this.filterType}`);const t=await ts.A.get(e);t.data.allowedDirs&&(this.allowedDirs=t.data.allowedDirs);const i=(t.data.directories||[]).map(e=>({name:e,isFolder:!0})),s=(t.data.files||[]).map(e=>({name:e.name,isFolder:!1,metadata:e.metadata,columnIndex:void 0}));s.forEach(e=>this.assignToColumn(e)),this.files=[...i,...s],this.totalCount=t.data.totalCount||this.files.length,this.hasMore=this.currentStartIndex+this.mediaFiles.length<this.totalCount}catch(e){if(403===e.response?.status){const t=e.response?.data?.error||"";t.includes("disabled")?this.error="公开浏览功能未启用":t.includes("not allowed")||t.includes("No public")?this.error="该目录不允许公开访问":this.error="访问被拒绝",this.canRetry=!1}else this.error="加载失败,请重试"}finally{this.loading=!1}},async loadMore(){if(!this.loading&&this.hasMore){this.loading=!0;try{const e=this.currentStartIndex+this.mediaFiles.length;let t=`/api/public/list?dir=${encodeURIComponent(this.currentPath)}&start=${e}&count=${this.pageSize}`;this.searchKeyword&&(t+=`&search=${encodeURIComponent(this.searchKeyword)}`),this.filterType&&(t+=`&type=${this.filterType}`);const i=await ts.A.get(t),s=(i.data.files||[]).map(e=>({name:e.name,isFolder:!1,metadata:e.metadata,columnIndex:void 0}));s.forEach(e=>this.assignToColumn(e)),this.files.push(...s),this.hasMore=this.currentStartIndex+this.mediaFiles.length<this.totalCount}catch(e){console.error("加载更多失败",e)}finally{this.loading=!1}}},enterFolder(e){const t=e.replace(/\/+$/,"");this.$router.push(`/browse/${t}`)},goToRoot(){this.$router.push(`/browse/${this.rootDir}`)},goToPath(e){const t=this.pathParts.slice(0,e+1),i=this.rootDir+(t.length?"/"+t.join("/"):"");this.$router.push(`/browse/${i}`)},getFolderName(e){return e.split("/").filter(Boolean).pop()||e},getFileUrl(e){return`${window.location.origin}/file/${encodeURI(e)}`},isImage(e){const t=e.name.split(".").pop().toLowerCase();return["jpg","jpeg","png","gif","webp","bmp","svg","avif"].includes(t)},isVideo(e){const t=e.name.split(".").pop().toLowerCase();return["mp4","webm","ogg","mov","m4v","mkv","avi","3gp","mpeg","mpg"].includes(t)},isAudio(e){const t=e.name.split(".").pop().toLowerCase();return["mp3","wav","ogg","flac","aac","m4a","wma","ape","opus"].includes(t)},getFileName(e){return e.split("/").pop()},handleImageError(e){const t=e.target,i=parseInt(t.dataset.retryCount||"0"),s=3;if(i<s){t.dataset.retryCount=i+1;const e=t.src.split("?_retry=")[0];setTimeout(()=>{t.src=e+"?_retry="+Date.now()},500*(i+1))}else t.style.display="none"},copyLink(e){const t=this.getFileUrl(e);navigator.clipboard?.writeText(t).then(()=>{this.showToast("已复制")}).catch(()=>{const e=document.createElement("input");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),this.showToast("已复制")})},showToast(e){const t=document.querySelector(".copy-toast");t&&t.remove();const i=document.createElement("div");i.className="copy-toast",i.textContent=e,document.body.appendChild(i),setTimeout(()=>i.classList.add("show"),10),setTimeout(()=>{i.classList.remove("show"),setTimeout(()=>i.remove(),300)},1500)},downloadFile(e){const t=document.createElement("a");t.href=this.getFileUrl(e),t.download=e.split("/").pop(),t.click()},openPreview(e){if(e.isFolder)return;ai(null);const t=this.mediaFiles.findIndex(t=>t.name===e.name);t>=0&&(this.previewIndex=t,this.previewVisible=!0,this.imageRotation=0,this.imageScale=1,this.imageTx=0,this.imageTy=0,this.gestureLocked=!1,document.body.style.overflow="hidden",this.$nextTick(()=>{this.viewportW=this.$refs.mobileViewport?.getBoundingClientRect().width||window.innerWidth}))},closePreview(){ai(null),this.previewVisible=!1,this.imageRotation=0,this.imageScale=1,this.imageTx=0,this.imageTy=0,this.gestureLocked=!1,document.body.style.overflow=""},prevImage(){ai(null),this.previewIndex>0&&(this.previewIndex--,this.imageRotation=0,this.imageScale=1,this.imageTx=0,this.imageTy=0)},nextImage(){ai(null),this.previewIndex<this.mediaFiles.length-1&&(this.previewIndex++,this.imageRotation=0,this.imageScale=1,this.imageTx=0,this.imageTy=0)},rotateImage(){this.imageRotation+=90},handleWheel(e){if(!this.currentPreviewFile||!this.isImage(this.currentPreviewFile))return;const t=e.deltaY>0?-.1:.1;let i=this.imageScale+t;i=Math.max(.5,Math.min(4,i)),this.imageScale=i,i<=1&&(this.imageTx=0,this.imageTy=0)},onImageMouseDown(e){this.imageScale<=1||(e.preventDefault(),this.imageDragging=!0,this.imageDragStart={x:e.clientX,y:e.clientY},this.imageStartTx=this.imageTx,this.imageStartTy=this.imageTy)},onImageMouseMove(e){if(!this.imageDragging)return;const t=e.clientX-this.imageDragStart.x,i=e.clientY-this.imageDragStart.y;this.imageTx=this.imageStartTx+t,this.imageTy=this.imageStartTy+i},onImageMouseUp(){this.imageDragging=!1},onSwipeStart(e){if(this.gestureLocked)return;if(this.swipeAnimating)return;const t=e.touches[0];this.swipeStartX=t.clientX,this.swipeStartY=t.clientY,this.swipeStartT=performance.now(),this.swipeX=0,this.swipeActive=!1,this.viewportW=this.$refs.mobileViewport?.getBoundingClientRect().width||window.innerWidth},onSwipeMove(e){if(this.gestureLocked)return;if(this.swipeAnimating)return;const t=e.touches[0],i=t.clientX-this.swipeStartX,s=t.clientY-this.swipeStartY;if(!this.swipeActive){if(Math.abs(i)<8)return;if(Math.abs(i)<=Math.abs(s))return;this.swipeActive=!0}e.preventDefault();let n=i;0===this.previewIndex&&n>0?n=this.rubberBand(n,this.viewportW,.55):this.previewIndex===this.mediaFiles.length-1&&n<0&&(n=-this.rubberBand(-n,this.viewportW,.55)),this.swipeX=n},onSwipeEnd(){if(this.gestureLocked)return;if(this.swipeAnimating)return;if(!this.swipeActive)return void(this.swipeX=0);const e=Math.max(1,performance.now()-this.swipeStartT),t=this.swipeX/e,i=.2*this.viewportW;let s=0;(this.swipeX<=-i||t<=-.8)&&(s=1),(this.swipeX>=i||t>=.8)&&(s=-1),(-1===s&&0===this.previewIndex||1===s&&this.previewIndex===this.mediaFiles.length-1)&&(s=0),this.swipeDir=s,this.swipeAnimating=!0,this.swipeX=1===s?-this.viewportW:-1===s?+this.viewportW:0},onSwipeTransitionEnd(){this.swipeAnimating&&(1===this.swipeDir&&this.previewIndex++,-1===this.swipeDir&&this.previewIndex--,this.swipeAnimating=!1,this.swipeDir=0,this.swipeX=0)},rubberBand(e,t,i=.55){return e*t*i/(t+i*e)},onEdgeSwipe(e){-1===e&&0===this.previewIndex||1===e&&this.previewIndex===this.mediaFiles.length-1||(this.swipeDir=e,this.swipeAnimating=!0,1===e?this.swipeX=-this.viewportW:-1===e&&(this.swipeX=+this.viewportW))},onAudioSwipeStart(e){const t=e.touches[0];this.audioSwipeStartX=t.clientX,this.audioSwipeStartT=performance.now(),this.audioSwipeActive=!1},onAudioSwipeMove(e){if(!this.audioSwipeStartX)return;const t=e.touches[0],i=t.clientX-this.audioSwipeStartX;Math.abs(i)>30&&(this.audioSwipeActive=!0)},onAudioSwipeEnd(e){if(!this.audioSwipeActive)return void(this.audioSwipeStartX=0);const t=e.changedTouches[0],i=t.clientX-this.audioSwipeStartX,s=Math.max(1,performance.now()-this.audioSwipeStartT),n=i/s,a=80;i>a||n>.5?this.prevImage():(i<-a||n<-.5)&&this.nextImage(),this.audioSwipeStartX=0,this.audioSwipeActive=!1},onDesktopVideoPlay(e){ai(e.target)},onMobileMediaPlay(e){ai(e.target)},onAudioEnded(e){"next"===e&&this.previewIndex<this.mediaFiles.length-1&&(this.previewIndex++,this.$nextTick(()=>{setTimeout(()=>{const e=this.isMobile?this.$refs.mobileAudio:this.$refs.desktopAudio;e?.player&&e.player.play()},100)}))}}};const ns=(0,di.A)(ss,[["render",es],["__scopeId","data-v-40c0acc5"]]);var as=ns}}]);
//# sourceMappingURL=667.bbd60d43.js.map