nsfwapp/backend/web/dist/assets/index-BC3HxqFv.js
2026-03-04 18:44:22 +01:00

450 lines
1.3 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function YE(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in n)){const l=Object.getOwnPropertyDescriptor(i,a);l&&Object.defineProperty(n,a,l.get?l:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function t(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=t(a);fetch(a.href,l)}})();var gf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Du(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function QE(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function i(){var a=!1;try{a=this instanceof i}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var a=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return n[i]}})}),t}var mp={exports:{}},Rc={};var r1;function ZE(){if(r1)return Rc;r1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var h in a)h!=="key"&&(l[h]=a[h])}else l=a;return a=l.ref,{$$typeof:n,type:i,key:u,ref:a!==void 0?a:null,props:l}}return Rc.Fragment=e,Rc.jsx=t,Rc.jsxs=t,Rc}var s1;function JE(){return s1||(s1=1,mp.exports=ZE()),mp.exports}var c=JE(),pp={exports:{}},bn={};var a1;function eC(){if(a1)return bn;a1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),C=Symbol.iterator;function N(L){return L===null||typeof L!="object"?null:(L=C&&L[C]||L["@@iterator"],typeof L=="function"?L:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function H(L,xe,Te){this.props=L,this.context=xe,this.refs=B,this.updater=Te||O}H.prototype.isReactComponent={},H.prototype.setState=function(L,xe){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,xe,"setState")},H.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function Y(){}Y.prototype=H.prototype;function U(L,xe,Te){this.props=L,this.context=xe,this.refs=B,this.updater=Te||O}var re=U.prototype=new Y;re.constructor=U,E(re,H.prototype),re.isPureReactComponent=!0;var W=Array.isArray;function X(){}var R={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function k(L,xe,Te){var ye=Te.ref;return{$$typeof:n,type:L,key:xe,ref:ye!==void 0?ye:null,props:Te}}function j(L,xe){return k(L.type,xe,L.props)}function Z(L){return typeof L=="object"&&L!==null&&L.$$typeof===n}function V(L){var xe={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(Te){return xe[Te]})}var ne=/\/+/g;function me(L,xe){return typeof L=="object"&&L!==null&&L.key!=null?V(""+L.key):xe.toString(36)}function ue(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(X,X):(L.status="pending",L.then(function(xe){L.status==="pending"&&(L.status="fulfilled",L.value=xe)},function(xe){L.status==="pending"&&(L.status="rejected",L.reason=xe)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function q(L,xe,Te,ye,be){var mt=typeof L;(mt==="undefined"||mt==="boolean")&&(L=null);var Ke=!1;if(L===null)Ke=!0;else switch(mt){case"bigint":case"string":case"number":Ke=!0;break;case"object":switch(L.$$typeof){case n:case e:Ke=!0;break;case _:return Ke=L._init,q(Ke(L._payload),xe,Te,ye,be)}}if(Ke)return be=be(L),Ke=ye===""?"."+me(L,0):ye,W(be)?(Te="",Ke!=null&&(Te=Ke.replace(ne,"$&/")+"/"),q(be,xe,Te,"",function(ct){return ct})):be!=null&&(Z(be)&&(be=j(be,Te+(be.key==null||L&&L.key===be.key?"":(""+be.key).replace(ne,"$&/")+"/")+Ke)),xe.push(be)),1;Ke=0;var we=ye===""?".":ye+":";if(W(L))for(var Re=0;Re<L.length;Re++)ye=L[Re],mt=we+me(ye,Re),Ke+=q(ye,xe,Te,mt,be);else if(Re=N(L),typeof Re=="function")for(L=Re.call(L),Re=0;!(ye=L.next()).done;)ye=ye.value,mt=we+me(ye,Re++),Ke+=q(ye,xe,Te,mt,be);else if(mt==="object"){if(typeof L.then=="function")return q(ue(L),xe,Te,ye,be);throw xe=String(L),Error("Objects are not valid as a React child (found: "+(xe==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":xe)+"). If you meant to render a collection of children, use an array instead.")}return Ke}function P(L,xe,Te){if(L==null)return L;var ye=[],be=0;return q(L,ye,"","",function(mt){return xe.call(Te,mt,be++)}),ye}function Q(L){if(L._status===-1){var xe=L._result;xe=xe(),xe.then(function(Te){(L._status===0||L._status===-1)&&(L._status=1,L._result=Te)},function(Te){(L._status===0||L._status===-1)&&(L._status=2,L._result=Te)}),L._status===-1&&(L._status=0,L._result=xe)}if(L._status===1)return L._result.default;throw L._result}var te=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var xe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(xe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},ge={map:P,forEach:function(L,xe,Te){P(L,function(){xe.apply(this,arguments)},Te)},count:function(L){var xe=0;return P(L,function(){xe++}),xe},toArray:function(L){return P(L,function(xe){return xe})||[]},only:function(L){if(!Z(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return bn.Activity=S,bn.Children=ge,bn.Component=H,bn.Fragment=t,bn.Profiler=a,bn.PureComponent=U,bn.StrictMode=i,bn.Suspense=f,bn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,bn.__COMPILER_RUNTIME={__proto__:null,c:function(L){return R.H.useMemoCache(L)}},bn.cache=function(L){return function(){return L.apply(null,arguments)}},bn.cacheSignal=function(){return null},bn.cloneElement=function(L,xe,Te){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ye=E({},L.props),be=L.key;if(xe!=null)for(mt in xe.key!==void 0&&(be=""+xe.key),xe)!le.call(xe,mt)||mt==="key"||mt==="__self"||mt==="__source"||mt==="ref"&&xe.ref===void 0||(ye[mt]=xe[mt]);var mt=arguments.length-2;if(mt===1)ye.children=Te;else if(1<mt){for(var Ke=Array(mt),we=0;we<mt;we++)Ke[we]=arguments[we+2];ye.children=Ke}return k(L.type,be,ye)},bn.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},bn.createElement=function(L,xe,Te){var ye,be={},mt=null;if(xe!=null)for(ye in xe.key!==void 0&&(mt=""+xe.key),xe)le.call(xe,ye)&&ye!=="key"&&ye!=="__self"&&ye!=="__source"&&(be[ye]=xe[ye]);var Ke=arguments.length-2;if(Ke===1)be.children=Te;else if(1<Ke){for(var we=Array(Ke),Re=0;Re<Ke;Re++)we[Re]=arguments[Re+2];be.children=we}if(L&&L.defaultProps)for(ye in Ke=L.defaultProps,Ke)be[ye]===void 0&&(be[ye]=Ke[ye]);return k(L,mt,be)},bn.createRef=function(){return{current:null}},bn.forwardRef=function(L){return{$$typeof:h,render:L}},bn.isValidElement=Z,bn.lazy=function(L){return{$$typeof:_,_payload:{_status:-1,_result:L},_init:Q}},bn.memo=function(L,xe){return{$$typeof:g,type:L,compare:xe===void 0?null:xe}},bn.startTransition=function(L){var xe=R.T,Te={};R.T=Te;try{var ye=L(),be=R.S;be!==null&&be(Te,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(X,te)}catch(mt){te(mt)}finally{xe!==null&&Te.types!==null&&(xe.types=Te.types),R.T=xe}},bn.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},bn.use=function(L){return R.H.use(L)},bn.useActionState=function(L,xe,Te){return R.H.useActionState(L,xe,Te)},bn.useCallback=function(L,xe){return R.H.useCallback(L,xe)},bn.useContext=function(L){return R.H.useContext(L)},bn.useDebugValue=function(){},bn.useDeferredValue=function(L,xe){return R.H.useDeferredValue(L,xe)},bn.useEffect=function(L,xe){return R.H.useEffect(L,xe)},bn.useEffectEvent=function(L){return R.H.useEffectEvent(L)},bn.useId=function(){return R.H.useId()},bn.useImperativeHandle=function(L,xe,Te){return R.H.useImperativeHandle(L,xe,Te)},bn.useInsertionEffect=function(L,xe){return R.H.useInsertionEffect(L,xe)},bn.useLayoutEffect=function(L,xe){return R.H.useLayoutEffect(L,xe)},bn.useMemo=function(L,xe){return R.H.useMemo(L,xe)},bn.useOptimistic=function(L,xe){return R.H.useOptimistic(L,xe)},bn.useReducer=function(L,xe,Te){return R.H.useReducer(L,xe,Te)},bn.useRef=function(L){return R.H.useRef(L)},bn.useState=function(L){return R.H.useState(L)},bn.useSyncExternalStore=function(L,xe,Te){return R.H.useSyncExternalStore(L,xe,Te)},bn.useTransition=function(){return R.H.useTransition()},bn.version="19.2.3",bn}var o1;function Kf(){return o1||(o1=1,pp.exports=eC()),pp.exports}var p=Kf();const rn=Du(p),l1=YE({__proto__:null,default:rn},[p]);var gp={exports:{}},Oc={},yp={exports:{}},bp={};var u1;function tC(){return u1||(u1=1,(function(n){function e(q,P){var Q=q.length;q.push(P);e:for(;0<Q;){var te=Q-1>>>1,ge=q[te];if(0<a(ge,P))q[te]=P,q[Q]=ge,Q=te;else break e}}function t(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var P=q[0],Q=q.pop();if(Q!==P){q[0]=Q;e:for(var te=0,ge=q.length,L=ge>>>1;te<L;){var xe=2*(te+1)-1,Te=q[xe],ye=xe+1,be=q[ye];if(0>a(Te,Q))ye<ge&&0>a(be,Te)?(q[te]=be,q[ye]=Q,te=ye):(q[te]=Te,q[xe]=Q,te=xe);else if(ye<ge&&0>a(be,Q))q[te]=be,q[ye]=Q,te=ye;else break e}}return P}function a(q,P){var Q=q.sortIndex-P.sortIndex;return Q!==0?Q:q.id-P.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var f=[],g=[],_=1,S=null,C=3,N=!1,O=!1,E=!1,B=!1,H=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function re(q){for(var P=t(g);P!==null;){if(P.callback===null)i(g);else if(P.startTime<=q)i(g),P.sortIndex=P.expirationTime,e(f,P);else break;P=t(g)}}function W(q){if(E=!1,re(q),!O)if(t(f)!==null)O=!0,X||(X=!0,V());else{var P=t(g);P!==null&&ue(W,P.startTime-q)}}var X=!1,R=-1,le=5,k=-1;function j(){return B?!0:!(n.unstable_now()-k<le)}function Z(){if(B=!1,X){var q=n.unstable_now();k=q;var P=!0;try{e:{O=!1,E&&(E=!1,Y(R),R=-1),N=!0;var Q=C;try{t:{for(re(q),S=t(f);S!==null&&!(S.expirationTime>q&&j());){var te=S.callback;if(typeof te=="function"){S.callback=null,C=S.priorityLevel;var ge=te(S.expirationTime<=q);if(q=n.unstable_now(),typeof ge=="function"){S.callback=ge,re(q),P=!0;break t}S===t(f)&&i(f),re(q)}else i(f);S=t(f)}if(S!==null)P=!0;else{var L=t(g);L!==null&&ue(W,L.startTime-q),P=!1}}break e}finally{S=null,C=Q,N=!1}P=void 0}}finally{P?V():X=!1}}}var V;if(typeof U=="function")V=function(){U(Z)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,me=ne.port2;ne.port1.onmessage=Z,V=function(){me.postMessage(null)}}else V=function(){H(Z,0)};function ue(q,P){R=H(function(){q(n.unstable_now())},P)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(q){q.callback=null},n.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):le=0<q?Math.floor(1e3/q):5},n.unstable_getCurrentPriorityLevel=function(){return C},n.unstable_next=function(q){switch(C){case 1:case 2:case 3:var P=3;break;default:P=C}var Q=C;C=P;try{return q()}finally{C=Q}},n.unstable_requestPaint=function(){B=!0},n.unstable_runWithPriority=function(q,P){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Q=C;C=q;try{return P()}finally{C=Q}},n.unstable_scheduleCallback=function(q,P,Q){var te=n.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?te+Q:te):Q=te,q){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=Q+ge,q={id:_++,callback:P,priorityLevel:q,startTime:Q,expirationTime:ge,sortIndex:-1},Q>te?(q.sortIndex=Q,e(g,q),t(f)===null&&q===t(g)&&(E?(Y(R),R=-1):E=!0,ue(W,Q-te))):(q.sortIndex=ge,e(f,q),O||N||(O=!0,X||(X=!0,V()))),q},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(q){var P=C;return function(){var Q=C;C=P;try{return q.apply(this,arguments)}finally{C=Q}}}})(bp)),bp}var c1;function nC(){return c1||(c1=1,yp.exports=tC()),yp.exports}var vp={exports:{}},vr={};var d1;function iC(){if(d1)return vr;d1=1;var n=Kf();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)g+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+f+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(f,g,_){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:S==null?null:""+S,children:f,containerInfo:g,implementation:_}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,g){if(f==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return vr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,vr.createPortal=function(f,g){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return l(f,g,null,_)},vr.flushSync=function(f){var g=u.T,_=i.p;try{if(u.T=null,i.p=2,f)return f()}finally{u.T=g,i.p=_,i.d.f()}},vr.preconnect=function(f,g){typeof f=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,i.d.C(f,g))},vr.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},vr.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var _=g.as,S=h(_,g.crossOrigin),C=typeof g.integrity=="string"?g.integrity:void 0,N=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;_==="style"?i.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:S,integrity:C,fetchPriority:N}):_==="script"&&i.d.X(f,{crossOrigin:S,integrity:C,fetchPriority:N,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},vr.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var _=h(g.as,g.crossOrigin);i.d.M(f,{crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&i.d.M(f)},vr.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var _=g.as,S=h(_,g.crossOrigin);i.d.L(f,_,{crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},vr.preloadModule=function(f,g){if(typeof f=="string")if(g){var _=h(g.as,g.crossOrigin);i.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else i.d.m(f)},vr.requestFormReset=function(f){i.d.r(f)},vr.unstable_batchedUpdates=function(f,g){return f(g)},vr.useFormState=function(f,g,_){return u.H.useFormState(f,g,_)},vr.useFormStatus=function(){return u.H.useHostTransitionStatus()},vr.version="19.2.3",vr}var h1;function J_(){if(h1)return vp.exports;h1=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),vp.exports=iC(),vp.exports}var f1;function rC(){if(f1)return Oc;f1=1;var n=nC(),e=Kf(),t=J_();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(i(188))}function g(r){var s=r.alternate;if(!s){if(s=l(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var y=o.return;if(y===null)break;var b=y.alternate;if(b===null){if(d=y.return,d!==null){o=d;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===o)return f(y),r;if(b===d)return f(y),s;b=b.sibling}throw Error(i(188))}if(o.return!==d.return)o=y,d=b;else{for(var D=!1,$=y.child;$;){if($===o){D=!0,o=y,d=b;break}if($===d){D=!0,d=y,o=b;break}$=$.sibling}if(!D){for($=b.child;$;){if($===o){D=!0,o=b,d=y;break}if($===d){D=!0,d=b,o=y;break}$=$.sibling}if(!D)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function _(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=_(r),s!==null)return s;r=r.sibling}return null}var S=Object.assign,C=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),U=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function V(r){return r===null||typeof r!="object"?null:(r=Z&&r[Z]||r["@@iterator"],typeof r=="function"?r:null)}var ne=Symbol.for("react.client.reference");function me(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ne?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case E:return"Fragment";case H:return"Profiler";case B:return"StrictMode";case W:return"Suspense";case X:return"SuspenseList";case k:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case O:return"Portal";case U:return r.displayName||"Context";case Y:return(r._context.displayName||"Context")+".Consumer";case re:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case R:return s=r.displayName||null,s!==null?s:me(r.type)||"Memo";case le:s=r._payload,r=r._init;try{return me(r(s))}catch{}}return null}var ue=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},te=[],ge=-1;function L(r){return{current:r}}function xe(r){0>ge||(r.current=te[ge],te[ge]=null,ge--)}function Te(r,s){ge++,te[ge]=r.current,r.current=s}var ye=L(null),be=L(null),mt=L(null),Ke=L(null);function we(r,s){switch(Te(mt,s),Te(be,r),Te(ye,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Cx(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Cx(s),r=Ax(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}xe(ye),Te(ye,r)}function Re(){xe(ye),xe(be),xe(mt)}function ct(r){r.memoizedState!==null&&Te(Ke,r);var s=ye.current,o=Ax(s,r.type);s!==o&&(Te(be,r),Te(ye,o))}function Oe(r){be.current===r&&(xe(ye),xe(be)),Ke.current===r&&(xe(Ke),Nc._currentValue=Q)}var je,Ue;function ze(r){if(je===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);je=s&&s[1]||"",Ue=-1<o.stack.indexOf(`
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
`+je+r+Ue}var gt=!1;function st(r,s){if(!r||gt)return"";gt=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ft=function(){throw Error()};if(Object.defineProperty(ft.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ft,[])}catch(Ze){var Ge=Ze}Reflect.construct(r,[],ft)}else{try{ft.call()}catch(Ze){Ge=Ze}r.call(ft.prototype)}}else{try{throw Error()}catch(Ze){Ge=Ze}(ft=r())&&typeof ft.catch=="function"&&ft.catch(function(){})}}catch(Ze){if(Ze&&Ge&&typeof Ze.stack=="string")return[Ze.stack,Ge.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=d.DetermineComponentFrameRoot(),D=b[0],$=b[1];if(D&&$){var ve=D.split(`
`),qe=$.split(`
`);for(y=d=0;d<ve.length&&!ve[d].includes("DetermineComponentFrameRoot");)d++;for(;y<qe.length&&!qe[y].includes("DetermineComponentFrameRoot");)y++;if(d===ve.length||y===qe.length)for(d=ve.length-1,y=qe.length-1;1<=d&&0<=y&&ve[d]!==qe[y];)y--;for(;1<=d&&0<=y;d--,y--)if(ve[d]!==qe[y]){if(d!==1||y!==1)do if(d--,y--,0>y||ve[d]!==qe[y]){var ot=`
`+ve[d].replace(" at new "," at ");return r.displayName&&ot.includes("<anonymous>")&&(ot=ot.replace("<anonymous>",r.displayName)),ot}while(1<=d&&0<=y);break}}}finally{gt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?ze(o):""}function bt(r,s){switch(r.tag){case 26:case 27:case 5:return ze(r.type);case 16:return ze("Lazy");case 13:return r.child!==s&&s!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return st(r.type,!1);case 11:return st(r.type.render,!1);case 1:return st(r.type,!0);case 31:return ze("Activity");default:return""}}function Qe(r){try{var s="",o=null;do s+=bt(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
Error generating stack: `+d.message+`
`+d.stack}}var Ye=Object.prototype.hasOwnProperty,tt=n.unstable_scheduleCallback,$e=n.unstable_cancelCallback,ht=n.unstable_shouldYield,At=n.unstable_requestPaint,he=n.unstable_now,Ie=n.unstable_getCurrentPriorityLevel,Le=n.unstable_ImmediatePriority,ke=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,et=n.unstable_LowPriority,kt=n.unstable_IdlePriority,Lt=n.log,pt=n.unstable_setDisableYieldValue,Zt=null,qt=null;function Gt(r){if(typeof Lt=="function"&&pt(r),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Zt,r)}catch{}}var wt=Math.clz32?Math.clz32:kn,lt=Math.log,Yt=Math.LN2;function kn(r){return r>>>=0,r===0?32:31-(lt(r)/Yt|0)|0}var pn=256,xn=262144,rt=4194304;function M(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function F(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var y=0,b=r.suspendedLanes,D=r.pingedLanes;r=r.warmLanes;var $=d&134217727;return $!==0?(d=$&~b,d!==0?y=M(d):(D&=$,D!==0?y=M(D):o||(o=$&~r,o!==0&&(y=M(o))))):($=d&~b,$!==0?y=M($):D!==0?y=M(D):o||(o=d&~r,o!==0&&(y=M(o)))),y===0?0:s!==0&&s!==y&&(s&b)===0&&(b=y&-y,o=s&-s,b>=o||b===32&&(o&4194048)!==0)?s:y}function ie(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function De(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ve(){var r=rt;return rt<<=1,(rt&62914560)===0&&(rt=4194304),r}function yt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function Vt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Jt(r,s,o,d,y,b){var D=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var $=r.entanglements,ve=r.expirationTimes,qe=r.hiddenUpdates;for(o=D&~o;0<o;){var ot=31-wt(o),ft=1<<ot;$[ot]=0,ve[ot]=-1;var Ge=qe[ot];if(Ge!==null)for(qe[ot]=null,ot=0;ot<Ge.length;ot++){var Ze=Ge[ot];Ze!==null&&(Ze.lane&=-536870913)}o&=~ft}d!==0&&gn(r,d,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(D&~s))}function gn(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-wt(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function ln(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-wt(o),y=1<<d;y&s|r[d]&s&&(r[d]|=s),o&=~y}}function _n(r,s){var o=s&-s;return o=(o&42)!==0?1:En(o),(o&(r.suspendedLanes|s))!==0?0:o}function En(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Ut(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function hn(){var r=P.p;return r!==0?r:(r=window.event,r===void 0?32:Qx(r.type))}function cn(r,s){var o=P.p;try{return P.p=r,s()}finally{P.p=o}}var en=Math.random().toString(36).slice(2),zt="__reactFiber$"+en,Dt="__reactProps$"+en,Ot="__reactContainer$"+en,Hn="__reactEvents$"+en,Rt="__reactListeners$"+en,qn="__reactHandles$"+en,_i="__reactResources$"+en,Mn="__reactMarker$"+en;function Wt(r){delete r[zt],delete r[Dt],delete r[Hn],delete r[Rt],delete r[qn]}function zn(r){var s=r[zt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Ot]||o[zt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=Lx(r);r!==null;){if(o=r[zt])return o;r=Lx(r)}return s}r=o,o=r.parentNode}return null}function Kn(r){if(r=r[zt]||r[Ot]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function jn(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Wn(r){var s=r[_i];return s||(s=r[_i]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Cn(r){r[Mn]=!0}var fi=new Set,Xn={};function li(r,s){_e(r,s),_e(r+"Capture",s)}function _e(r,s){for(Xn[r]=s,r=0;r<s.length;r++)fi.add(s[r])}var at=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ct={},St={};function Pt(r){return Ye.call(St,r)?!0:Ye.call(Ct,r)?!1:at.test(r)?St[r]=!0:(Ct[r]=!0,!1)}function tn(r,s,o){if(Pt(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function wn(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function vt(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function fn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ne(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Tt(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,b=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return y.call(this)},set:function(D){o=""+D,b.call(this,D)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(D){o=""+D},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function _t(r){if(!r._valueTracker){var s=Ne(r)?"checked":"value";r._valueTracker=Tt(r,s,""+r[s])}}function $t(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=Ne(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function Ht(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var yn=/[\n"\\]/g;function Xt(r){return r.replace(yn,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function On(r,s,o,d,y,b,D,$){r.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?r.type=D:r.removeAttribute("type"),s!=null?D==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+fn(s)):r.value!==""+fn(s)&&(r.value=""+fn(s)):D!=="submit"&&D!=="reset"||r.removeAttribute("value"),s!=null?mi(r,D,fn(s)):o!=null?mi(r,D,fn(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?r.name=""+fn($):r.removeAttribute("name")}function Vn(r,s,o,d,y,b,D,$){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(r.type=b),s!=null||o!=null){if(!(b!=="submit"&&b!=="reset"||s!=null)){_t(r);return}o=o!=null?""+fn(o):"",s=s!=null?""+fn(s):o,$||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=$?r.checked:!!d,r.defaultChecked=!!d,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(r.name=D),_t(r)}function mi(r,s,o){s==="number"&&Ht(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function $n(r,s,o,d){if(r=r.options,s){s={};for(var y=0;y<o.length;y++)s["$"+o[y]]=!0;for(o=0;o<r.length;o++)y=s.hasOwnProperty("$"+r[o].value),r[o].selected!==y&&(r[o].selected=y),y&&d&&(r[o].defaultSelected=!0)}else{for(o=""+fn(o),s=null,y=0;y<r.length;y++){if(r[y].value===o){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}s!==null||r[y].disabled||(s=r[y])}s!==null&&(s.selected=!0)}}function ji(r,s,o){if(s!=null&&(s=""+fn(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+fn(o):""}function Bi(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(ue(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=fn(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),_t(r)}function Yn(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var pi=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function gi(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||pi.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Pn(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in s)d=s[y],s.hasOwnProperty(y)&&o[y]!==d&&gi(r,y,d)}else for(var b in s)s.hasOwnProperty(b)&&gi(r,b,s[b])}function Ri(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ei=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ti=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function An(r){return ti.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function ii(){}var Pi=null;function Oi(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var se=null,I=null;function ce(r){var s=Kn(r);if(s&&(r=s.stateNode)){var o=r[Dt]||null;e:switch(r=s.stateNode,s.type){case"input":if(On(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Xt(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var y=d[Dt]||null;if(!y)throw Error(i(90));On(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&$t(d)}break e;case"textarea":ji(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&$n(r,!!o.multiple,s,!1)}}}var pe=!1;function Ce(r,s,o){if(pe)return r(s,o);pe=!0;try{var d=r(s);return d}finally{if(pe=!1,(se!==null||I!==null)&&(Th(),se&&(s=se,r=I,I=se=null,ce(s),r)))for(s=0;s<r.length;s++)ce(r[s])}}function Ae(r,s){var o=r.stateNode;if(o===null)return null;var d=o[Dt]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){G=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{G=!1}var ae=null,Be=null,Je=null;function We(){if(Je)return Je;var r,s=Be,o=s.length,d,y="value"in ae?ae.value:ae.textContent,b=y.length;for(r=0;r<o&&s[r]===y[r];r++);var D=o-r;for(d=1;d<=D&&s[o-d]===y[b-d];d++);return Je=y.slice(r,1<d?1-d:void 0)}function ut(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Mt(){return!0}function Nt(){return!1}function jt(r){function s(o,d,y,b,D){this._reactName=o,this._targetInst=y,this.type=d,this.nativeEvent=b,this.target=D,this.currentTarget=null;for(var $ in r)r.hasOwnProperty($)&&(o=r[$],this[$]=o?o(b):b[$]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Mt:Nt,this.isPropagationStopped=Nt,this}return S(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Mt)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Mt)},persist:function(){},isPersistent:Mt}),s}var Qt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gn=jt(Qt),rr=S({},Qt,{view:0,detail:0}),dr=jt(rr),ja,No,os,wi=S({},rr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pu,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==os&&(os&&r.type==="mousemove"?(ja=r.screenX-os.screenX,No=r.screenY-os.screenY):No=ja=0,os=r),ja)},movementY:function(r){return"movementY"in r?r.movementY:No}}),Fi=jt(wi),_s=S({},wi,{dataTransfer:0}),Do=jt(_s),k0=S({},rr,{relatedTarget:0}),Ra=jt(k0),Mo=S({},Qt,{animationName:0,elapsedTime:0,pseudoElement:0}),jo=jt(Mo),_l=S({},Qt,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Kr=jt(_l),ws=S({},Qt,{data:0}),Ro=jt(ws),Ad={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},C0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function A0(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=C0[r])?!!s[r]:!1}function Pu(){return A0}var Nd=S({},rr,{key:function(r){if(r.key){var s=Ad[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=ut(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?E0[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pu,charCode:function(r){return r.type==="keypress"?ut(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ut(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Dd=jt(Nd),wl=S({},wi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oa=jt(wl),Tl=S({},rr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pu}),ra=jt(Tl),N0=S({},Qt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Md=jt(N0),jd=S({},wi,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Rd=jt(jd),D0=S({},Qt,{newState:0,oldState:0}),M0=jt(D0),j0=[9,13,27,32],La=z&&"CompositionEvent"in window,Oo=null;z&&"documentMode"in document&&(Oo=document.documentMode);var Od=z&&"TextEvent"in window&&!Oo,Ld=z&&(!La||Oo&&8<Oo&&11>=Oo),Id=" ",Fu=!1;function Sl(r,s){switch(r){case"keyup":return j0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bd(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ia=!1;function R0(r,s){switch(r){case"compositionend":return Bd(s);case"keypress":return s.which!==32?null:(Fu=!0,Id);case"textInput":return r=s.data,r===Id&&Fu?null:r;default:return null}}function Uu(r,s){if(Ia)return r==="compositionend"||!La&&Sl(r,s)?(r=We(),Je=Be=ae=null,Ia=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ld&&s.locale!=="ko"?null:s.data;default:return null}}var O0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!O0[r.type]:s==="textarea"}function Pd(r,s,o,d){se?I?I.push(d):I=[d]:se=d,s=Dh(s,"onChange"),0<s.length&&(o=new Gn("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var Lo=null,Ba=null;function L0(r){_x(r,0)}function Io(r){var s=jn(r);if($t(s))return r}function $u(r,s){if(r==="change")return s}var Hu=!1;if(z){var qu;if(z){var Vu="oninput"in document;if(!Vu){var Bo=document.createElement("div");Bo.setAttribute("oninput","return;"),Vu=typeof Bo.oninput=="function"}qu=Vu}else qu=!1;Hu=qu&&(!document.documentMode||9<document.documentMode)}function Fd(){Lo&&(Lo.detachEvent("onpropertychange",Ud),Ba=Lo=null)}function Ud(r){if(r.propertyName==="value"&&Io(Ba)){var s=[];Pd(s,Ba,r,Oi(r)),Ce(L0,s)}}function I0(r,s,o){r==="focusin"?(Fd(),Lo=s,Ba=o,Lo.attachEvent("onpropertychange",Ud)):r==="focusout"&&Fd()}function B0(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Io(Ba)}function zd(r,s){if(r==="click")return Io(s)}function P0(r,s){if(r==="input"||r==="change")return Io(s)}function Po(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var yr=typeof Object.is=="function"?Object.is:Po;function Os(r,s){if(yr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var y=o[d];if(!Ye.call(s,y)||!yr(r[y],s[y]))return!1}return!0}function Pa(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ci(r,s){var o=Pa(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Pa(o)}}function sa(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?sa(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function kl(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Ht(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=Ht(r.document)}return s}function Gu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var F0=z&&"documentMode"in document&&11>=document.documentMode,Fa=null,Ku=null,Ua=null,El=!1;function Wu(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;El||Fa==null||Fa!==Ht(d)||(d=Fa,"selectionStart"in d&&Gu(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Ua&&Os(Ua,d)||(Ua=d,d=Dh(Ku,"onSelect"),0<d.length&&(s=new Gn("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=Fa)))}function Ls(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var aa={animationend:Ls("Animation","AnimationEnd"),animationiteration:Ls("Animation","AnimationIteration"),animationstart:Ls("Animation","AnimationStart"),transitionrun:Ls("Transition","TransitionRun"),transitionstart:Ls("Transition","TransitionStart"),transitioncancel:Ls("Transition","TransitionCancel"),transitionend:Ls("Transition","TransitionEnd")},Fo={},Xu={};z&&(Xu=document.createElement("div").style,"AnimationEvent"in window||(delete aa.animationend.animation,delete aa.animationiteration.animation,delete aa.animationstart.animation),"TransitionEvent"in window||delete aa.transitionend.transition);function Ts(r){if(Fo[r])return Fo[r];if(!aa[r])return r;var s=aa[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Xu)return Fo[r]=s[o];return r}var $d=Ts("animationend"),za=Ts("animationiteration"),Hd=Ts("animationstart"),qd=Ts("transitionrun"),Vd=Ts("transitionstart"),U0=Ts("transitioncancel"),Gd=Ts("transitionend"),Yu=new Map,Qu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Qu.push("scrollEnd");function Wr(r,s){Yu.set(r,s),li(s,[r])}var $a=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Nr=[],Ha=0,Zu=0;function Cl(){for(var r=Ha,s=Zu=Ha=0;s<r;){var o=Nr[s];Nr[s++]=null;var d=Nr[s];Nr[s++]=null;var y=Nr[s];Nr[s++]=null;var b=Nr[s];if(Nr[s++]=null,d!==null&&y!==null){var D=d.pending;D===null?y.next=y:(y.next=D.next,D.next=y),d.pending=y}b!==0&&Kd(o,y,b)}}function Al(r,s,o,d){Nr[Ha++]=r,Nr[Ha++]=s,Nr[Ha++]=o,Nr[Ha++]=d,Zu|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Ju(r,s,o,d){return Al(r,s,o,d),Nl(r)}function oa(r,s){return Al(r,null,null,s),Nl(r)}function Kd(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var y=!1,b=r.return;b!==null;)b.childLanes|=o,d=b.alternate,d!==null&&(d.childLanes|=o),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(y=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,y&&s!==null&&(y=31-wt(o),r=b.hiddenUpdates,d=r[y],d===null?r[y]=[s]:d.push(s),s.lane=o|536870912),b):null}function Nl(r){if(50<wc)throw wc=0,Pm=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var qa={};function z0(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ui(r,s,o,d){return new z0(r,s,o,d)}function ec(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ss(r,s){var o=r.alternate;return o===null?(o=Ui(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Wd(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function tc(r,s,o,d,y,b){var D=0;if(d=r,typeof r=="function")ec(r)&&(D=1);else if(typeof r=="string")D=PE(r,o,ye.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case k:return r=Ui(31,o,s,y),r.elementType=k,r.lanes=b,r;case E:return Is(o.children,y,b,s);case B:D=8,y|=24;break;case H:return r=Ui(12,o,s,y|2),r.elementType=H,r.lanes=b,r;case W:return r=Ui(13,o,s,y),r.elementType=W,r.lanes=b,r;case X:return r=Ui(19,o,s,y),r.elementType=X,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case U:D=10;break e;case Y:D=9;break e;case re:D=11;break e;case R:D=14;break e;case le:D=16,d=null;break e}D=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=Ui(D,o,s,y),s.elementType=r,s.type=d,s.lanes=b,s}function Is(r,s,o,d){return r=Ui(7,r,d,s),r.lanes=o,r}function Uo(r,s,o){return r=Ui(6,r,null,s),r.lanes=o,r}function nc(r){var s=Ui(18,null,null,0);return s.stateNode=r,s}function Va(r,s,o){return s=Ui(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var zo=new WeakMap;function Dr(r,s){if(typeof r=="object"&&r!==null){var o=zo.get(r);return o!==void 0?o:(s={value:r,source:s,stack:Qe(s)},zo.set(r,s),s)}return{value:r,source:s,stack:Qe(s)}}var Ga=[],Ka=0,Dl=null,$o=0,br=[],Mr=0,Bs=null,Xr=1,hr="";function Nn(r,s){Ga[Ka++]=$o,Ga[Ka++]=Dl,Dl=r,$o=s}function Ps(r,s,o){br[Mr++]=Xr,br[Mr++]=hr,br[Mr++]=Bs,Bs=r;var d=Xr;r=hr;var y=32-wt(d)-1;d&=~(1<<y),o+=1;var b=32-wt(s)+y;if(30<b){var D=y-y%5;b=(d&(1<<D)-1).toString(32),d>>=D,y-=D,Xr=1<<32-wt(s)+y|o<<y|d,hr=b+r}else Xr=1<<b|o<<y|d,hr=r}function tr(r){r.return!==null&&(Nn(r,1),Ps(r,1,0))}function jr(r){for(;r===Dl;)Dl=Ga[--Ka],Ga[Ka]=null,$o=Ga[--Ka],Ga[Ka]=null;for(;r===Bs;)Bs=br[--Mr],br[Mr]=null,hr=br[--Mr],br[Mr]=null,Xr=br[--Mr],br[Mr]=null}function Xd(r,s){br[Mr++]=Xr,br[Mr++]=hr,br[Mr++]=Bs,Xr=s.id,hr=s.overflow,Bs=r}var Yi=null,yi=null,Ln=!1,Fs=null,Rr=!1,ic=Error(i(519));function Us(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw x(Dr(s,r)),ic}function Yd(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[zt]=r,s[Dt]=d,o){case"dialog":Bn("cancel",s),Bn("close",s);break;case"iframe":case"object":case"embed":Bn("load",s);break;case"video":case"audio":for(o=0;o<Sc.length;o++)Bn(Sc[o],s);break;case"source":Bn("error",s);break;case"img":case"image":case"link":Bn("error",s),Bn("load",s);break;case"details":Bn("toggle",s);break;case"input":Bn("invalid",s),Vn(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Bn("invalid",s);break;case"textarea":Bn("invalid",s),Bi(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||kx(s.textContent,o)?(d.popover!=null&&(Bn("beforetoggle",s),Bn("toggle",s)),d.onScroll!=null&&Bn("scroll",s),d.onScrollEnd!=null&&Bn("scrollend",s),d.onClick!=null&&(s.onclick=ii),s=!0):s=!1,s||Us(r,!0)}function rc(r){for(Yi=r.return;Yi;)switch(Yi.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:Yi=Yi.return}}function m(r){if(r!==Yi)return!1;if(!Ln)return rc(r),Ln=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Jm(r.type,r.memoizedProps)),o=!o),o&&yi&&Us(r),rc(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));yi=Ox(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));yi=Ox(r)}else s===27?(s=yi,ao(r.type)?(r=rp,rp=null,yi=r):yi=s):yi=Yi?cs(r.stateNode.nextSibling):null;return!0}function v(){yi=Yi=null,Ln=!1}function w(){var r=Fs;return r!==null&&(Br===null?Br=r:Br.push.apply(Br,r),Fs=null),r}function x(r){Fs===null?Fs=[r]:Fs.push(r)}var T=L(null),A=null,K=null;function J(r,s,o){Te(T,s._currentValue),s._currentValue=o}function oe(r){r._currentValue=T.current,xe(T)}function fe(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Ee(r,s,o,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var b=y.dependencies;if(b!==null){var D=y.child;b=b.firstContext;e:for(;b!==null;){var $=b;b=y;for(var ve=0;ve<s.length;ve++)if($.context===s[ve]){b.lanes|=o,$=b.alternate,$!==null&&($.lanes|=o),fe(b.return,o,r),d||(D=null);break e}b=$.next}}else if(y.tag===18){if(D=y.return,D===null)throw Error(i(341));D.lanes|=o,b=D.alternate,b!==null&&(b.lanes|=o),fe(D,o,r),D=null}else D=y.child;if(D!==null)D.return=y;else for(D=y;D!==null;){if(D===r){D=null;break}if(y=D.sibling,y!==null){y.return=D.return,D=y;break}D=D.return}y=D}}function Xe(r,s,o,d){r=null;for(var y=s,b=!1;y!==null;){if(!b){if((y.flags&524288)!==0)b=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var D=y.alternate;if(D===null)throw Error(i(387));if(D=D.memoizedProps,D!==null){var $=y.type;yr(y.pendingProps.value,D.value)||(r!==null?r.push($):r=[$])}}else if(y===Ke.current){if(D=y.alternate,D===null)throw Error(i(387));D.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Nc):r=[Nc])}y=y.return}r!==null&&Ee(s,r,o,d),s.flags|=262144}function Et(r){for(r=r.firstContext;r!==null;){if(!yr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function it(r){A=r,K=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function It(r){return Vi(A,r)}function mn(r,s){return A===null&&it(r),Vi(r,s)}function Vi(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},K===null){if(r===null)throw Error(i(308));K=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else K=K.next=s;return o}var Tr=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},zs=n.unstable_scheduleCallback,Ho=n.unstable_NormalPriority,Ti={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new Tr,data:new Map,refCount:0}}function ks(r){r.refCount--,r.refCount===0&&zs(Ho,function(){r.controller.abort()})}var $s=null,si=0,ls=0,sr=null;function Bk(r,s){if($s===null){var o=$s=[];si=0,ls=qm(),sr={status:"pending",value:void 0,then:function(d){o.push(d)}}}return si++,s.then(db,db),s}function db(){if(--si===0&&$s!==null){sr!==null&&(sr.status="fulfilled");var r=$s;$s=null,ls=0,sr=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Pk(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(y){o.push(y)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var y=0;y<o.length;y++)(0,o[y])(s)},function(y){for(d.status="rejected",d.reason=y,y=0;y<o.length;y++)(0,o[y])(void 0)}),d}var hb=q.S;q.S=function(r,s){Xv=he(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Bk(r,s),hb!==null&&hb(r,s)};var qo=L(null);function $0(){var r=qo.current;return r!==null?r:bi.pooledCache}function Qd(r,s){s===null?Te(qo,qo.current):Te(qo,s.pool)}function fb(){var r=$0();return r===null?null:{parent:Ti._currentValue,pool:r}}var Ml=Error(i(460)),H0=Error(i(474)),Zd=Error(i(542)),Jd={then:function(){}};function mb(r){return r=r.status,r==="fulfilled"||r==="rejected"}function pb(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(ii,ii),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,yb(r),r;default:if(typeof s.status=="string")s.then(ii,ii);else{if(r=bi,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var y=s;y.status="fulfilled",y.value=d}},function(d){if(s.status==="pending"){var y=s;y.status="rejected",y.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,yb(r),r}throw Go=s,Ml}}function Vo(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Go=o,Ml):o}}var Go=null;function gb(){if(Go===null)throw Error(i(459));var r=Go;return Go=null,r}function yb(r){if(r===Ml||r===Zd)throw Error(i(483))}var jl=null,sc=0;function eh(r){var s=sc;return sc+=1,jl===null&&(jl=[]),pb(jl,r,s)}function ac(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function th(r,s){throw s.$$typeof===C?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function bb(r){function s(Me,Se){if(r){var He=Me.deletions;He===null?(Me.deletions=[Se],Me.flags|=16):He.push(Se)}}function o(Me,Se){if(!r)return null;for(;Se!==null;)s(Me,Se),Se=Se.sibling;return null}function d(Me){for(var Se=new Map;Me!==null;)Me.key!==null?Se.set(Me.key,Me):Se.set(Me.index,Me),Me=Me.sibling;return Se}function y(Me,Se){return Me=Ss(Me,Se),Me.index=0,Me.sibling=null,Me}function b(Me,Se,He){return Me.index=He,r?(He=Me.alternate,He!==null?(He=He.index,He<Se?(Me.flags|=67108866,Se):He):(Me.flags|=67108866,Se)):(Me.flags|=1048576,Se)}function D(Me){return r&&Me.alternate===null&&(Me.flags|=67108866),Me}function $(Me,Se,He,dt){return Se===null||Se.tag!==6?(Se=Uo(He,Me.mode,dt),Se.return=Me,Se):(Se=y(Se,He),Se.return=Me,Se)}function ve(Me,Se,He,dt){var nn=He.type;return nn===E?ot(Me,Se,He.props.children,dt,He.key):Se!==null&&(Se.elementType===nn||typeof nn=="object"&&nn!==null&&nn.$$typeof===le&&Vo(nn)===Se.type)?(Se=y(Se,He.props),ac(Se,He),Se.return=Me,Se):(Se=tc(He.type,He.key,He.props,null,Me.mode,dt),ac(Se,He),Se.return=Me,Se)}function qe(Me,Se,He,dt){return Se===null||Se.tag!==4||Se.stateNode.containerInfo!==He.containerInfo||Se.stateNode.implementation!==He.implementation?(Se=Va(He,Me.mode,dt),Se.return=Me,Se):(Se=y(Se,He.children||[]),Se.return=Me,Se)}function ot(Me,Se,He,dt,nn){return Se===null||Se.tag!==7?(Se=Is(He,Me.mode,dt,nn),Se.return=Me,Se):(Se=y(Se,He),Se.return=Me,Se)}function ft(Me,Se,He){if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return Se=Uo(""+Se,Me.mode,He),Se.return=Me,Se;if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case N:return He=tc(Se.type,Se.key,Se.props,null,Me.mode,He),ac(He,Se),He.return=Me,He;case O:return Se=Va(Se,Me.mode,He),Se.return=Me,Se;case le:return Se=Vo(Se),ft(Me,Se,He)}if(ue(Se)||V(Se))return Se=Is(Se,Me.mode,He,null),Se.return=Me,Se;if(typeof Se.then=="function")return ft(Me,eh(Se),He);if(Se.$$typeof===U)return ft(Me,mn(Me,Se),He);th(Me,Se)}return null}function Ge(Me,Se,He,dt){var nn=Se!==null?Se.key:null;if(typeof He=="string"&&He!==""||typeof He=="number"||typeof He=="bigint")return nn!==null?null:$(Me,Se,""+He,dt);if(typeof He=="object"&&He!==null){switch(He.$$typeof){case N:return He.key===nn?ve(Me,Se,He,dt):null;case O:return He.key===nn?qe(Me,Se,He,dt):null;case le:return He=Vo(He),Ge(Me,Se,He,dt)}if(ue(He)||V(He))return nn!==null?null:ot(Me,Se,He,dt,null);if(typeof He.then=="function")return Ge(Me,Se,eh(He),dt);if(He.$$typeof===U)return Ge(Me,Se,mn(Me,He),dt);th(Me,He)}return null}function Ze(Me,Se,He,dt,nn){if(typeof dt=="string"&&dt!==""||typeof dt=="number"||typeof dt=="bigint")return Me=Me.get(He)||null,$(Se,Me,""+dt,nn);if(typeof dt=="object"&&dt!==null){switch(dt.$$typeof){case N:return Me=Me.get(dt.key===null?He:dt.key)||null,ve(Se,Me,dt,nn);case O:return Me=Me.get(dt.key===null?He:dt.key)||null,qe(Se,Me,dt,nn);case le:return dt=Vo(dt),Ze(Me,Se,He,dt,nn)}if(ue(dt)||V(dt))return Me=Me.get(He)||null,ot(Se,Me,dt,nn,null);if(typeof dt.then=="function")return Ze(Me,Se,He,eh(dt),nn);if(dt.$$typeof===U)return Ze(Me,Se,He,mn(Se,dt),nn);th(Se,dt)}return null}function Ft(Me,Se,He,dt){for(var nn=null,Qn=null,Kt=Se,Sn=Se=0,Un=null;Kt!==null&&Sn<He.length;Sn++){Kt.index>Sn?(Un=Kt,Kt=null):Un=Kt.sibling;var Zn=Ge(Me,Kt,He[Sn],dt);if(Zn===null){Kt===null&&(Kt=Un);break}r&&Kt&&Zn.alternate===null&&s(Me,Kt),Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn,Kt=Un}if(Sn===He.length)return o(Me,Kt),Ln&&Nn(Me,Sn),nn;if(Kt===null){for(;Sn<He.length;Sn++)Kt=ft(Me,He[Sn],dt),Kt!==null&&(Se=b(Kt,Se,Sn),Qn===null?nn=Kt:Qn.sibling=Kt,Qn=Kt);return Ln&&Nn(Me,Sn),nn}for(Kt=d(Kt);Sn<He.length;Sn++)Un=Ze(Kt,Me,Sn,He[Sn],dt),Un!==null&&(r&&Un.alternate!==null&&Kt.delete(Un.key===null?Sn:Un.key),Se=b(Un,Se,Sn),Qn===null?nn=Un:Qn.sibling=Un,Qn=Un);return r&&Kt.forEach(function(ho){return s(Me,ho)}),Ln&&Nn(Me,Sn),nn}function un(Me,Se,He,dt){if(He==null)throw Error(i(151));for(var nn=null,Qn=null,Kt=Se,Sn=Se=0,Un=null,Zn=He.next();Kt!==null&&!Zn.done;Sn++,Zn=He.next()){Kt.index>Sn?(Un=Kt,Kt=null):Un=Kt.sibling;var ho=Ge(Me,Kt,Zn.value,dt);if(ho===null){Kt===null&&(Kt=Un);break}r&&Kt&&ho.alternate===null&&s(Me,Kt),Se=b(ho,Se,Sn),Qn===null?nn=ho:Qn.sibling=ho,Qn=ho,Kt=Un}if(Zn.done)return o(Me,Kt),Ln&&Nn(Me,Sn),nn;if(Kt===null){for(;!Zn.done;Sn++,Zn=He.next())Zn=ft(Me,Zn.value,dt),Zn!==null&&(Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn);return Ln&&Nn(Me,Sn),nn}for(Kt=d(Kt);!Zn.done;Sn++,Zn=He.next())Zn=Ze(Kt,Me,Sn,Zn.value,dt),Zn!==null&&(r&&Zn.alternate!==null&&Kt.delete(Zn.key===null?Sn:Zn.key),Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn);return r&&Kt.forEach(function(XE){return s(Me,XE)}),Ln&&Nn(Me,Sn),nn}function di(Me,Se,He,dt){if(typeof He=="object"&&He!==null&&He.type===E&&He.key===null&&(He=He.props.children),typeof He=="object"&&He!==null){switch(He.$$typeof){case N:e:{for(var nn=He.key;Se!==null;){if(Se.key===nn){if(nn=He.type,nn===E){if(Se.tag===7){o(Me,Se.sibling),dt=y(Se,He.props.children),dt.return=Me,Me=dt;break e}}else if(Se.elementType===nn||typeof nn=="object"&&nn!==null&&nn.$$typeof===le&&Vo(nn)===Se.type){o(Me,Se.sibling),dt=y(Se,He.props),ac(dt,He),dt.return=Me,Me=dt;break e}o(Me,Se);break}else s(Me,Se);Se=Se.sibling}He.type===E?(dt=Is(He.props.children,Me.mode,dt,He.key),dt.return=Me,Me=dt):(dt=tc(He.type,He.key,He.props,null,Me.mode,dt),ac(dt,He),dt.return=Me,Me=dt)}return D(Me);case O:e:{for(nn=He.key;Se!==null;){if(Se.key===nn)if(Se.tag===4&&Se.stateNode.containerInfo===He.containerInfo&&Se.stateNode.implementation===He.implementation){o(Me,Se.sibling),dt=y(Se,He.children||[]),dt.return=Me,Me=dt;break e}else{o(Me,Se);break}else s(Me,Se);Se=Se.sibling}dt=Va(He,Me.mode,dt),dt.return=Me,Me=dt}return D(Me);case le:return He=Vo(He),di(Me,Se,He,dt)}if(ue(He))return Ft(Me,Se,He,dt);if(V(He)){if(nn=V(He),typeof nn!="function")throw Error(i(150));return He=nn.call(He),un(Me,Se,He,dt)}if(typeof He.then=="function")return di(Me,Se,eh(He),dt);if(He.$$typeof===U)return di(Me,Se,mn(Me,He),dt);th(Me,He)}return typeof He=="string"&&He!==""||typeof He=="number"||typeof He=="bigint"?(He=""+He,Se!==null&&Se.tag===6?(o(Me,Se.sibling),dt=y(Se,He),dt.return=Me,Me=dt):(o(Me,Se),dt=Uo(He,Me.mode,dt),dt.return=Me,Me=dt),D(Me)):o(Me,Se)}return function(Me,Se,He,dt){try{sc=0;var nn=di(Me,Se,He,dt);return jl=null,nn}catch(Kt){if(Kt===Ml||Kt===Zd)throw Kt;var Qn=Ui(29,Kt,null,Me.mode);return Qn.lanes=dt,Qn.return=Me,Qn}}}var Ko=bb(!0),vb=bb(!1),Wa=!1;function q0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function V0(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Xa(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ya(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ni&2)!==0){var y=d.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),d.pending=s,s=Nl(r),Kd(r,null,o),s}return Al(r,d,s,o),Nl(r)}function oc(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ln(r,o)}}function G0(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var y=null,b=null;if(o=o.firstBaseUpdate,o!==null){do{var D={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?y=b=D:b=b.next=D,o=o.next}while(o!==null);b===null?y=b=s:b=b.next=s}else y=b=s;o={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var K0=!1;function lc(){if(K0){var r=sr;if(r!==null)throw r}}function uc(r,s,o,d){K0=!1;var y=r.updateQueue;Wa=!1;var b=y.firstBaseUpdate,D=y.lastBaseUpdate,$=y.shared.pending;if($!==null){y.shared.pending=null;var ve=$,qe=ve.next;ve.next=null,D===null?b=qe:D.next=qe,D=ve;var ot=r.alternate;ot!==null&&(ot=ot.updateQueue,$=ot.lastBaseUpdate,$!==D&&($===null?ot.firstBaseUpdate=qe:$.next=qe,ot.lastBaseUpdate=ve))}if(b!==null){var ft=y.baseState;D=0,ot=qe=ve=null,$=b;do{var Ge=$.lane&-536870913,Ze=Ge!==$.lane;if(Ze?(Fn&Ge)===Ge:(d&Ge)===Ge){Ge!==0&&Ge===ls&&(K0=!0),ot!==null&&(ot=ot.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Ft=r,un=$;Ge=s;var di=o;switch(un.tag){case 1:if(Ft=un.payload,typeof Ft=="function"){ft=Ft.call(di,ft,Ge);break e}ft=Ft;break e;case 3:Ft.flags=Ft.flags&-65537|128;case 0:if(Ft=un.payload,Ge=typeof Ft=="function"?Ft.call(di,ft,Ge):Ft,Ge==null)break e;ft=S({},ft,Ge);break e;case 2:Wa=!0}}Ge=$.callback,Ge!==null&&(r.flags|=64,Ze&&(r.flags|=8192),Ze=y.callbacks,Ze===null?y.callbacks=[Ge]:Ze.push(Ge))}else Ze={lane:Ge,tag:$.tag,payload:$.payload,callback:$.callback,next:null},ot===null?(qe=ot=Ze,ve=ft):ot=ot.next=Ze,D|=Ge;if($=$.next,$===null){if($=y.shared.pending,$===null)break;Ze=$,$=Ze.next,Ze.next=null,y.lastBaseUpdate=Ze,y.shared.pending=null}}while(!0);ot===null&&(ve=ft),y.baseState=ve,y.firstBaseUpdate=qe,y.lastBaseUpdate=ot,b===null&&(y.shared.lanes=0),to|=D,r.lanes=D,r.memoizedState=ft}}function xb(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function _b(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)xb(o[r],s)}var Rl=L(null),nh=L(0);function wb(r,s){r=ya,Te(nh,r),Te(Rl,s),ya=r|s.baseLanes}function W0(){Te(nh,ya),Te(Rl,Rl.current)}function X0(){ya=nh.current,xe(Rl),xe(nh)}var Yr=L(null),us=null;function Qa(r){var s=r.alternate;Te(Gi,Gi.current&1),Te(Yr,r),us===null&&(s===null||Rl.current!==null||s.memoizedState!==null)&&(us=r)}function Y0(r){Te(Gi,Gi.current),Te(Yr,r),us===null&&(us=r)}function Tb(r){r.tag===22?(Te(Gi,Gi.current),Te(Yr,r),us===null&&(us=r)):Za()}function Za(){Te(Gi,Gi.current),Te(Yr,Yr.current)}function Qr(r){xe(Yr),us===r&&(us=null),xe(Gi)}var Gi=L(0);function ih(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||np(o)||ip(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ua=0,Tn=null,ui=null,Qi=null,rh=!1,Ol=!1,Wo=!1,sh=0,cc=0,Ll=null,Fk=0;function zi(){throw Error(i(321))}function Q0(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!yr(r[o],s[o]))return!1;return!0}function Z0(r,s,o,d,y,b){return ua=b,Tn=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,q.H=r===null||r.memoizedState===null?av:fm,Wo=!1,b=o(d,y),Wo=!1,Ol&&(b=kb(s,o,d,y)),Sb(r),b}function Sb(r){q.H=fc;var s=ui!==null&&ui.next!==null;if(ua=0,Qi=ui=Tn=null,rh=!1,cc=0,Ll=null,s)throw Error(i(300));r===null||Zi||(r=r.dependencies,r!==null&&Et(r)&&(Zi=!0))}function kb(r,s,o,d){Tn=r;var y=0;do{if(Ol&&(Ll=null),cc=0,Ol=!1,25<=y)throw Error(i(301));if(y+=1,Qi=ui=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}q.H=ov,b=s(o,d)}while(Ol);return b}function Uk(){var r=q.H,s=r.useState()[0];return s=typeof s.then=="function"?dc(s):s,r=r.useState()[0],(ui!==null?ui.memoizedState:null)!==r&&(Tn.flags|=1024),s}function J0(){var r=sh!==0;return sh=0,r}function em(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function tm(r){if(rh){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}rh=!1}ua=0,Qi=ui=Tn=null,Ol=!1,cc=sh=0,Ll=null}function Sr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qi===null?Tn.memoizedState=Qi=r:Qi=Qi.next=r,Qi}function Ki(){if(ui===null){var r=Tn.alternate;r=r!==null?r.memoizedState:null}else r=ui.next;var s=Qi===null?Tn.memoizedState:Qi.next;if(s!==null)Qi=s,ui=r;else{if(r===null)throw Tn.alternate===null?Error(i(467)):Error(i(310));ui=r,r={memoizedState:ui.memoizedState,baseState:ui.baseState,baseQueue:ui.baseQueue,queue:ui.queue,next:null},Qi===null?Tn.memoizedState=Qi=r:Qi=Qi.next=r}return Qi}function ah(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function dc(r){var s=cc;return cc+=1,Ll===null&&(Ll=[]),r=pb(Ll,r,s),s=Tn,(Qi===null?s.memoizedState:Qi.next)===null&&(s=s.alternate,q.H=s===null||s.memoizedState===null?av:fm),r}function oh(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return dc(r);if(r.$$typeof===U)return It(r)}throw Error(i(438,String(r)))}function nm(r){var s=null,o=Tn.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=Tn.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(y){return y.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=ah(),Tn.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=j;return s.index++,o}function ca(r,s){return typeof s=="function"?s(r):s}function lh(r){var s=Ki();return im(s,ui,r)}function im(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var y=r.baseQueue,b=d.pending;if(b!==null){if(y!==null){var D=y.next;y.next=b.next,b.next=D}s.baseQueue=y=b,d.pending=null}if(b=r.baseState,y===null)r.memoizedState=b;else{s=y.next;var $=D=null,ve=null,qe=s,ot=!1;do{var ft=qe.lane&-536870913;if(ft!==qe.lane?(Fn&ft)===ft:(ua&ft)===ft){var Ge=qe.revertLane;if(Ge===0)ve!==null&&(ve=ve.next={lane:0,revertLane:0,gesture:null,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null}),ft===ls&&(ot=!0);else if((ua&Ge)===Ge){qe=qe.next,Ge===ls&&(ot=!0);continue}else ft={lane:0,revertLane:qe.revertLane,gesture:null,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null},ve===null?($=ve=ft,D=b):ve=ve.next=ft,Tn.lanes|=Ge,to|=Ge;ft=qe.action,Wo&&o(b,ft),b=qe.hasEagerState?qe.eagerState:o(b,ft)}else Ge={lane:ft,revertLane:qe.revertLane,gesture:qe.gesture,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null},ve===null?($=ve=Ge,D=b):ve=ve.next=Ge,Tn.lanes|=ft,to|=ft;qe=qe.next}while(qe!==null&&qe!==s);if(ve===null?D=b:ve.next=$,!yr(b,r.memoizedState)&&(Zi=!0,ot&&(o=sr,o!==null)))throw o;r.memoizedState=b,r.baseState=D,r.baseQueue=ve,d.lastRenderedState=b}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function rm(r){var s=Ki(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,y=o.pending,b=s.memoizedState;if(y!==null){o.pending=null;var D=y=y.next;do b=r(b,D.action),D=D.next;while(D!==y);yr(b,s.memoizedState)||(Zi=!0),s.memoizedState=b,s.baseQueue===null&&(s.baseState=b),o.lastRenderedState=b}return[b,d]}function Eb(r,s,o){var d=Tn,y=Ki(),b=Ln;if(b){if(o===void 0)throw Error(i(407));o=o()}else o=s();var D=!yr((ui||y).memoizedState,o);if(D&&(y.memoizedState=o,Zi=!0),y=y.queue,om(Nb.bind(null,d,y,r),[r]),y.getSnapshot!==s||D||Qi!==null&&Qi.memoizedState.tag&1){if(d.flags|=2048,Il(9,{destroy:void 0},Ab.bind(null,d,y,o,s),null),bi===null)throw Error(i(349));b||(ua&127)!==0||Cb(d,s,o)}return o}function Cb(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=Tn.updateQueue,s===null?(s=ah(),Tn.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function Ab(r,s,o,d){s.value=o,s.getSnapshot=d,Db(s)&&Mb(r)}function Nb(r,s,o){return o(function(){Db(s)&&Mb(r)})}function Db(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!yr(r,o)}catch{return!0}}function Mb(r){var s=oa(r,2);s!==null&&Pr(s,r,2)}function sm(r){var s=Sr();if(typeof r=="function"){var o=r;if(r=o(),Wo){Gt(!0);try{o()}finally{Gt(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:r},s}function jb(r,s,o,d){return r.baseState=o,im(r,ui,typeof d=="function"?d:ca)}function zk(r,s,o,d,y){if(dh(r))throw Error(i(485));if(r=s.action,r!==null){var b={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){b.listeners.push(D)}};q.T!==null?o(!0):b.isTransition=!1,d(b),o=s.pending,o===null?(b.next=s.pending=b,Rb(s,b)):(b.next=o.next,s.pending=o.next=b)}}function Rb(r,s){var o=s.action,d=s.payload,y=r.state;if(s.isTransition){var b=q.T,D={};q.T=D;try{var $=o(y,d),ve=q.S;ve!==null&&ve(D,$),Ob(r,s,$)}catch(qe){am(r,s,qe)}finally{b!==null&&D.types!==null&&(b.types=D.types),q.T=b}}else try{b=o(y,d),Ob(r,s,b)}catch(qe){am(r,s,qe)}}function Ob(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){Lb(r,s,d)},function(d){return am(r,s,d)}):Lb(r,s,o)}function Lb(r,s,o){s.status="fulfilled",s.value=o,Ib(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,Rb(r,o)))}function am(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,Ib(s),s=s.next;while(s!==d)}r.action=null}function Ib(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function Bb(r,s){return s}function Pb(r,s){if(Ln){var o=bi.formState;if(o!==null){e:{var d=Tn;if(Ln){if(yi){t:{for(var y=yi,b=Rr;y.nodeType!==8;){if(!b){y=null;break t}if(y=cs(y.nextSibling),y===null){y=null;break t}}b=y.data,y=b==="F!"||b==="F"?y:null}if(y){yi=cs(y.nextSibling),d=y.data==="F!";break e}}Us(d)}d=!1}d&&(s=o[0])}}return o=Sr(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bb,lastRenderedState:s},o.queue=d,o=iv.bind(null,Tn,d),d.dispatch=o,d=sm(!1),b=hm.bind(null,Tn,!1,d.queue),d=Sr(),y={state:s,dispatch:null,action:r,pending:null},d.queue=y,o=zk.bind(null,Tn,y,b,o),y.dispatch=o,d.memoizedState=r,[s,o,!1]}function Fb(r){var s=Ki();return Ub(s,ui,r)}function Ub(r,s,o){if(s=im(r,s,Bb)[0],r=lh(ca)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=dc(s)}catch(D){throw D===Ml?Zd:D}else d=s;s=Ki();var y=s.queue,b=y.dispatch;return o!==s.memoizedState&&(Tn.flags|=2048,Il(9,{destroy:void 0},$k.bind(null,y,o),null)),[d,b,r]}function $k(r,s){r.action=s}function zb(r){var s=Ki(),o=ui;if(o!==null)return Ub(s,o,r);Ki(),s=s.memoizedState,o=Ki();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Il(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=Tn.updateQueue,s===null&&(s=ah(),Tn.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function $b(){return Ki().memoizedState}function uh(r,s,o,d){var y=Sr();Tn.flags|=r,y.memoizedState=Il(1|s,{destroy:void 0},o,d===void 0?null:d)}function ch(r,s,o,d){var y=Ki();d=d===void 0?null:d;var b=y.memoizedState.inst;ui!==null&&d!==null&&Q0(d,ui.memoizedState.deps)?y.memoizedState=Il(s,b,o,d):(Tn.flags|=r,y.memoizedState=Il(1|s,b,o,d))}function Hb(r,s){uh(8390656,8,r,s)}function om(r,s){ch(2048,8,r,s)}function Hk(r){Tn.flags|=4;var s=Tn.updateQueue;if(s===null)s=ah(),Tn.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function qb(r){var s=Ki().memoizedState;return Hk({ref:s,nextImpl:r}),function(){if((ni&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function Vb(r,s){return ch(4,2,r,s)}function Gb(r,s){return ch(4,4,r,s)}function Kb(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Wb(r,s,o){o=o!=null?o.concat([r]):null,ch(4,4,Kb.bind(null,s,r),o)}function lm(){}function Xb(r,s){var o=Ki();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&Q0(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function Yb(r,s){var o=Ki();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&Q0(s,d[1]))return d[0];if(d=r(),Wo){Gt(!0);try{r()}finally{Gt(!1)}}return o.memoizedState=[d,s],d}function um(r,s,o){return o===void 0||(ua&1073741824)!==0&&(Fn&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=Qv(),Tn.lanes|=r,to|=r,o)}function Qb(r,s,o,d){return yr(o,s)?o:Rl.current!==null?(r=um(r,o,d),yr(r,s)||(Zi=!0),r):(ua&42)===0||(ua&1073741824)!==0&&(Fn&261930)===0?(Zi=!0,r.memoizedState=o):(r=Qv(),Tn.lanes|=r,to|=r,s)}function Zb(r,s,o,d,y){var b=P.p;P.p=b!==0&&8>b?b:8;var D=q.T,$={};q.T=$,hm(r,!1,s,o);try{var ve=y(),qe=q.S;if(qe!==null&&qe($,ve),ve!==null&&typeof ve=="object"&&typeof ve.then=="function"){var ot=Pk(ve,d);hc(r,s,ot,es(r))}else hc(r,s,d,es(r))}catch(ft){hc(r,s,{then:function(){},status:"rejected",reason:ft},es())}finally{P.p=b,D!==null&&$.types!==null&&(D.types=$.types),q.T=D}}function qk(){}function cm(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Jb(r).queue;Zb(r,y,s,Q,o===null?qk:function(){return ev(r),o(d)})}function Jb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:Q},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function ev(r){var s=Jb(r);s.next===null&&(s=r.alternate.memoizedState),hc(r,s.next.queue,{},es())}function dm(){return It(Nc)}function tv(){return Ki().memoizedState}function nv(){return Ki().memoizedState}function Vk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=es();r=Xa(o);var d=Ya(s,r,o);d!==null&&(Pr(d,s,o),oc(d,s,o)),s={cache:la()},r.payload=s;return}s=s.return}}function Gk(r,s,o){var d=es();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},dh(r)?rv(s,o):(o=Ju(r,s,o,d),o!==null&&(Pr(o,r,d),sv(o,s,d)))}function iv(r,s,o){var d=es();hc(r,s,o,d)}function hc(r,s,o,d){var y={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(dh(r))rv(s,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=s.lastRenderedReducer,b!==null))try{var D=s.lastRenderedState,$=b(D,o);if(y.hasEagerState=!0,y.eagerState=$,yr($,D))return Al(r,s,y,0),bi===null&&Cl(),!1}catch{}if(o=Ju(r,s,y,d),o!==null)return Pr(o,r,d),sv(o,s,d),!0}return!1}function hm(r,s,o,d){if(d={lane:2,revertLane:qm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},dh(r)){if(s)throw Error(i(479))}else s=Ju(r,o,d,2),s!==null&&Pr(s,r,2)}function dh(r){var s=r.alternate;return r===Tn||s!==null&&s===Tn}function rv(r,s){Ol=rh=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function sv(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ln(r,o)}}var fc={readContext:It,use:oh,useCallback:zi,useContext:zi,useEffect:zi,useImperativeHandle:zi,useLayoutEffect:zi,useInsertionEffect:zi,useMemo:zi,useReducer:zi,useRef:zi,useState:zi,useDebugValue:zi,useDeferredValue:zi,useTransition:zi,useSyncExternalStore:zi,useId:zi,useHostTransitionStatus:zi,useFormState:zi,useActionState:zi,useOptimistic:zi,useMemoCache:zi,useCacheRefresh:zi};fc.useEffectEvent=zi;var av={readContext:It,use:oh,useCallback:function(r,s){return Sr().memoizedState=[r,s===void 0?null:s],r},useContext:It,useEffect:Hb,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,uh(4194308,4,Kb.bind(null,s,r),o)},useLayoutEffect:function(r,s){return uh(4194308,4,r,s)},useInsertionEffect:function(r,s){uh(4,2,r,s)},useMemo:function(r,s){var o=Sr();s=s===void 0?null:s;var d=r();if(Wo){Gt(!0);try{r()}finally{Gt(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Sr();if(o!==void 0){var y=o(s);if(Wo){Gt(!0);try{o(s)}finally{Gt(!1)}}}else y=s;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=Gk.bind(null,Tn,r),[d.memoizedState,r]},useRef:function(r){var s=Sr();return r={current:r},s.memoizedState=r},useState:function(r){r=sm(r);var s=r.queue,o=iv.bind(null,Tn,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:lm,useDeferredValue:function(r,s){var o=Sr();return um(o,r,s)},useTransition:function(){var r=sm(!1);return r=Zb.bind(null,Tn,r.queue,!0,!1),Sr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=Tn,y=Sr();if(Ln){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),bi===null)throw Error(i(349));(Fn&127)!==0||Cb(d,s,o)}y.memoizedState=o;var b={value:o,getSnapshot:s};return y.queue=b,Hb(Nb.bind(null,d,b,r),[r]),d.flags|=2048,Il(9,{destroy:void 0},Ab.bind(null,d,b,o,s),null),o},useId:function(){var r=Sr(),s=bi.identifierPrefix;if(Ln){var o=hr,d=Xr;o=(d&~(1<<32-wt(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=sh++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=Fk++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:dm,useFormState:Pb,useActionState:Pb,useOptimistic:function(r){var s=Sr();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=hm.bind(null,Tn,!0,o),o.dispatch=s,[r,s]},useMemoCache:nm,useCacheRefresh:function(){return Sr().memoizedState=Vk.bind(null,Tn)},useEffectEvent:function(r){var s=Sr(),o={impl:r};return s.memoizedState=o,function(){if((ni&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},fm={readContext:It,use:oh,useCallback:Xb,useContext:It,useEffect:om,useImperativeHandle:Wb,useInsertionEffect:Vb,useLayoutEffect:Gb,useMemo:Yb,useReducer:lh,useRef:$b,useState:function(){return lh(ca)},useDebugValue:lm,useDeferredValue:function(r,s){var o=Ki();return Qb(o,ui.memoizedState,r,s)},useTransition:function(){var r=lh(ca)[0],s=Ki().memoizedState;return[typeof r=="boolean"?r:dc(r),s]},useSyncExternalStore:Eb,useId:tv,useHostTransitionStatus:dm,useFormState:Fb,useActionState:Fb,useOptimistic:function(r,s){var o=Ki();return jb(o,ui,r,s)},useMemoCache:nm,useCacheRefresh:nv};fm.useEffectEvent=qb;var ov={readContext:It,use:oh,useCallback:Xb,useContext:It,useEffect:om,useImperativeHandle:Wb,useInsertionEffect:Vb,useLayoutEffect:Gb,useMemo:Yb,useReducer:rm,useRef:$b,useState:function(){return rm(ca)},useDebugValue:lm,useDeferredValue:function(r,s){var o=Ki();return ui===null?um(o,r,s):Qb(o,ui.memoizedState,r,s)},useTransition:function(){var r=rm(ca)[0],s=Ki().memoizedState;return[typeof r=="boolean"?r:dc(r),s]},useSyncExternalStore:Eb,useId:tv,useHostTransitionStatus:dm,useFormState:zb,useActionState:zb,useOptimistic:function(r,s){var o=Ki();return ui!==null?jb(o,ui,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:nm,useCacheRefresh:nv};ov.useEffectEvent=qb;function mm(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:S({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var pm={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=es(),y=Xa(d);y.payload=s,o!=null&&(y.callback=o),s=Ya(r,y,d),s!==null&&(Pr(s,r,d),oc(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=es(),y=Xa(d);y.tag=1,y.payload=s,o!=null&&(y.callback=o),s=Ya(r,y,d),s!==null&&(Pr(s,r,d),oc(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=es(),d=Xa(o);d.tag=2,s!=null&&(d.callback=s),s=Ya(r,d,o),s!==null&&(Pr(s,r,o),oc(s,r,o))}};function lv(r,s,o,d,y,b,D){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,b,D):s.prototype&&s.prototype.isPureReactComponent?!Os(o,d)||!Os(y,b):!0}function uv(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&pm.enqueueReplaceState(s,s.state,null)}function Xo(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=S({},o));for(var y in r)o[y]===void 0&&(o[y]=r[y])}return o}function cv(r){$a(r)}function dv(r){console.error(r)}function hv(r){$a(r)}function hh(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function fv(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function gm(r,s,o){return o=Xa(o),o.tag=3,o.payload={element:null},o.callback=function(){hh(r,s)},o}function mv(r){return r=Xa(r),r.tag=3,r}function pv(r,s,o,d){var y=o.type.getDerivedStateFromError;if(typeof y=="function"){var b=d.value;r.payload=function(){return y(b)},r.callback=function(){fv(s,o,d)}}var D=o.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(r.callback=function(){fv(s,o,d),typeof y!="function"&&(no===null?no=new Set([this]):no.add(this));var $=d.stack;this.componentDidCatch(d.value,{componentStack:$!==null?$:""})})}function Kk(r,s,o,d,y){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&Xe(s,o,y,!0),o=Yr.current,o!==null){switch(o.tag){case 31:case 13:return us===null?Sh():o.alternate===null&&$i===0&&($i=3),o.flags&=-257,o.flags|=65536,o.lanes=y,d===Jd?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),zm(r,d,y)),!1;case 22:return o.flags|=65536,d===Jd?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),zm(r,d,y)),!1}throw Error(i(435,o.tag))}return zm(r,d,y),Sh(),!1}if(Ln)return s=Yr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=y,d!==ic&&(r=Error(i(422),{cause:d}),x(Dr(r,o)))):(d!==ic&&(s=Error(i(423),{cause:d}),x(Dr(s,o))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Dr(d,o),y=gm(r.stateNode,d,y),G0(r,y),$i!==4&&($i=2)),!1;var b=Error(i(520),{cause:d});if(b=Dr(b,o),_c===null?_c=[b]:_c.push(b),$i!==4&&($i=2),s===null)return!0;d=Dr(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=y&-y,o.lanes|=r,r=gm(o.stateNode,d,r),G0(o,r),!1;case 1:if(s=o.type,b=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(no===null||!no.has(b))))return o.flags|=65536,y&=-y,o.lanes|=y,y=mv(y),pv(y,r,o,d),G0(o,y),!1}o=o.return}while(o!==null);return!1}var ym=Error(i(461)),Zi=!1;function fr(r,s,o,d){s.child=r===null?vb(s,null,o,d):Ko(s,r.child,o,d)}function gv(r,s,o,d,y){o=o.render;var b=s.ref;if("ref"in d){var D={};for(var $ in d)$!=="ref"&&(D[$]=d[$])}else D=d;return it(s),d=Z0(r,s,o,D,b,y),$=J0(),r!==null&&!Zi?(em(r,s,y),da(r,s,y)):(Ln&&$&&tr(s),s.flags|=1,fr(r,s,d,y),s.child)}function yv(r,s,o,d,y){if(r===null){var b=o.type;return typeof b=="function"&&!ec(b)&&b.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=b,bv(r,s,b,d,y)):(r=tc(o.type,null,d,s,s.mode,y),r.ref=s.ref,r.return=s,s.child=r)}if(b=r.child,!km(r,y)){var D=b.memoizedProps;if(o=o.compare,o=o!==null?o:Os,o(D,d)&&r.ref===s.ref)return da(r,s,y)}return s.flags|=1,r=Ss(b,d),r.ref=s.ref,r.return=s,s.child=r}function bv(r,s,o,d,y){if(r!==null){var b=r.memoizedProps;if(Os(b,d)&&r.ref===s.ref)if(Zi=!1,s.pendingProps=d=b,km(r,y))(r.flags&131072)!==0&&(Zi=!0);else return s.lanes=r.lanes,da(r,s,y)}return bm(r,s,o,d,y)}function vv(r,s,o,d){var y=d.children,b=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(b=b!==null?b.baseLanes|o:o,r!==null){for(d=s.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~b}else d=0,s.child=null;return xv(r,s,b,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Qd(s,b!==null?b.cachePool:null),b!==null?wb(s,b):W0(),Tb(s);else return d=s.lanes=536870912,xv(r,s,b!==null?b.baseLanes|o:o,o,d)}else b!==null?(Qd(s,b.cachePool),wb(s,b),Za(),s.memoizedState=null):(r!==null&&Qd(s,null),W0(),Za());return fr(r,s,y,o),s.child}function mc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function xv(r,s,o,d,y){var b=$0();return b=b===null?null:{parent:Ti._currentValue,pool:b},s.memoizedState={baseLanes:o,cachePool:b},r!==null&&Qd(s,null),W0(),Tb(s),r!==null&&Xe(r,s,d,!0),s.childLanes=y,null}function fh(r,s){return s=ph({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function _v(r,s,o){return Ko(s,r.child,null,o),r=fh(s,s.pendingProps),r.flags|=2,Qr(s),s.memoizedState=null,r}function Wk(r,s,o){var d=s.pendingProps,y=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Ln){if(d.mode==="hidden")return r=fh(s,d),s.lanes=536870912,mc(null,r);if(Y0(s),(r=yi)?(r=Rx(r,Rr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Bs!==null?{id:Xr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},o=nc(r),o.return=s,s.child=o,Yi=s,yi=null)):r=null,r===null)throw Us(s);return s.lanes=536870912,null}return fh(s,d)}var b=r.memoizedState;if(b!==null){var D=b.dehydrated;if(Y0(s),y)if(s.flags&256)s.flags&=-257,s=_v(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(Zi||Xe(r,s,o,!1),y=(o&r.childLanes)!==0,Zi||y){if(d=bi,d!==null&&(D=_n(d,o),D!==0&&D!==b.retryLane))throw b.retryLane=D,oa(r,D),Pr(d,r,D),ym;Sh(),s=_v(r,s,o)}else r=b.treeContext,yi=cs(D.nextSibling),Yi=s,Ln=!0,Fs=null,Rr=!1,r!==null&&Xd(s,r),s=fh(s,d),s.flags|=4096;return s}return r=Ss(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function mh(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function bm(r,s,o,d,y){return it(s),o=Z0(r,s,o,d,void 0,y),d=J0(),r!==null&&!Zi?(em(r,s,y),da(r,s,y)):(Ln&&d&&tr(s),s.flags|=1,fr(r,s,o,y),s.child)}function wv(r,s,o,d,y,b){return it(s),s.updateQueue=null,o=kb(s,d,o,y),Sb(r),d=J0(),r!==null&&!Zi?(em(r,s,b),da(r,s,b)):(Ln&&d&&tr(s),s.flags|=1,fr(r,s,o,b),s.child)}function Tv(r,s,o,d,y){if(it(s),s.stateNode===null){var b=qa,D=o.contextType;typeof D=="object"&&D!==null&&(b=It(D)),b=new o(d,b),s.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=pm,s.stateNode=b,b._reactInternals=s,b=s.stateNode,b.props=d,b.state=s.memoizedState,b.refs={},q0(s),D=o.contextType,b.context=typeof D=="object"&&D!==null?It(D):qa,b.state=s.memoizedState,D=o.getDerivedStateFromProps,typeof D=="function"&&(mm(s,o,D,d),b.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(D=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),D!==b.state&&pm.enqueueReplaceState(b,b.state,null),uc(s,d,b,y),lc(),b.state=s.memoizedState),typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){b=s.stateNode;var $=s.memoizedProps,ve=Xo(o,$);b.props=ve;var qe=b.context,ot=o.contextType;D=qa,typeof ot=="object"&&ot!==null&&(D=It(ot));var ft=o.getDerivedStateFromProps;ot=typeof ft=="function"||typeof b.getSnapshotBeforeUpdate=="function",$=s.pendingProps!==$,ot||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||($||qe!==D)&&uv(s,b,d,D),Wa=!1;var Ge=s.memoizedState;b.state=Ge,uc(s,d,b,y),lc(),qe=s.memoizedState,$||Ge!==qe||Wa?(typeof ft=="function"&&(mm(s,o,ft,d),qe=s.memoizedState),(ve=Wa||lv(s,o,ve,d,Ge,qe,D))?(ot||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(s.flags|=4194308)):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=qe),b.props=d,b.state=qe,b.context=D,d=ve):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{b=s.stateNode,V0(r,s),D=s.memoizedProps,ot=Xo(o,D),b.props=ot,ft=s.pendingProps,Ge=b.context,qe=o.contextType,ve=qa,typeof qe=="object"&&qe!==null&&(ve=It(qe)),$=o.getDerivedStateFromProps,(qe=typeof $=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(D!==ft||Ge!==ve)&&uv(s,b,d,ve),Wa=!1,Ge=s.memoizedState,b.state=Ge,uc(s,d,b,y),lc();var Ze=s.memoizedState;D!==ft||Ge!==Ze||Wa||r!==null&&r.dependencies!==null&&Et(r.dependencies)?(typeof $=="function"&&(mm(s,o,$,d),Ze=s.memoizedState),(ot=Wa||lv(s,o,ot,d,Ge,Ze,ve)||r!==null&&r.dependencies!==null&&Et(r.dependencies))?(qe||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,Ze,ve),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,Ze,ve)),typeof b.componentDidUpdate=="function"&&(s.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof b.componentDidUpdate!="function"||D===r.memoizedProps&&Ge===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||D===r.memoizedProps&&Ge===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=Ze),b.props=d,b.state=Ze,b.context=ve,d=ot):(typeof b.componentDidUpdate!="function"||D===r.memoizedProps&&Ge===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||D===r.memoizedProps&&Ge===r.memoizedState||(s.flags|=1024),d=!1)}return b=d,mh(r,s),d=(s.flags&128)!==0,b||d?(b=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:b.render(),s.flags|=1,r!==null&&d?(s.child=Ko(s,r.child,null,y),s.child=Ko(s,null,o,y)):fr(r,s,o,y),s.memoizedState=b.state,r=s.child):r=da(r,s,y),r}function Sv(r,s,o,d){return v(),s.flags|=256,fr(r,s,o,d),s.child}var vm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xm(r){return{baseLanes:r,cachePool:fb()}}function _m(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=Jr),r}function kv(r,s,o){var d=s.pendingProps,y=!1,b=(s.flags&128)!==0,D;if((D=b)||(D=r!==null&&r.memoizedState===null?!1:(Gi.current&2)!==0),D&&(y=!0,s.flags&=-129),D=(s.flags&32)!==0,s.flags&=-33,r===null){if(Ln){if(y?Qa(s):Za(),(r=yi)?(r=Rx(r,Rr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Bs!==null?{id:Xr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},o=nc(r),o.return=s,s.child=o,Yi=s,yi=null)):r=null,r===null)throw Us(s);return ip(r)?s.lanes=32:s.lanes=536870912,null}var $=d.children;return d=d.fallback,y?(Za(),y=s.mode,$=ph({mode:"hidden",children:$},y),d=Is(d,y,o,null),$.return=s,d.return=s,$.sibling=d,s.child=$,d=s.child,d.memoizedState=xm(o),d.childLanes=_m(r,D,o),s.memoizedState=vm,mc(null,d)):(Qa(s),wm(s,$))}var ve=r.memoizedState;if(ve!==null&&($=ve.dehydrated,$!==null)){if(b)s.flags&256?(Qa(s),s.flags&=-257,s=Tm(r,s,o)):s.memoizedState!==null?(Za(),s.child=r.child,s.flags|=128,s=null):(Za(),$=d.fallback,y=s.mode,d=ph({mode:"visible",children:d.children},y),$=Is($,y,o,null),$.flags|=2,d.return=s,$.return=s,d.sibling=$,s.child=d,Ko(s,r.child,null,o),d=s.child,d.memoizedState=xm(o),d.childLanes=_m(r,D,o),s.memoizedState=vm,s=mc(null,d));else if(Qa(s),ip($)){if(D=$.nextSibling&&$.nextSibling.dataset,D)var qe=D.dgst;D=qe,d=Error(i(419)),d.stack="",d.digest=D,x({value:d,source:null,stack:null}),s=Tm(r,s,o)}else if(Zi||Xe(r,s,o,!1),D=(o&r.childLanes)!==0,Zi||D){if(D=bi,D!==null&&(d=_n(D,o),d!==0&&d!==ve.retryLane))throw ve.retryLane=d,oa(r,d),Pr(D,r,d),ym;np($)||Sh(),s=Tm(r,s,o)}else np($)?(s.flags|=192,s.child=r.child,s=null):(r=ve.treeContext,yi=cs($.nextSibling),Yi=s,Ln=!0,Fs=null,Rr=!1,r!==null&&Xd(s,r),s=wm(s,d.children),s.flags|=4096);return s}return y?(Za(),$=d.fallback,y=s.mode,ve=r.child,qe=ve.sibling,d=Ss(ve,{mode:"hidden",children:d.children}),d.subtreeFlags=ve.subtreeFlags&65011712,qe!==null?$=Ss(qe,$):($=Is($,y,o,null),$.flags|=2),$.return=s,d.return=s,d.sibling=$,s.child=d,mc(null,d),d=s.child,$=r.child.memoizedState,$===null?$=xm(o):(y=$.cachePool,y!==null?(ve=Ti._currentValue,y=y.parent!==ve?{parent:ve,pool:ve}:y):y=fb(),$={baseLanes:$.baseLanes|o,cachePool:y}),d.memoizedState=$,d.childLanes=_m(r,D,o),s.memoizedState=vm,mc(r.child,d)):(Qa(s),o=r.child,r=o.sibling,o=Ss(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(D=s.deletions,D===null?(s.deletions=[r],s.flags|=16):D.push(r)),s.child=o,s.memoizedState=null,o)}function wm(r,s){return s=ph({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function ph(r,s){return r=Ui(22,r,null,s),r.lanes=0,r}function Tm(r,s,o){return Ko(s,r.child,null,o),r=wm(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function Ev(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),fe(r.return,s,o)}function Sm(r,s,o,d,y,b){var D=r.memoizedState;D===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:y,treeForkCount:b}:(D.isBackwards=s,D.rendering=null,D.renderingStartTime=0,D.last=d,D.tail=o,D.tailMode=y,D.treeForkCount=b)}function Cv(r,s,o){var d=s.pendingProps,y=d.revealOrder,b=d.tail;d=d.children;var D=Gi.current,$=(D&2)!==0;if($?(D=D&1|2,s.flags|=128):D&=1,Te(Gi,D),fr(r,s,d,o),d=Ln?$o:0,!$&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Ev(r,o,s);else if(r.tag===19)Ev(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(o=s.child,y=null;o!==null;)r=o.alternate,r!==null&&ih(r)===null&&(y=o),o=o.sibling;o=y,o===null?(y=s.child,s.child=null):(y=o.sibling,o.sibling=null),Sm(s,!1,y,o,b,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,y=s.child,s.child=null;y!==null;){if(r=y.alternate,r!==null&&ih(r)===null){s.child=y;break}r=y.sibling,y.sibling=o,o=y,y=r}Sm(s,!0,o,null,b,d);break;case"together":Sm(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function da(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),to|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(Xe(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=Ss(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=Ss(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function km(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Et(r)))}function Xk(r,s,o){switch(s.tag){case 3:we(s,s.stateNode.containerInfo),J(s,Ti,r.memoizedState.cache),v();break;case 27:case 5:ct(s);break;case 4:we(s,s.stateNode.containerInfo);break;case 10:J(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Y0(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(Qa(s),s.flags|=128,null):(o&s.child.childLanes)!==0?kv(r,s,o):(Qa(s),r=da(r,s,o),r!==null?r.sibling:null);Qa(s);break;case 19:var y=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(Xe(r,s,o,!1),d=(o&s.childLanes)!==0),y){if(d)return Cv(r,s,o);s.flags|=128}if(y=s.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Te(Gi,Gi.current),d)break;return null;case 22:return s.lanes=0,vv(r,s,o,s.pendingProps);case 24:J(s,Ti,r.memoizedState.cache)}return da(r,s,o)}function Av(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)Zi=!0;else{if(!km(r,o)&&(s.flags&128)===0)return Zi=!1,Xk(r,s,o);Zi=(r.flags&131072)!==0}else Zi=!1,Ln&&(s.flags&1048576)!==0&&Ps(s,$o,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Vo(s.elementType),s.type=r,typeof r=="function")ec(r)?(d=Xo(r,d),s.tag=1,s=Tv(null,s,r,d,o)):(s.tag=0,s=bm(null,s,r,d,o));else{if(r!=null){var y=r.$$typeof;if(y===re){s.tag=11,s=gv(null,s,r,d,o);break e}else if(y===R){s.tag=14,s=yv(null,s,r,d,o);break e}}throw s=me(r)||r,Error(i(306,s,""))}}return s;case 0:return bm(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,y=Xo(d,s.pendingProps),Tv(r,s,d,y,o);case 3:e:{if(we(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var b=s.memoizedState;y=b.element,V0(r,s),uc(s,d,null,o);var D=s.memoizedState;if(d=D.cache,J(s,Ti,d),d!==b.cache&&Ee(s,[Ti],o,!0),lc(),d=D.element,b.isDehydrated)if(b={element:d,isDehydrated:!1,cache:D.cache},s.updateQueue.baseState=b,s.memoizedState=b,s.flags&256){s=Sv(r,s,d,o);break e}else if(d!==y){y=Dr(Error(i(424)),s),x(y),s=Sv(r,s,d,o);break e}else for(r=s.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,yi=cs(r.firstChild),Yi=s,Ln=!0,Fs=null,Rr=!0,o=vb(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(v(),d===y){s=da(r,s,o);break e}fr(r,s,d,o)}s=s.child}return s;case 26:return mh(r,s),r===null?(o=Fx(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ln||(o=s.type,r=s.pendingProps,d=Mh(mt.current).createElement(o),d[zt]=s,d[Dt]=r,mr(d,o,r),Cn(d),s.stateNode=d):s.memoizedState=Fx(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return ct(s),r===null&&Ln&&(d=s.stateNode=Ix(s.type,s.pendingProps,mt.current),Yi=s,Rr=!0,y=yi,ao(s.type)?(rp=y,yi=cs(d.firstChild)):yi=y),fr(r,s,s.pendingProps.children,o),mh(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Ln&&((y=d=yi)&&(d=kE(d,s.type,s.pendingProps,Rr),d!==null?(s.stateNode=d,Yi=s,yi=cs(d.firstChild),Rr=!1,y=!0):y=!1),y||Us(s)),ct(s),y=s.type,b=s.pendingProps,D=r!==null?r.memoizedProps:null,d=b.children,Jm(y,b)?d=null:D!==null&&Jm(y,D)&&(s.flags|=32),s.memoizedState!==null&&(y=Z0(r,s,Uk,null,null,o),Nc._currentValue=y),mh(r,s),fr(r,s,d,o),s.child;case 6:return r===null&&Ln&&((r=o=yi)&&(o=EE(o,s.pendingProps,Rr),o!==null?(s.stateNode=o,Yi=s,yi=null,r=!0):r=!1),r||Us(s)),null;case 13:return kv(r,s,o);case 4:return we(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Ko(s,null,d,o):fr(r,s,d,o),s.child;case 11:return gv(r,s,s.type,s.pendingProps,o);case 7:return fr(r,s,s.pendingProps,o),s.child;case 8:return fr(r,s,s.pendingProps.children,o),s.child;case 12:return fr(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,J(s,s.type,d.value),fr(r,s,d.children,o),s.child;case 9:return y=s.type._context,d=s.pendingProps.children,it(s),y=It(y),d=d(y),s.flags|=1,fr(r,s,d,o),s.child;case 14:return yv(r,s,s.type,s.pendingProps,o);case 15:return bv(r,s,s.type,s.pendingProps,o);case 19:return Cv(r,s,o);case 31:return Wk(r,s,o);case 22:return vv(r,s,o,s.pendingProps);case 24:return it(s),d=It(Ti),r===null?(y=$0(),y===null&&(y=bi,b=la(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=o),y=b),s.memoizedState={parent:d,cache:y},q0(s),J(s,Ti,y)):((r.lanes&o)!==0&&(V0(r,s),uc(s,null,null,o),lc()),y=r.memoizedState,b=s.memoizedState,y.parent!==d?(y={parent:d,cache:d},s.memoizedState=y,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=y),J(s,Ti,d)):(d=b.cache,J(s,Ti,d),d!==y.cache&&Ee(s,[Ti],o,!0))),fr(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ha(r){r.flags|=4}function Em(r,s,o,d,y){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(tx())r.flags|=8192;else throw Go=Jd,H0}else r.flags&=-16777217}function Nv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!qx(s))if(tx())r.flags|=8192;else throw Go=Jd,H0}function gh(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?Ve():536870912,r.lanes|=s,Ul|=s)}function pc(r,s){if(!Ln)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function ki(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var y=r.child;y!==null;)o|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)o|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function Yk(r,s,o){var d=s.pendingProps;switch(jr(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ki(s),null;case 1:return ki(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),oe(Ti),Re(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(m(s)?ha(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,w())),ki(s),null;case 26:var y=s.type,b=s.memoizedState;return r===null?(ha(s),b!==null?(ki(s),Nv(s,b)):(ki(s),Em(s,y,null,d,o))):b?b!==r.memoizedState?(ha(s),ki(s),Nv(s,b)):(ki(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&ha(s),ki(s),Em(s,y,r,d,o)),null;case 27:if(Oe(s),o=mt.current,y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ha(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return ki(s),null}r=ye.current,m(s)?Yd(s):(r=Ix(y,d,o),s.stateNode=r,ha(s))}return ki(s),null;case 5:if(Oe(s),y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ha(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return ki(s),null}if(b=ye.current,m(s))Yd(s);else{var D=Mh(mt.current);switch(b){case 1:b=D.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:b=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":b=D.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":b=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":b=D.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?D.createElement("select",{is:d.is}):D.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?D.createElement(y,{is:d.is}):D.createElement(y)}}b[zt]=s,b[Dt]=d;e:for(D=s.child;D!==null;){if(D.tag===5||D.tag===6)b.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===s)break e;for(;D.sibling===null;){if(D.return===null||D.return===s)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}s.stateNode=b;e:switch(mr(b,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ha(s)}}return ki(s),Em(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ha(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=mt.current,m(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=Yi,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[zt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||kx(r.nodeValue,o)),r||Us(s,!0)}else r=Mh(r).createTextNode(d),r[zt]=s,s.stateNode=r}return ki(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=m(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[zt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),r=!1}else o=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(Qr(s),s):(Qr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return ki(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=m(s),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(i(318));if(y=s.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));y[zt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),y=!1}else y=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(Qr(s),s):(Qr(s),null)}return Qr(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),b=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),b!==y&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),gh(s,s.updateQueue),ki(s),null);case 4:return Re(),r===null&&Wm(s.stateNode.containerInfo),ki(s),null;case 10:return oe(s.type),ki(s),null;case 19:if(xe(Gi),d=s.memoizedState,d===null)return ki(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)pc(d,!1);else{if($i!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=ih(r),b!==null){for(s.flags|=128,pc(d,!1),r=b.updateQueue,s.updateQueue=r,gh(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Wd(o,r),o=o.sibling;return Te(Gi,Gi.current&1|2),Ln&&Nn(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&he()>_h&&(s.flags|=128,y=!0,pc(d,!1),s.lanes=4194304)}else{if(!y)if(r=ih(b),r!==null){if(s.flags|=128,y=!0,r=r.updateQueue,s.updateQueue=r,gh(s,r),pc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!Ln)return ki(s),null}else 2*he()-d.renderingStartTime>_h&&o!==536870912&&(s.flags|=128,y=!0,pc(d,!1),s.lanes=4194304);d.isBackwards?(b.sibling=s.child,s.child=b):(r=d.last,r!==null?r.sibling=b:s.child=b,d.last=b)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=he(),r.sibling=null,o=Gi.current,Te(Gi,y?o&1|2:o&1),Ln&&Nn(s,d.treeForkCount),r):(ki(s),null);case 22:case 23:return Qr(s),X0(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(ki(s),s.subtreeFlags&6&&(s.flags|=8192)):ki(s),o=s.updateQueue,o!==null&&gh(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&xe(qo),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oe(Ti),ki(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Qk(r,s){switch(jr(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return oe(Ti),Re(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Oe(s),null;case 31:if(s.memoizedState!==null){if(Qr(s),s.alternate===null)throw Error(i(340));v()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(Qr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));v()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return xe(Gi),null;case 4:return Re(),null;case 10:return oe(s.type),null;case 22:case 23:return Qr(s),X0(),r!==null&&xe(qo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(Ti),null;case 25:return null;default:return null}}function Dv(r,s){switch(jr(s),s.tag){case 3:oe(Ti),Re();break;case 26:case 27:case 5:Oe(s);break;case 4:Re();break;case 31:s.memoizedState!==null&&Qr(s);break;case 13:Qr(s);break;case 19:xe(Gi);break;case 10:oe(s.type);break;case 22:case 23:Qr(s),X0(),r!==null&&xe(qo);break;case 24:oe(Ti)}}function gc(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var y=d.next;o=y;do{if((o.tag&r)===r){d=void 0;var b=o.create,D=o.inst;d=b(),D.destroy=d}o=o.next}while(o!==y)}}catch($){oi(s,s.return,$)}}function Ja(r,s,o){try{var d=s.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var b=y.next;d=b;do{if((d.tag&r)===r){var D=d.inst,$=D.destroy;if($!==void 0){D.destroy=void 0,y=s;var ve=o,qe=$;try{qe()}catch(ot){oi(y,ve,ot)}}}d=d.next}while(d!==b)}}catch(ot){oi(s,s.return,ot)}}function Mv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{_b(s,o)}catch(d){oi(r,r.return,d)}}}function jv(r,s,o){o.props=Xo(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){oi(r,s,d)}}function yc(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(y){oi(r,s,y)}}function Hs(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(y){oi(r,s,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(y){oi(r,s,y)}else o.current=null}function Rv(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(y){oi(r,r.return,y)}}function Cm(r,s,o){try{var d=r.stateNode;vE(d,r.type,o,s),d[Dt]=s}catch(y){oi(r,r.return,y)}}function Ov(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ao(r.type)||r.tag===4}function Am(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ov(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ao(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Nm(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=ii));else if(d!==4&&(d===27&&ao(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Nm(r,s,o),r=r.sibling;r!==null;)Nm(r,s,o),r=r.sibling}function yh(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&ao(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(yh(r,s,o),r=r.sibling;r!==null;)yh(r,s,o),r=r.sibling}function Lv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);mr(s,d,o),s[zt]=r,s[Dt]=o}catch(b){oi(r,r.return,b)}}var fa=!1,Ji=!1,Dm=!1,Iv=typeof WeakSet=="function"?WeakSet:Set,ar=null;function Zk(r,s){if(r=r.containerInfo,Qm=Ph,r=kl(r),Gu(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var y=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var D=0,$=-1,ve=-1,qe=0,ot=0,ft=r,Ge=null;t:for(;;){for(var Ze;ft!==o||y!==0&&ft.nodeType!==3||($=D+y),ft!==b||d!==0&&ft.nodeType!==3||(ve=D+d),ft.nodeType===3&&(D+=ft.nodeValue.length),(Ze=ft.firstChild)!==null;)Ge=ft,ft=Ze;for(;;){if(ft===r)break t;if(Ge===o&&++qe===y&&($=D),Ge===b&&++ot===d&&(ve=D),(Ze=ft.nextSibling)!==null)break;ft=Ge,Ge=ft.parentNode}ft=Ze}o=$===-1||ve===-1?null:{start:$,end:ve}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zm={focusedElem:r,selectionRange:o},Ph=!1,ar=s;ar!==null;)if(s=ar,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ar=r;else for(;ar!==null;){switch(s=ar,b=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)y=r[o],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&b!==null){r=void 0,o=s,y=b.memoizedProps,b=b.memoizedState,d=o.stateNode;try{var Ft=Xo(o.type,y);r=d.getSnapshotBeforeUpdate(Ft,b),d.__reactInternalSnapshotBeforeUpdate=r}catch(un){oi(o,o.return,un)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)tp(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":tp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,ar=r;break}ar=s.return}}function Bv(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:pa(r,o),d&4&&gc(5,o);break;case 1:if(pa(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(D){oi(o,o.return,D)}else{var y=Xo(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(y,s,r.__reactInternalSnapshotBeforeUpdate)}catch(D){oi(o,o.return,D)}}d&64&&Mv(o),d&512&&yc(o,o.return);break;case 3:if(pa(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{_b(r,s)}catch(D){oi(o,o.return,D)}}break;case 27:s===null&&d&4&&Lv(o);case 26:case 5:pa(r,o),s===null&&d&4&&Rv(o),d&512&&yc(o,o.return);break;case 12:pa(r,o);break;case 31:pa(r,o),d&4&&Uv(r,o);break;case 13:pa(r,o),d&4&&zv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=oE.bind(null,o),CE(r,o))));break;case 22:if(d=o.memoizedState!==null||fa,!d){s=s!==null&&s.memoizedState!==null||Ji,y=fa;var b=Ji;fa=d,(Ji=s)&&!b?ga(r,o,(o.subtreeFlags&8772)!==0):pa(r,o),fa=y,Ji=b}break;case 30:break;default:pa(r,o)}}function Pv(r){var s=r.alternate;s!==null&&(r.alternate=null,Pv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Wt(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ai=null,Or=!1;function ma(r,s,o){for(o=o.child;o!==null;)Fv(r,s,o),o=o.sibling}function Fv(r,s,o){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Zt,o)}catch{}switch(o.tag){case 26:Ji||Hs(o,s),ma(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Ji||Hs(o,s);var d=Ai,y=Or;ao(o.type)&&(Ai=o.stateNode,Or=!1),ma(r,s,o),Ec(o.stateNode),Ai=d,Or=y;break;case 5:Ji||Hs(o,s);case 6:if(d=Ai,y=Or,Ai=null,ma(r,s,o),Ai=d,Or=y,Ai!==null)if(Or)try{(Ai.nodeType===9?Ai.body:Ai.nodeName==="HTML"?Ai.ownerDocument.body:Ai).removeChild(o.stateNode)}catch(b){oi(o,s,b)}else try{Ai.removeChild(o.stateNode)}catch(b){oi(o,s,b)}break;case 18:Ai!==null&&(Or?(r=Ai,Mx(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Wl(r)):Mx(Ai,o.stateNode));break;case 4:d=Ai,y=Or,Ai=o.stateNode.containerInfo,Or=!0,ma(r,s,o),Ai=d,Or=y;break;case 0:case 11:case 14:case 15:Ja(2,o,s),Ji||Ja(4,o,s),ma(r,s,o);break;case 1:Ji||(Hs(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&jv(o,s,d)),ma(r,s,o);break;case 21:ma(r,s,o);break;case 22:Ji=(d=Ji)||o.memoizedState!==null,ma(r,s,o),Ji=d;break;default:ma(r,s,o)}}function Uv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Wl(r)}catch(o){oi(s,s.return,o)}}}function zv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Wl(r)}catch(o){oi(s,s.return,o)}}function Jk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Iv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Iv),s;default:throw Error(i(435,r.tag))}}function bh(r,s){var o=Jk(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var y=lE.bind(null,r,d);d.then(y,y)}})}function Lr(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var y=o[d],b=r,D=s,$=D;e:for(;$!==null;){switch($.tag){case 27:if(ao($.type)){Ai=$.stateNode,Or=!1;break e}break;case 5:Ai=$.stateNode,Or=!1;break e;case 3:case 4:Ai=$.stateNode.containerInfo,Or=!0;break e}$=$.return}if(Ai===null)throw Error(i(160));Fv(b,D,y),Ai=null,Or=!1,b=y.alternate,b!==null&&(b.return=null),y.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)$v(s,r),s=s.sibling}var Es=null;function $v(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Lr(s,r),Ir(r),d&4&&(Ja(3,r,r.return),gc(3,r),Ja(5,r,r.return));break;case 1:Lr(s,r),Ir(r),d&512&&(Ji||o===null||Hs(o,o.return)),d&64&&fa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var y=Es;if(Lr(s,r),Ir(r),d&512&&(Ji||o===null||Hs(o,o.return)),d&4){var b=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":b=y.getElementsByTagName("title")[0],(!b||b[Mn]||b[zt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(d),y.head.insertBefore(b,y.querySelector("head > title"))),mr(b,d,o),b[zt]=r,Cn(b),d=b;break e;case"link":var D=$x("link","href",y).get(d+(o.href||""));if(D){for(var $=0;$<D.length;$++)if(b=D[$],b.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&b.getAttribute("rel")===(o.rel==null?null:o.rel)&&b.getAttribute("title")===(o.title==null?null:o.title)&&b.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){D.splice($,1);break t}}b=y.createElement(d),mr(b,d,o),y.head.appendChild(b);break;case"meta":if(D=$x("meta","content",y).get(d+(o.content||""))){for($=0;$<D.length;$++)if(b=D[$],b.getAttribute("content")===(o.content==null?null:""+o.content)&&b.getAttribute("name")===(o.name==null?null:o.name)&&b.getAttribute("property")===(o.property==null?null:o.property)&&b.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&b.getAttribute("charset")===(o.charSet==null?null:o.charSet)){D.splice($,1);break t}}b=y.createElement(d),mr(b,d,o),y.head.appendChild(b);break;default:throw Error(i(468,d))}b[zt]=r,Cn(b),d=b}r.stateNode=d}else Hx(y,r.type,r.stateNode);else r.stateNode=zx(y,d,r.memoizedProps);else b!==d?(b===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):b.count--,d===null?Hx(y,r.type,r.stateNode):zx(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Cm(r,r.memoizedProps,o.memoizedProps)}break;case 27:Lr(s,r),Ir(r),d&512&&(Ji||o===null||Hs(o,o.return)),o!==null&&d&4&&Cm(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Lr(s,r),Ir(r),d&512&&(Ji||o===null||Hs(o,o.return)),r.flags&32){y=r.stateNode;try{Yn(y,"")}catch(Ft){oi(r,r.return,Ft)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,Cm(r,y,o!==null?o.memoizedProps:y)),d&1024&&(Dm=!0);break;case 6:if(Lr(s,r),Ir(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ft){oi(r,r.return,Ft)}}break;case 3:if(Oh=null,y=Es,Es=jh(s.containerInfo),Lr(s,r),Es=y,Ir(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Wl(s.containerInfo)}catch(Ft){oi(r,r.return,Ft)}Dm&&(Dm=!1,Hv(r));break;case 4:d=Es,Es=jh(r.stateNode.containerInfo),Lr(s,r),Ir(r),Es=d;break;case 12:Lr(s,r),Ir(r);break;case 31:Lr(s,r),Ir(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 13:Lr(s,r),Ir(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(xh=he()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 22:y=r.memoizedState!==null;var ve=o!==null&&o.memoizedState!==null,qe=fa,ot=Ji;if(fa=qe||y,Ji=ot||ve,Lr(s,r),Ji=ot,fa=qe,Ir(r),d&8192)e:for(s=r.stateNode,s._visibility=y?s._visibility&-2:s._visibility|1,y&&(o===null||ve||fa||Ji||Yo(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){ve=o=s;try{if(b=ve.stateNode,y)D=b.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{$=ve.stateNode;var ft=ve.memoizedProps.style,Ge=ft!=null&&ft.hasOwnProperty("display")?ft.display:null;$.style.display=Ge==null||typeof Ge=="boolean"?"":(""+Ge).trim()}}catch(Ft){oi(ve,ve.return,Ft)}}}else if(s.tag===6){if(o===null){ve=s;try{ve.stateNode.nodeValue=y?"":ve.memoizedProps}catch(Ft){oi(ve,ve.return,Ft)}}}else if(s.tag===18){if(o===null){ve=s;try{var Ze=ve.stateNode;y?jx(Ze,!0):jx(ve.stateNode,!1)}catch(Ft){oi(ve,ve.return,Ft)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,bh(r,o))));break;case 19:Lr(s,r),Ir(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 30:break;case 21:break;default:Lr(s,r),Ir(r)}}function Ir(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(Ov(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var y=o.stateNode,b=Am(r);yh(r,b,y);break;case 5:var D=o.stateNode;o.flags&32&&(Yn(D,""),o.flags&=-33);var $=Am(r);yh(r,$,D);break;case 3:case 4:var ve=o.stateNode.containerInfo,qe=Am(r);Nm(r,qe,ve);break;default:throw Error(i(161))}}catch(ot){oi(r,r.return,ot)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Hv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Hv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function pa(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Bv(r,s.alternate,s),s=s.sibling}function Yo(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Ja(4,s,s.return),Yo(s);break;case 1:Hs(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&jv(s,s.return,o),Yo(s);break;case 27:Ec(s.stateNode);case 26:case 5:Hs(s,s.return),Yo(s);break;case 22:s.memoizedState===null&&Yo(s);break;case 30:Yo(s);break;default:Yo(s)}r=r.sibling}}function ga(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,y=r,b=s,D=b.flags;switch(b.tag){case 0:case 11:case 15:ga(y,b,o),gc(4,b);break;case 1:if(ga(y,b,o),d=b,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(qe){oi(d,d.return,qe)}if(d=b,y=d.updateQueue,y!==null){var $=d.stateNode;try{var ve=y.shared.hiddenCallbacks;if(ve!==null)for(y.shared.hiddenCallbacks=null,y=0;y<ve.length;y++)xb(ve[y],$)}catch(qe){oi(d,d.return,qe)}}o&&D&64&&Mv(b),yc(b,b.return);break;case 27:Lv(b);case 26:case 5:ga(y,b,o),o&&d===null&&D&4&&Rv(b),yc(b,b.return);break;case 12:ga(y,b,o);break;case 31:ga(y,b,o),o&&D&4&&Uv(y,b);break;case 13:ga(y,b,o),o&&D&4&&zv(y,b);break;case 22:b.memoizedState===null&&ga(y,b,o),yc(b,b.return);break;case 30:break;default:ga(y,b,o)}s=s.sibling}}function Mm(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&ks(o))}function jm(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ks(r))}function Cs(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)qv(r,s,o,d),s=s.sibling}function qv(r,s,o,d){var y=s.flags;switch(s.tag){case 0:case 11:case 15:Cs(r,s,o,d),y&2048&&gc(9,s);break;case 1:Cs(r,s,o,d);break;case 3:Cs(r,s,o,d),y&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ks(r)));break;case 12:if(y&2048){Cs(r,s,o,d),r=s.stateNode;try{var b=s.memoizedProps,D=b.id,$=b.onPostCommit;typeof $=="function"&&$(D,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(ve){oi(s,s.return,ve)}}else Cs(r,s,o,d);break;case 31:Cs(r,s,o,d);break;case 13:Cs(r,s,o,d);break;case 23:break;case 22:b=s.stateNode,D=s.alternate,s.memoizedState!==null?b._visibility&2?Cs(r,s,o,d):bc(r,s):b._visibility&2?Cs(r,s,o,d):(b._visibility|=2,Bl(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),y&2048&&Mm(D,s);break;case 24:Cs(r,s,o,d),y&2048&&jm(s.alternate,s);break;default:Cs(r,s,o,d)}}function Bl(r,s,o,d,y){for(y=y&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var b=r,D=s,$=o,ve=d,qe=D.flags;switch(D.tag){case 0:case 11:case 15:Bl(b,D,$,ve,y),gc(8,D);break;case 23:break;case 22:var ot=D.stateNode;D.memoizedState!==null?ot._visibility&2?Bl(b,D,$,ve,y):bc(b,D):(ot._visibility|=2,Bl(b,D,$,ve,y)),y&&qe&2048&&Mm(D.alternate,D);break;case 24:Bl(b,D,$,ve,y),y&&qe&2048&&jm(D.alternate,D);break;default:Bl(b,D,$,ve,y)}s=s.sibling}}function bc(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,y=d.flags;switch(d.tag){case 22:bc(o,d),y&2048&&Mm(d.alternate,d);break;case 24:bc(o,d),y&2048&&jm(d.alternate,d);break;default:bc(o,d)}s=s.sibling}}var vc=8192;function Pl(r,s,o){if(r.subtreeFlags&vc)for(r=r.child;r!==null;)Vv(r,s,o),r=r.sibling}function Vv(r,s,o){switch(r.tag){case 26:Pl(r,s,o),r.flags&vc&&r.memoizedState!==null&&FE(o,Es,r.memoizedState,r.memoizedProps);break;case 5:Pl(r,s,o);break;case 3:case 4:var d=Es;Es=jh(r.stateNode.containerInfo),Pl(r,s,o),Es=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vc,vc=16777216,Pl(r,s,o),vc=d):Pl(r,s,o));break;default:Pl(r,s,o)}}function Gv(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function xc(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];ar=d,Wv(d,r)}Gv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Kv(r),r=r.sibling}function Kv(r){switch(r.tag){case 0:case 11:case 15:xc(r),r.flags&2048&&Ja(9,r,r.return);break;case 3:xc(r);break;case 12:xc(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,vh(r)):xc(r);break;default:xc(r)}}function vh(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];ar=d,Wv(d,r)}Gv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Ja(8,s,s.return),vh(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,vh(s));break;default:vh(s)}r=r.sibling}}function Wv(r,s){for(;ar!==null;){var o=ar;switch(o.tag){case 0:case 11:case 15:Ja(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ks(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,ar=d;else e:for(o=r;ar!==null;){d=ar;var y=d.sibling,b=d.return;if(Pv(d),d===o){ar=null;break e}if(y!==null){y.return=b,ar=y;break e}ar=b}}}var eE={getCacheForType:function(r){var s=It(Ti),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return It(Ti).controller.signal}},tE=typeof WeakMap=="function"?WeakMap:Map,ni=0,bi=null,In=null,Fn=0,ai=0,Zr=null,eo=!1,Fl=!1,Rm=!1,ya=0,$i=0,to=0,Qo=0,Om=0,Jr=0,Ul=0,_c=null,Br=null,Lm=!1,xh=0,Xv=0,_h=1/0,wh=null,no=null,nr=0,io=null,zl=null,ba=0,Im=0,Bm=null,Yv=null,wc=0,Pm=null;function es(){return(ni&2)!==0&&Fn!==0?Fn&-Fn:q.T!==null?qm():hn()}function Qv(){if(Jr===0)if((Fn&536870912)===0||Ln){var r=xn;xn<<=1,(xn&3932160)===0&&(xn=262144),Jr=r}else Jr=536870912;return r=Yr.current,r!==null&&(r.flags|=32),Jr}function Pr(r,s,o){(r===bi&&(ai===2||ai===9)||r.cancelPendingCommit!==null)&&($l(r,0),ro(r,Fn,Jr,!1)),Vt(r,o),((ni&2)===0||r!==bi)&&(r===bi&&((ni&2)===0&&(Qo|=o),$i===4&&ro(r,Fn,Jr,!1)),qs(r))}function Zv(r,s,o){if((ni&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||ie(r,s),y=d?rE(r,s):Um(r,s,!0),b=d;do{if(y===0){Fl&&!d&&ro(r,s,0,!1);break}else{if(o=r.current.alternate,b&&!nE(o)){y=Um(r,s,!1),b=!1;continue}if(y===2){if(b=s,r.errorRecoveryDisabledLanes&b)var D=0;else D=r.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){s=D;e:{var $=r;y=_c;var ve=$.current.memoizedState.isDehydrated;if(ve&&($l($,D).flags|=256),D=Um($,D,!1),D!==2){if(Rm&&!ve){$.errorRecoveryDisabledLanes|=b,Qo|=b,y=4;break e}b=Br,Br=y,b!==null&&(Br===null?Br=b:Br.push.apply(Br,b))}y=D}if(b=!1,y!==2)continue}}if(y===1){$l(r,0),ro(r,s,0,!0);break}e:{switch(d=r,b=y,b){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ro(d,s,Jr,!eo);break e;case 2:Br=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(y=xh+300-he(),10<y)){if(ro(d,s,Jr,!eo),F(d,0,!0)!==0)break e;ba=s,d.timeoutHandle=Nx(Jv.bind(null,d,o,Br,wh,Lm,s,Jr,Qo,Ul,eo,b,"Throttled",-0,0),y);break e}Jv(d,o,Br,wh,Lm,s,Jr,Qo,Ul,eo,b,null,-0,0)}}break}while(!0);qs(r)}function Jv(r,s,o,d,y,b,D,$,ve,qe,ot,ft,Ge,Ze){if(r.timeoutHandle=-1,ft=s.subtreeFlags,ft&8192||(ft&16785408)===16785408){ft={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ii},Vv(s,b,ft);var Ft=(b&62914560)===b?xh-he():(b&4194048)===b?Xv-he():0;if(Ft=UE(ft,Ft),Ft!==null){ba=b,r.cancelPendingCommit=Ft(ox.bind(null,r,s,b,o,d,y,D,$,ve,ot,ft,null,Ge,Ze)),ro(r,b,D,!qe);return}}ox(r,s,b,o,d,y,D,$,ve)}function nE(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var y=o[d],b=y.getSnapshot;y=y.value;try{if(!yr(b(),y))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ro(r,s,o,d){s&=~Om,s&=~Qo,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var y=s;0<y;){var b=31-wt(y),D=1<<b;d[b]=-1,y&=~D}o!==0&&gn(r,o,s)}function Th(){return(ni&6)===0?(Tc(0),!1):!0}function Fm(){if(In!==null){if(ai===0)var r=In.return;else r=In,K=A=null,tm(r),jl=null,sc=0,r=In;for(;r!==null;)Dv(r.alternate,r),r=r.return;In=null}}function $l(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,wE(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),ba=0,Fm(),bi=r,In=o=Ss(r.current,null),Fn=s,ai=0,Zr=null,eo=!1,Fl=ie(r,s),Rm=!1,Ul=Jr=Om=Qo=to=$i=0,Br=_c=null,Lm=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var y=31-wt(d),b=1<<y;s|=r[y],d&=~b}return ya=s,Cl(),o}function ex(r,s){Tn=null,q.H=fc,s===Ml||s===Zd?(s=gb(),ai=3):s===H0?(s=gb(),ai=4):ai=s===ym?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Zr=s,In===null&&($i=1,hh(r,Dr(s,r.current)))}function tx(){var r=Yr.current;return r===null?!0:(Fn&4194048)===Fn?us===null:(Fn&62914560)===Fn||(Fn&536870912)!==0?r===us:!1}function nx(){var r=q.H;return q.H=fc,r===null?fc:r}function ix(){var r=q.A;return q.A=eE,r}function Sh(){$i=4,eo||(Fn&4194048)!==Fn&&Yr.current!==null||(Fl=!0),(to&134217727)===0&&(Qo&134217727)===0||bi===null||ro(bi,Fn,Jr,!1)}function Um(r,s,o){var d=ni;ni|=2;var y=nx(),b=ix();(bi!==r||Fn!==s)&&(wh=null,$l(r,s)),s=!1;var D=$i;e:do try{if(ai!==0&&In!==null){var $=In,ve=Zr;switch(ai){case 8:Fm(),D=6;break e;case 3:case 2:case 9:case 6:Yr.current===null&&(s=!0);var qe=ai;if(ai=0,Zr=null,Hl(r,$,ve,qe),o&&Fl){D=0;break e}break;default:qe=ai,ai=0,Zr=null,Hl(r,$,ve,qe)}}iE(),D=$i;break}catch(ot){ex(r,ot)}while(!0);return s&&r.shellSuspendCounter++,K=A=null,ni=d,q.H=y,q.A=b,In===null&&(bi=null,Fn=0,Cl()),D}function iE(){for(;In!==null;)rx(In)}function rE(r,s){var o=ni;ni|=2;var d=nx(),y=ix();bi!==r||Fn!==s?(wh=null,_h=he()+500,$l(r,s)):Fl=ie(r,s);e:do try{if(ai!==0&&In!==null){s=In;var b=Zr;t:switch(ai){case 1:ai=0,Zr=null,Hl(r,s,b,1);break;case 2:case 9:if(mb(b)){ai=0,Zr=null,sx(s);break}s=function(){ai!==2&&ai!==9||bi!==r||(ai=7),qs(r)},b.then(s,s);break e;case 3:ai=7;break e;case 4:ai=5;break e;case 7:mb(b)?(ai=0,Zr=null,sx(s)):(ai=0,Zr=null,Hl(r,s,b,7));break;case 5:var D=null;switch(In.tag){case 26:D=In.memoizedState;case 5:case 27:var $=In;if(D?qx(D):$.stateNode.complete){ai=0,Zr=null;var ve=$.sibling;if(ve!==null)In=ve;else{var qe=$.return;qe!==null?(In=qe,kh(qe)):In=null}break t}}ai=0,Zr=null,Hl(r,s,b,5);break;case 6:ai=0,Zr=null,Hl(r,s,b,6);break;case 8:Fm(),$i=6;break e;default:throw Error(i(462))}}sE();break}catch(ot){ex(r,ot)}while(!0);return K=A=null,q.H=d,q.A=y,ni=o,In!==null?0:(bi=null,Fn=0,Cl(),$i)}function sE(){for(;In!==null&&!ht();)rx(In)}function rx(r){var s=Av(r.alternate,r,ya);r.memoizedProps=r.pendingProps,s===null?kh(r):In=s}function sx(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=wv(o,s,s.pendingProps,s.type,void 0,Fn);break;case 11:s=wv(o,s,s.pendingProps,s.type.render,s.ref,Fn);break;case 5:tm(s);default:Dv(o,s),s=In=Wd(s,ya),s=Av(o,s,ya)}r.memoizedProps=r.pendingProps,s===null?kh(r):In=s}function Hl(r,s,o,d){K=A=null,tm(s),jl=null,sc=0;var y=s.return;try{if(Kk(r,y,s,o,Fn)){$i=1,hh(r,Dr(o,r.current)),In=null;return}}catch(b){if(y!==null)throw In=y,b;$i=1,hh(r,Dr(o,r.current)),In=null;return}s.flags&32768?(Ln||d===1?r=!0:Fl||(Fn&536870912)!==0?r=!1:(eo=r=!0,(d===2||d===9||d===3||d===6)&&(d=Yr.current,d!==null&&d.tag===13&&(d.flags|=16384))),ax(s,r)):kh(s)}function kh(r){var s=r;do{if((s.flags&32768)!==0){ax(s,eo);return}r=s.return;var o=Yk(s.alternate,s,ya);if(o!==null){In=o;return}if(s=s.sibling,s!==null){In=s;return}In=s=r}while(s!==null);$i===0&&($i=5)}function ax(r,s){do{var o=Qk(r.alternate,r);if(o!==null){o.flags&=32767,In=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){In=r;return}In=r=o}while(r!==null);$i=6,In=null}function ox(r,s,o,d,y,b,D,$,ve){r.cancelPendingCommit=null;do Eh();while(nr!==0);if((ni&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(b=s.lanes|s.childLanes,b|=Zu,Jt(r,o,b,D,$,ve),r===bi&&(In=bi=null,Fn=0),zl=s,io=r,ba=o,Im=b,Bm=y,Yv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,uE(Pe,function(){return hx(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,y=P.p,P.p=2,D=ni,ni|=4;try{Zk(r,s,o)}finally{ni=D,P.p=y,q.T=d}}nr=1,lx(),ux(),cx()}}function lx(){if(nr===1){nr=0;var r=io,s=zl,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=q.T,q.T=null;var d=P.p;P.p=2;var y=ni;ni|=4;try{$v(s,r);var b=Zm,D=kl(r.containerInfo),$=b.focusedElem,ve=b.selectionRange;if(D!==$&&$&&$.ownerDocument&&sa($.ownerDocument.documentElement,$)){if(ve!==null&&Gu($)){var qe=ve.start,ot=ve.end;if(ot===void 0&&(ot=qe),"selectionStart"in $)$.selectionStart=qe,$.selectionEnd=Math.min(ot,$.value.length);else{var ft=$.ownerDocument||document,Ge=ft&&ft.defaultView||window;if(Ge.getSelection){var Ze=Ge.getSelection(),Ft=$.textContent.length,un=Math.min(ve.start,Ft),di=ve.end===void 0?un:Math.min(ve.end,Ft);!Ze.extend&&un>di&&(D=di,di=un,un=D);var Me=Ci($,un),Se=Ci($,di);if(Me&&Se&&(Ze.rangeCount!==1||Ze.anchorNode!==Me.node||Ze.anchorOffset!==Me.offset||Ze.focusNode!==Se.node||Ze.focusOffset!==Se.offset)){var He=ft.createRange();He.setStart(Me.node,Me.offset),Ze.removeAllRanges(),un>di?(Ze.addRange(He),Ze.extend(Se.node,Se.offset)):(He.setEnd(Se.node,Se.offset),Ze.addRange(He))}}}}for(ft=[],Ze=$;Ze=Ze.parentNode;)Ze.nodeType===1&&ft.push({element:Ze,left:Ze.scrollLeft,top:Ze.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<ft.length;$++){var dt=ft[$];dt.element.scrollLeft=dt.left,dt.element.scrollTop=dt.top}}Ph=!!Qm,Zm=Qm=null}finally{ni=y,P.p=d,q.T=o}}r.current=s,nr=2}}function ux(){if(nr===2){nr=0;var r=io,s=zl,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=q.T,q.T=null;var d=P.p;P.p=2;var y=ni;ni|=4;try{Bv(r,s.alternate,s)}finally{ni=y,P.p=d,q.T=o}}nr=3}}function cx(){if(nr===4||nr===3){nr=0,At();var r=io,s=zl,o=ba,d=Yv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?nr=5:(nr=0,zl=io=null,dx(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(no=null),Ut(o),s=s.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Zt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=q.T,y=P.p,P.p=2,q.T=null;try{for(var b=r.onRecoverableError,D=0;D<d.length;D++){var $=d[D];b($.value,{componentStack:$.stack})}}finally{q.T=s,P.p=y}}(ba&3)!==0&&Eh(),qs(r),y=r.pendingLanes,(o&261930)!==0&&(y&42)!==0?r===Pm?wc++:(wc=0,Pm=r):wc=0,Tc(0)}}function dx(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,ks(s)))}function Eh(){return lx(),ux(),cx(),hx()}function hx(){if(nr!==5)return!1;var r=io,s=Im;Im=0;var o=Ut(ba),d=q.T,y=P.p;try{P.p=32>o?32:o,q.T=null,o=Bm,Bm=null;var b=io,D=ba;if(nr=0,zl=io=null,ba=0,(ni&6)!==0)throw Error(i(331));var $=ni;if(ni|=4,Kv(b.current),qv(b,b.current,D,o),ni=$,Tc(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Zt,b)}catch{}return!0}finally{P.p=y,q.T=d,dx(r,s)}}function fx(r,s,o){s=Dr(o,s),s=gm(r.stateNode,s,2),r=Ya(r,s,2),r!==null&&(Vt(r,2),qs(r))}function oi(r,s,o){if(r.tag===3)fx(r,r,o);else for(;s!==null;){if(s.tag===3){fx(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(no===null||!no.has(d))){r=Dr(o,r),o=mv(2),d=Ya(s,o,2),d!==null&&(pv(o,d,s,r),Vt(d,2),qs(d));break}}s=s.return}}function zm(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new tE;var y=new Set;d.set(s,y)}else y=d.get(s),y===void 0&&(y=new Set,d.set(s,y));y.has(o)||(Rm=!0,y.add(o),r=aE.bind(null,r,s,o),s.then(r,r))}function aE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,bi===r&&(Fn&o)===o&&($i===4||$i===3&&(Fn&62914560)===Fn&&300>he()-xh?(ni&2)===0&&$l(r,0):Om|=o,Ul===Fn&&(Ul=0)),qs(r)}function mx(r,s){s===0&&(s=Ve()),r=oa(r,s),r!==null&&(Vt(r,s),qs(r))}function oE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),mx(r,o)}function lE(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(o=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),mx(r,o)}function uE(r,s){return tt(r,s)}var Ch=null,ql=null,$m=!1,Ah=!1,Hm=!1,so=0;function qs(r){r!==ql&&r.next===null&&(ql===null?Ch=ql=r:ql=ql.next=r),Ah=!0,$m||($m=!0,dE())}function Tc(r,s){if(!Hm&&Ah){Hm=!0;do for(var o=!1,d=Ch;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var b=0;else{var D=d.suspendedLanes,$=d.pingedLanes;b=(1<<31-wt(42|r)+1)-1,b&=y&~(D&~$),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,bx(d,b))}else b=Fn,b=F(d,d===bi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ie(d,b)||(o=!0,bx(d,b));d=d.next}while(o);Hm=!1}}function cE(){px()}function px(){Ah=$m=!1;var r=0;so!==0&&_E()&&(r=so);for(var s=he(),o=null,d=Ch;d!==null;){var y=d.next,b=gx(d,s);b===0?(d.next=null,o===null?Ch=y:o.next=y,y===null&&(ql=o)):(o=d,(r!==0||(b&3)!==0)&&(Ah=!0)),d=y}nr!==0&&nr!==5||Tc(r),so!==0&&(so=0)}function gx(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var D=31-wt(b),$=1<<D,ve=y[D];ve===-1?(($&o)===0||($&d)!==0)&&(y[D]=De($,s)):ve<=s&&(r.expiredLanes|=$),b&=~$}if(s=bi,o=Fn,o=F(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(ai===2||ai===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&$e(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||ie(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&$e(d),Ut(o)){case 2:case 8:o=ke;break;case 32:o=Pe;break;case 268435456:o=kt;break;default:o=Pe}return d=yx.bind(null,r),o=tt(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&$e(d),r.callbackPriority=2,r.callbackNode=null,2}function yx(r,s){if(nr!==0&&nr!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Eh()&&r.callbackNode!==o)return null;var d=Fn;return d=F(r,r===bi?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Zv(r,d,s),gx(r,he()),r.callbackNode!=null&&r.callbackNode===o?yx.bind(null,r):null)}function bx(r,s){if(Eh())return null;Zv(r,s,!0)}function dE(){TE(function(){(ni&6)!==0?tt(Le,cE):px()})}function qm(){if(so===0){var r=ls;r===0&&(r=pn,pn<<=1,(pn&261888)===0&&(pn=256)),so=r}return so}function vx(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:An(""+r)}function xx(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function hE(r,s,o,d,y){if(s==="submit"&&o&&o.stateNode===y){var b=vx((y[Dt]||null).action),D=d.submitter;D&&(s=(s=D[Dt]||null)?vx(s.formAction):D.getAttribute("formAction"),s!==null&&(b=s,D=null));var $=new Gn("action","action",null,d,y);r.push({event:$,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(so!==0){var ve=D?xx(y,D):new FormData(y);cm(o,{pending:!0,data:ve,method:y.method,action:b},null,ve)}}else typeof b=="function"&&($.preventDefault(),ve=D?xx(y,D):new FormData(y),cm(o,{pending:!0,data:ve,method:y.method,action:b},b,ve))},currentTarget:y}]})}}for(var Vm=0;Vm<Qu.length;Vm++){var Gm=Qu[Vm],fE=Gm.toLowerCase(),mE=Gm[0].toUpperCase()+Gm.slice(1);Wr(fE,"on"+mE)}Wr($d,"onAnimationEnd"),Wr(za,"onAnimationIteration"),Wr(Hd,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(qd,"onTransitionRun"),Wr(Vd,"onTransitionStart"),Wr(U0,"onTransitionCancel"),Wr(Gd,"onTransitionEnd"),_e("onMouseEnter",["mouseout","mouseover"]),_e("onMouseLeave",["mouseout","mouseover"]),_e("onPointerEnter",["pointerout","pointerover"]),_e("onPointerLeave",["pointerout","pointerover"]),li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),li("onBeforeInput",["compositionend","keypress","textInput","paste"]),li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),pE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sc));function _x(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],y=d.event;d=d.listeners;e:{var b=void 0;if(s)for(var D=d.length-1;0<=D;D--){var $=d[D],ve=$.instance,qe=$.currentTarget;if($=$.listener,ve!==b&&y.isPropagationStopped())break e;b=$,y.currentTarget=qe;try{b(y)}catch(ot){$a(ot)}y.currentTarget=null,b=ve}else for(D=0;D<d.length;D++){if($=d[D],ve=$.instance,qe=$.currentTarget,$=$.listener,ve!==b&&y.isPropagationStopped())break e;b=$,y.currentTarget=qe;try{b(y)}catch(ot){$a(ot)}y.currentTarget=null,b=ve}}}}function Bn(r,s){var o=s[Hn];o===void 0&&(o=s[Hn]=new Set);var d=r+"__bubble";o.has(d)||(wx(s,r,2,!1),o.add(d))}function Km(r,s,o){var d=0;s&&(d|=4),wx(o,r,d,s)}var Nh="_reactListening"+Math.random().toString(36).slice(2);function Wm(r){if(!r[Nh]){r[Nh]=!0,fi.forEach(function(o){o!=="selectionchange"&&(pE.has(o)||Km(o,!1,r),Km(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Nh]||(s[Nh]=!0,Km("selectionchange",!1,s))}}function wx(r,s,o,d){switch(Qx(s)){case 2:var y=HE;break;case 8:y=qE;break;default:y=up}o=y.bind(null,s,o,r),y=void 0,!G||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(s,o,{capture:!0,passive:y}):r.addEventListener(s,o,!0):y!==void 0?r.addEventListener(s,o,{passive:y}):r.addEventListener(s,o,!1)}function Xm(r,s,o,d,y){var b=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var D=d.tag;if(D===3||D===4){var $=d.stateNode.containerInfo;if($===y)break;if(D===4)for(D=d.return;D!==null;){var ve=D.tag;if((ve===3||ve===4)&&D.stateNode.containerInfo===y)return;D=D.return}for(;$!==null;){if(D=zn($),D===null)return;if(ve=D.tag,ve===5||ve===6||ve===26||ve===27){d=b=D;continue e}$=$.parentNode}}d=d.return}Ce(function(){var qe=b,ot=Oi(o),ft=[];e:{var Ge=Yu.get(r);if(Ge!==void 0){var Ze=Gn,Ft=r;switch(r){case"keypress":if(ut(o)===0)break e;case"keydown":case"keyup":Ze=Dd;break;case"focusin":Ft="focus",Ze=Ra;break;case"focusout":Ft="blur",Ze=Ra;break;case"beforeblur":case"afterblur":Ze=Ra;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ze=Fi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ze=Do;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ze=ra;break;case $d:case za:case Hd:Ze=jo;break;case Gd:Ze=Md;break;case"scroll":case"scrollend":Ze=dr;break;case"wheel":Ze=Rd;break;case"copy":case"cut":case"paste":Ze=Kr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ze=Oa;break;case"toggle":case"beforetoggle":Ze=M0}var un=(s&4)!==0,di=!un&&(r==="scroll"||r==="scrollend"),Me=un?Ge!==null?Ge+"Capture":null:Ge;un=[];for(var Se=qe,He;Se!==null;){var dt=Se;if(He=dt.stateNode,dt=dt.tag,dt!==5&&dt!==26&&dt!==27||He===null||Me===null||(dt=Ae(Se,Me),dt!=null&&un.push(kc(Se,dt,He))),di)break;Se=Se.return}0<un.length&&(Ge=new Ze(Ge,Ft,null,o,ot),ft.push({event:Ge,listeners:un}))}}if((s&7)===0){e:{if(Ge=r==="mouseover"||r==="pointerover",Ze=r==="mouseout"||r==="pointerout",Ge&&o!==Pi&&(Ft=o.relatedTarget||o.fromElement)&&(zn(Ft)||Ft[Ot]))break e;if((Ze||Ge)&&(Ge=ot.window===ot?ot:(Ge=ot.ownerDocument)?Ge.defaultView||Ge.parentWindow:window,Ze?(Ft=o.relatedTarget||o.toElement,Ze=qe,Ft=Ft?zn(Ft):null,Ft!==null&&(di=l(Ft),un=Ft.tag,Ft!==di||un!==5&&un!==27&&un!==6)&&(Ft=null)):(Ze=null,Ft=qe),Ze!==Ft)){if(un=Fi,dt="onMouseLeave",Me="onMouseEnter",Se="mouse",(r==="pointerout"||r==="pointerover")&&(un=Oa,dt="onPointerLeave",Me="onPointerEnter",Se="pointer"),di=Ze==null?Ge:jn(Ze),He=Ft==null?Ge:jn(Ft),Ge=new un(dt,Se+"leave",Ze,o,ot),Ge.target=di,Ge.relatedTarget=He,dt=null,zn(ot)===qe&&(un=new un(Me,Se+"enter",Ft,o,ot),un.target=He,un.relatedTarget=di,dt=un),di=dt,Ze&&Ft)t:{for(un=gE,Me=Ze,Se=Ft,He=0,dt=Me;dt;dt=un(dt))He++;dt=0;for(var nn=Se;nn;nn=un(nn))dt++;for(;0<He-dt;)Me=un(Me),He--;for(;0<dt-He;)Se=un(Se),dt--;for(;He--;){if(Me===Se||Se!==null&&Me===Se.alternate){un=Me;break t}Me=un(Me),Se=un(Se)}un=null}else un=null;Ze!==null&&Tx(ft,Ge,Ze,un,!1),Ft!==null&&di!==null&&Tx(ft,di,Ft,un,!0)}}e:{if(Ge=qe?jn(qe):window,Ze=Ge.nodeName&&Ge.nodeName.toLowerCase(),Ze==="select"||Ze==="input"&&Ge.type==="file")var Qn=$u;else if(zu(Ge))if(Hu)Qn=P0;else{Qn=B0;var Kt=I0}else Ze=Ge.nodeName,!Ze||Ze.toLowerCase()!=="input"||Ge.type!=="checkbox"&&Ge.type!=="radio"?qe&&Ri(qe.elementType)&&(Qn=$u):Qn=zd;if(Qn&&(Qn=Qn(r,qe))){Pd(ft,Qn,o,ot);break e}Kt&&Kt(r,Ge,qe),r==="focusout"&&qe&&Ge.type==="number"&&qe.memoizedProps.value!=null&&mi(Ge,"number",Ge.value)}switch(Kt=qe?jn(qe):window,r){case"focusin":(zu(Kt)||Kt.contentEditable==="true")&&(Fa=Kt,Ku=qe,Ua=null);break;case"focusout":Ua=Ku=Fa=null;break;case"mousedown":El=!0;break;case"contextmenu":case"mouseup":case"dragend":El=!1,Wu(ft,o,ot);break;case"selectionchange":if(F0)break;case"keydown":case"keyup":Wu(ft,o,ot)}var Sn;if(La)e:{switch(r){case"compositionstart":var Un="onCompositionStart";break e;case"compositionend":Un="onCompositionEnd";break e;case"compositionupdate":Un="onCompositionUpdate";break e}Un=void 0}else Ia?Sl(r,o)&&(Un="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(Un="onCompositionStart");Un&&(Ld&&o.locale!=="ko"&&(Ia||Un!=="onCompositionStart"?Un==="onCompositionEnd"&&Ia&&(Sn=We()):(ae=ot,Be="value"in ae?ae.value:ae.textContent,Ia=!0)),Kt=Dh(qe,Un),0<Kt.length&&(Un=new Ro(Un,r,null,o,ot),ft.push({event:Un,listeners:Kt}),Sn?Un.data=Sn:(Sn=Bd(o),Sn!==null&&(Un.data=Sn)))),(Sn=Od?R0(r,o):Uu(r,o))&&(Un=Dh(qe,"onBeforeInput"),0<Un.length&&(Kt=new Ro("onBeforeInput","beforeinput",null,o,ot),ft.push({event:Kt,listeners:Un}),Kt.data=Sn)),hE(ft,r,qe,o,ot)}_x(ft,s)})}function kc(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Dh(r,s){for(var o=s+"Capture",d=[];r!==null;){var y=r,b=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||b===null||(y=Ae(r,o),y!=null&&d.unshift(kc(r,y,b)),y=Ae(r,s),y!=null&&d.push(kc(r,y,b))),r.tag===3)return d;r=r.return}return[]}function gE(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Tx(r,s,o,d,y){for(var b=s._reactName,D=[];o!==null&&o!==d;){var $=o,ve=$.alternate,qe=$.stateNode;if($=$.tag,ve!==null&&ve===d)break;$!==5&&$!==26&&$!==27||qe===null||(ve=qe,y?(qe=Ae(o,b),qe!=null&&D.unshift(kc(o,qe,ve))):y||(qe=Ae(o,b),qe!=null&&D.push(kc(o,qe,ve)))),o=o.return}D.length!==0&&r.push({event:s,listeners:D})}var yE=/\r\n?/g,bE=/\u0000|\uFFFD/g;function Sx(r){return(typeof r=="string"?r:""+r).replace(yE,`
`).replace(bE,"")}function kx(r,s){return s=Sx(s),Sx(r)===s}function ci(r,s,o,d,y,b){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Yn(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Yn(r,""+d);break;case"className":wn(r,"class",d);break;case"tabIndex":wn(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(r,o,d);break;case"style":Pn(r,d,b);break;case"data":if(s!=="object"){wn(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=An(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof b=="function"&&(o==="formAction"?(s!=="input"&&ci(r,s,"name",y.name,y,null),ci(r,s,"formEncType",y.formEncType,y,null),ci(r,s,"formMethod",y.formMethod,y,null),ci(r,s,"formTarget",y.formTarget,y,null)):(ci(r,s,"encType",y.encType,y,null),ci(r,s,"method",y.method,y,null),ci(r,s,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=An(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=ii);break;case"onScroll":d!=null&&Bn("scroll",r);break;case"onScrollEnd":d!=null&&Bn("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(y.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=An(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":Bn("beforetoggle",r),Bn("toggle",r),tn(r,"popover",d);break;case"xlinkActuate":vt(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":vt(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":vt(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":vt(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":vt(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":vt(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":vt(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":vt(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":vt(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":tn(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=ei.get(o)||o,tn(r,o,d))}}function Ym(r,s,o,d,y,b){switch(o){case"style":Pn(r,d,b);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(y.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Yn(r,d):(typeof d=="number"||typeof d=="bigint")&&Yn(r,""+d);break;case"onScroll":d!=null&&Bn("scroll",r);break;case"onScrollEnd":d!=null&&Bn("scrollend",r);break;case"onClick":d!=null&&(r.onclick=ii);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xn.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(y=o.endsWith("Capture"),s=o.slice(2,y?o.length-7:void 0),b=r[Dt]||null,b=b!=null?b[o]:null,typeof b=="function"&&r.removeEventListener(s,b,y),typeof d=="function")){typeof b!="function"&&b!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,y);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):tn(r,o,d)}}}function mr(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Bn("error",r),Bn("load",r);var d=!1,y=!1,b;for(b in o)if(o.hasOwnProperty(b)){var D=o[b];if(D!=null)switch(b){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:ci(r,s,b,D,o,null)}}y&&ci(r,s,"srcSet",o.srcSet,o,null),d&&ci(r,s,"src",o.src,o,null);return;case"input":Bn("invalid",r);var $=b=D=y=null,ve=null,qe=null;for(d in o)if(o.hasOwnProperty(d)){var ot=o[d];if(ot!=null)switch(d){case"name":y=ot;break;case"type":D=ot;break;case"checked":ve=ot;break;case"defaultChecked":qe=ot;break;case"value":b=ot;break;case"defaultValue":$=ot;break;case"children":case"dangerouslySetInnerHTML":if(ot!=null)throw Error(i(137,s));break;default:ci(r,s,d,ot,o,null)}}Vn(r,b,$,ve,qe,D,y,!1);return;case"select":Bn("invalid",r),d=D=b=null;for(y in o)if(o.hasOwnProperty(y)&&($=o[y],$!=null))switch(y){case"value":b=$;break;case"defaultValue":D=$;break;case"multiple":d=$;default:ci(r,s,y,$,o,null)}s=b,o=D,r.multiple=!!d,s!=null?$n(r,!!d,s,!1):o!=null&&$n(r,!!d,o,!0);return;case"textarea":Bn("invalid",r),b=y=d=null;for(D in o)if(o.hasOwnProperty(D)&&($=o[D],$!=null))switch(D){case"value":d=$;break;case"defaultValue":y=$;break;case"children":b=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(i(91));break;default:ci(r,s,D,$,o,null)}Bi(r,d,y,b);return;case"option":for(ve in o)o.hasOwnProperty(ve)&&(d=o[ve],d!=null)&&(ve==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":ci(r,s,ve,d,o,null));return;case"dialog":Bn("beforetoggle",r),Bn("toggle",r),Bn("cancel",r),Bn("close",r);break;case"iframe":case"object":Bn("load",r);break;case"video":case"audio":for(d=0;d<Sc.length;d++)Bn(Sc[d],r);break;case"image":Bn("error",r),Bn("load",r);break;case"details":Bn("toggle",r);break;case"embed":case"source":case"link":Bn("error",r),Bn("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(qe in o)if(o.hasOwnProperty(qe)&&(d=o[qe],d!=null))switch(qe){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:ci(r,s,qe,d,o,null)}return;default:if(Ri(s)){for(ot in o)o.hasOwnProperty(ot)&&(d=o[ot],d!==void 0&&Ym(r,s,ot,d,o,void 0));return}}for($ in o)o.hasOwnProperty($)&&(d=o[$],d!=null&&ci(r,s,$,d,o,null))}function vE(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,b=null,D=null,$=null,ve=null,qe=null,ot=null;for(Ze in o){var ft=o[Ze];if(o.hasOwnProperty(Ze)&&ft!=null)switch(Ze){case"checked":break;case"value":break;case"defaultValue":ve=ft;default:d.hasOwnProperty(Ze)||ci(r,s,Ze,null,d,ft)}}for(var Ge in d){var Ze=d[Ge];if(ft=o[Ge],d.hasOwnProperty(Ge)&&(Ze!=null||ft!=null))switch(Ge){case"type":b=Ze;break;case"name":y=Ze;break;case"checked":qe=Ze;break;case"defaultChecked":ot=Ze;break;case"value":D=Ze;break;case"defaultValue":$=Ze;break;case"children":case"dangerouslySetInnerHTML":if(Ze!=null)throw Error(i(137,s));break;default:Ze!==ft&&ci(r,s,Ge,Ze,d,ft)}}On(r,D,$,ve,qe,ot,b,y);return;case"select":Ze=D=$=Ge=null;for(b in o)if(ve=o[b],o.hasOwnProperty(b)&&ve!=null)switch(b){case"value":break;case"multiple":Ze=ve;default:d.hasOwnProperty(b)||ci(r,s,b,null,d,ve)}for(y in d)if(b=d[y],ve=o[y],d.hasOwnProperty(y)&&(b!=null||ve!=null))switch(y){case"value":Ge=b;break;case"defaultValue":$=b;break;case"multiple":D=b;default:b!==ve&&ci(r,s,y,b,d,ve)}s=$,o=D,d=Ze,Ge!=null?$n(r,!!o,Ge,!1):!!d!=!!o&&(s!=null?$n(r,!!o,s,!0):$n(r,!!o,o?[]:"",!1));return;case"textarea":Ze=Ge=null;for($ in o)if(y=o[$],o.hasOwnProperty($)&&y!=null&&!d.hasOwnProperty($))switch($){case"value":break;case"children":break;default:ci(r,s,$,null,d,y)}for(D in d)if(y=d[D],b=o[D],d.hasOwnProperty(D)&&(y!=null||b!=null))switch(D){case"value":Ge=y;break;case"defaultValue":Ze=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==b&&ci(r,s,D,y,d,b)}ji(r,Ge,Ze);return;case"option":for(var Ft in o)Ge=o[Ft],o.hasOwnProperty(Ft)&&Ge!=null&&!d.hasOwnProperty(Ft)&&(Ft==="selected"?r.selected=!1:ci(r,s,Ft,null,d,Ge));for(ve in d)Ge=d[ve],Ze=o[ve],d.hasOwnProperty(ve)&&Ge!==Ze&&(Ge!=null||Ze!=null)&&(ve==="selected"?r.selected=Ge&&typeof Ge!="function"&&typeof Ge!="symbol":ci(r,s,ve,Ge,d,Ze));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var un in o)Ge=o[un],o.hasOwnProperty(un)&&Ge!=null&&!d.hasOwnProperty(un)&&ci(r,s,un,null,d,Ge);for(qe in d)if(Ge=d[qe],Ze=o[qe],d.hasOwnProperty(qe)&&Ge!==Ze&&(Ge!=null||Ze!=null))switch(qe){case"children":case"dangerouslySetInnerHTML":if(Ge!=null)throw Error(i(137,s));break;default:ci(r,s,qe,Ge,d,Ze)}return;default:if(Ri(s)){for(var di in o)Ge=o[di],o.hasOwnProperty(di)&&Ge!==void 0&&!d.hasOwnProperty(di)&&Ym(r,s,di,void 0,d,Ge);for(ot in d)Ge=d[ot],Ze=o[ot],!d.hasOwnProperty(ot)||Ge===Ze||Ge===void 0&&Ze===void 0||Ym(r,s,ot,Ge,d,Ze);return}}for(var Me in o)Ge=o[Me],o.hasOwnProperty(Me)&&Ge!=null&&!d.hasOwnProperty(Me)&&ci(r,s,Me,null,d,Ge);for(ft in d)Ge=d[ft],Ze=o[ft],!d.hasOwnProperty(ft)||Ge===Ze||Ge==null&&Ze==null||ci(r,s,ft,Ge,d,Ze)}function Ex(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xE(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var y=o[d],b=y.transferSize,D=y.initiatorType,$=y.duration;if(b&&$&&Ex(D)){for(D=0,$=y.responseEnd,d+=1;d<o.length;d++){var ve=o[d],qe=ve.startTime;if(qe>$)break;var ot=ve.transferSize,ft=ve.initiatorType;ot&&Ex(ft)&&(ve=ve.responseEnd,D+=ot*(ve<$?1:($-qe)/(ve-qe)))}if(--d,s+=8*(b+D)/(y.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Qm=null,Zm=null;function Mh(r){return r.nodeType===9?r:r.ownerDocument}function Cx(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ax(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Jm(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var ep=null;function _E(){var r=window.event;return r&&r.type==="popstate"?r===ep?!1:(ep=r,!0):(ep=null,!1)}var Nx=typeof setTimeout=="function"?setTimeout:void 0,wE=typeof clearTimeout=="function"?clearTimeout:void 0,Dx=typeof Promise=="function"?Promise:void 0,TE=typeof queueMicrotask=="function"?queueMicrotask:typeof Dx<"u"?function(r){return Dx.resolve(null).then(r).catch(SE)}:Nx;function SE(r){setTimeout(function(){throw r})}function ao(r){return r==="head"}function Mx(r,s){var o=s,d=0;do{var y=o.nextSibling;if(r.removeChild(o),y&&y.nodeType===8)if(o=y.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(y),Wl(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Ec(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,Ec(o);for(var b=o.firstChild;b;){var D=b.nextSibling,$=b.nodeName;b[Mn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=D}}else o==="body"&&Ec(r.ownerDocument.body);o=y}while(o);Wl(s)}function jx(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function tp(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":tp(o),Wt(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function kE(r,s,o,d){for(;r.nodeType===1;){var y=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Mn])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(b=r.getAttribute("rel"),b==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(b!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(b=r.getAttribute("src"),(b!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&b&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var b=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===b)return r}else return r;if(r=cs(r.nextSibling),r===null)break}return null}function EE(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=cs(r.nextSibling),r===null))return null;return r}function Rx(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=cs(r.nextSibling),r===null))return null;return r}function np(r){return r.data==="$?"||r.data==="$~"}function ip(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function CE(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function cs(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var rp=null;function Ox(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return cs(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function Lx(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function Ix(r,s,o){switch(s=Mh(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function Ec(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Wt(r)}var ds=new Map,Bx=new Set;function jh(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var va=P.d;P.d={f:AE,r:NE,D:DE,C:ME,L:jE,m:RE,X:LE,S:OE,M:IE};function AE(){var r=va.f(),s=Th();return r||s}function NE(r){var s=Kn(r);s!==null&&s.tag===5&&s.type==="form"?ev(s):va.r(r)}var Vl=typeof document>"u"?null:document;function Px(r,s,o){var d=Vl;if(d&&typeof s=="string"&&s){var y=Xt(s);y='link[rel="'+r+'"][href="'+y+'"]',typeof o=="string"&&(y+='[crossorigin="'+o+'"]'),Bx.has(y)||(Bx.add(y),r={rel:r,crossOrigin:o,href:s},d.querySelector(y)===null&&(s=d.createElement("link"),mr(s,"link",r),Cn(s),d.head.appendChild(s)))}}function DE(r){va.D(r),Px("dns-prefetch",r,null)}function ME(r,s){va.C(r,s),Px("preconnect",r,s)}function jE(r,s,o){va.L(r,s,o);var d=Vl;if(d&&r&&s){var y='link[rel="preload"][as="'+Xt(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+Xt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+Xt(o.imageSizes)+'"]')):y+='[href="'+Xt(r)+'"]';var b=y;switch(s){case"style":b=Gl(r);break;case"script":b=Kl(r)}ds.has(b)||(r=S({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),ds.set(b,r),d.querySelector(y)!==null||s==="style"&&d.querySelector(Cc(b))||s==="script"&&d.querySelector(Ac(b))||(s=d.createElement("link"),mr(s,"link",r),Cn(s),d.head.appendChild(s)))}}function RE(r,s){va.m(r,s);var o=Vl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+Xt(d)+'"][href="'+Xt(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Kl(r)}if(!ds.has(b)&&(r=S({rel:"modulepreload",href:r},s),ds.set(b,r),o.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ac(b)))return}d=o.createElement("link"),mr(d,"link",r),Cn(d),o.head.appendChild(d)}}}function OE(r,s,o){va.S(r,s,o);var d=Vl;if(d&&r){var y=Wn(d).hoistableStyles,b=Gl(r);s=s||"default";var D=y.get(b);if(!D){var $={loading:0,preload:null};if(D=d.querySelector(Cc(b)))$.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ds.get(b))&&sp(r,o);var ve=D=d.createElement("link");Cn(ve),mr(ve,"link",r),ve._p=new Promise(function(qe,ot){ve.onload=qe,ve.onerror=ot}),ve.addEventListener("load",function(){$.loading|=1}),ve.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Rh(D,s,d)}D={type:"stylesheet",instance:D,count:1,state:$},y.set(b,D)}}}function LE(r,s){va.X(r,s);var o=Vl;if(o&&r){var d=Wn(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0},s),(s=ds.get(y))&&ap(r,s),b=o.createElement("script"),Cn(b),mr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function IE(r,s){va.M(r,s);var o=Vl;if(o&&r){var d=Wn(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0,type:"module"},s),(s=ds.get(y))&&ap(r,s),b=o.createElement("script"),Cn(b),mr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function Fx(r,s,o,d){var y=(y=mt.current)?jh(y):null;if(!y)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Gl(o.href),o=Wn(y).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=Gl(o.href);var b=Wn(y).hoistableStyles,D=b.get(r);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,D),(b=y.querySelector(Cc(r)))&&!b._p&&(D.instance=b,D.state.loading=5),ds.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ds.set(r,o),b||BE(y,r,o,D.state))),s&&d===null)throw Error(i(528,""));return D}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Kl(o),o=Wn(y).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Gl(r){return'href="'+Xt(r)+'"'}function Cc(r){return'link[rel="stylesheet"]['+r+"]"}function Ux(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function BE(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),mr(s,"link",o),Cn(s),r.head.appendChild(s))}function Kl(r){return'[src="'+Xt(r)+'"]'}function Ac(r){return"script[async]"+r}function zx(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Xt(o.href)+'"]');if(d)return s.instance=d,Cn(d),d;var y=S({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Cn(d),mr(d,"style",y),Rh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Gl(o.href);var b=r.querySelector(Cc(y));if(b)return s.state.loading|=4,s.instance=b,Cn(b),b;d=Ux(o),(y=ds.get(y))&&sp(d,y),b=(r.ownerDocument||r).createElement("link"),Cn(b);var D=b;return D._p=new Promise(function($,ve){D.onload=$,D.onerror=ve}),mr(b,"link",d),s.state.loading|=4,Rh(b,o.precedence,r),s.instance=b;case"script":return b=Kl(o.src),(y=r.querySelector(Ac(b)))?(s.instance=y,Cn(y),y):(d=o,(y=ds.get(b))&&(d=S({},o),ap(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),Cn(y),mr(y,"link",d),r.head.appendChild(y),s.instance=y);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Rh(d,o.precedence,r));return s.instance}function Rh(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,b=y,D=0;D<d.length;D++){var $=d[D];if($.dataset.precedence===s)b=$;else if(b!==y)break}b?b.parentNode.insertBefore(r,b.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function sp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function ap(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Oh=null;function $x(r,s,o){if(Oh===null){var d=new Map,y=Oh=new Map;y.set(o,d)}else y=Oh,d=y.get(o),d||(d=new Map,y.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),y=0;y<o.length;y++){var b=o[y];if(!(b[Mn]||b[zt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var D=b.getAttribute(s)||"";D=r+D;var $=d.get(D);$?$.push(b):d.set(D,[b])}}return d}function Hx(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function PE(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(r=s.disabled,typeof s.precedence=="string"&&r==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function qx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function FE(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var y=Gl(d.href),b=s.querySelector(Cc(y));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Lh.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=b,Cn(b);return}b=s.ownerDocument||s,d=Ux(d),(y=ds.get(y))&&sp(d,y),b=b.createElement("link"),Cn(b);var D=b;D._p=new Promise(function($,ve){D.onload=$,D.onerror=ve}),mr(b,"link",d),o.instance=b}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Lh.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var op=0;function UE(r,s){return r.stylesheets&&r.count===0&&Bh(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Bh(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+s);0<r.imgBytes&&op===0&&(op=62500*xE());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Bh(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>op?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Lh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bh(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Ih=null;function Bh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Ih=new Map,s.forEach(zE,r),Ih=null,Lh.call(r))}function zE(r,s){if(!(s.state.loading&4)){var o=Ih.get(r);if(o)var d=o.get(null);else{o=new Map,Ih.set(r,o);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<y.length;b++){var D=y[b];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(o.set(D.dataset.precedence,D),d=D)}d&&o.set(null,d)}y=s.instance,D=y.getAttribute("data-precedence"),b=o.get(D)||d,b===d&&o.set(null,y),o.set(D,y),this.count++,d=Lh.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),b?b.parentNode.insertBefore(y,b.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),s.state.loading|=4}}var Nc={$$typeof:U,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function $E(r,s,o,d,y,b,D,$,ve){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.hiddenUpdates=yt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ve,this.incompleteTransitions=new Map}function Vx(r,s,o,d,y,b,D,$,ve,qe,ot,ft){return r=new $E(r,s,o,D,ve,qe,ot,ft,$),s=1,b===!0&&(s|=24),b=Ui(3,null,null,s),r.current=b,b.stateNode=r,s=la(),s.refCount++,r.pooledCache=s,s.refCount++,b.memoizedState={element:d,isDehydrated:o,cache:s},q0(b),r}function Gx(r){return r?(r=qa,r):qa}function Kx(r,s,o,d,y,b){y=Gx(y),d.context===null?d.context=y:d.pendingContext=y,d=Xa(s),d.payload={element:o},b=b===void 0?null:b,b!==null&&(d.callback=b),o=Ya(r,d,s),o!==null&&(Pr(o,r,s),oc(o,r,s))}function Wx(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function lp(r,s){Wx(r,s),(r=r.alternate)&&Wx(r,s)}function Xx(r){if(r.tag===13||r.tag===31){var s=oa(r,67108864);s!==null&&Pr(s,r,67108864),lp(r,67108864)}}function Yx(r){if(r.tag===13||r.tag===31){var s=es();s=En(s);var o=oa(r,s);o!==null&&Pr(o,r,s),lp(r,s)}}var Ph=!0;function HE(r,s,o,d){var y=q.T;q.T=null;var b=P.p;try{P.p=2,up(r,s,o,d)}finally{P.p=b,q.T=y}}function qE(r,s,o,d){var y=q.T;q.T=null;var b=P.p;try{P.p=8,up(r,s,o,d)}finally{P.p=b,q.T=y}}function up(r,s,o,d){if(Ph){var y=cp(d);if(y===null)Xm(r,s,d,Fh,o),Zx(r,d);else if(GE(y,r,s,o,d))d.stopPropagation();else if(Zx(r,d),s&4&&-1<VE.indexOf(r)){for(;y!==null;){var b=Kn(y);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var D=M(b.pendingLanes);if(D!==0){var $=b;for($.pendingLanes|=2,$.entangledLanes|=2;D;){var ve=1<<31-wt(D);$.entanglements[1]|=ve,D&=~ve}qs(b),(ni&6)===0&&(_h=he()+500,Tc(0))}}break;case 31:case 13:$=oa(b,2),$!==null&&Pr($,b,2),Th(),lp(b,2)}if(b=cp(d),b===null&&Xm(r,s,d,Fh,o),b===y)break;y=b}y!==null&&d.stopPropagation()}else Xm(r,s,d,null,o)}}function cp(r){return r=Oi(r),dp(r)}var Fh=null;function dp(r){if(Fh=null,r=zn(r),r!==null){var s=l(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=h(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Fh=r,null}function Qx(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ie()){case Le:return 2;case ke:return 8;case Pe:case et:return 32;case kt:return 268435456;default:return 32}default:return 32}}var hp=!1,oo=null,lo=null,uo=null,Dc=new Map,Mc=new Map,co=[],VE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Zx(r,s){switch(r){case"focusin":case"focusout":oo=null;break;case"dragenter":case"dragleave":lo=null;break;case"mouseover":case"mouseout":uo=null;break;case"pointerover":case"pointerout":Dc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mc.delete(s.pointerId)}}function jc(r,s,o,d,y,b){return r===null||r.nativeEvent!==b?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:b,targetContainers:[y]},s!==null&&(s=Kn(s),s!==null&&Xx(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,y!==null&&s.indexOf(y)===-1&&s.push(y),r)}function GE(r,s,o,d,y){switch(s){case"focusin":return oo=jc(oo,r,s,o,d,y),!0;case"dragenter":return lo=jc(lo,r,s,o,d,y),!0;case"mouseover":return uo=jc(uo,r,s,o,d,y),!0;case"pointerover":var b=y.pointerId;return Dc.set(b,jc(Dc.get(b)||null,r,s,o,d,y)),!0;case"gotpointercapture":return b=y.pointerId,Mc.set(b,jc(Mc.get(b)||null,r,s,o,d,y)),!0}return!1}function Jx(r){var s=zn(r.target);if(s!==null){var o=l(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,cn(r.priority,function(){Yx(o)});return}}else if(s===31){if(s=h(o),s!==null){r.blockedOn=s,cn(r.priority,function(){Yx(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Uh(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=cp(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Pi=d,o.target.dispatchEvent(d),Pi=null}else return s=Kn(o),s!==null&&Xx(s),r.blockedOn=o,!1;s.shift()}return!0}function e1(r,s,o){Uh(r)&&o.delete(s)}function KE(){hp=!1,oo!==null&&Uh(oo)&&(oo=null),lo!==null&&Uh(lo)&&(lo=null),uo!==null&&Uh(uo)&&(uo=null),Dc.forEach(e1),Mc.forEach(e1)}function zh(r,s){r.blockedOn===s&&(r.blockedOn=null,hp||(hp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,KE)))}var $h=null;function t1(r){$h!==r&&($h=r,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){$h===r&&($h=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],y=r[s+2];if(typeof d!="function"){if(dp(d||o)===null)continue;break}var b=Kn(o);b!==null&&(r.splice(s,3),s-=3,cm(b,{pending:!0,data:y,method:o.method,action:d},d,y))}}))}function Wl(r){function s(ve){return zh(ve,r)}oo!==null&&zh(oo,r),lo!==null&&zh(lo,r),uo!==null&&zh(uo,r),Dc.forEach(s),Mc.forEach(s);for(var o=0;o<co.length;o++){var d=co[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<co.length&&(o=co[0],o.blockedOn===null);)Jx(o),o.blockedOn===null&&co.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var y=o[d],b=o[d+1],D=y[Dt]||null;if(typeof b=="function")D||t1(o);else if(D){var $=null;if(b&&b.hasAttribute("formAction")){if(y=b,D=b[Dt]||null)$=D.formAction;else if(dp(y)!==null)continue}else $=D.action;typeof $=="function"?o[d+1]=$:(o.splice(d,3),d-=3),t1(o)}}}function n1(){function r(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(D){return y=D})},focusReset:"manual",scroll:"manual"})}function s(){y!==null&&(y(),y=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),y!==null&&(y(),y=null)}}}function fp(r){this._internalRoot=r}Hh.prototype.render=fp.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=es();Kx(o,d,r,s,null,null)},Hh.prototype.unmount=fp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Kx(r.current,2,null,r,null,null),Th(),s[Ot]=null}};function Hh(r){this._internalRoot=r}Hh.prototype.unstable_scheduleHydration=function(r){if(r){var s=hn();r={blockedOn:null,target:r,priority:s};for(var o=0;o<co.length&&s!==0&&s<co[o].priority;o++);co.splice(o,0,r),o===0&&Jx(r)}};var i1=e.version;if(i1!=="19.2.3")throw Error(i(527,i1,"19.2.3"));P.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=g(s),r=r!==null?_(r):null,r=r===null?null:r.stateNode,r};var WE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qh.isDisabled&&qh.supportsFiber)try{Zt=qh.inject(WE),qt=qh}catch{}}return Oc.createRoot=function(r,s){if(!a(r))throw Error(i(299));var o=!1,d="",y=cv,b=dv,D=hv;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(b=s.onCaughtError),s.onRecoverableError!==void 0&&(D=s.onRecoverableError)),s=Vx(r,1,!1,null,null,o,d,null,y,b,D,n1),r[Ot]=s.current,Wm(r),new fp(s)},Oc.hydrateRoot=function(r,s,o){if(!a(r))throw Error(i(299));var d=!1,y="",b=cv,D=dv,$=hv,ve=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onUncaughtError!==void 0&&(b=o.onUncaughtError),o.onCaughtError!==void 0&&(D=o.onCaughtError),o.onRecoverableError!==void 0&&($=o.onRecoverableError),o.formState!==void 0&&(ve=o.formState)),s=Vx(r,1,!0,s,o??null,d,y,ve,b,D,$,n1),s.context=Gx(null),o=s.current,d=es(),d=En(d),y=Xa(d),y.callback=null,Ya(o,y,d),o=d,s.current.lanes=o,Vt(s,o),qs(s),r[Ot]=s.current,Wm(r),new Hh(s)},Oc.version="19.2.3",Oc}var m1;function sC(){if(m1)return gp.exports;m1=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),gp.exports=rC(),gp.exports}var ew=sC();function aC(...n){return n.filter(Boolean).join(" ")}const oC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",lC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},uC={xs:"px-2 py-1 text-xs",sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3.5 py-2.5 text-sm"},cC={indigo:{primary:"!bg-indigo-600 !text-white shadow-sm hover:!bg-indigo-700 focus-visible:outline-indigo-600 dark:!bg-indigo-500 dark:hover:!bg-indigo-400 dark:focus-visible:outline-indigo-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-indigo-50 text-indigo-600 shadow-xs hover:bg-indigo-100 dark:bg-indigo-500/20 dark:text-indigo-400 dark:shadow-none dark:hover:bg-indigo-500/30"},blue:{primary:"!bg-blue-600 !text-white shadow-sm hover:!bg-blue-700 focus-visible:outline-blue-600 dark:!bg-blue-500 dark:hover:!bg-blue-400 dark:focus-visible:outline-blue-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-blue-50 text-blue-600 shadow-xs hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-400 dark:shadow-none dark:hover:bg-blue-500/30"},emerald:{primary:"!bg-emerald-600 !text-white shadow-sm hover:!bg-emerald-700 focus-visible:outline-emerald-600 dark:!bg-emerald-500 dark:hover:!bg-emerald-400 dark:focus-visible:outline-emerald-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-emerald-50 text-emerald-700 shadow-xs hover:bg-emerald-100 dark:bg-emerald-500/20 dark:text-emerald-400 dark:shadow-none dark:hover:bg-emerald-500/30"},red:{primary:"!bg-red-600 !text-white shadow-sm hover:!bg-red-700 focus-visible:outline-red-600 dark:!bg-red-500 dark:hover:!bg-red-400 dark:focus-visible:outline-red-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-red-50 text-red-700 shadow-xs hover:bg-red-100 dark:bg-red-500/20 dark:text-red-400 dark:shadow-none dark:hover:bg-red-500/30"},amber:{primary:"!bg-amber-500 !text-white shadow-sm hover:!bg-amber-600 focus-visible:outline-amber-500 dark:!bg-amber-500 dark:hover:!bg-amber-400 dark:focus-visible:outline-amber-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-amber-50 text-amber-800 shadow-xs hover:bg-amber-100 dark:bg-amber-500/20 dark:text-amber-300 dark:shadow-none dark:hover:bg-amber-500/30"}};function dC(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 animate-spin","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.25"}),c.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.9"})]})}function sn({children:n,variant:e="primary",color:t="indigo",size:i="md",rounded:a="md",leadingIcon:l,trailingIcon:u,isLoading:h=!1,disabled:f,className:g,type:_="button",...S}){const C=l||u||h?"gap-x-1.5":"";return c.jsxs("button",{type:_,disabled:f||h,className:aC(oC,lC[a],uC[i],cC[t][e],C,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(dC,{})}):l&&c.jsx("span",{className:"-ml-0.5",children:l}),c.jsx("span",{children:n}),u&&!h&&c.jsx("span",{className:"-mr-0.5",children:u})]})}function tw(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var a=n.length;for(e=0;e<a;e++)n[e]&&(t=tw(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function on(){for(var n,e,t=0,i="",a=arguments.length;t<a;t++)(n=arguments[t])&&(e=tw(n))&&(i&&(i+=" "),i+=e);return i}var yu=J_(),hC=Object.defineProperty,fC=(n,e,t)=>e in n?hC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xp=(n,e,t)=>(fC(n,typeof e!="symbol"?e+"":e,t),t);let mC=class{constructor(){xp(this,"current",this.detect()),xp(this,"handoffState","pending"),xp(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Js=new mC;function vd(n){var e;return Js.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function Ng(n){var e,t;return Js.isServer?null:n==null?document:(t=(e=n?.getRootNode)==null?void 0:e.call(n))!=null?t:document}function nw(n){var e,t;return(t=(e=Ng(n))==null?void 0:e.activeElement)!=null?t:null}function pC(n){return nw(n)===n}function Wf(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function Ma(){let n=[],e={addEventListener(t,i,a,l){return t.addEventListener(i,a,l),e.add(()=>t.removeEventListener(i,a,l))},requestAnimationFrame(...t){let i=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let i=setTimeout(...t);return e.add(()=>clearTimeout(i))},microTask(...t){let i={current:!0};return Wf(()=>{i.current&&t[0]()}),e.add(()=>{i.current=!1})},style(t,i,a){let l=t.style.getPropertyValue(i);return Object.assign(t.style,{[i]:a}),this.add(()=>{Object.assign(t.style,{[i]:l})})},group(t){let i=Ma();return t(i),this.add(()=>i.dispose())},add(t){return n.includes(t)||n.push(t),()=>{let i=n.indexOf(t);if(i>=0)for(let a of n.splice(i,1))a()}},dispose(){for(let t of n.splice(0))t()}};return e}function Xf(){let[n]=p.useState(Ma);return p.useEffect(()=>()=>n.dispose(),[n]),n}let qr=(n,e)=>{Js.isServer?p.useEffect(n,e):p.useLayoutEffect(n,e)};function xl(n){let e=p.useRef(n);return qr(()=>{e.current=n},[n]),e}let xi=function(n){let e=xl(n);return rn.useCallback((...t)=>e.current(...t),[e])};function xd(n){return p.useMemo(()=>n,Object.values(n))}let gC=p.createContext(void 0);function yC(){return p.useContext(gC)}function Dg(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Na(n,e,...t){if(n in e){let a=e[n];return typeof a=="function"?a(...t):a}let i=new Error(`Tried to handle "${n}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,Na),i}var yf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(yf||{}),To=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(To||{});function vs(){let n=vC();return p.useCallback(e=>bC({mergeRefs:n,...e}),[n])}function bC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??xC;let f=iw(e,n);if(l)return Vh(f,t,i,u,h);let g=a??0;if(g&2){let{static:_=!1,...S}=f;if(_)return Vh(S,t,i,u,h)}if(g&1){let{unmount:_=!0,...S}=f;return Na(_?0:1,{0(){return null},1(){return Vh({...S,hidden:!0,style:{display:"none"}},t,i,u,h)}})}return Vh(f,t,i,u,h)}function Vh(n,e={},t,i,a){let{as:l=t,children:u,refName:h="ref",...f}=_p(n,["unmount","static"]),g=n.ref!==void 0?{[h]:n.ref}:{},_=typeof u=="function"?u(e):u;"className"in f&&f.className&&typeof f.className=="function"&&(f.className=f.className(e)),f["aria-labelledby"]&&f["aria-labelledby"]===f.id&&(f["aria-labelledby"]=void 0);let S={};if(e){let C=!1,N=[];for(let[O,E]of Object.entries(e))typeof E=="boolean"&&(C=!0),E===!0&&N.push(O.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(C){S["data-headlessui-state"]=N.join(" ");for(let O of N)S[`data-${O}`]=""}}if(Yc(l)&&(Object.keys(nl(f)).length>0||Object.keys(nl(S)).length>0))if(!p.isValidElement(_)||Array.isArray(_)&&_.length>1||wC(_)){if(Object.keys(nl(f)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(nl(f)).concat(Object.keys(nl(S))).map(C=>` - ${C}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(C=>` - ${C}`).join(`
`)].join(`
`))}else{let C=_.props,N=C?.className,O=typeof N=="function"?(...H)=>Dg(N(...H),f.className):Dg(N,f.className),E=O?{className:O}:{},B=iw(_.props,nl(_p(f,["ref"])));for(let H in S)H in B&&delete S[H];return p.cloneElement(_,Object.assign({},B,S,g,{ref:a(_C(_),g.ref)},E))}return p.createElement(l,Object.assign({},_p(f,["ref"]),!Yc(l)&&g,!Yc(l)&&S),_)}function vC(){let n=p.useRef([]),e=p.useCallback(t=>{for(let i of n.current)i!=null&&(typeof i=="function"?i(t):i.current=t)},[]);return(...t)=>{if(!t.every(i=>i==null))return n.current=t,e}}function xC(...n){return n.every(e=>e==null)?void 0:e=>{for(let t of n)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function iw(...n){if(n.length===0)return{};if(n.length===1)return n[0];let e={},t={};for(let i of n)for(let a in i)a.startsWith("on")&&typeof i[a]=="function"?(t[a]!=null||(t[a]=[]),t[a].push(i[a])):e[a]=i[a];if(e.disabled||e["aria-disabled"])for(let i in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(t[i]=[a=>{var l;return(l=a?.preventDefault)==null?void 0:l.call(a)}]);for(let i in t)Object.assign(e,{[i](a,...l){let u=t[i];for(let h of u){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;h(a,...l)}}});return e}function Gr(n){var e;return Object.assign(p.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function nl(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function _p(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function _C(n){return rn.version.split(".")[0]>="19"?n.props.ref:n.ref}function Yc(n){return n===p.Fragment||n===Symbol.for("react.fragment")}function wC(n){return Yc(n.type)}let TC="span";var bf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(bf||{});function SC(n,e){var t;let{features:i=1,...a}=n,l={ref:e,"aria-hidden":(i&2)===2?!0:(t=a["aria-hidden"])!=null?t:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return vs()({ourProps:l,theirProps:a,slot:{},defaultTag:TC,name:"Hidden"})}let Mg=Gr(SC);function kC(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function ko(n){return kC(n)&&"tagName"in n}function pl(n){return ko(n)&&"accessKey"in n}function So(n){return ko(n)&&"tabIndex"in n}function EC(n){return ko(n)&&"style"in n}function CC(n){return pl(n)&&n.nodeName==="IFRAME"}function AC(n){return pl(n)&&n.nodeName==="INPUT"}let rw=Symbol();function NC(n,e=!0){return Object.assign(n,{[rw]:e})}function ia(...n){let e=p.useRef(n);p.useEffect(()=>{e.current=n},[n]);let t=xi(i=>{for(let a of e.current)a!=null&&(typeof a=="function"?a(i):a.current=i)});return n.every(i=>i==null||i?.[rw])?void 0:t}let py=p.createContext(null);py.displayName="DescriptionContext";function sw(){let n=p.useContext(py);if(n===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,sw),e}return n}function DC(){let[n,e]=p.useState([]);return[n.length>0?n.join(" "):void 0,p.useMemo(()=>function(t){let i=xi(l=>(e(u=>[...u,l]),()=>e(u=>{let h=u.slice(),f=h.indexOf(l);return f!==-1&&h.splice(f,1),h}))),a=p.useMemo(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return rn.createElement(py.Provider,{value:a},t.children)},[e])]}let MC="p";function jC(n,e){let t=p.useId(),i=yC(),{id:a=`headlessui-description-${t}`,...l}=n,u=sw(),h=ia(e);qr(()=>u.register(a),[a,u.register]);let f=xd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return vs()({ourProps:g,theirProps:l,slot:f,defaultTag:MC,name:u.name||"Description"})}let RC=Gr(jC),OC=Object.assign(RC,{});var aw=(n=>(n.Space=" ",n.Enter="Enter",n.Escape="Escape",n.Backspace="Backspace",n.Delete="Delete",n.ArrowLeft="ArrowLeft",n.ArrowUp="ArrowUp",n.ArrowRight="ArrowRight",n.ArrowDown="ArrowDown",n.Home="Home",n.End="End",n.PageUp="PageUp",n.PageDown="PageDown",n.Tab="Tab",n))(aw||{});let LC=p.createContext(()=>{});function IC({value:n,children:e}){return rn.createElement(LC.Provider,{value:n},e)}let ow=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var BC=Object.defineProperty,PC=(n,e,t)=>e in n?BC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,FC=(n,e,t)=>(PC(n,e+"",t),t),lw=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},hs=(n,e,t)=>(lw(n,e,"read from private field"),t?t.call(n):e.get(n)),wp=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},p1=(n,e,t,i)=>(lw(n,e,"write to private field"),e.set(n,t),t),Gs,qc,Vc;let UC=class{constructor(e){wp(this,Gs,{}),wp(this,qc,new ow(()=>new Set)),wp(this,Vc,new Set),FC(this,"disposables",Ma()),p1(this,Gs,e),Js.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return hs(this,Gs)}subscribe(e,t){if(Js.isServer)return()=>{};let i={selector:e,callback:t,current:e(hs(this,Gs))};return hs(this,Vc).add(i),this.disposables.add(()=>{hs(this,Vc).delete(i)})}on(e,t){return Js.isServer?()=>{}:(hs(this,qc).get(e).add(t),this.disposables.add(()=>{hs(this,qc).get(e).delete(t)}))}send(e){let t=this.reduce(hs(this,Gs),e);if(t!==hs(this,Gs)){p1(this,Gs,t);for(let i of hs(this,Vc)){let a=i.selector(hs(this,Gs));uw(i.current,a)||(i.current=a,i.callback(a))}for(let i of hs(this,qc).get(e.type))i(hs(this,Gs),e)}}};Gs=new WeakMap,qc=new WeakMap,Vc=new WeakMap;function uw(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null?!1:Array.isArray(n)&&Array.isArray(e)?n.length!==e.length?!1:Tp(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:Tp(n.entries(),e.entries()):g1(n)&&g1(e)?Tp(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Tp(n,e){do{let t=n.next(),i=e.next();if(t.done&&i.done)return!0;if(t.done||i.done||!Object.is(t.value,i.value))return!1}while(!0)}function g1(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}var zC=Object.defineProperty,$C=(n,e,t)=>e in n?zC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y1=(n,e,t)=>($C(n,typeof e!="symbol"?e+"":e,t),t),HC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(HC||{});let qC={0(n,e){let t=e.id,i=n.stack,a=n.stack.indexOf(t);if(a!==-1){let l=n.stack.slice();return l.splice(a,1),l.push(t),i=l,{...n,stack:i}}return{...n,stack:[...n.stack,t]}},1(n,e){let t=e.id,i=n.stack.indexOf(t);if(i===-1)return n;let a=n.stack.slice();return a.splice(i,1),{...n,stack:a}}},VC=class cw extends UC{constructor(){super(...arguments),y1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),y1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new cw({stack:[]})}reduce(e,t){return Na(t.type,qC,e,t)}};const dw=new ow(()=>VC.new());var Sp={exports:{}},kp={};var b1;function GC(){if(b1)return kp;b1=1;var n=Kf();function e(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var t=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,a=n.useRef,l=n.useEffect,u=n.useMemo,h=n.useDebugValue;return kp.useSyncExternalStoreWithSelector=function(f,g,_,S,C){var N=a(null);if(N.current===null){var O={hasValue:!1,value:null};N.current=O}else O=N.current;N=u(function(){function B(W){if(!H){if(H=!0,Y=W,W=S(W),C!==void 0&&O.hasValue){var X=O.value;if(C(X,W))return U=X}return U=W}if(X=U,t(Y,W))return X;var R=S(W);return C!==void 0&&C(X,R)?(Y=W,X):(Y=W,U=R)}var H=!1,Y,U,re=_===void 0?null:_;return[function(){return B(g())},re===null?void 0:function(){return B(re())}]},[g,_,S,C]);var E=i(f,N[0],N[1]);return l(function(){O.hasValue=!0,O.value=E},[E]),h(E),E},kp}var v1;function KC(){return v1||(v1=1,Sp.exports=GC()),Sp.exports}var WC=KC();function hw(n,e,t=uw){return WC.useSyncExternalStoreWithSelector(xi(i=>n.subscribe(XC,i)),xi(()=>n.state),xi(()=>n.state),xi(e),t)}function XC(n){return n}function _d(n,e){let t=p.useId(),i=dw.get(e),[a,l]=hw(i,p.useCallback(u=>[i.selectors.isTop(u,t),i.selectors.inStack(u,t)],[i,t]));return qr(()=>{if(n)return i.actions.push(t),()=>i.actions.pop(t)},[i,n,t]),n?l?a:!0:!1}let jg=new Map,Qc=new Map;function x1(n){var e;let t=(e=Qc.get(n))!=null?e:0;return Qc.set(n,t+1),t!==0?()=>_1(n):(jg.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>_1(n))}function _1(n){var e;let t=(e=Qc.get(n))!=null?e:1;if(t===1?Qc.delete(n):Qc.set(n,t-1),t!==1)return;let i=jg.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,jg.delete(n))}function YC(n,{allowed:e,disallowed:t}={}){let i=_d(n,"inert-others");qr(()=>{var a,l;if(!i)return;let u=Ma();for(let f of(a=t?.())!=null?a:[])f&&u.add(x1(f));let h=(l=e?.())!=null?l:[];for(let f of h){if(!f)continue;let g=vd(f);if(!g)continue;let _=f.parentElement;for(;_&&_!==g.body;){for(let S of _.children)h.some(C=>S.contains(C))||u.add(x1(S));_=_.parentElement}}return u.dispose},[i,e,t])}function QC(n,e,t){let i=xl(a=>{let l=a.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&t()});p.useEffect(()=>{if(!n)return;let a=e===null?null:pl(e)?e:e.current;if(!a)return;let l=Ma();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}return()=>l.dispose()},[e,i,n])}let vf=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(","),ZC=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Sa=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n[n.AutoFocus=64]="AutoFocus",n))(Sa||{}),Rg=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Rg||{}),JC=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(JC||{});function e5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(vf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function t5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(ZC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var fw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(fw||{});function n5(n,e=0){var t;return n===((t=vd(n))==null?void 0:t.body)?!1:Na(e,{0(){return n.matches(vf)},1(){let i=n;for(;i!==null;){if(i.matches(vf))return!0;i=i.parentElement}return!1}})}var i5=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(i5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",n=>{n.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:n.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Ca(n){n?.focus({preventScroll:!0})}let r5=["textarea","input"].join(",");function s5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,r5))!=null?t:!1}function a5(n,e=t=>t){return n.slice().sort((t,i)=>{let a=e(t),l=e(i);if(a===null||l===null)return 0;let u=a.compareDocumentPosition(l);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Zc(n,e,{sorted:t=!0,relativeTo:i=null,skipElements:a=[]}={}){let l=Array.isArray(n)?n.length>0?Ng(n[0]):document:Ng(n),u=Array.isArray(n)?t?a5(n):n:e&64?t5(n):e5(n);a.length>0&&u.length>1&&(u=u.filter(N=>!a.some(O=>O!=null&&"current"in O?O?.current===N:O===N))),i=i??l?.activeElement;let h=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),f=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,u.indexOf(i))-1;if(e&4)return Math.max(0,u.indexOf(i))+1;if(e&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),g=e&32?{preventScroll:!0}:{},_=0,S=u.length,C;do{if(_>=S||_+S<=0)return 0;let N=f+_;if(e&16)N=(N+S)%S;else{if(N<0)return 3;if(N>=S)return 1}C=u[N],C?.focus(g),_+=h}while(C!==nw(C));return e&6&&s5(C)&&C.select(),2}function mw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function o5(){return/Android/gi.test(window.navigator.userAgent)}function w1(){return mw()||o5()}function Gh(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return document.addEventListener(e,l,i),()=>document.removeEventListener(e,l,i)},[n,e,i])}function pw(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return window.addEventListener(e,l,i),()=>window.removeEventListener(e,l,i)},[n,e,i])}const T1=30;function l5(n,e,t){let i=xl(t),a=p.useCallback(function(h,f){if(h.defaultPrevented)return;let g=f(h);if(g===null||!g.getRootNode().contains(g)||!g.isConnected)return;let _=(function S(C){return typeof C=="function"?S(C()):Array.isArray(C)||C instanceof Set?C:[C]})(e);for(let S of _)if(S!==null&&(S.contains(g)||h.composed&&h.composedPath().includes(S)))return;return!n5(g,fw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=p.useRef(null);Gh(n,"pointerdown",h=>{var f,g;w1()||(l.current=((g=(f=h.composedPath)==null?void 0:f.call(h))==null?void 0:g[0])||h.target)},!0),Gh(n,"pointerup",h=>{if(w1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=p.useRef({x:0,y:0});Gh(n,"touchstart",h=>{u.current.x=h.touches[0].clientX,u.current.y=h.touches[0].clientY},!0),Gh(n,"touchend",h=>{let f={x:h.changedTouches[0].clientX,y:h.changedTouches[0].clientY};if(!(Math.abs(f.x-u.current.x)>=T1||Math.abs(f.y-u.current.y)>=T1))return a(h,()=>So(h.target)?h.target:null)},!0),pw(n,"blur",h=>a(h,()=>CC(window.document.activeElement)?window.document.activeElement:null),!0)}function gy(...n){return p.useMemo(()=>vd(...n),[...n])}function gw(n,e,t,i){let a=xl(t);p.useEffect(()=>{n=n??window;function l(u){a.current(u)}return n.addEventListener(e,l,i),()=>n.removeEventListener(e,l,i)},[n,e,i])}function u5(n){return p.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function c5(n,e){let t=n(),i=new Set;return{getSnapshot(){return t},subscribe(a){return i.add(a),()=>i.delete(a)},dispatch(a,...l){let u=e[a].call(t,...l);u&&(t=u,i.forEach(h=>h()))}}}function d5(){let n;return{before({doc:e}){var t;let i=e.documentElement,a=(t=e.defaultView)!=null?t:window;n=Math.max(0,a.innerWidth-i.clientWidth)},after({doc:e,d:t}){let i=e.documentElement,a=Math.max(0,i.clientWidth-i.offsetWidth),l=Math.max(0,n-a);t.style(i,"paddingRight",`${l}px`)}}}function h5(){return mw()?{before({doc:n,d:e,meta:t}){function i(a){for(let l of t().containers)for(let u of l())if(u.contains(a))return!0;return!1}e.microTask(()=>{var a;if(window.getComputedStyle(n.documentElement).scrollBehavior!=="auto"){let h=Ma();h.style(n.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>h.dispose()))}let l=(a=window.scrollY)!=null?a:window.pageYOffset,u=null;e.addEventListener(n,"click",h=>{if(So(h.target))try{let f=h.target.closest("a");if(!f)return;let{hash:g}=new URL(f.href),_=n.querySelector(g);So(_)&&!i(_)&&(u=_)}catch{}},!0),e.group(h=>{e.addEventListener(n,"touchstart",f=>{if(h.dispose(),So(f.target)&&EC(f.target))if(i(f.target)){let g=f.target;for(;g.parentElement&&i(g.parentElement);)g=g.parentElement;h.style(g,"overscrollBehavior","contain")}else h.style(f.target,"touchAction","none")})}),e.addEventListener(n,"touchmove",h=>{if(So(h.target)){if(AC(h.target))return;if(i(h.target)){let f=h.target;for(;f.parentElement&&f.dataset.headlessuiPortal!==""&&!(f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth);)f=f.parentElement;f.dataset.headlessuiPortal===""&&h.preventDefault()}else h.preventDefault()}},{passive:!1}),e.add(()=>{var h;let f=(h=window.scrollY)!=null?h:window.pageYOffset;l!==f&&window.scrollTo(0,l),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function f5(){return{before({doc:n,d:e}){e.style(n.documentElement,"overflow","hidden")}}}function S1(n){let e={};for(let t of n)Object.assign(e,t(e));return e}let ol=c5(()=>new Map,{PUSH(n,e){var t;let i=(t=this.get(n))!=null?t:{doc:n,count:0,d:Ma(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=S1(i.meta),this.set(n,i),this},POP(n,e){let t=this.get(n);return t&&(t.count--,t.meta.delete(e),t.computedMeta=S1(t.meta)),this},SCROLL_PREVENT(n){let e={doc:n.doc,d:n.d,meta(){return n.computedMeta}},t=[h5(),d5(),f5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});ol.subscribe(()=>{let n=ol.getSnapshot(),e=new Map;for(let[t]of n)e.set(t,t.documentElement.style.overflow);for(let t of n.values()){let i=e.get(t.doc)==="hidden",a=t.count!==0;(a&&!i||!a&&i)&&ol.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&ol.dispatch("TEARDOWN",t)}});function m5(n,e,t=()=>({containers:[]})){let i=u5(ol),a=e?i.get(e):void 0,l=a?a.count>0:!1;return qr(()=>{if(!(!e||!n))return ol.dispatch("PUSH",e,t),()=>ol.dispatch("POP",e,t)},[n,e]),l}function p5(n,e,t=()=>[document.body]){let i=_d(n,"scroll-lock");m5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function g5(n=0){let[e,t]=p.useState(n),i=p.useCallback(f=>t(f),[]),a=p.useCallback(f=>t(g=>g|f),[]),l=p.useCallback(f=>(e&f)===f,[e]),u=p.useCallback(f=>t(g=>g&~f),[]),h=p.useCallback(f=>t(g=>g^f),[]);return{flags:e,setFlag:i,addFlag:a,hasFlag:l,removeFlag:u,toggleFlag:h}}var y5={},k1,E1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((k1=process==null?void 0:y5)==null?void 0:k1.NODE_ENV)==="test"&&typeof((E1=Element?.prototype)==null?void 0:E1.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var b5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(b5||{});function v5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function x5(n,e,t,i){let[a,l]=p.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=g5(n&&a?3:0),g=p.useRef(!1),_=p.useRef(!1),S=Xf();return qr(()=>{var C;if(n){if(t&&l(!0),!e){t&&h(3);return}return(C=i?.start)==null||C.call(i,t),_5(e,{inFlight:g,prepare(){_.current?_.current=!1:_.current=g.current,g.current=!0,!_.current&&(t?(h(3),f(4)):(h(4),f(2)))},run(){_.current?t?(f(3),h(4)):(f(4),h(3)):t?f(1):h(1)},done(){var N;_.current&&S5(e)||(g.current=!1,f(7),t||l(!1),(N=i?.end)==null||N.call(i,t))}})}},[n,t,e,S]),n?[a,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function _5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ma();return T5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(w5(n,i))})}),l.dispose}function w5(n,e){var t,i;let a=Ma();if(!n)return a.dispose;let l=!1;a.add(()=>{l=!0});let u=(i=(t=n.getAnimations)==null?void 0:t.call(n).filter(h=>h instanceof CSSTransition))!=null?i:[];return u.length===0?(e(),a.dispose):(Promise.allSettled(u.map(h=>h.finished)).then(()=>{l||e()}),a.dispose)}function T5(n,{inFlight:e,prepare:t}){if(e!=null&&e.current){t();return}let i=n.style.transition;n.style.transition="none",t(),n.offsetHeight,n.style.transition=i}function S5(n){var e,t;return((t=(e=n.getAnimations)==null?void 0:e.call(n))!=null?t:[]).some(i=>i instanceof CSSTransition&&i.playState!=="finished")}function yy(n,e){let t=p.useRef([]),i=xi(n);p.useEffect(()=>{let a=[...t.current];for(let[l,u]of e.entries())if(t.current[l]!==u){let h=i(e,a);return t.current=e,h}},[i,...e])}let Yf=p.createContext(null);Yf.displayName="OpenClosedContext";var As=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(As||{});function Qf(){return p.useContext(Yf)}function k5({value:n,children:e}){return rn.createElement(Yf.Provider,{value:n},e)}function E5({children:n}){return rn.createElement(Yf.Provider,{value:null},n)}function C5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let wo=[];C5(()=>{function n(e){if(!So(e.target)||e.target===document.body||wo[0]===e.target)return;let t=e.target;t=t.closest(vf),wo.unshift(t??e.target),wo=wo.filter(i=>i!=null&&i.isConnected),wo.splice(10)}window.addEventListener("click",n,{capture:!0}),window.addEventListener("mousedown",n,{capture:!0}),window.addEventListener("focus",n,{capture:!0}),document.body.addEventListener("click",n,{capture:!0}),document.body.addEventListener("mousedown",n,{capture:!0}),document.body.addEventListener("focus",n,{capture:!0})});function yw(n){let e=xi(n),t=p.useRef(!1);p.useEffect(()=>(t.current=!1,()=>{t.current=!0,Wf(()=>{t.current&&e()})}),[e])}let bw=p.createContext(!1);function A5(){return p.useContext(bw)}function C1(n){return rn.createElement(bw.Provider,{value:n.force},n.children)}function N5(n){let e=A5(),t=p.useContext(xw),[i,a]=p.useState(()=>{var l;if(!e&&t!==null)return(l=t.current)!=null?l:null;if(Js.isServer)return null;let u=n?.getElementById("headlessui-portal-root");if(u)return u;if(n===null)return null;let h=n.createElement("div");return h.setAttribute("id","headlessui-portal-root"),n.body.appendChild(h)});return p.useEffect(()=>{i!==null&&(n!=null&&n.body.contains(i)||n==null||n.body.appendChild(i))},[i,n]),p.useEffect(()=>{e||t!==null&&a(t.current)},[t,a,e]),i}let vw=p.Fragment,D5=Gr(function(n,e){let{ownerDocument:t=null,...i}=n,a=p.useRef(null),l=ia(NC(C=>{a.current=C}),e),u=gy(a.current),h=t??u,f=N5(h),g=p.useContext(Og),_=Xf(),S=vs();return yw(()=>{var C;f&&f.childNodes.length<=0&&((C=f.parentElement)==null||C.removeChild(f))}),f?yu.createPortal(rn.createElement("div",{"data-headlessui-portal":"",ref:C=>{_.dispose(),g&&C&&_.add(g.register(C))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:vw,name:"Portal"})),f):null});function M5(n,e){let t=ia(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=vs();return i?rn.createElement(D5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:vw,name:"Portal"})}let j5=p.Fragment,xw=p.createContext(null);function R5(n,e){let{target:t,...i}=n,a={ref:ia(e)},l=vs();return rn.createElement(xw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:j5,name:"Popover.Group"}))}let Og=p.createContext(null);function O5(){let n=p.useContext(Og),e=p.useRef([]),t=xi(l=>(e.current.push(l),n&&n.register(l),()=>i(l))),i=xi(l=>{let u=e.current.indexOf(l);u!==-1&&e.current.splice(u,1),n&&n.unregister(l)}),a=p.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,p.useMemo(()=>function({children:l}){return rn.createElement(Og.Provider,{value:a},l)},[a])]}let L5=Gr(M5),_w=Gr(R5),I5=Object.assign(L5,{Group:_w});function B5(n,e=typeof document<"u"?document.defaultView:null,t){let i=_d(n,"escape");gw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===aw.Escape&&t(a))})}function P5(){var n;let[e]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=p.useState((n=e?.matches)!=null?n:!1);return qr(()=>{if(!e)return;function a(l){i(l.matches)}return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function F5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=xi(()=>{var a,l;let u=vd(t),h=[];for(let f of n)f!==null&&(ko(f)?h.push(f):"current"in f&&ko(f.current)&&h.push(f.current));if(e!=null&&e.current)for(let f of e.current)h.push(f);for(let f of(a=u?.querySelectorAll("html > *, body > *"))!=null?a:[])f!==document.body&&f!==document.head&&ko(f)&&f.id!=="headlessui-portal-root"&&(t&&(f.contains(t)||f.contains((l=t?.getRootNode())==null?void 0:l.host))||h.some(g=>f.contains(g))||h.push(f));return h});return{resolveContainers:i,contains:xi(a=>i().some(l=>l.contains(a)))}}let ww=p.createContext(null);function A1({children:n,node:e}){let[t,i]=p.useState(null),a=Tw(e??t);return rn.createElement(ww.Provider,{value:a},n,a===null&&rn.createElement(Mg,{features:bf.Hidden,ref:l=>{var u,h;if(l){for(let f of(h=(u=vd(l))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?h:[])if(f!==document.body&&f!==document.head&&ko(f)&&f!=null&&f.contains(l)){i(f);break}}}}))}function Tw(n=null){var e;return(e=p.useContext(ww))!=null?e:n}function U5(){let n=typeof document>"u";return"useSyncExternalStore"in l1?(e=>e.useSyncExternalStore)(l1)(()=>()=>{},()=>!1,()=>!n):!1}function Zf(){let n=U5(),[e,t]=p.useState(Js.isHandoffComplete);return e&&Js.isHandoffComplete===!1&&t(!1),p.useEffect(()=>{e!==!0&&t(!0)},[e]),p.useEffect(()=>Js.handoff(),[]),n?!1:e}function by(){let n=p.useRef(!1);return qr(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var Gc=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(Gc||{});function z5(){let n=p.useRef(0);return pw(!0,"keydown",e=>{e.key==="Tab"&&(n.current=e.shiftKey?1:0)},!0),n}function Sw(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let e=new Set;for(let t of n.current)ko(t.current)&&e.add(t.current);return e}let $5="div";var sl=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(sl||{});function H5(n,e){let t=p.useRef(null),i=ia(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;Zf()||(h=0);let g=gy(t.current);K5(h,{ownerDocument:g});let _=W5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});X5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:_});let S=z5(),C=xi(Y=>{if(!pl(t.current))return;let U=t.current;(re=>re())(()=>{Na(S.current,{[Gc.Forwards]:()=>{Zc(U,Sa.First,{skipElements:[Y.relatedTarget,l]})},[Gc.Backwards]:()=>{Zc(U,Sa.Last,{skipElements:[Y.relatedTarget,l]})}})})}),N=_d(!!(h&2),"focus-trap#tab-lock"),O=Xf(),E=p.useRef(!1),B={ref:i,onKeyDown(Y){Y.key=="Tab"&&(E.current=!0,O.requestAnimationFrame(()=>{E.current=!1}))},onBlur(Y){if(!(h&4))return;let U=Sw(u);pl(t.current)&&U.add(t.current);let re=Y.relatedTarget;So(re)&&re.dataset.headlessuiFocusGuard!=="true"&&(kw(U,re)||(E.current?Zc(t.current,Na(S.current,{[Gc.Forwards]:()=>Sa.Next,[Gc.Backwards]:()=>Sa.Previous})|Sa.WrapAround,{relativeTo:Y.target}):So(Y.target)&&Ca(Y.target)))}},H=vs();return rn.createElement(rn.Fragment,null,N&&rn.createElement(Mg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}),H({ourProps:B,theirProps:f,defaultTag:$5,name:"FocusTrap"}),N&&rn.createElement(Mg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}))}let q5=Gr(H5),V5=Object.assign(q5,{features:sl});function G5(n=!0){let e=p.useRef(wo.slice());return yy(([t],[i])=>{i===!0&&t===!1&&Wf(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=wo.slice())},[n,wo,e]),xi(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function K5(n,{ownerDocument:e}){let t=!!(n&8),i=G5(t);yy(()=>{t||pC(e?.body)&&Ca(i())},[t]),yw(()=>{t&&Ca(i())})}function W5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=p.useRef(null),u=_d(!!(n&1),"focus-trap#initial-focus"),h=by();return yy(()=>{if(n===0)return;if(!u){a!=null&&a.current&&Ca(a.current);return}let f=t.current;f&&Wf(()=>{if(!h.current)return;let g=e?.activeElement;if(i!=null&&i.current){if(i?.current===g){l.current=g;return}}else if(f.contains(g)){l.current=g;return}if(i!=null&&i.current)Ca(i.current);else{if(n&16){if(Zc(f,Sa.First|Sa.AutoFocus)!==Rg.Error)return}else if(Zc(f,Sa.First)!==Rg.Error)return;if(a!=null&&a.current&&(Ca(a.current),e?.activeElement===a.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}l.current=e?.activeElement})},[a,u,n]),l}function X5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=by(),u=!!(n&4);gw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=Sw(i);pl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let _=h.target;pl(_)?kw(f,_)?(a.current=_,Ca(_)):(h.preventDefault(),h.stopPropagation(),Ca(g)):Ca(a.current)},!0)}function kw(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function Ew(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Yc((e=n.as)!=null?e:Aw)||rn.Children.count(n.children)===1}let Jf=p.createContext(null);Jf.displayName="TransitionContext";var Y5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(Y5||{});function Q5(){let n=p.useContext(Jf);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function Z5(){let n=p.useContext(e0);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}let e0=p.createContext(null);e0.displayName="NestingContext";function t0(n){return"children"in n?t0(n.children):n.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Cw(n,e){let t=xl(n),i=p.useRef([]),a=by(),l=Xf(),u=xi((N,O=To.Hidden)=>{let E=i.current.findIndex(({el:B})=>B===N);E!==-1&&(Na(O,{[To.Unmount](){i.current.splice(E,1)},[To.Hidden](){i.current[E].state="hidden"}}),l.microTask(()=>{var B;!t0(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=xi(N=>{let O=i.current.find(({el:E})=>E===N);return O?O.state!=="visible"&&(O.state="visible"):i.current.push({el:N,state:"visible"}),()=>u(N,To.Unmount)}),f=p.useRef([]),g=p.useRef(Promise.resolve()),_=p.useRef({enter:[],leave:[]}),S=xi((N,O,E)=>{f.current.splice(0),e&&(e.chains.current[O]=e.chains.current[O].filter(([B])=>B!==N)),e?.chains.current[O].push([N,new Promise(B=>{f.current.push(B)})]),e?.chains.current[O].push([N,new Promise(B=>{Promise.all(_.current[O].map(([H,Y])=>Y)).then(()=>B())})]),O==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>E(O)):E(O)}),C=xi((N,O,E)=>{Promise.all(_.current[O].splice(0).map(([B,H])=>H)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>E(O))});return p.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:C,wait:g,chains:_}),[h,u,i,S,C,_,g])}let Aw=p.Fragment,Nw=yf.RenderStrategy;function J5(n,e){var t,i;let{transition:a=!0,beforeEnter:l,afterEnter:u,beforeLeave:h,afterLeave:f,enter:g,enterFrom:_,enterTo:S,entered:C,leave:N,leaveFrom:O,leaveTo:E,...B}=n,[H,Y]=p.useState(null),U=p.useRef(null),re=Ew(n),W=ia(...re?[U,e,Y]:e===null?[]:[e]),X=(t=B.unmount)==null||t?To.Unmount:To.Hidden,{show:R,appear:le,initial:k}=Q5(),[j,Z]=p.useState(R?"visible":"hidden"),V=Z5(),{register:ne,unregister:me}=V;qr(()=>ne(U),[ne,U]),qr(()=>{if(X===To.Hidden&&U.current){if(R&&j!=="visible"){Z("visible");return}return Na(j,{hidden:()=>me(U),visible:()=>ne(U)})}},[j,U,ne,me,R,X]);let ue=Zf();qr(()=>{if(re&&ue&&j==="visible"&&U.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[U,j,ue,re]);let q=k&&!le,P=le&&R&&k,Q=p.useRef(!1),te=Cw(()=>{Q.current||(Z("hidden"),me(U))},V),ge=xi(Ke=>{Q.current=!0;let we=Ke?"enter":"leave";te.onStart(U,we,Re=>{Re==="enter"?l?.():Re==="leave"&&h?.()})}),L=xi(Ke=>{let we=Ke?"enter":"leave";Q.current=!1,te.onStop(U,we,Re=>{Re==="enter"?u?.():Re==="leave"&&f?.()}),we==="leave"&&!t0(te)&&(Z("hidden"),me(U))});p.useEffect(()=>{re&&a||(ge(R),L(R))},[R,re,a]);let xe=!(!a||!re||!ue||q),[,Te]=x5(xe,H,R,{start:ge,end:L}),ye=nl({ref:W,className:((i=Dg(B.className,P&&g,P&&_,Te.enter&&g,Te.enter&&Te.closed&&_,Te.enter&&!Te.closed&&S,Te.leave&&N,Te.leave&&!Te.closed&&O,Te.leave&&Te.closed&&E,!Te.transition&&R&&C))==null?void 0:i.trim())||void 0,...v5(Te)}),be=0;j==="visible"&&(be|=As.Open),j==="hidden"&&(be|=As.Closed),R&&j==="hidden"&&(be|=As.Opening),!R&&j==="visible"&&(be|=As.Closing);let mt=vs();return rn.createElement(e0.Provider,{value:te},rn.createElement(k5,{value:be},mt({ourProps:ye,theirProps:B,defaultTag:Aw,features:Nw,visible:j==="visible",name:"Transition.Child"})))}function eA(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=p.useRef(null),h=Ew(n),f=ia(...h?[u,e]:e===null?[]:[e]);Zf();let g=Qf();if(t===void 0&&g!==null&&(t=(g&As.Open)===As.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[_,S]=p.useState(t?"visible":"hidden"),C=Cw(()=>{t||S("hidden")}),[N,O]=p.useState(!0),E=p.useRef([t]);qr(()=>{N!==!1&&E.current[E.current.length-1]!==t&&(E.current.push(t),O(!1))},[E,t]);let B=p.useMemo(()=>({show:t,appear:i,initial:N}),[t,i,N]);qr(()=>{t?S("visible"):!t0(C)&&u.current!==null&&S("hidden")},[t,C]);let H={unmount:a},Y=xi(()=>{var W;N&&O(!1),(W=n.beforeEnter)==null||W.call(n)}),U=xi(()=>{var W;N&&O(!1),(W=n.beforeLeave)==null||W.call(n)}),re=vs();return rn.createElement(e0.Provider,{value:C},rn.createElement(Jf.Provider,{value:B},re({ourProps:{...H,as:p.Fragment,children:rn.createElement(Dw,{ref:f,...H,...l,beforeEnter:Y,beforeLeave:U})},theirProps:{},defaultTag:p.Fragment,features:Nw,visible:_==="visible",name:"Transition"})))}function tA(n,e){let t=p.useContext(Jf)!==null,i=Qf()!==null;return rn.createElement(rn.Fragment,null,!t&&i?rn.createElement(Lg,{ref:e,...n}):rn.createElement(Dw,{ref:e,...n}))}let Lg=Gr(eA),Dw=Gr(J5),vy=Gr(tA),Jc=Object.assign(Lg,{Child:vy,Root:Lg});var nA=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(nA||{}),iA=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(iA||{});let rA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},xy=p.createContext(null);xy.displayName="DialogContext";function n0(n){let e=p.useContext(xy);if(e===null){let t=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,n0),t}return e}function sA(n,e){return Na(e.type,rA,n,e)}let N1=Gr(function(n,e){let t=p.useId(),{id:i=`headlessui-dialog-${t}`,open:a,onClose:l,initialFocus:u,role:h="dialog",autoFocus:f=!0,__demoMode:g=!1,unmount:_=!1,...S}=n,C=p.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(C.current||(C.current=!0,console.warn(`Invalid role [${h}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let N=Qf();a===void 0&&N!==null&&(a=(N&As.Open)===As.Open);let O=p.useRef(null),E=ia(O,e),B=gy(O.current),H=a?0:1,[Y,U]=p.useReducer(sA,{titleId:null,descriptionId:null,panelRef:p.createRef()}),re=xi(()=>l(!1)),W=xi(Te=>U({type:0,id:Te})),X=Zf()?H===0:!1,[R,le]=O5(),k={get current(){var Te;return(Te=Y.panelRef.current)!=null?Te:O.current}},j=Tw(),{resolveContainers:Z}=F5({mainTreeNode:j,portals:R,defaultContainers:[k]}),V=N!==null?(N&As.Closing)===As.Closing:!1;YC(g||V?!1:X,{allowed:xi(()=>{var Te,ye;return[(ye=(Te=O.current)==null?void 0:Te.closest("[data-headlessui-portal]"))!=null?ye:null]}),disallowed:xi(()=>{var Te;return[(Te=j?.closest("body > *:not(#headlessui-portal-root)"))!=null?Te:null]})});let ne=dw.get(null);qr(()=>{if(X)return ne.actions.push(i),()=>ne.actions.pop(i)},[ne,i,X]);let me=hw(ne,p.useCallback(Te=>ne.selectors.isTop(Te,i),[ne,i]));l5(me,Z,Te=>{Te.preventDefault(),re()}),B5(me,B?.defaultView,Te=>{Te.preventDefault(),Te.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),re()}),p5(g||V?!1:X,B,Z),QC(X,O,re);let[ue,q]=DC(),P=p.useMemo(()=>[{dialogState:H,close:re,setTitleId:W,unmount:_},Y],[H,re,W,_,Y]),Q=xd({open:H===0}),te={ref:E,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:H===0?!0:void 0,"aria-labelledby":Y.titleId,"aria-describedby":ue,unmount:_},ge=!P5(),L=sl.None;X&&!g&&(L|=sl.RestoreFocus,L|=sl.TabLock,f&&(L|=sl.AutoFocus),ge&&(L|=sl.InitialFocus));let xe=vs();return rn.createElement(E5,null,rn.createElement(C1,{force:!0},rn.createElement(I5,null,rn.createElement(xy.Provider,{value:P},rn.createElement(_w,{target:O},rn.createElement(C1,{force:!1},rn.createElement(q,{slot:Q},rn.createElement(le,null,rn.createElement(V5,{initialFocus:u,initialFocusFallback:O,containers:Z,features:L},rn.createElement(IC,{value:re},xe({ourProps:te,theirProps:S,slot:Q,defaultTag:aA,features:oA,visible:H===0,name:"Dialog"})))))))))))}),aA="div",oA=yf.RenderStrategy|yf.Static;function lA(n,e){let{transition:t=!1,open:i,...a}=n,l=Qf(),u=n.hasOwnProperty("open")||l!==null,h=n.hasOwnProperty("onClose");if(!u&&!h)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!h)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!l&&typeof n.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n.open}`);if(typeof n.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n.onClose}`);return(i!==void 0||t)&&!a.static?rn.createElement(A1,null,rn.createElement(Jc,{show:i,transition:t,unmount:a.unmount},rn.createElement(N1,{ref:e,...a}))):rn.createElement(A1,null,rn.createElement(N1,{ref:e,open:i,...a}))}let uA="div";function cA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=n0("Dialog.Panel"),g=ia(e,f.panelRef),_=xd({open:u===0}),S=xi(B=>{B.stopPropagation()}),C={ref:g,id:i,onClick:S},N=a?vy:p.Fragment,O=a?{unmount:h}:{},E=vs();return rn.createElement(N,{...O},E({ourProps:C,theirProps:l,slot:_,defaultTag:uA,name:"Dialog.Panel"}))}let dA="div";function hA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=n0("Dialog.Backdrop"),u=xd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?vy:p.Fragment,g=t?{unmount:l}:{},_=vs();return rn.createElement(f,{...g},_({ourProps:h,theirProps:i,slot:u,defaultTag:dA,name:"Dialog.Backdrop"}))}let fA="h2";function mA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=n0("Dialog.Title"),h=ia(e);p.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=xd({open:l===0}),g={ref:h,id:i};return vs()({ourProps:g,theirProps:a,slot:f,defaultTag:fA,name:"Dialog.Title"})}let pA=Gr(lA),gA=Gr(cA);Gr(hA);let yA=Gr(mA),au=Object.assign(pA,{Panel:gA,Title:yA,Description:OC});function bA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=p.useState(""),[u,h]=p.useState(""),[f,g]=p.useState([]),_=p.useRef(!1);p.useEffect(()=>{n&&!_.current&&(l(""),h(""),g(i??[])),_.current=n},[n,i]);function S(){const O=a.trim(),E=u.trim();!O||!E||(g(B=>[...B.filter(Y=>Y.name!==O),{name:O,value:E}]),l(""),h(""))}function C(O){g(E=>E.filter(B=>B.name!==O))}function N(){t(f),e()}return c.jsxs(au,{open:n,onClose:e,className:"relative z-50",children:[c.jsx("div",{className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),c.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:c.jsxs(au.Panel,{className:"w-full max-w-lg rounded-lg bg-white dark:bg-gray-800 p-6 shadow-xl dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[c.jsx(au.Title,{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Zusätzliche Cookies"}),c.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[c.jsx("input",{value:a,onChange:O=>l(O.target.value),placeholder:"Name (z. B. cf_clearance)",className:"col-span-1 truncate rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),c.jsx("input",{value:u,onChange:O=>h(O.target.value),placeholder:"Wert",className:"col-span-1 truncate sm:col-span-2 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"})]}),c.jsx("div",{className:"mt-2",children:c.jsx(sn,{size:"sm",variant:"secondary",onClick:S,disabled:!a.trim()||!u.trim(),children:"Hinzufügen"})}),c.jsx("div",{className:"mt-4",children:f.length===0?c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Noch keine Cookies hinzugefügt."}):c.jsxs("table",{className:"min-w-full text-sm border divide-y dark:divide-white/10",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Name"}),c.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Wert"}),c.jsx("th",{className:"px-3 py-2"})]})}),c.jsx("tbody",{className:"divide-y dark:divide-white/10",children:f.map(O=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:O.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:O.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>C(O.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},O.name))})]})}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx(sn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(sn,{variant:"primary",onClick:N,children:"Übernehmen"})]})]})})]})}function vA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const xA=p.forwardRef(vA);function Ig({tabs:n,value:e,onChange:t,className:i,ariaLabel:a="Ansicht auswählen",variant:l="underline",hideCountUntilMd:u=!1}){if(!n?.length)return null;const h=n.find(C=>C.id===e)??n[0],f=on("col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800 dark:focus:outline-indigo-500",l==="pillsBrand"?"dark:bg-gray-800/50":"dark:bg-white/5"),g=C=>on(C?"bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400":"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300",u?"ml-3 hidden rounded-full px-2.5 py-0.5 text-xs font-medium md:inline-block":"ml-3 rounded-full px-2.5 py-0.5 text-xs font-medium"),_=(C,N)=>N.count===void 0?null:c.jsx("span",{className:g(C),children:N.count}),S=()=>{switch(l){case"underline":case"underlineIcons":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex space-x-8",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-200",l==="underlineIcons"?"group inline-flex items-center border-b-2 px-1 py-4 text-sm font-medium":"flex items-center border-b-2 px-1 py-4 text-sm font-medium whitespace-nowrap",O&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[l==="underlineIcons"&&C.icon?c.jsx(C.icon,{"aria-hidden":"true",className:on(N?"text-indigo-500 dark:text-indigo-400":"text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-400","mr-2 -ml-0.5 size-5")}):null,c.jsx("span",{children:C.label}),_(N,C)]},C.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const C=l==="pills"?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-gray-200":l==="pillsGray"?"bg-gray-200 text-gray-800 dark:bg-white/10 dark:text-white":"bg-indigo-100 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300",N=l==="pills"?"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200":l==="pillsGray"?"text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200";return c.jsx("nav",{"aria-label":a,className:"flex space-x-4",children:n.map(O=>{const E=O.id===h.id,B=!!O.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(O.id),disabled:B,"aria-current":E?"page":void 0,className:on(E?C:N,"inline-flex items-center rounded-md px-3 py-2 text-sm font-medium",B&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:[c.jsx("span",{children:O.label}),O.count!==void 0?c.jsx("span",{className:on(E?"ml-2 bg-white/70 text-gray-900 dark:bg-white/10 dark:text-white":"ml-2 bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300","rounded-full px-2 py-0.5 text-xs font-medium"),children:O.count}):null]},O.id)})})}case"fullWidthUnderline":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsx("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300","flex-1 border-b-2 px-1 py-4 text-center text-sm font-medium",O&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:C.label},C.id)})})});case"barUnderline":return c.jsx("nav",{"aria-label":a,className:"isolate flex divide-x divide-gray-200 rounded-lg bg-white shadow-sm dark:divide-white/10 dark:bg-gray-800/50 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",children:n.map((C,N)=>{const O=C.id===h.id,E=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!E&&t(C.id),disabled:E,"aria-current":O?"page":void 0,className:on(O?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",N===0?"rounded-l-lg":"",N===n.length-1?"rounded-r-lg":"","group relative min-w-0 flex-1 overflow-hidden px-4 py-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10 dark:hover:bg-white/5",E&&"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center justify-center",children:[c.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",title:C.label,children:C.label}),C.count!==void 0?c.jsx("span",{className:"ml-2 shrink-0 tabular-nums min-w-[2.25rem] rounded-full bg-white/70 px-2 py-0.5 text-center text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-white",children:C.count}):null]}),c.jsx("span",{"aria-hidden":"true",className:on(O?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},C.id)})});case"simple":return c.jsx("nav",{className:"flex border-b border-gray-200 py-4 dark:border-white/10","aria-label":a,children:c.jsx("ul",{role:"list",className:"flex min-w-full flex-none gap-x-8 px-2 text-sm/6 font-semibold text-gray-500 dark:text-gray-400",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",O&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:C.label})},C.id)})})});default:return null}};return c.jsxs("div",{className:i,children:[c.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[c.jsx("select",{value:h.id,onChange:C=>t(C.target.value),"aria-label":a,className:f,children:n.map(C=>c.jsx("option",{value:C.id,children:C.label},C.id))}),c.jsx(xA,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),c.jsx("div",{className:"hidden sm:block",children:S()})]})}function Ns({header:n,footer:e,grayBody:t=!1,grayFooter:i=!1,edgeToEdgeMobile:a=!1,well:l=!1,noBodyPadding:u=!1,className:h,bodyClassName:f,children:g}){const _=l;return c.jsxs("div",{className:on("overflow-hidden",a?"sm:rounded-lg":"rounded-lg",_?"bg-gray-50 dark:bg-gray-800 shadow-none":"bg-white shadow-sm dark:bg-gray-800 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",h),children:[n&&c.jsx("div",{className:"shrink-0 px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-white/10",children:n}),c.jsx("div",{className:on("min-h-0",u?"p-0":"px-4 py-5 sm:p-6",t&&"bg-gray-50 dark:bg-gray-800",f),children:g}),e&&c.jsx("div",{className:on("shrink-0 px-4 py-4 sm:px-6",i&&"bg-gray-50 dark:bg-gray-800/50","border-t border-gray-200 dark:border-white/10"),children:e})]})}function Bg({checked:n,onChange:e,id:t,name:i,disabled:a,required:l,ariaLabel:u,ariaLabelledby:h,ariaDescribedby:f,size:g="default",variant:_="simple",className:S}){const C=O=>{a||e(O.target.checked)},N=on("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:on("group relative inline-flex h-5 w-10 shrink-0 items-center justify-center rounded-full outline-offset-2 outline-indigo-600 has-focus-visible:outline-2 dark:outline-indigo-500",a&&"opacity-60",S),children:[c.jsx("span",{className:on("absolute mx-auto h-4 w-9 rounded-full bg-gray-200 inset-ring inset-ring-gray-900/5 transition-colors duration-200 ease-in-out dark:bg-gray-800/50 dark:inset-ring-white/10",n&&"bg-indigo-600 dark:bg-indigo-500")}),c.jsx("span",{className:on("absolute left-0 size-5 rounded-full border border-gray-300 bg-white shadow-xs transition-transform duration-200 ease-in-out dark:shadow-none",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:N})]}):c.jsxs("div",{className:on("group relative inline-flex w-11 shrink-0 rounded-full bg-gray-200 p-0.5 inset-ring inset-ring-gray-900/5 outline-offset-2 outline-indigo-600 transition-colors duration-200 ease-in-out has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-indigo-500",n&&"bg-indigo-600 dark:bg-indigo-500",a&&"opacity-60",S),children:[_==="icon"?c.jsxs("span",{className:on("relative size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",n&&"translate-x-5"),children:[c.jsx("span",{"aria-hidden":"true",className:on("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-in",n?"opacity-0 duration-100":"opacity-100 duration-200"),children:c.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-gray-600",children:c.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}),c.jsx("span",{"aria-hidden":"true",className:on("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-out",n?"opacity-100 duration-200":"opacity-0 duration-100"),children:c.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-500",children:c.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})]}):c.jsx("span",{className:on("size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:N})]})}function wa({label:n,description:e,labelPosition:t="left",id:i,className:a,...l}){const u=p.useId(),h=i??`sw-${u}`,f=`${h}-label`,g=`${h}-desc`;return t==="right"?c.jsxs("div",{className:on("flex items-center justify-between gap-3",a),children:[c.jsx(Bg,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0}),c.jsxs("div",{className:"text-sm",children:[c.jsx("label",{id:f,htmlFor:h,className:"font-medium text-gray-900 dark:text-white",children:n})," ",e?c.jsx("span",{id:g,className:"text-gray-500 dark:text-gray-400",children:e}):null]})]}):c.jsxs("div",{className:on("flex items-center justify-between",a),children:[c.jsxs("span",{className:"flex grow flex-col",children:[c.jsx("label",{id:f,htmlFor:h,className:"text-sm/6 font-medium text-gray-900 dark:text-white",children:n}),e?c.jsx("span",{id:g,className:"text-sm text-gray-500 dark:text-gray-400",children:e}):null]}),c.jsx(Bg,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const bu=new Map;let D1=!1;function _A(){D1||(D1=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const n of bu.values())n.es&&(n.es.close(),n.es=null,n.dispatchers.clear());else for(const n of bu.values())n.refs>0&&!n.es&&Mw(n)}))}function Mw(n){if(!n.es&&!document.hidden){n.es=new EventSource(n.url);for(const[e,t]of n.listeners.entries()){const i=a=>{let l=null;try{l=JSON.parse(String(a.data??"null"))}catch{return}for(const u of t)u(l)};n.dispatchers.set(e,i),n.es.addEventListener(e,i)}n.es.onerror=()=>{}}}function wA(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function TA(n){let e=bu.get(n);return e||(e={url:n,es:null,refs:0,listeners:new Map,dispatchers:new Map},bu.set(n,e)),e}function ud(n,e,t){_A();const i=TA(n);let a=i.listeners.get(e);if(a||(a=new Set,i.listeners.set(e,a)),a.add(t),i.refs+=1,i.es){if(!i.dispatchers.has(e)){const l=u=>{let h=null;try{h=JSON.parse(String(u.data??"null"))}catch{return}for(const f of i.listeners.get(e)??[])f(h)};i.dispatchers.set(e,l),i.es.addEventListener(e,l)}}else Mw(i);return()=>{const l=bu.get(n);if(!l)return;const u=l.listeners.get(e);u&&(u.delete(t),u.size===0&&l.listeners.delete(e)),l.refs=Math.max(0,l.refs-1),l.refs===0&&(wA(l),bu.delete(n))}}async function SA(n,e){const t=await fetch(n,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const a=i&&(i.error||i.message)||t.statusText;throw new Error(a)}return i}const kA="/api/stream",EA="state";function M1({startUrl:n,stopUrl:e,onTrigger:t,title:i="Task",description:a="Startet eine Hintergrundaufgabe. Fortschritt & Abbrechen oben in der Taskliste.",startLabel:l="Start",startingLabel:u="Starte…",disabled:h=!1,busy:f=!1,onFinished:g,onStart:_,onProgress:S,onDone:C,onCancelled:N,onError:O}){const[E,B]=p.useState(null),[H,Y]=p.useState(!1),[U,re]=p.useState(null),W=p.useRef(null),X=p.useRef(!1),R=p.useRef(!1),le=p.useRef(!1),k=p.useRef(!1),j=p.useRef(""),Z=p.useRef(S),V=p.useRef(O);p.useEffect(()=>{Z.current=S},[S]),p.useEffect(()=>{V.current=O},[O]);async function ne(){if(e&&!le.current){le.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{le.current=!1}}}function me(){if(W.current)return W.current;const Q=new AbortController;W.current=Q;const te=()=>{R.current=!0,ne()};return Q.signal.addEventListener("abort",te,{once:!0}),Q}function ue(Q){X.current||(X.current=!0,_?.(Q))}p.useEffect(()=>{const Q=k.current,te=!!E?.running;if(k.current=te,Q&&!te){const ge=String(E?.error??"").trim();W.current=null,X.current=!1,R.current||ge==="abgebrochen"?(R.current=!1,N?.()):ge||C?.(),g?.()}},[E?.running,E?.error,g,C,N]),p.useEffect(()=>{if(t||!n)return;const Q=ud(kA,EA,te=>{if(B(te),te?.running){const L=me();ue(L),Z.current?.({done:te?.done??0,total:te?.total??0,currentFile:te?.currentFile??""})}const ge=String(te?.error??"").trim();ge&&ge!=="abgebrochen"&&ge!==j.current&&(j.current=ge,V.current?.(ge))});return()=>Q()},[n,t]);async function q(){if(f||E?.running)return;if(re(null),Y(!0),R.current=!1,j.current="",t){try{await t()}catch(te){const ge=te?.message??String(te);re(ge),O?.(ge)}finally{Y(!1)}return}if(!n){const te="Task ist nicht konfiguriert (startUrl fehlt).";re(te),O?.(te),Y(!1);return}const Q=me();try{const te=await SA(n,{method:"POST"});B(te),ue(Q),te?.running&&S?.({done:te?.done??0,total:te?.total??0,currentFile:te?.currentFile??""})}catch(te){W.current=null,X.current=!1;const ge=te?.message??String(te);re(ge),O?.(ge)}finally{Y(!1)}}const P=!!E?.running;return c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:i}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:a}),U?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:U}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(sn,{variant:"primary",onClick:q,disabled:h||f||H||P,children:H||f?u:l})})]})}function CA(n,e){const t=Number(n??0),i=Number(e??0);return!i||i<=0?0:Math.max(0,Math.min(100,Math.round(t/i*100)))}function AA({tasks:n,onCancel:e}){const t=(n||[]).filter(i=>i.status!=="idle");return c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsx("div",{className:"flex items-start justify-between gap-3",children:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Hintergrundaufgaben"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Laufende Hintergrundaufgaben (z.B. Assets/Previews)."})]})}),c.jsxs("div",{className:"mt-3 space-y-3",children:[t.length===0?c.jsx("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-600 dark:border-white/10 dark:bg-white/5 dark:text-gray-300",children:"Keine laufenden Aufgaben."}):null,t.map(i=>{const a=CA(i.done,i.total),l=i.status==="running",u=l&&(i.total??0)>0,h=(i.title??"").trim(),f=(i.text??"").trim();return c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 dark:border-white/10 dark:bg-white/5 transition-opacity duration-500 "+(i.fading?"opacity-0":"opacity-100"),children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"shrink-0",children:l&&i.cancellable&&e?c.jsx("button",{type:"button",onClick:()=>e?.(i.id),className:`inline-flex h-7 w-7 items-center justify-center rounded-md\r
text-red-700 hover:bg-red-50 hover:text-red-900\r
dark:text-red-300 dark:hover:bg-red-500/10 dark:hover:text-red-200`,title:"Abbrechen","aria-label":"Task abbrechen",children:"✕"}):i.status==="done"?c.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-green-700 dark:text-green-300",title:"Fertig","aria-label":"Fertig",children:"✓"}):c.jsx("span",{className:"inline-block h-7 w-7"})}),c.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[c.jsxs("div",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",children:[h||"Aufgabe",f?c.jsxs("span",{className:"font-normal text-gray-600 dark:text-gray-300",children:[" · ",f]}):null]}),i.status==="done"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-[11px] font-semibold text-green-800 ring-1 ring-inset ring-green-200 dark:bg-green-500/20 dark:text-green-200 dark:ring-green-400/30",children:"fertig"}):i.status==="cancelled"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10",children:"abgebrochen"}):i.status==="error"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-[11px] font-semibold text-red-800 ring-1 ring-inset ring-red-200 dark:bg-red-500/20 dark:text-red-200 dark:ring-red-400/30",children:"fehler"}):null,c.jsx("div",{className:"flex-1"}),u?c.jsxs("div",{className:"shrink-0 flex items-center gap-3 text-xs text-gray-600 dark:text-gray-300",children:[c.jsxs("span",{className:"tabular-nums",children:[i.done??0,"/",i.total??0]}),c.jsxs("span",{className:"tabular-nums",children:[a,"%"]}),c.jsx("div",{className:"hidden sm:block h-2 w-40 overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:c.jsx("div",{className:"h-full bg-indigo-500",style:{width:`${a}%`}})})]}):null]})]}),i.status==="error"&&i.err?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:i.err}):null]},i.id)})]})]})}function NA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}const DA=p.forwardRef(NA);function MA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const j1=p.forwardRef(MA);function jA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const RA=p.forwardRef(jA);function OA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"}))}const Kh=p.forwardRef(OA);function LA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))}const IA=p.forwardRef(LA);function BA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))}const PA=p.forwardRef(BA);function FA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0 1 20.25 6v12A2.25 2.25 0 0 1 18 20.25H6A2.25 2.25 0 0 1 3.75 18V6A2.25 2.25 0 0 1 6 3.75h1.5m9 0h-9"}))}const R1=p.forwardRef(FA);function UA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"}))}const Ep=p.forwardRef(UA);function zA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const $A=p.forwardRef(zA);function HA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const qA=p.forwardRef(HA);function VA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"}))}const GA=p.forwardRef(VA);function KA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const WA=p.forwardRef(KA);function XA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const xf=p.forwardRef(XA);function YA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z"}))}const O1=p.forwardRef(YA);function QA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const ed=p.forwardRef(QA);function ZA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Zm6-10.125a1.875 1.875 0 1 1-3.75 0 1.875 1.875 0 0 1 3.75 0Zm1.294 6.336a6.721 6.721 0 0 1-3.17.789 6.721 6.721 0 0 1-3.168-.789 3.376 3.376 0 0 1 6.338 0Z"}))}const JA=p.forwardRef(ZA);function eN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const tN=p.forwardRef(eN);function nN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"}))}const iN=p.forwardRef(nN);function rN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))}const sN=p.forwardRef(rN);function aN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const L1=p.forwardRef(aN);function oN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const lN=p.forwardRef(oN);function uN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const cN=p.forwardRef(uN);function dN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"}))}const hN=p.forwardRef(dN);function fN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const Cp=p.forwardRef(fN);function mN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const pN=p.forwardRef(mN);function gN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const _f=p.forwardRef(gN);function yN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"}))}const bN=p.forwardRef(yN);function vN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const I1=p.forwardRef(vN);function xN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}const B1=p.forwardRef(xN);function _N({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const wN=p.forwardRef(_N);function TN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const wf=p.forwardRef(TN);function pr(...n){return n.filter(Boolean).join(" ")}function Tf({open:n,onClose:e,title:t,children:i,footer:a,icon:l,width:u="max-w-lg",layout:h="single",left:f,leftWidthClass:g="lg:w-80",scroll:_,bodyClassName:S,leftClassName:C,rightClassName:N,rightHeader:O,rightBodyClassName:E,mobileCollapsedImageSrc:B,mobileCollapsedImageAlt:H}){const Y=_??(h==="split"?"right":"body"),U=p.useRef(null),[re,W]=p.useState(!1);return p.useEffect(()=>{if(!n)return;const X=document.documentElement,R=document.body,le=X.style.overflow,k=R.style.overflow,j=R.style.paddingRight,Z=window.innerWidth-X.clientWidth;return X.style.overflow="hidden",R.style.overflow="hidden",Z>0&&(R.style.paddingRight=`${Z}px`),()=>{X.style.overflow=le,R.style.overflow=k,R.style.paddingRight=j}},[n]),p.useEffect(()=>{n&&W(!1)},[n]),p.useEffect(()=>{if(!n)return;const X=U.current;if(!X)return;const R=72,le=()=>{const k=X.scrollTop||0;W(j=>{const Z=k>R;return j===Z?j:Z})};return le(),X.addEventListener("scroll",le,{passive:!0}),()=>X.removeEventListener("scroll",le)},[n]),c.jsx(Jc,{show:n,as:p.Fragment,children:c.jsxs(au,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(Jc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:c.jsx("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/50"})}),c.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden px-4 py-6 sm:px-6",children:c.jsx("div",{className:"min-h-full flex items-start justify-center sm:items-center",children:c.jsx(Jc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:c.jsxs(au.Panel,{className:pr("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",u),children:[l?c.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:l}):null,c.jsxs("div",{className:pr("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",h==="split"?"hidden lg:flex":"flex"),children:[c.jsx("div",{className:"min-w-0",children:t?c.jsx(au.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]}),h==="single"?c.jsx("div",{className:pr("flex-1 min-h-0 h-full",Y==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",N),children:i}):c.jsxs("div",{className:pr("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",S),children:[c.jsxs("div",{ref:U,className:pr("lg:hidden flex-1 min-h-0 relative",Y==="right"||Y==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:pr("sticky top-0 z-50","bg-white/95 backdrop-blur dark:bg-gray-800/95","border-b border-gray-200/70 dark:border-white/10"),children:[c.jsxs("div",{className:pr("flex items-center justify-between gap-3 px-3",re?"py-2":"py-3"),children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[B?c.jsx("img",{src:B,alt:H||t||"",className:pr("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",re?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0",children:t?c.jsx("div",{className:pr("truncate font-semibold text-gray-900 dark:text-white",re?"text-sm":"text-base"),children:t}):null})]}),c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]}),O?c.jsx("div",{children:O}):null]}),f?c.jsx("div",{className:pr("lg:hidden px-2 pb-2",C),children:f}):null,c.jsx("div",{className:pr("px-2 pt-0 min-h-0",N),children:c.jsx("div",{className:pr("min-h-0",E),children:i})})]}),c.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[c.jsx("div",{className:pr("min-h-0",g,"shrink-0","overflow-hidden",C),children:f}),c.jsxs("div",{className:pr("flex-1 min-h-0 flex flex-col",N),children:[O?c.jsx("div",{className:"shrink-0",children:O}):null,c.jsx("div",{className:pr("flex-1 min-h-0",Y==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",E),children:i})]})]})]}),a?c.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:a}):null]})})})})]})})}function jw(n,e){const t=Number(n);return Number.isFinite(t)&&t>0?Math.floor(t):e}function SN(n){const e=(n.user||"").trim()||"postgres",t=(n.host||"").trim()||"127.0.0.1",i=jw(n.port,5432),a=(n.db||"").trim()||"postgres",l=(n.sslmode||"").trim()||"disable";return`postgres://${encodeURIComponent(e)}@${t}:${i}/${encodeURIComponent(a)}?sslmode=${encodeURIComponent(l)}`}function kN({open:n,onClose:e,initialUrl:t,initialHasPassword:i,onApply:a}){const[l,u]=p.useState("127.0.0.1"),[h,f]=p.useState(5432),[g,_]=p.useState("nsfwapp"),[S,C]=p.useState("postgres"),[N,O]=p.useState(""),[E,B]=p.useState("disable"),H=p.useMemo(()=>SN({user:S,host:l,port:h,db:g,sslmode:E}),[S,l,h,g,E]),Y=c.jsxs(c.Fragment,{children:[c.jsx(sn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(sn,{variant:"primary",onClick:()=>{a({databaseUrl:H,dbPassword:N}),e()},children:"Übernehmen"})]});return c.jsx(Tf,{open:n,onClose:e,title:"Postgres URL erstellen",width:"max-w-2xl",footer:Y,children:c.jsxs("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6 space-y-4",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Passwort wird ",c.jsx("span",{className:"font-semibold",children:"verschlüsselt"})," gespeichert (nicht in der URL).",t?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"mt-1",children:["Aktuelle URL: ",c.jsx("code",{className:"break-all",children:t})]})}):null,i?c.jsx("div",{className:"mt-1",children:"Passwort: ✅ gespeichert"}):null]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Host"}),c.jsx("input",{value:l,onChange:U=>u(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"127.0.0.1"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Port"}),c.jsx("input",{type:"number",min:1,max:65535,value:h,onChange:U=>f(jw(U.target.value,5432)),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Datenbank"}),c.jsx("input",{value:g,onChange:U=>_(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"nsfwapp"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"User"}),c.jsx("input",{value:S,onChange:U=>C(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"postgres"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Passwort"}),c.jsx("input",{value:N,onChange:U=>O(U.target.value),type:"password",className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"••••••••"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"SSL"}),c.jsxs("select",{value:E,onChange:U=>B(U.target.value),className:`sm:col-span-9 h-10 rounded-lg px-3 text-sm bg-white text-gray-900 ring-1 ring-gray-200 shadow-sm\r
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"disable",children:"disable"}),c.jsx("option",{value:"require",children:"require"}),c.jsx("option",{value:"verify-full",children:"verify-full"})]})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 text-xs text-gray-700 dark:border-white/10 dark:bg-white/5 dark:text-gray-200",children:[c.jsx("div",{className:"font-semibold mb-1",children:"Vorschau"}),c.jsx("code",{className:"break-all",children:H})]})]})})}function EN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.74a.75.75 0 0 1 1.04-.207Z",clipRule:"evenodd"}))}const Rw=p.forwardRef(EN);function CN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),p.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const gl=p.forwardRef(CN);function AN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.176 7.547 7.547 0 0 1-1.705-1.715.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.546 3.75 3.75 0 0 1 3.255 3.718Z",clipRule:"evenodd"}))}const Pg=p.forwardRef(AN);function NN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"}))}const DN=p.forwardRef(NN);function MN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z"}))}const yl=p.forwardRef(MN);function jN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z",clipRule:"evenodd"}))}const RN=p.forwardRef(jN);function ON({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.427 1.529-2.33 2.779-1.643l11.54 6.347c1.295.712 1.295 2.573 0 3.286L7.28 19.99c-1.25.687-2.779-.217-2.779-1.643V5.653Z",clipRule:"evenodd"}))}const LN=p.forwardRef(ON);function IN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.636 4.575a.75.75 0 0 1 0 1.061 9 9 0 0 0 0 12.728.75.75 0 1 1-1.06 1.06c-4.101-4.1-4.101-10.748 0-14.849a.75.75 0 0 1 1.06 0Zm12.728 0a.75.75 0 0 1 1.06 0c4.101 4.1 4.101 10.75 0 14.85a.75.75 0 1 1-1.06-1.061 9 9 0 0 0 0-12.728.75.75 0 0 1 0-1.06ZM7.757 6.697a.75.75 0 0 1 0 1.06 6 6 0 0 0 0 8.486.75.75 0 0 1-1.06 1.06 7.5 7.5 0 0 1 0-10.606.75.75 0 0 1 1.06 0Zm8.486 0a.75.75 0 0 1 1.06 0 7.5 7.5 0 0 1 0 10.606.75.75 0 0 1-1.06-1.06 6 6 0 0 0 0-8.486.75.75 0 0 1 0-1.06ZM9.879 8.818a.75.75 0 0 1 0 1.06 3 3 0 0 0 0 4.243.75.75 0 1 1-1.061 1.061 4.5 4.5 0 0 1 0-6.364.75.75 0 0 1 1.06 0Zm4.242 0a.75.75 0 0 1 1.061 0 4.5 4.5 0 0 1 0 6.364.75.75 0 0 1-1.06-1.06 3 3 0 0 0 0-4.243.75.75 0 0 1 0-1.061ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))}const BN=p.forwardRef(IN);function PN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}const vu=p.forwardRef(PN);function FN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const UN=p.forwardRef(FN),Wi={databaseUrl:"",hasDbPassword:!1,recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!0,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!0,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:5,enableNotifications:!0};function zN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function $N({onAssetsGenerated:n}){const[e,t]=p.useState(Wi),[i,a]=p.useState(!1),[l,u]=p.useState(0),h=p.useRef(null),[f,g]=p.useState(!1),[_,S]=p.useState(null),[C,N]=p.useState(null),[O,E]=p.useState(null),[B,H]=p.useState(null),Y=p.useRef(null),[U,re]=p.useState(!1),[W,X]=p.useState(""),R=Date.now(),le=l>R,j=i?"saving":le?"success":!!O&&!i&&!le?"error":"idle",Z=j==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:j==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(Rw,{className:"size-4"}),isLoading:!1}:j==="error"?{text:"Fehler",color:"red",icon:c.jsx(UN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[V,ne]=p.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[me,ue]=p.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),q=Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB??5),P=B?.pauseGB??q,Q=B?.resumeGB??q+3;p.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),p.useEffect(()=>{let ye=!0;return fetch("/api/settings",{cache:"no-store"}).then(async be=>{if(!be.ok)throw new Error(await be.text());return be.json()}).then(be=>{ye&&t({databaseUrl:String(be.databaseUrl??""),hasDbPassword:!!(be.hasDbPassword??!1),recordDir:(be.recordDir||Wi.recordDir).toString(),doneDir:(be.doneDir||Wi.doneDir).toString(),ffmpegPath:String(be.ffmpegPath??Wi.ffmpegPath??""),autoAddToDownloadList:be.autoAddToDownloadList??Wi.autoAddToDownloadList,autoStartAddedDownloads:be.autoStartAddedDownloads??Wi.autoStartAddedDownloads,useChaturbateApi:be.useChaturbateApi??Wi.useChaturbateApi,useMyFreeCamsWatcher:be.useMyFreeCamsWatcher??Wi.useMyFreeCamsWatcher,autoDeleteSmallDownloads:be.autoDeleteSmallDownloads??Wi.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:be.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB,blurPreviews:be.blurPreviews??Wi.blurPreviews,teaserPlayback:be.teaserPlayback??Wi.teaserPlayback,teaserAudio:be.teaserAudio??Wi.teaserAudio,lowDiskPauseBelowGB:be.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB,enableNotifications:be.enableNotifications??Wi.enableNotifications})}).catch(()=>{}),()=>{ye=!1}},[]),p.useEffect(()=>{let ye=!0;const be=async()=>{try{const Ke=await fetch("/api/status/disk",{cache:"no-store"});if(!Ke.ok)return;const we=await Ke.json();ye&&H(we)}catch{}};be();const mt=window.setInterval(be,5e3);return()=>{ye=!1,window.clearInterval(mt)}},[]);async function te(ye){E(null),N(null),S(ye);try{window.focus();const be=await fetch(`/api/settings/browse?target=${ye}`,{cache:"no-store"});if(be.status===204)return;if(!be.ok){const we=await be.text().catch(()=>"");throw new Error(we||`HTTP ${be.status}`)}const Ke=((await be.json()).path??"").trim();if(!Ke)return;t(we=>ye==="record"?{...we,recordDir:Ke}:ye==="done"?{...we,doneDir:Ke}:{...we,ffmpegPath:Ke})}catch(be){E(be?.message??String(be))}finally{S(null)}}async function ge(){E(null),N(null);const ye=e.recordDir.trim(),be=e.doneDir.trim(),mt=(e.ffmpegPath??"").trim(),Ke=String(e.databaseUrl??"").trim();if(!ye||!be){E("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const we=!!e.autoAddToDownloadList,Re=we?!!e.autoStartAddedDownloads:!1,ct=!!e.useChaturbateApi,Oe=!!e.useMyFreeCamsWatcher,je=!!e.autoDeleteSmallDownloads,Ue=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB)))),ze=!!e.blurPreviews,gt=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:Wi.teaserPlayback,st=!!e.teaserAudio,bt=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB))),Qe=!!e.enableNotifications;a(!0);try{const Ye=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:Ke,dbPassword:W||void 0,recordDir:ye,doneDir:be,ffmpegPath:mt,autoAddToDownloadList:we,autoStartAddedDownloads:Re,useChaturbateApi:ct,useMyFreeCamsWatcher:Oe,autoDeleteSmallDownloads:je,autoDeleteSmallDownloadsBelowMB:Ue,blurPreviews:ze,teaserPlayback:gt,teaserAudio:st,lowDiskPauseBelowGB:bt,enableNotifications:Qe})});if(!Ye.ok){const $e=await Ye.text().catch(()=>"");throw new Error($e||`HTTP ${Ye.status}`)}N("✅ Gespeichert.");const tt=Date.now()+2500;u(tt),h.current!=null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{u(0),h.current=null},2500),window.dispatchEvent(new CustomEvent("recorder-settings-updated"))}catch(Ye){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),E(Ye?.message??String(Ye))}finally{a(!1)}}function L(ye,be=3500,mt=500){window.setTimeout(()=>{ye(Ke=>({...Ke,fading:!0})),window.setTimeout(()=>{ye(Ke=>({...Ke,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},mt)},be)}async function xe(){E(null),N(null);const ye=Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB??0),be=(e.doneDir||Wi.doneDir).trim();if(!be){E("doneDir ist leer.");return}if(!ye||ye<=0){E("Mindestgröße ist 0 es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen:
• Löscht Dateien in "${be}" < ${ye} MB (Ordner "keep" wird übersprungen)
• Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei
Fortfahren?`)){g(!0),ue(Ke=>({...Ke,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const Ke=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!Ke.ok){const Ue=await Ke.text().catch(()=>"");throw new Error(Ue||`HTTP ${Ke.status}`)}const we=await Ke.json(),Re=Number(we.scannedFiles??0),ct=Number(we.orphanIdsRemoved??0),Oe=Number(we.generatedOrphansRemoved??0),je=ct+Oe;ue(Ue=>({...Ue,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Re} · Orphans: ${je}`})),L(ue)}catch(Ke){const we=Ke?.message??String(Ke);E(we),ue(Re=>({...Re,status:"error",text:"Fehler beim Aufräumen.",err:we})),L(ue)}finally{g(!1)}}}async function Te(){const ye=Y.current;if(Y.current=null,ne(be=>({...be,status:"cancelled",text:"Abgebrochen."})),ye){ye.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return c.jsx(Ns,{header:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Einstellungen"}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Recorder-Konfiguration, Automatisierung und Tasks."})]}),c.jsxs("div",{className:"flex items-start gap-2",children:[j!=="success"?c.jsx("div",{className:"hidden sm:flex min-w-0 max-w-[520px] items-stretch",children:O?c.jsx("div",{className:`\r
inline-flex items-center\r
px-3 py-[7px] text-sm\r
rounded-md border border-red-200 bg-red-50 text-red-700\r
dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200\r
`,children:O}):C?c.jsx("div",{className:`\r
inline-flex items-center\r
px-3 py-[7px] text-sm\r
rounded-md border border-green-200 bg-green-50 text-green-700\r
dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200\r
`,children:C}):null}):null,c.jsx(sn,{variant:"primary",color:Z.color,onClick:ge,disabled:i,className:"shrink-0",size:"md",isLoading:Z.isLoading,leadingIcon:Z.icon,children:Z.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(AA,{tasks:[V,me],onCancel:ye=>{ye==="generate-assets"&&Te()}}),j!=="success"?c.jsxs("div",{className:"sm:hidden",children:[O&&c.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:O}),C&&c.jsx("div",{className:"rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200",children:C})]}):null,c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsx("div",{className:"flex items-start justify-between gap-4",children:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Aufgaben"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Hintergrundaufgaben wie z.B. Asset/Preview-Generierung."})]})}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(M1,{title:"Assets-Generator",description:"Erzeugt fehlende Assets (thumb/preview/meta). Fortschritt & Abbrechen oben in der Taskliste.",startLabel:"Start",startingLabel:"Starte…",startUrl:"/api/tasks/generate-assets",stopUrl:"/api/tasks/generate-assets",onFinished:n,onStart:ye=>{Y.current=ye,ne(be=>({...be,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:ye=>{const be=zN(ye.currentFile);ne(mt=>({...mt,status:"running",title:"Assets generieren",text:be||"",done:ye.done,total:ye.total}))},onDone:()=>{Y.current=null,ne(ye=>({...ye,status:"done",title:"Assets generieren"})),L(ne)},onCancelled:()=>{Y.current=null,ne(ye=>({...ye,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),L(ne)},onError:ye=>{Y.current=null,ne(be=>({...be,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:ye})),L(ne)}}),c.jsx(M1,{title:"Aufräumen",description:'Löscht Dateien im doneDir kleiner als die Mindestgröße (Ordner "keep" wird übersprungen) und entfernt verwaiste Assets.',startLabel:"Aufräumen",startingLabel:"Läuft…",onTrigger:xe,busy:f,disabled:i||!e.autoDeleteSmallDownloads,onError:ye=>{E(ye)}})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Pfad-Einstellungen"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aufnahme- und Zielverzeichnisse sowie optionaler ffmpeg-Pfad."})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Datenbank"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Postgres Verbindung. Passwort wird verschlüsselt gespeichert."})]}),c.jsx("div",{className:"space-y-3",children:c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Database URL"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:String(e.databaseUrl??""),onChange:ye=>t(be=>({...be,databaseUrl:ye.target.value})),placeholder:"postgres://user@host:5432/db?sslmode=disable",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>re(!0),disabled:i,children:"URL erstellen…"})]})]})})]}),c.jsx(kN,{open:U,onClose:()=>re(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:ye,dbPassword:be})=>{t(mt=>({...mt,databaseUrl:ye})),X(be||"")}}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Aufnahme-Ordner"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.recordDir,onChange:ye=>t(be=>({...be,recordDir:ye.target.value})),placeholder:"records (oder absolut: C:\\records / /mnt/data/records)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("record"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Fertige Downloads nach"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.doneDir,onChange:ye=>t(be=>({...be,doneDir:ye.target.value})),placeholder:"records/done",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("done"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"ffmpeg.exe"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.ffmpegPath??"",onChange:ye=>t(be=>({...be,ffmpegPath:ye.target.value})),placeholder:"Leer = automatisch (FFMPEG_PATH / ffmpeg im PATH)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("ffmpeg"),disabled:i||_!==null,children:"Durchsuchen..."})]})]})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Automatisierung & Anzeige"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Verhalten beim Hinzufügen/Starten sowie Anzeigeoptionen."})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(wa,{checked:!!e.autoAddToDownloadList,onChange:ye=>t(be=>({...be,autoAddToDownloadList:ye,autoStartAddedDownloads:ye?be.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),c.jsx(wa,{checked:!!e.autoStartAddedDownloads,onChange:ye=>t(be=>({...be,autoStartAddedDownloads:ye})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),c.jsx(wa,{checked:!!e.useChaturbateApi,onChange:ye=>t(be=>({...be,useChaturbateApi:ye})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),c.jsx(wa,{checked:!!e.useMyFreeCamsWatcher,onChange:ye=>t(be=>({...be,useMyFreeCamsWatcher:ye})),label:"MyFreeCams Auto-Check (watched)",description:"Geht watched MyFreeCams-Models einzeln durch und startet einen Download. Wenn keine Output-Datei entsteht, ist der Stream nicht öffentlich (offline/away/private) und der Job wird wieder entfernt."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsx(wa,{checked:!!e.autoDeleteSmallDownloads,onChange:ye=>t(be=>({...be,autoDeleteSmallDownloads:ye,autoDeleteSmallDownloadsBelowMB:be.autoDeleteSmallDownloadsBelowMB??50})),label:"Kleine Downloads automatisch löschen",description:"Löscht fertige Downloads automatisch, wenn die Datei kleiner als die eingestellte Mindestgröße ist."}),c.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center "+(e.autoDeleteSmallDownloads?"":"opacity-50 pointer-events-none"),children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Mindestgröße"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Alles darunter wird gelöscht."})]}),c.jsx("div",{className:"sm:col-span-8",children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("input",{type:"number",min:0,step:1,value:e.autoDeleteSmallDownloadsBelowMB??50,onChange:ye=>t(be=>({...be,autoDeleteSmallDownloadsBelowMB:Number(ye.target.value||0)})),className:`h-9 w-32 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100`}),c.jsx("span",{className:"shrink-0 text-xs text-gray-600 dark:text-gray-300",children:"MB"})]})})]})]}),c.jsx(wa,{checked:!!e.blurPreviews,onChange:ye=>t(be=>({...be,blurPreviews:ye})),label:"Vorschaubilder blurren",description:"Weichzeichnet Vorschaubilder/Teaser (praktisch auf mobilen Geräten oder im öffentlichen Umfeld)."}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Teaser abspielen"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Standbild spart Leistung. „Bei Hover (Standard)“: Desktop spielt bei Hover ab, Mobile im Viewport. „Alle“ kann viel CPU ziehen."})]}),c.jsxs("div",{className:"sm:col-span-8",children:[c.jsx("label",{className:"sr-only",htmlFor:"teaserPlayback",children:"Teaser abspielen"}),c.jsxs("select",{id:"teaserPlayback",value:e.teaserPlayback??"hover",onChange:ye=>t(be=>({...be,teaserPlayback:ye.target.value})),className:`h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"still",children:"Standbild"}),c.jsx("option",{value:"hover",children:"Bei Hover (Standard)"}),c.jsx("option",{value:"all",children:"Alle"})]})]})]}),c.jsx(wa,{checked:!!e.teaserAudio,onChange:ye=>t(be=>({...be,teaserAudio:ye})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(wa,{checked:!!e.enableNotifications,onChange:ye=>t(be=>({...be,enableNotifications:ye})),label:"Benachrichtigungen",description:"Wenn aktiv, zeigt das Frontend Toasts (z.B. wenn watched Models online/live gehen oder wenn ein queued Model wieder public wird)."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Speicherplatz-Notbremse"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aktiviert automatisch Stop + Autostart-Block bei wenig freiem Speicher (Resume bei +3 GB)."})]}),c.jsx("span",{className:"inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium "+(B?.emergency?"bg-red-100 text-red-800 dark:bg-red-500/20 dark:text-red-200":"bg-green-100 text-green-800 dark:bg-green-500/20 dark:text-green-200"),title:B?.emergency?"Notfallbremse greift gerade":"OK",children:B?.emergency?"AKTIV":"OK"})]}),c.jsxs("div",{className:"mt-3 text-sm text-gray-900 dark:text-gray-200",children:[c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Schwelle:"})," ","Pause unter ",c.jsx("span",{className:"tabular-nums",children:P})," GB"," · ","Resume ab"," ",c.jsx("span",{className:"tabular-nums",children:Q})," ","GB"]}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:B?`Frei: ${B.freeBytesHuman}${B.recordPath?` (Pfad: ${B.recordPath})`:""}`:"Status wird geladen…"}),B?.emergency&&c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"Notfallbremse greift: laufende Downloads werden gestoppt und Autostart bleibt gesperrt, bis wieder genug frei ist."})]})]})]})]})]})})}function Ap(...n){return n.filter(Boolean).join(" ")}const HN={sm:{btn:"px-2.5 py-1.5 text-sm",icon:"size-5",iconOnly:"h-9 w-9"},md:{btn:"px-3 py-2 text-sm",icon:"size-5",iconOnly:"h-10 w-10"},lg:{btn:"px-3.5 py-2.5 text-sm",icon:"size-5",iconOnly:"h-11 w-11"}};function Fg({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=HN[i];return c.jsx("span",{className:Ap("isolate inline-flex rounded-md shadow-xs dark:shadow-none ring-1 ring-gray-300 dark:ring-gray-700 overflow-hidden",a),role:"group","aria-label":l,children:n.map((h,f)=>{const g=h.id===e,_=f===0,S=f===n.length-1,C=!h.label&&!!h.icon;return c.jsxs("button",{type:"button",disabled:h.disabled,onClick:()=>t(h.id),"aria-pressed":g,className:Ap("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!_&&"before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-gray-300 dark:before:bg-gray-700",_&&"rounded-l-md",S&&"rounded-r-md",g?"bg-indigo-100 text-indigo-800 hover:bg-indigo-200 dark:bg-indigo-500/40 dark:text-indigo-100 dark:hover:bg-indigo-500/50":"bg-white text-gray-900 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:hover:bg-white/20","disabled:opacity-50 disabled:cursor-not-allowed",C?`p-0 ${u.iconOnly}`:u.btn),title:typeof h.label=="string"?h.label:h.srLabel,children:[C&&h.srLabel?c.jsx("span",{className:"sr-only",children:h.srLabel}):null,h.icon?c.jsx("span",{className:Ap("shrink-0",C?"":"-ml-0.5",g?"text-indigo-600 dark:text-indigo-200":"text-gray-400 dark:text-gray-500"),children:h.icon}):null,h.label?c.jsx("span",{className:h.icon?"ml-1.5":"",children:h.label}):null]},h.id)})})}function qN(...n){return n.filter(Boolean).join(" ")}function VN(){if(typeof document>"u")return null;const n="__swipecard_hot_fx_layer__";let e=document.getElementById(n);return e||(e=document.createElement("div"),e.id=n,e.style.position="fixed",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="2147483647",e.style.contain="layout style paint",document.body.appendChild(e)),e}const GN=p.forwardRef(function({children:e,enabled:t=!0,disabled:i=!1,onTap:a,onSwipeLeft:l,onSwipeRight:u,className:h,thresholdPx:f=140,thresholdRatio:g=.28,ignoreFromBottomPx:_=72,ignoreSelector:S="[data-swipe-ignore]",snapMs:C=180,commitMs:N=180,tapIgnoreSelector:O="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:E,hotTargetSelector:B="[data-hot-target]",doubleTapMs:H=360,doubleTapMaxMovePx:Y=48},U){const re=p.useRef(null),W=p.useRef(!1),X=p.useRef(0),R=p.useRef(null),le=p.useRef(0),k=p.useRef(null),j=p.useRef(null),Z=p.useRef(null),V=p.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[ne,me]=p.useState(0),[ue,q]=p.useState(null),[P,Q]=p.useState(0),te=p.useCallback(()=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0,re.current&&(re.current.style.touchAction="pan-y"),Q(C),me(0),q(null),window.setTimeout(()=>Q(0),C)},[C]),ge=p.useCallback(async(Oe,je)=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),re.current&&(re.current.style.touchAction="pan-y");const ze=re.current?.offsetWidth||360;Q(N),q(Oe==="right"?"right":"left");const gt=Oe==="right"?ze+40:-(ze+40);X.current=gt,me(gt);let st;je?st=Promise.resolve(Oe==="right"?u():l()).catch(()=>!1):st=Promise.resolve(!0);const bt=new Promise(Ye=>{window.setTimeout(Ye,N)}),[,Qe]=await Promise.all([bt,st]);return Qe===!1?(Q(C),q(null),me(0),window.setTimeout(()=>Q(0),C),!1):!0},[N,l,u,C]),L=p.useCallback(()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),xe=p.useCallback(()=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0,Q(0),me(0),q(null);try{const Oe=re.current;Oe&&(Oe.style.touchAction="pan-y")}catch{}},[]),Te=p.useCallback((Oe,je)=>{const Ue=k.current,ze=re.current;if(!Ue||!ze)return;const gt=VN();if(!gt)return;let st=typeof Oe=="number"?Oe:window.innerWidth/2,bt=typeof je=="number"?je:window.innerHeight/2;const Qe=B?k.current?.querySelector(B)??ze.querySelector(B):null;let Ye=st,tt=bt;if(Qe){const Zt=Qe.getBoundingClientRect();Ye=Zt.left+Zt.width/2,tt=Zt.top+Zt.height/2}const $e=Ye-st,ht=tt-bt,At=document.createElement("div");At.style.position="absolute",At.style.left=`${st}px`,At.style.top=`${bt}px`,At.style.transform="translate(-50%, -50%)",At.style.pointerEvents="none",At.style.willChange="transform, opacity",At.style.zIndex="2147483647",At.style.lineHeight="1",At.style.userSelect="none",At.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const he=document.createElement("div");he.style.width="30px",he.style.height="30px",he.style.color="#f59e0b",he.style.display="block",At.appendChild(he),gt.appendChild(At);const Ie=ew.createRoot(he);Ie.render(c.jsx(Pg,{className:"w-full h-full","aria-hidden":"true"})),At.getBoundingClientRect();const Le=200,ke=500,Pe=400,et=Le+ke+Pe,kt=Le/et,Lt=(Le+ke)/et,pt=At.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:kt*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:kt},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Lt},{transform:`translate(calc(-50% + ${$e}px), calc(-50% + ${ht}px)) scale(0.85)`,opacity:.95,offset:Lt+(1-Lt)*.75},{transform:`translate(calc(-50% + ${$e}px), calc(-50% + ${ht}px)) scale(0.55)`,opacity:0,offset:1}],{duration:et,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});Qe&&window.setTimeout(()=>{try{Qe.animate([{transform:"translateZ(0) scale(1)",filter:"brightness(1)"},{transform:"translateZ(0) scale(1.10)",filter:"brightness(1.25)",offset:.35},{transform:"translateZ(0) scale(1)",filter:"brightness(1)"}],{duration:260,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)"})}catch{}},Le+ke+Math.round(Pe*.75)),pt.onfinish=()=>{try{Ie.unmount()}catch{}At.remove()}},[B]);p.useEffect(()=>()=>{j.current!=null&&window.clearTimeout(j.current)},[]),p.useImperativeHandle(U,()=>({swipeLeft:Oe=>ge("left",Oe?.runAction??!0),swipeRight:Oe=>ge("right",Oe?.runAction??!0),reset:()=>te()}),[ge,te]);const ye=Math.abs(ne),be=ne===0?null:ne>0?"right":"left",mt=le.current||Math.min(f,(re.current?.offsetWidth||360)*g),Ke=Math.max(0,Math.min(1,ye/Math.max(1,mt))),we=Math.max(0,Math.min(1,ye/Math.max(1,mt*1.35))),Re=Math.max(-6,Math.min(6,ne/28)),ct=ne===0?1:.995;return c.jsx("div",{ref:k,className:qN("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:re,className:"relative",style:{transform:ne!==0?`translate3d(${ne}px,0,0) rotate(${Re}deg) scale(${ct})`:void 0,transition:P?`transform ${P}ms ease`:void 0,touchAction:"pan-y",willChange:ne!==0?"transform":void 0,boxShadow:ne!==0?be==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+Ke*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+Ke*.12})`:void 0,borderRadius:ne!==0?"12px":void 0,filter:ne!==0?`saturate(${1+Ke*.08}) brightness(${1+Ke*.02})`:void 0},onPointerDown:Oe=>{if(!t||i)return;const je=Oe.target;let Ue=!!(O&&je?.closest?.(O));if(S&&je?.closest?.(S))return;let ze=!1;const gt=Oe.currentTarget,bt=Array.from(gt.querySelectorAll("video")).find(ht=>ht.controls);if(bt){const ht=bt.getBoundingClientRect();if(Oe.clientX>=ht.left&&Oe.clientX<=ht.right&&Oe.clientY>=ht.top&&Oe.clientY<=ht.bottom)if(ht.bottom-Oe.clientY<=72)ze=!0,Ue=!0;else{const ke=Oe.clientX-ht.left,Pe=ht.right-Oe.clientX;ke<=64||Pe<=64||(ze=!0,Ue=!0)}}const Ye=Oe.currentTarget.getBoundingClientRect().bottom-Oe.clientY;_&&Ye<=_&&(ze=!0),V.current={id:Oe.pointerId,x:Oe.clientX,y:Oe.clientY,dragging:!1,captured:!1,tapIgnored:Ue,noSwipe:ze};const $e=re.current?.offsetWidth||360;le.current=Math.min(f,$e*g),X.current=0},onPointerMove:Oe=>{if(!t||i||V.current.id!==Oe.pointerId||V.current.noSwipe)return;const je=Oe.clientX-V.current.x,Ue=Oe.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(Ue)>Math.abs(je)&&Math.abs(Ue)>8){V.current.id=null;return}if(Math.abs(je)<12)return;V.current.dragging=!0,Oe.currentTarget.style.touchAction="none",Q(0);try{Oe.currentTarget.setPointerCapture(Oe.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const ze=(Qe,Ye)=>{const tt=Ye*.9,$e=Math.abs(Qe);if($e<=tt)return Qe;const ht=$e-tt,At=tt+ht*.25;return Math.sign(Qe)*At},gt=re.current?.offsetWidth||360;X.current=ze(je,gt),R.current==null&&(R.current=requestAnimationFrame(()=>{R.current=null,me(X.current)}));const st=le.current,bt=je>st?"right":je<-st?"left":null;q(Qe=>{if(Qe===bt)return Qe;if(bt)try{navigator.vibrate?.(10)}catch{}return bt})},onPointerUp:Oe=>{if(!t||i||V.current.id!==Oe.pointerId)return;const je=le.current||Math.min(f,(re.current?.offsetWidth||360)*g),Ue=V.current.dragging,ze=V.current.captured,gt=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,ze)try{Oe.currentTarget.releasePointerCapture(Oe.pointerId)}catch{}if(Oe.currentTarget.style.touchAction="pan-y",!Ue){const bt=Date.now(),Qe=Z.current,Ye=Qe&&Math.hypot(Oe.clientX-Qe.x,Oe.clientY-Qe.y)<=Y;if(!!E&&Qe&&bt-Qe.t<=H&&Ye){if(Z.current=null,L(),W.current)return;W.current=!0;try{Te(Oe.clientX,Oe.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await E?.()}finally{W.current=!1}})()});return}if(gt){Z.current={t:bt,x:Oe.clientX,y:Oe.clientY},L(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null},E?H:0);return}xe(),Z.current={t:bt,x:Oe.clientX,y:Oe.clientY},L(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null,a?.()},E?H:0);return}const st=X.current;R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),st>je?ge("right",!0):st<-je?ge("left",!0):te(),X.current=0},onPointerCancel:Oe=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{Oe.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0;try{Oe.currentTarget.style.touchAction="pan-y"}catch{}te()}},children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"relative z-10",children:e}),c.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ne===0?0:.12+we*.18,background:be==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":be==="left"?"linear-gradient(270deg, rgba(244,63,94,0.16) 0%, rgba(244,63,94,0.04) 45%, rgba(0,0,0,0) 100%)":"transparent"}}),c.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ue?1:0,boxShadow:ue==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ue==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function Ow({children:n,content:e}){const t=p.useRef(null),i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null),f=p.useRef(null),g=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},_=()=>{g(),f.current=window.setTimeout(()=>{l(!1),f.current=null},150)},S=()=>{g(),l(!0)},C=()=>{_()},N=()=>{g(),l(!1)},O=()=>{const B=t.current,H=i.current;if(!B||!H)return;const Y=8,U=8,re=B.getBoundingClientRect(),W=H.getBoundingClientRect();let X=re.bottom+Y;if(X+W.height>window.innerHeight-U){const k=re.top-W.height-Y;k>=U?X=k:X=Math.max(U,window.innerHeight-W.height-U)}let le=re.left;le+W.width>window.innerWidth-U&&(le=window.innerWidth-W.width-U),le=Math.max(U,le),h({left:le,top:X})};p.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>O());return()=>cancelAnimationFrame(B)},[a]),p.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>O());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),p.useEffect(()=>()=>g(),[]);const E=()=>typeof e=="function"?e(a,{close:N}):e;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:S,onMouseLeave:C,children:n}),a&&yu.createPortal(c.jsx("div",{ref:i,className:"fixed z-50",style:{left:u?.left??-9999,top:u?.top??-9999,visibility:u?"visible":"hidden"},onMouseEnter:S,onMouseLeave:C,children:c.jsx(Ns,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:E()})}),document.body)]})}const Sf=!0,KN=!1;function cd(n,e){if(!n)return;const t=e?.muted??Sf;n.muted=t,n.defaultMuted=t,n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline","")}function P1(n){return(n||"").split(/[\\/]/).pop()||""}function xu({job:n,getFileName:e,durationSeconds:t,onDuration:i,onResolution:a,animated:l=!1,animatedMode:u="frames",animatedTrigger:h="always",autoTickMs:f=15e3,thumbStepSec:g,thumbSpread:_,thumbSamples:S,clipSeconds:C=.75,clipCount:N=12,variant:O="thumb",className:E,showPopover:B=!0,blur:H=!1,inlineVideo:Y=!1,inlineNonce:U=0,inlineControls:re=!1,inlineLoop:W=!0,assetNonce:X=0,muted:R=Sf,popoverMuted:le=Sf,noGenerateTeaser:k,alwaysLoadStill:j=!1,teaserPreloadEnabled:Z=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:ne,preferScrubProgress:me=!1}){const ue=P1(n.output||"")||e(n.output||""),q=H?"blur-md":"",P=p.useMemo(()=>{const Ne=n?.meta;if(!Ne)return null;if(typeof Ne=="string")try{return JSON.parse(Ne)}catch{return null}return Ne},[n]),[Q,te]=p.useState(null),ge=p.useRef(new Set),L=p.useMemo(()=>!P&&!Q?null:P?Q?{...P,...Q}:P:Q,[P,Q]),xe=p.useMemo(()=>{let Ne=L?.previewClips;if(typeof Ne=="string"){const _t=Ne.trim();if(_t.length>0)try{const $t=JSON.parse(_t);return Array.isArray($t)&&$t.length>0,!0}catch{return!0}}if(Array.isArray(Ne)&&Ne.length>0)return!0;const Tt=L?.preview?.clips;return!!(Array.isArray(Tt)&&Tt.length>0)},[L]),[Te,ye]=p.useState(0),be=p.useMemo(()=>{let Ne=L?.previewClips;if(typeof Ne=="string")try{Ne=JSON.parse(Ne)}catch{Ne=null}!Array.isArray(Ne)&&Array.isArray(L?.preview?.clips)&&(Ne=L.preview.clips);const Tt=Ne;if(!Array.isArray(Tt)||Tt.length===0)return null;let _t=0;const $t=[];for(const Ht of Tt){const yn=Number(Ht?.startSeconds),Xt=Number(Ht?.durationSeconds);if(!Number.isFinite(yn)||yn<0||!Number.isFinite(Xt)||Xt<=0)continue;const On=_t,Vn=_t+Xt;$t.push({start:yn,dur:Xt,cumStart:On,cumEnd:Vn}),_t=Vn}return $t.length?$t:null},[L]),mt=p.useMemo(()=>be?be.map(Ne=>`${Ne.start.toFixed(3)}:${Ne.dur.toFixed(3)}`).join("|"):"",[be]),Ke=(typeof P?.videoWidth=="number"&&Number.isFinite(P.videoWidth)&&P.videoWidth>0?P.videoWidth:void 0)??(typeof n.videoWidth=="number"&&Number.isFinite(n.videoWidth)&&n.videoWidth>0?n.videoWidth:void 0),we=(typeof P?.videoHeight=="number"&&Number.isFinite(P.videoHeight)&&P.videoHeight>0?P.videoHeight:void 0)??(typeof n.videoHeight=="number"&&Number.isFinite(n.videoHeight)&&n.videoHeight>0?n.videoHeight:void 0),Re=(typeof P?.fileSize=="number"&&Number.isFinite(P.fileSize)&&P.fileSize>0?P.fileSize:void 0)??(typeof n.sizeBytes=="number"&&Number.isFinite(n.sizeBytes)&&n.sizeBytes>0?n.sizeBytes:void 0),ct=(typeof P?.fps=="number"&&Number.isFinite(P.fps)&&P.fps>0?P.fps:void 0)??(typeof n.fps=="number"&&Number.isFinite(n.fps)&&n.fps>0?n.fps:void 0),Oe=(typeof L?.durationSeconds=="number"&&Number.isFinite(L.durationSeconds)&&L.durationSeconds>0?L.durationSeconds:void 0)??(typeof n.durationSeconds=="number"&&Number.isFinite(n.durationSeconds)&&n.durationSeconds>0?n.durationSeconds:void 0)??(typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0),je=typeof Oe=="number"&&Number.isFinite(Oe)&&Oe>0?Oe>1440*60?Oe/1e3:Oe:void 0,Ue=typeof je=="number"&&Number.isFinite(je)&&je>0,ze=typeof Ke=="number"&&typeof we=="number"&&Number.isFinite(Ke)&&Number.isFinite(we)&&Ke>0&&we>0,gt={muted:R,playsInline:!0,preload:"metadata"},[st,bt]=p.useState(!0),[Qe,Ye]=p.useState(!0),[tt,$e]=p.useState(!1),[ht,At]=p.useState(!1),[he,Ie]=p.useState(!0),Le=p.useRef(""),ke=p.useRef(""),Pe=p.useRef(null),[et,kt]=p.useState(!1),[Lt,pt]=p.useState(!1),[Zt,qt]=p.useState(!1),[Gt,wt]=p.useState(0),[lt,Yt]=p.useState(!1),kn=Y===!0||Y==="always"?"always":Y==="hover"?"hover":"never",pn=kn==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",xn=Ne=>Ne.startsWith("HOT ")?Ne.slice(4):Ne,rt=p.useMemo(()=>{const Ne=P1(n.output||"")||e(n.output||"");if(!Ne)return"";const Tt=Ne.replace(/\.[^.]+$/,"");return xn(Tt).trim()},[n.output,e]),M=p.useMemo(()=>ue?`/api/record/video?file=${encodeURIComponent(ue)}`:"",[ue]),F=O==="fill"?"w-full h-full":"w-20 h-16",ie=p.useRef(null),De=p.useRef(null),Ve=p.useRef(null),yt=p.useRef({inline:null,teaser:null,clips:null}),Vt=(Ne,Tt)=>{Tt&&yt.current[Ne]!==Tt&&(yt.current[Ne]=Tt,ye(_t=>_t+1))},[Jt,gn]=p.useState(0),[,ln]=p.useState(0),_n=Ne=>Ne<0?0:Ne>1?1:Ne,En=(Ne,Tt,_t=C,$t=!1)=>{if(!Ne)return{ratio:0,globalSec:0,vvDur:0};const Ht=Number(Ne.duration);if(!(Number.isFinite(Ht)&&Ht>0))return{ratio:0,globalSec:0,vvDur:0};const Xt=Number(Ne.currentTime);if(!Number.isFinite(Xt)||Xt<0)return{ratio:0,globalSec:0,vvDur:Ht};const On=be;let Vn=0;if($t&&Array.isArray(On)&&On.length>0){const $n=On[On.length-1];if(Xt>=$n.cumEnd)Vn=typeof Tt=="number"&&Number.isFinite(Tt)&&Tt>0?Tt:$n.start+$n.dur;else{let ji=0,Bi=On.length-1,Yn=0;for(;ji<=Bi;){const Pn=ji+Bi>>1,Ri=On[Pn];if(Xt<Ri.cumStart)Bi=Pn-1;else if(Xt>=Ri.cumEnd)ji=Pn+1;else{Yn=Pn;break}}return Vn=On[Yn].start,{ratio:On.length>0?_n(Yn/On.length):0,globalSec:Math.max(0,Vn),vvDur:Ht}}}return Number.isFinite(_t)&&_t>0?Vn=Math.floor(Xt/_t)*_t:Vn=Xt,{ratio:_n(Math.min(Vn,Ht)/Ht),globalSec:Math.max(0,Vn),vvDur:Ht}},Ut=Ne=>{if(Ne){try{Ne.pause()}catch{}try{Ne.removeAttribute("src"),Ne.src="",Ne.load()}catch{}}};p.useEffect(()=>{At(!1),Ie(!0),te(null),Le.current="",ke.current="",$e(!1)},[rt,X,k]),p.useEffect(()=>{const Ne=Tt=>{const _t=String(Tt?.detail?.file??"");!_t||_t!==ue||(Ut(ie.current),Ut(De.current),Ut(Ve.current))};return window.addEventListener("player:release",Ne),window.addEventListener("player:close",Ne),()=>{window.removeEventListener("player:release",Ne),window.removeEventListener("player:close",Ne)}},[ue]),p.useEffect(()=>{const Ne=Pe.current;if(!Ne)return;const Tt=new IntersectionObserver(_t=>{const $t=!!_t[0]?.isIntersecting;kt($t),$t&&qt(!0)},{threshold:.01,rootMargin:"0px"});return Tt.observe(Ne),()=>Tt.disconnect()},[]),p.useEffect(()=>{const Ne=Pe.current;if(!Ne)return;if(!Z){pt(et);return}let Tt=!0;const _t=new IntersectionObserver($t=>{$t[0]?.isIntersecting&&(pt(!0),Tt&&(Tt=!1,_t.disconnect()))},{threshold:0,rootMargin:V});return _t.observe(Ne),()=>_t.disconnect()},[Z,V,et]),p.useEffect(()=>{if(!l||u!=="frames"||!et||document.hidden)return;const Ne=window.setInterval(()=>wt(Tt=>Tt+1),f);return()=>window.clearInterval(Ne)},[l,u,et,f]);const hn=p.useMemo(()=>{if(!l||u!=="frames"||!Ue)return null;const Ne=je,Tt=Math.max(.25,g??3);if(_){const Ht=Math.max(4,Math.min(S??16,Math.floor(Ne))),yn=Gt%Ht,Xt=Math.max(.1,Ne-Tt),On=Math.min(.25,Xt*.02),Vn=yn/Ht*Xt+On;return Math.min(Ne-.05,Math.max(.05,Vn))}const _t=Math.max(Ne-.1,Tt),$t=Gt*Tt%_t;return Math.min(Ne-.05,Math.max(.05,$t))},[l,u,Ue,je,Gt,g,_,S]),cn=X??0,en=p.useMemo(()=>rt?hn==null?`/api/preview?id=${encodeURIComponent(rt)}&v=${cn}`:`/api/preview?id=${encodeURIComponent(rt)}&t=${hn}&v=${cn}`:"",[rt,hn,cn]),zt=p.useMemo(()=>{if(!rt)return"";const Ne=k?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(rt)}${Ne}&v=${cn}`},[rt,cn,k]),Dt=kn!=="never"&&et&&Qe&&(kn==="always"||kn==="hover"&&lt),Ot=l&&et&&!document.hidden&&Qe&&!Dt&&(h==="always"||lt)&&(u==="teaser"&&he&&!!zt||u==="clips"&&Ue),Hn=Ue&&typeof je=="number"?je:void 0,Rt=j||et||Zt||pn&&lt,qn=Lt||et||Zt||pn&&lt;p.useEffect(()=>{let Ne=!1;if(i&&Ue){const Tt=Number(je),_t=`${ue}|dur|${Tt}`;Le.current!==_t&&(Le.current=_t,i(n,Tt),Ne=!0)}if(a&&ze){const Tt=Number(Ke),_t=Number(we),$t=`${ue}|res|${Tt}x${_t}`;ke.current!==$t&&(ke.current=$t,a(n,Tt,_t),Ne=!0)}Ne&&$e(!0)},[ue,n,i,a,Ue,ze,je,Ke,we]),p.useEffect(()=>{if(!rt||!ue||!l||u!=="teaser"||!qn||xe||ge.current.has(ue))return;let Ne=!1;const Tt=new AbortController,_t=async $t=>{try{const Ht=await fetch($t,{signal:Tt.signal,cache:"no-store",credentials:"include"});return Ht.ok?await Ht.json():null}catch{return null}};return(async()=>{const $t=await _t(`/api/record/done/meta?file=${encodeURIComponent(ue)}`);Ne||(ge.current.add(ue),$t&&te($t))})(),()=>{Ne=!0,Tt.abort()}},[rt,ue,l,u,qn,xe]);const _i=Ne=>{$e(!0);const Tt=Ne.currentTarget;if(i&&!Ue){const _t=Number(Tt.duration);if(Number.isFinite(_t)&&_t>0){const $t=`${ue}|dur|${_t}`;Le.current!==$t&&(Le.current=$t,i(n,_t))}}if(a&&!ze){const _t=Number(Tt.videoWidth),$t=Number(Tt.videoHeight);if(Number.isFinite(_t)&&Number.isFinite($t)&&_t>0&&$t>0){const Ht=`${ue}|res|${_t}x${$t}`;ke.current!==Ht&&(ke.current=Ht,a(n,_t,$t))}}};if(p.useEffect(()=>{bt(!0),Ye(!0),yt.current.inline=null,yt.current.teaser=null,yt.current.clips=null},[rt,X]),!M)return c.jsx("div",{className:[F,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Mn=qn,Wt=l&&u==="teaser"&&he&&!!zt&&!Dt&&qn,zn=Dt?ie:!Dt&&Ot&&u==="teaser"?De:!Dt&&Ot&&u==="clips"?Ve:null,Kn=!!zn&&et,jn=Dt?"inline":Ot&&u==="teaser"?"teaser":"clips",Wn=l&&u==="frames"&&Ue&&typeof hn=="number"&&Number.isFinite(hn)&&hn>=0,Cn=Wn?_n(hn/je):0,fi=!Dt&&me&&typeof ne=="number"&&Number.isFinite(ne),Xn=fi?_n(ne):Kn?Jt:Wn?Cn:0,_e=!Dt&&(fi||(Kn||Wn)),at=p.useMemo(()=>{if(!Ue)return null;const Ne=je;if(!(Ne>0))return null;let _t=L?.previewClips;if(typeof _t=="string")try{_t=JSON.parse(_t)}catch{_t=null}if(!Array.isArray(_t)||_t.length===0)return null;const $t=_t.map(Ht=>({start:Number(Ht?.startSeconds),dur:Number(Ht?.durationSeconds)})).filter(Ht=>Number.isFinite(Ht.start)&&Ht.start>=0&&Number.isFinite(Ht.dur)&&Ht.dur>0);return $t.length?$t.map(Ht=>{const yn=_n(Ht.start/Ne),Xt=_n(Ht.dur/Ne);return{left:yn,width:Xt,start:Ht.start,dur:Ht.dur}}):null},[L,Ue,je]),Ct=p.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Ue)return[];const Ne=je,Tt=Math.max(.25,C),_t=Math.max(8,Math.min(N??S??12,Math.floor(Ne))),$t=Math.max(.1,Ne-Tt),Ht=Math.min(.25,$t*.02),yn=[];for(let Xt=0;Xt<_t;Xt++){const On=Xt/_t*$t+Ht;yn.push(Math.min(Ne-.05,Math.max(.05,On)))}return yn},[l,u,Ue,je,S,C,N]),St=p.useMemo(()=>Ct.map(Ne=>Ne.toFixed(2)).join(","),[Ct]),Pt=p.useRef(0),tn=p.useRef(0);p.useEffect(()=>{const Ne=De.current;if(!Ne)return;if(!(Ot&&u==="teaser")){try{Ne.pause()}catch{}return}cd(Ne,{muted:R});const _t=Ne.play?.();_t&&typeof _t.catch=="function"&&_t.catch(()=>{})},[Ot,u,zt,R]),p.useEffect(()=>{if(!Kn){gn(0),ln(0);return}const Ne=zn?.current??null;if(!Ne){gn(0),ln(0);return}let Tt=!1,_t=null;const $t=()=>{if(Tt||!Ne.isConnected)return;const Xt=jn==="teaser"&&Array.isArray(be)&&be.length>0,On=En(Ne,Hn,C,Xt);gn(On.ratio),ln(On.globalSec)};$t(),_t=window.setInterval($t,100);const Ht=()=>$t(),yn=()=>$t();return Ne.addEventListener("loadedmetadata",Ht),Ne.addEventListener("durationchange",Ht),Ne.addEventListener("timeupdate",yn),()=>{Tt=!0,_t!=null&&window.clearInterval(_t),Ne.removeEventListener("loadedmetadata",Ht),Ne.removeEventListener("durationchange",Ht),Ne.removeEventListener("timeupdate",yn)}},[Kn,zn,Hn,mt,jn,be,Te]),p.useEffect(()=>{Dt&&cd(ie.current,{muted:R})},[Dt,R]),p.useEffect(()=>{const Ne=Ve.current;if(!Ne)return;if(!(Ot&&u==="clips")){Ot||Ne.pause();return}if(!Ct.length)return;Pt.current=Pt.current%Ct.length,tn.current=Ct[Pt.current];const Tt=()=>{try{Ne.currentTime=tn.current}catch{}const Ht=Ne.play();Ht&&typeof Ht.catch=="function"&&Ht.catch(()=>{})},_t=()=>Tt(),$t=()=>{if(Ct.length&&Ne.currentTime-tn.current>=C){Pt.current=(Pt.current+1)%Ct.length,tn.current=Ct[Pt.current];try{Ne.currentTime=tn.current+.01}catch{}}};return Ne.addEventListener("loadedmetadata",_t),Ne.addEventListener("timeupdate",$t),Ne.readyState>=1&&Tt(),()=>{Ne.removeEventListener("loadedmetadata",_t),Ne.removeEventListener("timeupdate",$t),Ne.pause()}},[Ot,u,St,C,Ct]);const wn=(Lt||et)&&(i||a)&&!tt&&!Dt&&(i&&!Ue||a&&!ze),vt=!!at&&(jn==="teaser"||!Dt&&fi&&u==="teaser"),fn=c.jsxs("div",{ref:Pe,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",F,E??""].join(" "),onMouseEnter:pn?()=>Yt(!0):void 0,onMouseLeave:pn?()=>Yt(!1):void 0,onFocus:pn?()=>Yt(!0):void 0,onBlur:pn?()=>Yt(!1):void 0,"data-duration":Ue?String(je):void 0,"data-res":ze?`${Ke}x${we}`:void 0,"data-size":typeof Re=="number"?String(Re):void 0,"data-fps":typeof ct=="number"?String(ct):void 0,children:[Rt&&en&&st?c.jsx("img",{src:en,loading:j?"eager":"lazy",decoding:"async",alt:ue,className:["absolute inset-0 w-full h-full object-cover",q].filter(Boolean).join(" "),onError:()=>bt(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Dt?p.createElement("video",{...gt,ref:Ne=>{ie.current=Ne,Vt("inline",Ne)},key:`inline-${rt}-${U}`,src:M,className:["absolute inset-0 w-full h-full object-cover",q,re?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:R,controls:re,loop:W,poster:Mn&&en||void 0,onLoadedMetadata:_i,onError:()=>Ye(!1)}):null,!Dt&&Wt&&!(Ot&&u==="teaser")?c.jsx("video",{src:zt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>At(!0),onCanPlay:()=>At(!0),onError:()=>{Ie(!1),At(!1)}},`teaser-prewarm-${rt}`):null,!Dt&&Ot&&u==="teaser"?c.jsx("video",{ref:Ne=>{De.current=Ne,Vt("teaser",Ne)},src:zt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q,ht?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:R,playsInline:!0,autoPlay:!0,loop:!0,preload:ht?"auto":"metadata",poster:Mn&&en||void 0,onLoadedData:()=>At(!0),onPlaying:()=>At(!0),onError:()=>{Ie(!1),At(!1)}},`teaser-mp4-${rt}`):null,!Dt&&Ot&&u==="clips"?c.jsx("video",{ref:Ne=>{Ve.current=Ne,Vt("clips",Ne)},src:M,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q].filter(Boolean).join(" "),muted:R,playsInline:!0,preload:"metadata",poster:Mn&&en||void 0,onError:()=>Ye(!1)},`clips-${rt}-${St}`):null,_e?c.jsxs("div",{"aria-hidden":"true",className:["absolute left-0 right-0 bottom-0 z-40 pointer-events-none","h-0.5 group-hover:h-1","transition-[height] duration-150 ease-out","rounded-none group-hover:rounded-full","bg-black/35 dark:bg-white/10","overflow-hidden group-hover:overflow-visible"].join(" "),children:[vt?c.jsx("div",{className:"absolute inset-0",children:at.map((Ne,Tt)=>c.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${Ne.left*100}%`,width:`${Ne.width*100}%`}},`seg-${Tt}-${Ne.left.toFixed(6)}-${Ne.width.toFixed(6)}`))}):null,c.jsx("div",{className:["absolute inset-0 origin-left",jn==="teaser"?"":"transition-transform duration-150 ease-out"].join(" "),style:{transform:`scaleX(${_n(Xn)})`,background:"rgba(99,102,241,0.95)"}})]}):null,wn?c.jsx("video",{src:M,preload:"metadata",muted:R,playsInline:!0,className:"hidden",onLoadedMetadata:_i}):null]});return B?c.jsx(Ow,{content:Ne=>Ne&&c.jsx("div",{className:"w-[420px]",children:c.jsx("div",{className:"aspect-video",children:c.jsx("video",{src:M,className:["w-full h-full bg-black",q].filter(Boolean).join(" "),muted:le,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:Tt=>Tt.stopPropagation(),onMouseDown:Tt=>Tt.stopPropagation()})})}),children:fn}):fn}function Rn(...n){return n.filter(Boolean).join(" ")}const WN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",XN=n=>n.startsWith("HOT ")?n.slice(4):n,YN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function QN(n){const t=XN(WN(n||"")).replace(/\.[^.]+$/,""),i=t.match(YN);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function Ds({job:n,variant:e="overlay",collapseToMenu:t=!1,inlineCount:i,busy:a=!1,compact:l=!1,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onToggleFavorite:_,onToggleLike:S,onToggleHot:C,onKeep:N,onDelete:O,onToggleWatch:E,onAddToDownloads:B,order:H,className:Y}){const U=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",re=l?"size-4":"size-5",W="h-full w-full",X=e==="table"?`inline-flex items-center justify-center rounded-md ${U} hover:bg-gray-100/70 dark:hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`:`inline-flex items-center justify-center rounded-md bg-white/75 ${U} text-gray-900 backdrop-blur ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/60 dark:focus-visible:ring-white/40 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`,R=e==="table"?{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-500 dark:text-gray-300",keep:"text-emerald-600 dark:text-emerald-300",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-300"}:{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-800/90 dark:text-white/90",keep:"text-emerald-600 dark:text-emerald-200",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-200"},le=H??["watch","favorite","like","hot","keep","delete","details"],k=rt=>le.includes(rt),j=String(n?.sourceUrl??"").trim(),Z=QN(n.output||""),V=Z?`Mehr zu ${Z} anzeigen`:"Mehr anzeigen",ne=k("favorite"),me=k("like"),ue=k("hot"),q=k("watch"),P=k("keep"),Q=k("delete"),te=k("details")&&!!Z,ge=k("add"),[L,xe]=p.useState("idle"),Te=p.useRef(null);p.useEffect(()=>()=>{Te.current&&window.clearTimeout(Te.current)},[]);const ye=()=>{xe("ok"),Te.current&&window.clearTimeout(Te.current),Te.current=window.setTimeout(()=>xe("idle"),800)},be=async()=>{if(a||L==="busy"||!B&&!!!j)return!1;xe("busy");try{let M=!0;return B?M=await B(n)!==!1:j?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:j}})),M=!0):M=!1,M?ye():xe("idle"),M}catch{return xe("idle"),!1}},[mt,Ke]=p.useState(0),[we,Re]=p.useState(4),ct=rt=>M=>{M.preventDefault(),M.stopPropagation(),!(a||!rt)&&Promise.resolve(rt(n)).catch(()=>{})},Oe=te?c.jsxs("button",{type:"button",className:Rn(X),title:V,"aria-label":V,disabled:a,onClick:rt=>{rt.preventDefault(),rt.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},children:[c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(L1,{className:Rn(W,R.off)})}),c.jsx("span",{className:"sr-only",children:V})]}):null,je=ge?c.jsxs("button",{type:"button",className:Rn(X),title:j?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||L==="busy"||!B&&!j,onClick:async rt=>{rt.preventDefault(),rt.stopPropagation(),await be()},children:[c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:L==="ok"?c.jsx(Rw,{className:Rn(W,"text-emerald-600 dark:text-emerald-300")}):c.jsx(j1,{className:Rn(W,R.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Ue=ne?c.jsx("button",{type:"button",className:X,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!_,onClick:ct(_),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(_f,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",h?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(vu,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",h?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.favOn)})]})}):null,ze=me?c.jsx("button",{type:"button",className:X,title:f?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-label":f?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-pressed":f,disabled:a||!S,onClick:ct(S),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(ed,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",f?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(yl,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",f?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.likeOn)})]})}):null,gt=ue?c.jsx("button",{type:"button","data-hot-target":!0,className:X,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!C,onClick:ct(C),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(O1,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(Pg,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.hotOn)})]})}):null,st=q?c.jsx("button",{type:"button",className:X,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!E,onClick:ct(E),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(xf,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(gl,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.watchOn)})]})}):null,bt=P?c.jsx("button",{type:"button",className:X,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!N,onClick:ct(N),children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(R1,{className:Rn(W,R.keep)})})}):null,Qe=Q?c.jsx("button",{type:"button",className:X,title:"Löschen","aria-label":"Löschen",disabled:a||!O,onClick:ct(O),children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(I1,{className:Rn(W,R.del)})})}):null,Ye={details:Oe,add:je,favorite:Ue,like:ze,watch:st,hot:gt,keep:bt,delete:Qe},tt=t,$e=le.filter(rt=>!!Ye[rt]),ht=tt&&typeof i!="number",Ie=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Le=l?2:3,ke=p.useMemo(()=>{if(!ht)return i??Le;const rt=mt||0;if(rt<=0)return Math.min($e.length,Le);for(let M=$e.length;M>=0;M--)if(M*Ie+Ie+(M>0?M*we:0)<=rt)return M;return 0},[ht,i,Le,mt,$e.length,Ie,we]),Pe=tt?$e.slice(0,ke):$e,et=tt?$e.slice(ke):[],[kt,Lt]=p.useState(!1),pt=p.useRef(null);p.useLayoutEffect(()=>{const rt=pt.current;if(!rt||typeof window>"u")return;const M=()=>{const ie=pt.current;if(!ie)return;const De=Math.floor(ie.getBoundingClientRect().width||0);De>0&&Ke(De);const Ve=window.getComputedStyle(ie),yt=Ve.columnGap||Ve.gap||"0",Vt=parseFloat(yt);Number.isFinite(Vt)&&Vt>=0&&Re(Vt)};M();const F=new ResizeObserver(()=>M());return F.observe(rt),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M),F.disconnect()}},[]);const Zt=p.useRef(null),qt=p.useRef(null),Gt=208,wt=4,lt=8,[Yt,kn]=p.useState(null);p.useEffect(()=>{if(!kt)return;const rt=F=>{F.key==="Escape"&&Lt(!1)},M=F=>{const ie=pt.current,De=qt.current,Ve=F.target;ie&&ie.contains(Ve)||De&&De.contains(Ve)||Lt(!1)};return window.addEventListener("keydown",rt),window.addEventListener("mousedown",M),()=>{window.removeEventListener("keydown",rt),window.removeEventListener("mousedown",M)}},[kt]),p.useLayoutEffect(()=>{if(!kt){kn(null);return}const rt=()=>{const M=Zt.current;if(!M)return;const F=M.getBoundingClientRect(),ie=window.innerWidth,De=window.innerHeight;let Ve=F.right-Gt;Ve=Math.max(lt,Math.min(Ve,ie-Gt-lt));let yt=F.bottom+wt;yt=Math.max(lt,Math.min(yt,De-lt));const Vt=Math.max(120,De-yt-lt);kn({top:yt,left:Ve,maxH:Vt})};return rt(),window.addEventListener("resize",rt),window.addEventListener("scroll",rt,!0),()=>{window.removeEventListener("resize",rt),window.removeEventListener("scroll",rt,!0)}},[kt]);const pn=()=>{Z&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},xn=rt=>rt==="details"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a,onClick:M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),pn()},children:[c.jsx(L1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):rt==="add"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!B&&!j,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await be()},children:[c.jsx(j1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):rt==="favorite"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!_,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await _?.(n)},children:[h?c.jsx(vu,{className:Rn("size-4",R.favOn)}):c.jsx(_f,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):rt==="like"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!S,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await S?.(n)},children:[f?c.jsx(yl,{className:Rn("size-4",R.favOn)}):c.jsx(ed,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):rt==="watch"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!E,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await E?.(n)},children:[g?c.jsx(gl,{className:Rn("size-4",R.favOn)}):c.jsx(xf,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):rt==="hot"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!C,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await C?.(n)},children:[u?c.jsx(Pg,{className:Rn("size-4",R.favOn)}):c.jsx(O1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:u?"HOT entfernen":"Als HOT markieren"})]},"hot"):rt==="keep"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!N,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await N?.(n)},children:[c.jsx(R1,{className:Rn("size-4",R.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):rt==="delete"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!O,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await O?.(n)},children:[c.jsx(I1,{className:Rn("size-4",R.del)}),c.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return c.jsxs("div",{ref:pt,className:Rn("relative flex items-center flex-nowrap",Y??"gap-2"),children:[Pe.map(rt=>{const M=Ye[rt];return M?c.jsx(p.Fragment,{children:M},rt):null}),tt&&et.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:Zt,type:"button",className:X,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":kt,disabled:a,onClick:rt=>{rt.preventDefault(),rt.stopPropagation(),!a&&Lt(M=>!M)},children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(GA,{className:Rn(W,R.off)})})}),kt&&Yt&&typeof document<"u"?yu.createPortal(c.jsx("div",{ref:qt,role:"menu",className:"rounded-md bg-white/95 dark:bg-gray-900/95 shadow-lg ring-1 ring-black/10 dark:ring-white/10 p-1 z-[9999] overflow-auto",style:{position:"fixed",top:Yt.top,left:Yt.left,width:Gt,maxHeight:Yt.maxH},onClick:rt=>rt.stopPropagation(),children:et.map(xn)}),document.body):null]}):null]})}function ps({tag:n,children:e,title:t,active:i,onClick:a,maxWidthClassName:l="max-w-[11rem]",className:u,stopPropagation:h=!0}){const f=n??(typeof e=="string"||typeof e=="number"?String(e):""),g=on("inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs",l,"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-200"),C=on(g,i?"bg-sky-100 text-sky-800 dark:bg-sky-400/20 dark:text-sky-100":"",a?"cursor-pointer hover:bg-sky-100 dark:hover:bg-sky-400/20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500":"",u),N=E=>E.stopPropagation(),O=h?{onPointerDown:N,onMouseDown:N}:{};return a?c.jsx("button",{type:"button",className:C,title:t??f,"aria-pressed":!!i,...O,onClick:E=>{h&&(E.preventDefault(),E.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:C,title:t??f,...O,onClick:h?N:void 0,children:e??n})}function dd({rowKey:n,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:a,maxVisible:l,maxWidthClassName:u,gapPx:h=6,className:f}){const[g,_]=p.useState(!1),S=p.useRef(null),C=p.useRef(null),N=p.useRef(null);p.useEffect(()=>_(!1),[n]),p.useEffect(()=>{if(!g)return;const R=le=>{le.key==="Escape"&&_(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[g]);const O=p.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),E=p.useMemo(()=>[...e].sort((R,le)=>R.localeCompare(le,void 0,{sensitivity:"base"})),[e]),[B,H]=p.useState(()=>{const R=Math.min(E.length,O);return Math.min(R,6)}),Y=p.useCallback(()=>{const R=S.current,le=C.current;if(!R||!le)return;const k=Math.floor(R.getBoundingClientRect().width);if(k<=0)return;const j=Math.min(E.length,O);if(j<=0){H(0);return}const V=Array.from(le.children).map(P=>P.offsetWidth).slice(0,j),ne=N.current?.offsetWidth??0,me=2,ue=P=>{let Q=0,te=0;for(let ge=0;ge<V.length;ge++){const L=V[ge]+(te>0?h:0);if(Q+L<=P-me)Q+=L,te++;else break}return te};let q=ue(k);if(q<j){const P=ne>0?ne+h:0,Q=Math.max(0,k-P);q=ue(Q),q=Math.max(0,q)}H(Math.max(0,Math.min(q,j)))},[E,O,h]);p.useLayoutEffect(()=>{Y()},[Y,E.join("\0"),u,O]),p.useEffect(()=>{const R=S.current;if(!R)return;const le=new ResizeObserver(()=>Y());return le.observe(R),()=>le.disconnect()},[Y]);const U=Math.min(E.length,O),re=E.slice(0,Math.min(B,U)),W=R=>R.stopPropagation(),X=E.length-re.length;return c.jsxs(c.Fragment,{children:[g?null:c.jsxs("div",{ref:S,className:["mt-2 h-6 flex items-center gap-1.5",f].filter(Boolean).join(" "),onClick:W,onMouseDown:W,onPointerDown:W,children:[c.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:c.jsx("div",{className:"flex flex-nowrap items-center gap-1.5",children:re.length>0?re.map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R)):c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),X>0?c.jsxs("button",{type:"button",className:["inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs","cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500","bg-gray-100 text-gray-700 hover:bg-gray-200/70","dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20"].join(" "),onClick:R=>{R.preventDefault(),R.stopPropagation(),_(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",X]}):null]}),g?c.jsxs("div",{className:["absolute inset-0 z-30","bg-white/60 dark:bg-gray-950","px-3 py-3","pointer-events-auto"].join(" "),onClick:W,onMouseDown:W,onPointerDown:W,role:"dialog","aria-label":"Tags",children:[c.jsx("button",{type:"button",className:`\r
absolute right-2 top-2 z-10\r
rounded-md bg-gray-100/80 px-2 py-1 text-xs font-semibold text-gray-700\r
hover:bg-gray-200/80\r
dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20\r
`,onClick:()=>_(!1),"aria-label":"Schließen",title:"Schließen",children:"✕"}),c.jsx("div",{className:"h-full overflow-auto pr-1",children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R))})})]}):null,c.jsxs("div",{className:"absolute -left-[9999px] -top-[9999px] opacity-0 pointer-events-none",children:[c.jsx("div",{ref:C,className:"flex flex-nowrap items-center gap-1.5",children:E.slice(0,U).map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R))}),c.jsx("button",{ref:N,type:"button",className:"inline-flex items-center rounded-md bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-200",children:"+99"})]})]})}function F1(n,e,t){return Math.max(e,Math.min(t,n))}function ZN(n){const e=Math.max(0,Math.floor(n)),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}function _y({imageCount:n,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:a,stepSeconds:l=0}){const u=p.useRef(null),h=p.useRef(null),f=p.useRef(void 0),g=p.useCallback(()=>{h.current=null,t(f.current)},[t]),_=p.useCallback(W=>{f.current=W,h.current==null&&(h.current=window.requestAnimationFrame(g))},[g]);p.useEffect(()=>()=>{h.current!=null&&(window.cancelAnimationFrame(h.current),h.current=null)},[]);const S=p.useCallback(W=>{if(!u.current||n<1)return;const X=u.current.getBoundingClientRect();if(X.width<=0)return;const R=W-X.left,le=F1(R/X.width,0,.999999);return F1(Math.floor(le*n),0,n-1)},[n]),C=p.useCallback(W=>{const X=S(W.clientX);_(X)},[S,_]),N=p.useCallback(W=>{const X=S(W.clientX);_(X)},[S,_]),O=p.useCallback(()=>{_(void 0)},[_]),E=p.useCallback(W=>{W.stopPropagation();const X=S(W.clientX);_(X);try{W.currentTarget.setPointerCapture?.(W.pointerId)}catch{}},[S,_]),B=p.useCallback(W=>{if(W.stopPropagation(),!i)return;const X=S(W.clientX);typeof X=="number"&&i(X)},[S,i]);if(!n||n<1)return null;const H=typeof e=="number"?(e+.5)/n*100:void 0,Y=typeof e=="number"?l>0?ZN(e*l):`${e+1}/${n}`:"",U=typeof e=="number",re=typeof H=="number"?{left:`clamp(24px, ${H}%, calc(100% - 24px))`,transform:"translateX(-50%)"}:void 0;return c.jsxs("div",{ref:u,className:["relative h-7 w-full select-none touch-none cursor-col-resize","opacity-0 transition-opacity duration-150","pointer-events-none","group-hover:opacity-100 group-focus-within:opacity-100","group-hover:pointer-events-auto group-focus-within:pointer-events-auto",a].filter(Boolean).join(" "),onPointerMove:C,onPointerEnter:N,onPointerLeave:O,onPointerDown:E,onMouseDown:W=>W.stopPropagation(),onClick:B,title:U?Y:`Preview scrubber (${n})`,role:"slider","aria-label":"Preview scrubber","aria-valuemin":1,"aria-valuemax":n,"aria-valuenow":typeof e=="number"?e+1:void 0,children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-4 bg-white/35 ring-1 ring-white/40 backdrop-blur-[1px]",children:typeof H=="number"?c.jsx("div",{className:"absolute inset-y-0 w-[2px] bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:`${H}%`,transform:"translateX(-50%)"}}):null}),c.jsx("div",{className:["pointer-events-none absolute bottom-[19px] z-10","rounded bg-black/70 px-1.5 py-0.5","text-[11px] leading-none text-white whitespace-nowrap","transition-opacity duration-100",U?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:re,children:Y})]})}const Lw=/^HOT[ \u00A0]+/i,Iw=n=>String(n||"").replaceAll(" "," "),ou=n=>Lw.test(Iw(n)),$r=n=>Iw(n).replace(Lw,"");function hd(n){if(!n)return"";const e=Math.round(Number(n.w)),t=Math.round(Number(n.h));if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return"";const i=Math.min(e,t),a=Math.max(12,Math.round(i*.02)),l=u=>Math.abs(i-u)<=a;return l(4320)?"8K":l(2160)||i>=2e3?"4K":l(1440)?"1440p":l(1080)?"1080p":l(720)?"720p":l(480)?"480p":l(360)?"360p":l(240)?"240p":`${i}p`}const JN=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a};function e3(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function Np(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function U1(n,e,t){return Math.max(e,Math.min(t,n))}const t3=5;function n3(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function i3({blurred:n,animateUnblurOnMount:e,children:t}){const[i,a]=p.useState(!e);p.useEffect(()=>{if(!e)return;const u=requestAnimationFrame(()=>{a(!0)});return()=>cancelAnimationFrame(u)},[e]);const l=["relative will-change-[filter,transform] transition-[filter,transform,opacity] duration-180 ease-out",n?"blur-[1.5px] saturate-90 scale-[0.995]":i?"blur-0 saturate-100 scale-100":"blur-[1.5px] saturate-90 scale-[0.995]"].filter(Boolean).join(" ");return c.jsx("div",{className:l,children:t})}function r3({animateOnMount:n,children:e}){const[t,i]=p.useState(!n);return p.useEffect(()=>{if(!n)return;const a=requestAnimationFrame(()=>{i(!0)});return()=>cancelAnimationFrame(a)},[n]),c.jsx("div",{className:"will-change-[transform,opacity] transition-[transform,opacity] duration-160 ease-out motion-reduce:transition-none",style:{transform:t?"translateY(0px) scale(1) translateZ(0)":"translateY(-15px) scale(0.97) translateZ(0)",opacity:t?1:.92,transformOrigin:"top center"},children:e})}function s3({rows:n,isSmall:e,isLoading:t,teaserPlayback:i,teaserAudio:a,hoverTeaserKey:l,blurPreviews:u,durations:h,teaserKey:f,inlinePlay:g,deletingKeys:_,keepingKeys:S,removingKeys:C,swipeRefs:N,assetNonce:O,handleScrubberClickIndex:E,keyFor:B,baseName:H,modelNameFromOutput:Y,runtimeOf:U,sizeBytesOf:re,formatBytes:W,lower:X,onHoverPreviewKeyChange:R,onOpenPlayer:le,openPlayer:k,startInlineAt:j,startInline:Z,tryAutoplayInline:V,registerTeaserHost:ne,handleDuration:me,deleteVideo:ue,keepVideo:q,modelsByKey:P,activeTagSet:Q,onToggleTagFilter:te,onToggleHot:ge,onToggleFavorite:L,onToggleLike:xe,onToggleWatch:Te,enqueueDeleteVideo:ye,enqueueKeepVideo:be,enqueueToggleHot:mt}){const Ke=p.useCallback(Le=>{const ke=Le?.meta;if(!ke)return null;if(typeof ke=="string")try{return JSON.parse(ke)}catch{return null}return ke},[]),we=p.useCallback(Le=>{const ke=Ke(Le),Pe=(typeof ke?.videoWidth=="number"&&Number.isFinite(ke.videoWidth)?ke.videoWidth:0)||(typeof Le.videoWidth=="number"&&Number.isFinite(Le.videoWidth)?Le.videoWidth:0),et=(typeof ke?.videoHeight=="number"&&Number.isFinite(ke.videoHeight)?ke.videoHeight:0)||(typeof Le.videoHeight=="number"&&Number.isFinite(Le.videoHeight)?Le.videoHeight:0);return Pe>0&&et>0?{w:Pe,h:et}:null},[Ke]),Re=p.useCallback(Le=>{const ke=Ke(Le);let Pe=ke?.previewSprite??ke?.preview?.sprite??ke?.sprite??Le?.previewSprite??Le?.preview?.sprite??null;if(typeof Pe=="string")try{Pe=JSON.parse(Pe)}catch{Pe=null}const et=Number(Pe?.count??Pe?.frames??Pe?.imageCount),kt=Number(Pe?.stepSeconds??Pe?.step??Pe?.intervalSeconds);if(Number.isFinite(et)&&et>=2)return{count:Math.max(2,Math.floor(et)),stepSeconds:Number.isFinite(kt)&&kt>0?kt:5};const Lt=B(Le),pt=h[Lt]??(typeof Le?.durationSeconds=="number"?Le.durationSeconds:void 0);return typeof pt=="number"&&Number.isFinite(pt)&&pt>1?{count:Math.max(2,Math.min(240,Math.floor(pt/5)+1)),stepSeconds:5}:null},[Ke,B,h]),[ct,Oe]=p.useState({}),[je,Ue]=p.useState({}),[ze,gt]=p.useState(null),st=p.useCallback((Le,ke)=>{Oe(Pe=>{if(ke===void 0){if(!(Le in Pe))return Pe;const et={...Pe};return delete et[Le],et}return Pe[Le]===ke?Pe:{...Pe,[Le]:ke}})},[]),bt=p.useCallback(Le=>{st(Le,void 0)},[st]),Qe=p.useCallback((Le,ke)=>{Ue(Pe=>{if(ke===void 0){if(!(Le in Pe))return Pe;const et={...Pe};return delete et[Le],et}return Pe[Le]===ke?Pe:{...Pe,[Le]:ke}})},[]),Ye=(Le,ke)=>{const Pe=B(Le),et=g?.key===Pe,kt=ke?.disableInline?!1:et,pt=!(!ke?.forceStill&&!!a&&(kt||l===Pe)),Zt=kt?g?.nonce??0:0,qt=!!ke?.forceLoadStill,Gt=ke?.forceStill?!1:ke?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Pe:!1,wt=_.has(Pe)||S.has(Pe)||C.has(Pe),lt=Y(Le.output),Yt=H(Le.output||""),kn=$r(Yt.replace(/\.[^.]+$/,"")).trim(),pn=X(lt),xn=P[pn],rt=Ke(Le),M=Re(Le),F=ct[Pe],ie=je[Pe]===!0,De=e3(rt?.previewSprite?.path,rt?.previewSpritePath,xn?.previewScrubberPath,kn?`/api/preview-sprite/${encodeURIComponent(kn)}`:void 0),Ve=De?De.replace(/\/+$/,""):void 0,yt=rt?.previewSprite?.stepSeconds??rt?.previewSpriteStepSeconds,Vt=typeof yt=="number"&&Number.isFinite(yt)&&yt>0?yt:M?.stepSeconds&&M.stepSeconds>0?M.stepSeconds:t3,Jt=Np(rt?.durationSeconds)??Np(Le?.durationSeconds)??Np(h[Pe]),gn=typeof Jt=="number"&&Jt>0?Math.max(1,Math.min(200,Math.floor(Jt/Vt)+1)):void 0,ln=rt?.previewSprite?.count??rt?.previewSpriteCount??xn?.previewScrubberCount??gn,_n=rt?.previewSprite?.cols??rt?.previewSpriteCols,En=rt?.previewSprite?.rows??rt?.previewSpriteRows,Ut=typeof ln=="number"&&Number.isFinite(ln)?Math.max(0,Math.floor(ln)):0,[hn,cn]=Ut>1?n3(Ut):[0,0],en=Number(_n),zt=Number(En),Dt=Number.isFinite(en)&&Number.isFinite(zt)&&en>0&&zt>0&&!(Ut>1&&en===1&&zt===1)&&(Ut<=1||en*zt>=Ut),Ot=Dt?Math.floor(en):hn,Hn=Dt?Math.floor(zt):cn,Rt=(typeof rt?.updatedAtUnix=="number"&&Number.isFinite(rt.updatedAtUnix)?rt.updatedAtUnix:void 0)??(typeof rt?.fileModUnix=="number"&&Number.isFinite(rt.fileModUnix)?rt.fileModUnix:void 0)??O??0,qn=Ve&&Rt?`${Ve}?v=${encodeURIComponent(String(Rt))}`:Ve||void 0,_i=!!qn&&Ut>1,Mn=_i&&Ot>0&&Hn>0,Wt=_i?Ut:0,zn=_i?Vt:0,Kn=typeof F=="number"&&Wt>1?U1(F/(Wt-1),0,1):void 0,jn=Mn&&typeof F=="number"?(()=>{const vt=U1(F,0,Math.max(0,Ut-1)),fn=vt%Ot,Ne=Math.floor(vt/Ot),Tt=Ot<=1?0:fn/(Ot-1)*100,_t=Hn<=1?0:Ne/(Hn-1)*100;return{backgroundImage:`url("${qn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Ot*100}% ${Hn*100}%`,backgroundPosition:`${Tt}% ${_t}%`}})():void 0,Wn=ou(Yt),Cn=!!xn?.favorite,fi=xn?.liked===!0,Xn=!!xn?.watching,li=JN(xn?.tags),_e=U(Le),at=W(re(Le)),Ct=we(Le),St=hd(Ct),Pt=`inline-prev-${encodeURIComponent(Pe)}`,tn=["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200",!e&&"hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",wt&&"pointer-events-none opacity-70",_.has(Pe)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",S.has(Pe)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",C.has(Pe)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),wn=c.jsx("div",{role:"button",tabIndex:0,className:tn,onClick:e?void 0:()=>k(Le),onKeyDown:vt=>{(vt.key==="Enter"||vt.key===" ")&&(vt.preventDefault(),le(Le))},children:c.jsx(i3,{blurred:ke?.blur,animateUnblurOnMount:ke?.animateUnblurOnMount,children:c.jsxs(Ns,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:Pt,ref:ke?.disableInline||ke?.isDecorative?void 0:ne(Pe),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||ke?.disablePreviewHover?void 0:()=>{gt(Pe),R?.(Pe)},onMouseLeave:()=>{!e&&!ke?.disablePreviewHover&&R?.(null),gt(vt=>vt===Pe?null:vt),bt(Pe),Qe(Pe,!1)},onClick:vt=>{vt.preventDefault(),vt.stopPropagation(),!(e||ke?.disableInline)&&Z(Pe)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[kt?null:c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0 "+(kt?"opacity-0":"opacity-100"),children:c.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[_e,Ct?`${Ct.w}×${Ct.h}`:St||"",at].filter(Boolean).join(" • "),children:[c.jsx("span",{children:_e}),St?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,St?c.jsx("span",{children:St}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:at})]})}),c.jsx(xu,{job:Le,getFileName:vt=>$r(H(vt)),className:"h-full w-full",variant:"fill",durationSeconds:h[Pe]??Le?.durationSeconds,onDuration:me,showPopover:!1,blur:kt?!1:!!u,animated:Gt,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!ke?.disableInline&&kt?"always":!1,inlineNonce:Zt,inlineControls:kt,inlineLoop:!1,muted:pt,popoverMuted:pt,assetNonce:O??0,alwaysLoadStill:qt,teaserPreloadEnabled:ke?.mobileStackTopOnlyVideo||ke?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:ke?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:Kn,preferScrubProgress:ie&&typeof F=="number"}),Mn&&qn?c.jsx("img",{src:qn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Mn&&jn&&!kt?c.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:c.jsx("div",{className:"h-full w-full",style:jn})}):null,!ke?.isDecorative&&!ke?.disableScrubber&&!kt&&Wt>1&&ze===Pe?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),onMouseEnter:()=>Qe(Pe,!0),onMouseLeave:()=>{Qe(Pe,!1),st(Pe,void 0)},children:c.jsx(_y,{className:"pointer-events-auto px-1",imageCount:Wt,activeIndex:F,onActiveIndexChange:vt=>st(Pe,vt),onIndexClick:vt=>{if(e||ke?.disableInline){E(Le,vt,Wt);return}const fn=zn>0?vt*zn:0;if(j){j(Pe,fn,Pt),requestAnimationFrame(()=>{V(Pt)||requestAnimationFrame(()=>V(Pt))});return}Z(Pe),requestAnimationFrame(()=>{V(Pt)||requestAnimationFrame(()=>V(Pt))})},stepSeconds:zn})}):null]})}),c.jsxs("div",{className:"relative min-h-[112px] overflow-hidden px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:lt}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Wn?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:$r(Yt)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[Xn?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,fi?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Cn?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:Le,variant:"table",busy:wt,collapseToMenu:!0,compact:!1,isHot:Wn,isFavorite:Cn,isLiked:fi,isWatching:Xn,onToggleWatch:Te,onToggleFavorite:L,onToggleLike:xe,onToggleHot:ge,onKeep:q,onDelete:ue,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),children:c.jsx(dd,{rowKey:Pe,tags:li,activeTagSet:Q,lower:X,onToggleTagFilter:te})})]})]})})});return{k:Pe,j:Le,busy:wt,isHot:Wn,inlineDomId:Pt,cardInner:wn}},tt=3,$e=e?n.slice(0,tt):[],At=e?n.slice(tt,tt+4):[],he=15,Ie=Math.min($e.length,tt)-1;return c.jsxs("div",{className:"relative",children:[e?c.jsx("div",{className:"relative overflow-y-visible touch-pan-y",style:{overflowX:"clip"},children:n.length===0?null:c.jsxs("div",{className:"relative mx-auto w-full max-w-[560px] overflow-y-visible",style:{overflowX:"clip"},children:[c.jsx("div",{className:"relative overflow-visible",style:{paddingTop:Ie>0?`${Ie}px`:void 0},children:(()=>{const Le=$e,ke=Le[0],Pe=Le.slice(1);return c.jsxs(c.Fragment,{children:[Pe.map((et,kt)=>{const Lt=kt+1,{k:pt,cardInner:Zt}=Ye(et,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),qt=Lt,Gt=-(qt*he),wt=1-qt*.03,lt=1-qt*.14;return c.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none will-change-[transform,opacity] transition-[transform,opacity] duration-220 ease-out motion-reduce:transition-none",style:{zIndex:20-qt,transform:`translateY(${Gt}px) scale(${wt}) translateZ(0)`,opacity:lt,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[Zt,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},pt)}).reverse(),ke?(()=>{const et=ke,{k:kt,busy:Lt,isHot:pt,cardInner:Zt,inlineDomId:qt}=Ye(et,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(r3,{animateOnMount:!0,children:c.jsx(GN,{ref:Gt=>{Gt?N.current.set(kt,Gt):N.current.delete(kt)},enabled:!0,disabled:Lt,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!pt){if(mt){mt(et);return}await ge?.(et)}},onTap:()=>{Z(kt),requestAnimationFrame(()=>{V(qt)||requestAnimationFrame(()=>V(qt))})},onSwipeLeft:()=>ye?ye(et):ue(et),onSwipeRight:()=>be?be(et):q(et),children:Zt})})},kt)})():null]})})()}),At.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:At.map(Le=>{const ke=B(Le);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(xu,{job:Le,getFileName:H,className:"h-full w-full",showPopover:!1,blur:!!u,animated:!1,teaserPreloadEnabled:!0,teaserPreloadRootMargin:"1200px 0px",animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!1,inlineControls:!1,inlineLoop:!1,muted:!0,popoverMuted:!0,assetNonce:O??0,alwaysLoadStill:!0})},`preload-still-${ke}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Le=>{const{k:ke,cardInner:Pe}=Ye(Le);return c.jsx(p.Fragment,{children:Pe},ke)})}),t&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function a3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const o3=p.forwardRef(a3);function l3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const u3=p.forwardRef(l3);function c3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const d3=p.forwardRef(c3);function h3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const z1=p.forwardRef(h3);function Fr(...n){return n.filter(Boolean).join(" ")}function $1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function f3(n){return n==="center"?"justify-center":n==="right"?"justify-end":"justify-start"}function H1(n,e){const t=n===0,i=n===e-1;return t||i?"pl-2 pr-2":"px-2"}function q1(n){return n==null?{isNull:!0,kind:"string",value:""}:n instanceof Date?{isNull:!1,kind:"number",value:n.getTime()}:typeof n=="number"?{isNull:!1,kind:"number",value:n}:typeof n=="boolean"?{isNull:!1,kind:"number",value:n?1:0}:typeof n=="bigint"?{isNull:!1,kind:"number",value:Number(n)}:{isNull:!1,kind:"string",value:String(n).toLocaleLowerCase()}}function td({columns:n,rows:e,getRowKey:t,title:i,description:a,actions:l,fullWidth:u=!1,card:h=!0,striped:f=!1,stickyHeader:g=!1,compact:_=!1,isLoading:S=!1,emptyLabel:C="Keine Daten vorhanden.",className:N,rowClassName:O,onRowClick:E,onRowContextMenu:B,sort:H,onSortChange:Y,defaultSort:U=null}){const re=_?"py-2":"py-4",W=_?"py-3":"py-3.5",X=H!==void 0,[R,le]=p.useState(U),k=X?H:R,j=p.useCallback(V=>{X||le(V),Y?.(V)},[X,Y]),Z=p.useMemo(()=>{if(!k)return e;const V=n.find(ue=>ue.key===k.key);if(!V)return e;const ne=k.direction==="asc"?1:-1,me=e.map((ue,q)=>({r:ue,i:q}));return me.sort((ue,q)=>{let P=0;if(V.sortFn)P=V.sortFn(ue.r,q.r);else{const Q=V.sortValue?V.sortValue(ue.r):ue.r?.[V.key],te=V.sortValue?V.sortValue(q.r):q.r?.[V.key],ge=q1(Q),L=q1(te);ge.isNull&&!L.isNull?P=1:!ge.isNull&&L.isNull?P=-1:ge.kind==="number"&&L.kind==="number"?P=ge.value<L.value?-1:ge.value>L.value?1:0:P=String(ge.value).localeCompare(String(L.value),void 0,{numeric:!0})}return P===0?ue.i-q.i:P*ne}),me.map(ue=>ue.r)},[e,n,k]);return c.jsxs("div",{className:Fr(u?"":"px-4 sm:px-6 lg:px-8",N),children:[(i||a||l)&&c.jsxs("div",{className:"sm:flex sm:items-center",children:[c.jsxs("div",{className:"sm:flex-auto",children:[i&&c.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-white",children:i}),a&&c.jsx("p",{className:"mt-2 text-sm text-gray-700 dark:text-gray-300",children:a})]}),l&&c.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-16 sm:flex-none",children:l})]}),c.jsx("div",{className:Fr(i||a||l?"mt-8":""),children:c.jsx("div",{className:"flow-root",children:c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:Fr("inline-block min-w-full align-middle",u?"":"sm:px-6 lg:px-8"),children:c.jsx("div",{className:Fr(h&&"overflow-hidden shadow-sm outline-1 outline-black/5 rounded-lg dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"),children:c.jsxs("table",{className:"relative min-w-full divide-y divide-gray-200 dark:divide-white/10",children:[c.jsx("thead",{className:Fr(h&&"bg-gray-50/90 dark:bg-gray-800/70",g&&"sticky top-0 z-10 backdrop-blur-sm shadow-sm"),children:c.jsx("tr",{children:n.map((V,ne)=>{const me=H1(ne,n.length),ue=!!k&&k.key===V.key,q=ue?k.direction:void 0,P=V.sortable&&!V.srOnlyHeader?ue?q==="asc"?"ascending":"descending":"none":void 0,Q=()=>{if(!(!V.sortable||V.srOnlyHeader))return j(ue?q==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":P,className:Fr(W,me,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",$1(V.align),V.widthClassName,V.headerClassName),children:V.srOnlyHeader?c.jsx("span",{className:"sr-only",children:V.header}):V.sortable?c.jsxs("button",{type:"button",onClick:Q,className:Fr("group inline-flex w-full items-center gap-2 select-none rounded-md px-1.5 py-1 -my-1 hover:bg-gray-100/70 dark:hover:bg-white/5",f3(V.align)),children:[c.jsx("span",{children:V.header}),c.jsx("span",{className:Fr("flex-none rounded-sm text-gray-400 dark:text-gray-500",ue?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(o3,{"aria-hidden":"true",className:Fr("size-5 transition-transform",ue&&q==="asc"&&"rotate-180")})})]}):V.header},V.key)})})}),c.jsx("tbody",{className:Fr("divide-y divide-gray-200 dark:divide-white/10",h?"bg-white dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),children:S?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(re,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):Z.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(re,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:C})}):Z.map((V,ne)=>{const me=t?t(V,ne):String(ne);return c.jsx("tr",{className:Fr(f&&"even:bg-gray-50 dark:even:bg-gray-800/50",E&&"cursor-pointer",E&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",O?.(V,ne)),onClick:()=>E?.(V),onContextMenu:B?ue=>{ue.preventDefault(),B(V,ue)}:void 0,children:n.map((ue,q)=>{const P=H1(q,n.length),Q=ue.cell?.(V,ne)??ue.accessor?.(V)??V?.[ue.key];return c.jsx("td",{className:Fr(re,P,"text-sm whitespace-nowrap",$1(ue.align),ue.className,ue.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Q},ue.key)})},me)})})]})})})})})})]})}function m3({rows:n,isLoading:e,keyFor:t,baseName:i,lower:a,modelNameFromOutput:l,runtimeOf:u,sizeBytesOf:h,formatBytes:f,resolutions:g,durations:_,canHover:S,teaserAudio:C,hoverTeaserKey:N,setHoverTeaserKey:O,teaserPlayback:E="hover",teaserKey:B,registerTeaserHost:H,handleDuration:Y,handleResolution:U,blurPreviews:re,assetNonce:W,deletingKeys:X,keepingKeys:R,removingKeys:le,modelsByKey:k,activeTagSet:j,onToggleTagFilter:Z,onOpenPlayer:V,onSortModeChange:ne,page:me,onPageChange:ue,onToggleHot:q,onToggleFavorite:P,onToggleLike:Q,onToggleWatch:te,deleteVideo:ge,keepVideo:L,enqueueDeleteVideo:xe,enqueueKeepVideo:Te,enqueueToggleHot:ye}){const[be,mt]=p.useState(null),Ke=p.useCallback(Qe=>{const Ye=Qe?.durationSeconds;if(typeof Ye=="number"&&Number.isFinite(Ye)&&Ye>0)return Ye;const tt=Date.parse(String(Qe?.startedAt||"")),$e=Date.parse(String(Qe?.endedAt||""));if(Number.isFinite(tt)&&Number.isFinite($e)&&$e>tt){const ht=($e-tt)/1e3;if(ht>=1&&ht<=1440*60)return ht}return Number.POSITIVE_INFINITY},[]),we=p.useCallback(Qe=>{const Ye=String(Qe??"").trim();if(!Ye)return[];const tt=Ye.split(/[\n,;|]+/g).map(At=>At.trim()).filter(Boolean),$e=new Set,ht=[];for(const At of tt){const he=At.toLowerCase();$e.has(he)||($e.add(he),ht.push(At))}return ht.sort((At,he)=>At.localeCompare(he,void 0,{sensitivity:"base"})),ht},[]),Re=p.useCallback(Qe=>{const Ye=Qe?.meta;if(!Ye)return null;if(typeof Ye=="string")try{return JSON.parse(Ye)}catch{return null}return Ye},[]),ct=p.useCallback(Qe=>{const Ye=Re(Qe);let tt=Ye?.previewSprite??Ye?.preview?.sprite??null;if(typeof tt=="string")try{tt=JSON.parse(tt)}catch{tt=null}const $e=Number(tt?.count),ht=Number(tt?.stepSeconds);return!Number.isFinite($e)||$e<2?null:{count:Math.max(2,Math.floor($e)),stepSeconds:Number.isFinite(ht)&&ht>0?ht:5}},[Re]),[Oe,je]=p.useState({}),Ue=p.useCallback((Qe,Ye)=>{je(tt=>tt[Qe]===Ye?tt:{...tt,[Qe]:Ye})},[]),ze=p.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Qe=>{const Ye=t(Qe),$e=!(!!C&&N===Ye),ht=ct(Qe),At=Oe[Ye],he=i(Qe.output||""),Ie=$r(he.replace(/\.[^.]+$/,"")).trim(),Le=ht&&typeof At=="number"?Math.max(0,At*ht.stepSeconds):void 0,ke=Ie&&typeof Le=="number"?`/api/preview?id=${encodeURIComponent(Ie)}&t=${Le.toFixed(3)}&v=${W??0}`:"";return c.jsxs("div",{ref:H(Ye),className:"group relative py-1",onClick:Pe=>Pe.stopPropagation(),onMouseDown:Pe=>Pe.stopPropagation(),onMouseEnter:()=>{S&&O(Ye)},onMouseLeave:()=>{S&&O(null),Ue(Ye,void 0)},children:[c.jsx(xu,{job:Qe,getFileName:i,durationSeconds:_[Ye],muted:$e,popoverMuted:$e,onDuration:Y,onResolution:U,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:re,animated:E==="all"?!0:E==="hover"?B===Ye:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:W}),ht&&typeof At=="number"&&ke?c.jsx("img",{src:ke,alt:"","aria-hidden":"true",className:"pointer-events-none absolute left-0 top-1 z-[15] h-16 w-28 rounded-md object-cover ring-1 ring-black/5 dark:ring-white/10",draggable:!1}):null]})}},{key:"Model",header:"Model",sortable:!0,sortValue:Qe=>{const Ye=i(Qe.output||""),tt=ou(Ye),$e=l(Qe.output),ht=$r(Ye);return`${$e} ${tt?"HOT":""} ${ht}`.trim()},cell:Qe=>{const Ye=i(Qe.output||""),tt=ou(Ye),$e=$r(Ye),ht=l(Qe.output),At=a(l(Qe.output)),he=we(k[At]?.tags);return c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:ht}),c.jsxs("div",{className:"mt-0.5 min-w-0 text-xs text-gray-500 dark:text-gray-400",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"truncate",title:$e,children:$e||"—"}),(()=>{const Ie=t(Qe),Le=g[Ie]??null,ke=hd(Le);return ke?c.jsx("span",{className:`shrink-0 rounded-md bg-gray-100 px-1.5 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200\r
dark:bg-white/5 dark:text-gray-200 dark:ring-white/10`,title:Le?`${Le.w}×${Le.h}`:"Auflösung",children:ke}):null})(),tt?c.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[11px] font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null]}),he.length>0?c.jsx("div",{className:"mt-1",onClick:Ie=>Ie.stopPropagation(),onMouseDown:Ie=>Ie.stopPropagation(),children:c.jsx(dd,{rowKey:t(Qe),tags:he,activeTagSet:j,lower:a,onToggleTagFilter:Z,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Qe=>{const Ye=Date.parse(String(Qe.endedAt||""));return Number.isFinite(Ye)?Ye:Number.NEGATIVE_INFINITY},cell:Qe=>{const Ye=Date.parse(String(Qe.endedAt||""));if(!Number.isFinite(Ye))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const tt=new Date(Ye),$e=tt.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),ht=tt.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:tt.toISOString(),title:`${$e} ${ht}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[c.jsx("span",{className:"font-medium",children:$e}),c.jsx("span",{className:"mx-1 text-gray-400 dark:text-gray-600",children:"·"}),c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:ht})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Qe=>Ke(Qe),cell:Qe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(Qe)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Qe=>{const Ye=h(Qe);return typeof Ye=="number"?Ye:Number.NEGATIVE_INFINITY},cell:Qe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(Qe))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Qe=>{const Ye=t(Qe),tt=X.has(Ye)||R.has(Ye)||le.has(Ye),$e=i(Qe.output||""),ht=ou($e),At=a(l(Qe.output)),he=k[At],Ie=!!he?.favorite,Le=he?.liked===!0,ke=!!he?.watching;return c.jsx(Ds,{job:Qe,variant:"table",busy:tt,isHot:ht,isFavorite:Ie,isLiked:Le,isWatching:ke,onToggleWatch:te,onToggleFavorite:P,onToggleLike:Q,onToggleHot:q?async Pe=>{if(!(ye&&ye(Pe)))return q(Pe)}:void 0,onKeep:async Pe=>Te&&Te(Pe)?!0:L(Pe),onDelete:async Pe=>xe&&xe(Pe)?!0:ge(Pe),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,_,C,N,H,S,O,Y,U,re,E,B,W,a,l,k,j,Z,g,X,R,le,ct,Oe,Ue,te,P,Q,q,L,ge,h,f,u,we,Ke]),gt=p.useCallback(Qe=>{if(!Qe)return"completed_desc";const Ye=Qe,tt=String(Ye.key??Ye.columnKey??Ye.id??""),$e=String(Ye.dir??Ye.direction??Ye.order??"").toLowerCase(),ht=$e==="asc"||$e==="1"||$e==="true";return tt==="completedAt"?ht?"completed_asc":"completed_desc":tt==="runtime"?ht?"duration_asc":"duration_desc":tt==="size"?ht?"size_asc":"size_desc":tt==="Model"||tt==="video"?ht?"file_asc":"file_desc":ht?"completed_asc":"completed_desc"},[]),st=p.useCallback(Qe=>{mt(Qe),ne(gt(Qe)),me!==1&&ue(1)},[ne,gt,me,ue]),bt=p.useCallback(Qe=>{const Ye=t(Qe);return["transition-all duration-300",(X.has(Ye)||le.has(Ye))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",X.has(Ye)&&"animate-pulse",(R.has(Ye)||le.has(Ye))&&"pointer-events-none",R.has(Ye)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",le.has(Ye)&&"opacity-0"].filter(Boolean).join(" ")},[t,X,R,le]);return c.jsxs("div",{className:"relative",children:[c.jsx(td,{rows:n,columns:ze,getRowKey:Qe=>t(Qe),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:be,onSortChange:st,onRowClick:V,rowClassName:bt}),e&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function V1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function p3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function Dp(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function G1(n,e,t){return Math.max(e,Math.min(t,n))}const g3=5;function y3(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function b3({rows:n,isLoading:e,blurPreviews:t,durations:i,teaserPlayback:a,teaserAudio:l,hoverTeaserKey:u,teaserKey:h,handleDuration:f,handleScrubberClickIndex:g,keyFor:_,baseName:S,modelNameFromOutput:C,runtimeOf:N,sizeBytesOf:O,formatBytes:E,deletingKeys:B,keepingKeys:H,removingKeys:Y,deletedKeys:U,registerTeaserHost:re,onHoverPreviewKeyChange:W,onOpenPlayer:X,deleteVideo:R,keepVideo:le,onToggleHot:k,lower:j,modelsByKey:Z,activeTagSet:V,onToggleTagFilter:ne,onToggleFavorite:me,onToggleLike:ue,onToggleWatch:q,enqueueDeleteVideo:P,enqueueKeepVideo:Q,enqueueToggleHot:te}){const ge=a==="hover"||a==="all",L=p.useCallback(je=>Ue=>{if(!ge){re(je)(null);return}re(je)(Ue)},[re,ge]),xe=je=>{const Ue=String(je??"").trim();if(!Ue)return[];const ze=Ue.split(/[\n,;|]+/g).map(bt=>bt.trim()).filter(Boolean),gt=new Set,st=[];for(const bt of ze){const Qe=bt.toLowerCase();gt.has(Qe)||(gt.add(Qe),st.push(bt))}return st},Te=p.useCallback(je=>{const Ue=(typeof je?.meta?.videoWidth=="number"&&Number.isFinite(je.meta.videoWidth)?je.meta.videoWidth:0)||(typeof je?.videoWidth=="number"&&Number.isFinite(je.videoWidth)?je.videoWidth:0),ze=(typeof je?.meta?.videoHeight=="number"&&Number.isFinite(je.meta.videoHeight)?je.meta.videoHeight:0)||(typeof je?.videoHeight=="number"&&Number.isFinite(je.videoHeight)?je.videoHeight:0);return Ue>0&&ze>0?{w:Ue,h:ze}:null},[]),[ye,be]=p.useState(null),[mt,Ke]=p.useState({}),[we,Re]=p.useState(null),ct=p.useCallback((je,Ue)=>{Ke(ze=>{if(Ue===void 0){if(!(je in ze))return ze;const gt={...ze};return delete gt[je],gt}return ze[je]===Ue?ze:{...ze,[je]:Ue}})},[]),Oe=p.useCallback(je=>{ct(je,void 0)},[ct]);return c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:n.map(je=>{const Ue=_(je),gt=!(!!l&&u===Ue),st=C(je.output),bt=j(st),Qe=Z[bt],Ye=!!Qe?.favorite,tt=Qe?.liked===!0,$e=!!Qe?.watching,ht=xe(Qe?.tags),At=S(je.output||""),he=ou(At),Ie=$r(At),Le=N(je),ke=E(O(je)),Pe=Te(je),et=hd(Pe),kt=B.has(Ue)||H.has(Ue)||Y.has(Ue),Lt=U.has(Ue),pt=V1(Qe?.image,Qe?.imageUrl,je?.meta?.modelImage,je?.meta?.modelImageUrl),qt=$r(S(je.output||"")).replace(/\.[^.]+$/,"").trim(),Gt=p3(je?.meta),wt=V1(Gt?.previewSprite?.path,Gt?.previewSpritePath,Qe?.previewScrubberPath,qt?`/api/preview-sprite/${encodeURIComponent(qt)}`:void 0),lt=wt?wt.replace(/\/+$/,""):void 0,Yt=Gt?.previewSprite?.stepSeconds??Gt?.previewSpriteStepSeconds,kn=typeof Yt=="number"&&Number.isFinite(Yt)&&Yt>0?Yt:g3,pn=Dp(Gt?.durationSeconds)??Dp(je?.durationSeconds)??Dp(i[Ue]),xn=typeof pn=="number"&&pn>0?Math.max(1,Math.min(200,Math.floor(pn/kn)+1)):void 0,rt=Gt?.previewSprite?.count??Gt?.previewSpriteCount??Qe?.previewScrubberCount??xn,M=Gt?.previewSprite?.cols??Gt?.previewSpriteCols,F=Gt?.previewSprite?.rows??Gt?.previewSpriteRows,ie=typeof rt=="number"&&Number.isFinite(rt)?Math.max(0,Math.floor(rt)):0,[De,Ve]=ie>1?y3(ie):[0,0],yt=typeof M=="number"&&Number.isFinite(M)?Math.max(0,Math.floor(M)):De,Vt=typeof F=="number"&&Number.isFinite(F)?Math.max(0,Math.floor(F)):Ve,Jt=(typeof Gt?.updatedAtUnix=="number"&&Number.isFinite(Gt.updatedAtUnix)?Gt.updatedAtUnix:void 0)??(typeof Gt?.fileModUnix=="number"&&Number.isFinite(Gt.fileModUnix)?Gt.fileModUnix:void 0)??0,gn=lt&&Jt?`${lt}?v=${encodeURIComponent(String(Jt))}`:lt||void 0,ln=!!gn&&ie>1,_n=ln&&yt>0&&Vt>0,En=ln?ie:0,Ut=ln?kn:0,hn=ln,cn=mt[Ue],en=typeof cn=="number"&&En>1?G1(cn/(En-1),0,1):void 0,zt=_n&&typeof cn=="number"?(()=>{const Rt=G1(cn,0,Math.max(0,ie-1)),qn=Rt%yt,_i=Math.floor(Rt/yt),Mn=yt<=1?0:qn/(yt-1)*100,Wt=Vt<=1?0:_i/(Vt-1)*100;return{backgroundImage:`url("${gn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${yt*100}% ${Vt*100}%`,backgroundPosition:`${Mn}% ${Wt}%`}})():void 0,Dt=ye===Ue&&!!pt,Ot=!Dt&&!!zt,Hn=Dt||Ot;return c.jsxs("div",{role:"button",tabIndex:0,className:["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",kt&&"pointer-events-none opacity-70",B.has(Ue)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",Y.has(Ue)&&"opacity-0 translate-y-2 scale-[0.98]",Lt&&"hidden"].filter(Boolean).join(" "),onClick:()=>X(je),onKeyDown:Rt=>{(Rt.key==="Enter"||Rt.key===" ")&&X(je)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:L(Ue),onMouseEnter:()=>{Re(Ue),W?.(Ue)},onMouseLeave:()=>{Re(Rt=>Rt===Ue?null:Rt),W?.(null),Oe(Ue),be(Rt=>Rt===Ue?null:Rt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:je,getFileName:Rt=>$r(S(Rt)),durationSeconds:i[Ue]??je?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Hn?!1:a==="all"?!0:a==="hover"?h===Ue:!1,animatedMode:"teaser",animatedTrigger:"always",muted:gt,popoverMuted:gt,scrubProgressRatio:en,preferScrubProgress:typeof cn=="number"})}),_n&&gn?c.jsx("img",{src:gn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Ot&&zt?c.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:c.jsx("div",{className:"h-full w-full",style:zt})}):null,Dt&&pt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:pt,alt:st?`${st} preview`:"Model preview",className:"h-full w-full object-cover",draggable:!1}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/65 to-transparent px-2 py-1.5",children:c.jsx("div",{className:"text-[10px] font-semibold tracking-wide text-white/95",children:"MODEL PREVIEW"})})]}):null,hn&&we===Ue?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx(_y,{className:"pointer-events-auto px-1",imageCount:En,activeIndex:cn,onActiveIndexChange:Rt=>ct(Ue,Rt),onIndexClick:Rt=>{ct(Ue,Rt),g(je,Rt,En)},stepSeconds:Ut})}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",children:c.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Le,Pe?`${Pe.w}×${Pe.h}`:et||"",ke].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Le}),et?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,et?c.jsx("span",{children:et}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:ke})]})})]})}),c.jsxs("div",{className:"relative min-h-[118px] px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[he?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:$r(Ie)||"—",children:$r(Ie)||"—"})]})}),c.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"min-w-0",children:c.jsx("span",{className:["block truncate text-xs text-gray-500 dark:text-gray-400",pt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:pt?`${st} (Hover: Model-Preview)`:st,onMouseEnter:Rt=>{Rt.stopPropagation(),pt&&be(Ue)},onMouseLeave:Rt=>{Rt.stopPropagation(),be(qn=>qn===Ue?null:qn)},onMouseDown:Rt=>Rt.stopPropagation(),onClick:Rt=>Rt.stopPropagation(),children:st||"—"})}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[$e?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,tt?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Ye?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:je,variant:"table",busy:kt,collapseToMenu:!0,compact:!0,isHot:he,isFavorite:Ye,isLiked:tt,isWatching:$e,onToggleWatch:q,onToggleFavorite:me,onToggleLike:ue,onToggleHot:async Rt=>{if(!(te&&te(Rt)))return k(Rt)},onKeep:async Rt=>Q&&Q(Rt)?!0:le(Rt),onDelete:async Rt=>P&&P(Rt)?!0:R(Rt),order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx(dd,{rowKey:Ue,tags:ht,activeTagSet:V,lower:j,onToggleTagFilter:ne})})]})]},Ue)})}),e&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function K1(n,e,t){return Math.max(e,Math.min(t,n))}function Mp(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function v3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=Mp(a,Math.min(t,l)),h=Mp(Math.max(l-t+1,t+1),l),f=Math.max(Math.min(e-i,l-t-i*2-1),t+1),g=Math.min(Math.max(e+i,t+i*2+2),l-t),_=[];_.push(...u),f>t+1?_.push("ellipsis"):t+1<l-t&&_.push(t+1),_.push(...Mp(f,g)),g<l-t?_.push("ellipsis"):l-t>t&&_.push(l-t),_.push(...h);const S=new Set;return _.filter(C=>{const N=String(C);return S.has(N)?!1:(S.add(N),!0)})}function x3({active:n,disabled:e,rounded:t,onClick:i,children:a,title:l}){const u=t==="l"?"rounded-l-md":t==="r"?"rounded-r-md":"";return c.jsx("button",{type:"button",disabled:e,onClick:e?void 0:i,title:l,className:on("relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:z-20 focus:outline-offset-0",u,e?"opacity-50 cursor-not-allowed":"cursor-pointer",n?"z-10 bg-indigo-600 text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:bg-indigo-500 dark:focus-visible:outline-indigo-500":"text-gray-900 inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:text-gray-200 dark:inset-ring-gray-700 dark:hover:bg-white/5"),"aria-current":n?"page":void 0,children:a})}function kf({page:n,pageSize:e,totalItems:t,onPageChange:i,siblingCount:a=1,boundaryCount:l=1,showSummary:u=!0,className:h,ariaLabel:f="Pagination",prevLabel:g="Previous",nextLabel:_="Next"}){const S=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),C=K1(n||1,1,S);if(S<=1)return null;const N=t===0?0:(C-1)*e+1,O=Math.min(C*e,t),E=v3(S,C,l,a),B=H=>i(K1(H,1,S));return c.jsxs("div",{className:on("flex items-center justify-between bg-white dark:border-white/10 dark:bg-transparent",h),children:[c.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[c.jsx("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:g}),c.jsx("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:_})]}),c.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[c.jsx("div",{children:u?c.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300 px-2",children:["Showing ",c.jsx("span",{className:"font-medium",children:N})," to"," ",c.jsx("span",{className:"font-medium",children:O})," of"," ",c.jsx("span",{className:"font-medium",children:t})," results"]}):null}),c.jsx("div",{children:c.jsxs("nav",{"aria-label":f,className:"isolate inline-flex -space-x-px rounded-md shadow-xs dark:shadow-none",children:[c.jsxs("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:g}),c.jsx(u3,{"aria-hidden":"true",className:"size-5"})]}),E.map((H,Y)=>H==="ellipsis"?c.jsx("span",{className:"relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 inset-ring inset-ring-gray-300 dark:text-gray-400 dark:inset-ring-gray-700",children:"…"},`e-${Y}`):c.jsx(x3,{active:H===C,onClick:()=>B(H),rounded:"none",children:H},H)),c.jsxs("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:_}),c.jsx(d3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Bw=p.createContext(null),jp=220;function _3(n){switch(n){case"success":return{Icon:$A,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:wN,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:WA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:tN,cls:"text-sky-600 dark:text-sky-400"}}}function w3(n){switch(n){case"success":return"border-emerald-200/80 dark:border-emerald-400/20";case"error":return"border-rose-200/80 dark:border-rose-400/20";case"warning":return"border-amber-200/80 dark:border-amber-400/20";default:return"border-sky-200/80 dark:border-sky-400/20"}}function T3(n){switch(n){case"success":return{line:"bg-emerald-500 dark:bg-emerald-400",progressTrack:"bg-emerald-500/10 dark:bg-emerald-400/10",progressFill:"bg-emerald-500/70 dark:bg-emerald-400/70",iconBg:"bg-emerald-50 dark:bg-emerald-400/10"};case"error":return{line:"bg-rose-500 dark:bg-rose-400",progressTrack:"bg-rose-500/10 dark:bg-rose-400/10",progressFill:"bg-rose-500/70 dark:bg-rose-400/70",iconBg:"bg-rose-50 dark:bg-rose-400/10"};case"warning":return{line:"bg-amber-500 dark:bg-amber-400",progressTrack:"bg-amber-500/10 dark:bg-amber-400/10",progressFill:"bg-amber-500/70 dark:bg-amber-400/70",iconBg:"bg-amber-50 dark:bg-amber-400/10"};default:return{line:"bg-sky-500 dark:bg-sky-400",progressTrack:"bg-sky-500/10 dark:bg-sky-400/10",progressFill:"bg-sky-500/70 dark:bg-sky-400/70",iconBg:"bg-sky-50 dark:bg-sky-400/10"}}}function S3(n){switch(n){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function k3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function E3({children:n,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[a,l]=p.useState([]),[u,h]=p.useState(!0),f=p.useRef({}),g=p.useRef({}),_=p.useRef({}),S=p.useRef({}),C=p.useRef({}),N=p.useCallback(k=>{const j=f.current[k];j&&(window.clearTimeout(j),delete f.current[k]);const Z=g.current[k];Z&&(window.clearTimeout(Z),delete g.current[k]),delete _.current[k],delete S.current[k],delete C.current[k]},[]),O=p.useCallback(async()=>{try{const k=await fetch("/api/settings",{cache:"no-store"});if(!k.ok)return;const j=await k.json();h(!!(j?.enableNotifications??!0))}catch{}},[]);p.useEffect(()=>{O();const k=()=>O();return window.addEventListener("recorder-settings-updated",k),()=>window.removeEventListener("recorder-settings-updated",k)},[O]),p.useEffect(()=>{u||(l(j=>j.map(Z=>Z.type==="error"?Z:{...Z,open:!1})),a.filter(j=>j.type!=="error").map(j=>j.id).forEach(j=>{N(j),g.current[j]=window.setTimeout(()=>{l(Z=>Z.filter(V=>V.id!==j)),delete g.current[j]},jp)}))},[u]);const E=p.useCallback(k=>{l(j=>j.map(Z=>Z.id===k?{...Z,open:!1}:Z)),N(k),g.current[k]=window.setTimeout(()=>{l(j=>j.filter(Z=>Z.id!==k)),delete g.current[k]},jp)},[N]),B=p.useCallback(()=>{l(k=>k.map(j=>({...j,open:!1}))),Object.keys(f.current).forEach(k=>{window.clearTimeout(f.current[k]),delete f.current[k]}),Object.keys(g.current).forEach(k=>{window.clearTimeout(g.current[k]),delete g.current[k]}),window.setTimeout(()=>l([]),jp)},[]),H=p.useCallback((k,j)=>{if(!j||j<=0)return;const Z=f.current[k];Z&&(window.clearTimeout(Z),delete f.current[k]),_.current[k]=Date.now(),S.current[k]=j,C.current[k]=!1,f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]),Y=p.useCallback(k=>{if(!u&&k.type!=="error")return"";const j=k3(),Z=k.durationMs??t;return l(V=>{const ne=[{...k,id:j,durationMs:Z,open:!0},...V],me=Math.max(1,e),ue=ne.slice(0,me);return ne.slice(me).forEach(P=>N(P.id)),ue}),Z&&Z>0&&H(j,Z),j},[t,e,u,N,H]),U=p.useCallback(k=>{if(C.current[k])return;const j=f.current[k];if(!j)return;window.clearTimeout(j),delete f.current[k];const Z=_.current[k]??Date.now(),V=S.current[k]??0,ne=Date.now()-Z,me=Math.max(0,V-ne);S.current[k]=me,C.current[k]=!0},[]),re=p.useCallback(k=>{if(!C.current[k])return;const j=S.current[k]??0;if(j<=0){E(k);return}C.current[k]=!1,_.current[k]=Date.now(),f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]);p.useEffect(()=>()=>{Object.values(f.current).forEach(k=>window.clearTimeout(k)),Object.values(g.current).forEach(k=>window.clearTimeout(k))},[]);const W=p.useMemo(()=>({push:Y,remove:E,clear:B}),[Y,E,B]),X=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",R=i.endsWith("left")?"sm:items-start":"sm:items-end",le=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return c.jsxs(Bw.Provider,{value:W,children:[n,c.jsx("style",{children:`
@keyframes toast-progress {
from { transform: scaleX(1); }
to { transform: scaleX(0); }
}
.toast-progress-bar {
animation-name: toast-progress;
animation-timing-function: linear;
animation-fill-mode: forwards;
transform-origin: left center;
will-change: transform;
}
`}),c.jsx("div",{"aria-live":"assertive",className:["pointer-events-none fixed z-[80] inset-x-0",le].join(" "),children:c.jsx("div",{className:["flex w-full px-3 py-4 sm:px-6 sm:py-6",X].join(" "),children:c.jsx("div",{className:["flex w-full flex-col gap-2.5 sm:gap-3",R].join(" "),children:a.map(k=>{const{Icon:j,cls:Z}=_3(k.type),V=T3(k.type),ne=(k.title||"").trim()||S3(k.type),me=(k.message||"").trim(),ue=(k.imageUrl||"").trim(),q=(k.imageAlt||ne).trim(),P=typeof k.onClick=="function";return c.jsx(Jc,{appear:!0,show:k.open,enter:"transform transition ease-out duration-250",enterFrom:"opacity-0 -translate-y-3 sm:-translate-y-2",enterTo:"opacity-100 translate-y-0",leave:"transform transition ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-2 sm:-translate-y-3",children:c.jsx("div",{role:P?"button":"status",className:["pointer-events-auto relative w-[22rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-xl","border bg-white dark:bg-slate-900","shadow-sm","ring-1 ring-black/5 dark:ring-white/5",P?"cursor-pointer transition-[box-shadow,transform,background-color] duration-150 hover:bg-gray-50 dark:hover:bg-slate-800/90 hover:shadow-lg hover:ring-black/10 dark:hover:ring-white/10 active:scale-[0.998]":"",w3(k.type)].join(" "),onMouseEnter:()=>U(k.id),onMouseLeave:()=>re(k.id),onFocus:()=>U(k.id),onBlur:()=>re(k.id),onClick:()=>{k.onClick&&(k.onClick(),k.closeOnClick!==!1&&E(k.id))},onKeyDown:Q=>{k.onClick&&(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),k.onClick(),k.closeOnClick!==!1&&E(k.id))},tabIndex:P?0:void 0,"aria-label":P?`${ne} öffnen`:void 0,children:ue?c.jsxs("div",{className:"relative pr-12 sm:pr-14",children:[c.jsxs("div",{className:"flex items-stretch",children:[c.jsx("div",{className:"shrink-0",children:c.jsx("img",{src:ue,alt:q,loading:"lazy",referrerPolicy:"no-referrer",className:["h-full min-h-[72px] w-16 sm:w-[72px]","object-cover object-center","rounded-l-xl","border-r border-black/5 dark:border-white/10","bg-gray-100 dark:bg-white/5"].join(" ")})}),c.jsxs("div",{className:"min-w-0 flex-1 py-3 pl-3 pr-2 sm:py-3.5 sm:pl-3.5 sm:pr-3",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:Q=>{Q.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(z1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]}):c.jsxs("div",{className:"relative pr-12 py-2.5 sm:pr-14",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 sm:px-3.5",children:[c.jsx("div",{className:"shrink-0",children:c.jsx("div",{className:["inline-flex h-12 w-12 sm:h-14 sm:w-14 items-center justify-center rounded-full",V.iconBg,"ring-1 ring-black/5 dark:ring-white/10"].join(" "),children:c.jsx(j,{className:["size-5.5 sm:size-6",Z].join(" "),"aria-hidden":"true"})})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:Q=>{Q.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(z1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]})})},k.id)})})})})]})}function C3(){const n=p.useContext(Bw);if(!n)throw new Error("useToast must be used within <ToastProvider>");return n}function Pw(){const{push:n,remove:e,clear:t}=C3(),i=a=>(l,u,h)=>n({type:a,title:l,message:u,...h});return{push:n,remove:e,clear:t,success:i("success"),error:i("error"),info:i("info"),warning:i("warning")}}function A3(n){return typeof n=="number"?n:n==="xs"?12:n==="sm"?16:n==="lg"?28:20}function W1(...n){return n.filter(Boolean).join(" ")}function X1({size:n="md",className:e,label:t,srLabel:i="Lädt…",center:a=!1}){const l=A3(n);return c.jsxs("span",{className:W1("inline-flex items-center gap-2",a&&"justify-center w-full"),role:"status","aria-live":"polite",children:[c.jsxs("svg",{width:l,height:l,viewBox:"0 0 24 24",className:W1("animate-spin text-gray-500",e),"aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),c.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",d:"M21 12a9 9 0 0 0-9-9",opacity:"0.95"})]}),t?c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200",children:t}):c.jsx("span",{className:"sr-only",children:i})]})}const wy=n=>(n||"").replaceAll("\\","/"),ir=n=>{const t=wy(n).split("/");return t[t.length-1]||""},vi=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):ir(n.output||"")||String(n?.output||"")},N3=n=>{const e=wy(String(n??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function Y1(n){if(!Number.isFinite(n)||n<=0)return"—";const e=Math.floor(n/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function Rp(n){if(typeof n!="number"||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0||t>=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function Q1(n){const[e,t]=p.useState(!1);return p.useEffect(()=>{const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}const Lc=n=>{const e=ir(n||""),t=$r(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i},ts=n=>(n||"").trim().toLowerCase(),D3=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a.sort((l,u)=>l.localeCompare(u,void 0,{sensitivity:"base"})),a},Op=n=>{const e=n,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function Z1(n){return new Promise(e=>window.setTimeout(e,n))}function M3(n){return n instanceof Error?n.message||String(n):String(n??"")}function J1(n){const e=M3(n).toLowerCase();return e.includes("wird gerade verwendet")||e.includes("wird gerade abgespielt")||e.includes("sharing violation")||e.includes("used by another process")||e.includes("file in use")||e.includes("409")}async function Lp(n,e){const t=await fetch(n,e);if(!t.ok){const a=(await t.text().catch(()=>"")||`HTTP ${t.status}`).trim();throw new Error(a)}return t}function j3(){const n=p.useRef([]),e=p.useRef(!1),t=p.useRef(!1),i=p.useRef(new Set),a=p.useCallback(()=>{if(t.current)return;t.current=!0;const f=()=>{t.current=!1,l()};typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(f,{timeout:250}):setTimeout(f,0)},[]),l=p.useCallback(async()=>{if(!e.current){e.current=!0;try{for(;n.current.length>0;){const f=n.current.shift();if(f){try{await f.run()}finally{i.current.delete(f.id)}await new Promise(g=>setTimeout(g,0))}}}finally{e.current=!1,n.current.length>0&&a()}}},[a]),u=p.useCallback((f,g)=>!f||i.current.has(f)?!1:(i.current.add(f),n.current.push({id:f,run:g}),a(),!0),[a]),h=p.useCallback(f=>i.current.has(f),[]);return{enqueue:u,isQueued:h}}function R3({jobs:n,doneJobs:e,blurPreviews:t,teaserPlayback:i,teaserAudio:a,onOpenPlayer:l,onDeleteJob:u,onToggleHot:h,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,onKeepJob:S,doneTotal:C,page:N,pageSize:O,onPageChange:E,assetNonce:B,sortMode:H,onSortModeChange:Y,modelsByKey:U,loadMode:re="paged"}){const W=re==="all",X=i??"hover",R=Q1("(hover: hover) and (pointer: fine)"),le=Pw(),k=j3(),j=p.useRef(new Map),[Z,V]=p.useState(null),[ne,me]=p.useState(null),ue=p.useRef(null),q=p.useRef(new WeakMap),[P,Q]=p.useState(()=>new Set),[te,ge]=p.useState(()=>new Set),[L,xe]=p.useState(!1),Te=p.useRef(!1),ye=p.useRef(!1),be=p.useRef(0),mt="finishedDownloads_lastUndo_v1",[Ke,we]=p.useState(()=>{if(typeof window>"u")return null;try{const z=localStorage.getItem(mt);if(!z)return null;const G=JSON.parse(z);if(!G||G.v!==1||!G.action)return null;const ee=Date.now()-Number(G.ts||0);return!Number.isFinite(ee)||ee<0||ee>1800*1e3?(localStorage.removeItem(mt),null):G.action}catch{return null}}),[Re,ct]=p.useState(!1);p.useEffect(()=>{try{if(!Ke){localStorage.removeItem(mt);return}const z={v:1,action:Ke,ts:Date.now()};localStorage.setItem(mt,JSON.stringify(z))}catch{}},[Ke]);const[Oe,je]=p.useState({}),[Ue,ze]=p.useState(null),[gt,st]=p.useState(null),[bt,Qe]=p.useState(0),Ye=p.useRef(null),tt=p.useRef({pending:0,t:0,timer:0}),$e=p.useCallback(z=>{!z||!Number.isFinite(z)||(tt.current.pending+=z,!tt.current.timer&&(tt.current.timer=window.setTimeout(()=>{tt.current.timer=0;const G=tt.current.pending;tt.current.pending=0,G&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:G}}))},120)))},[]),ht="finishedDownloads_view",At="finishedDownloads_includeKeep_v2",he="finishedDownloads_mobileOptionsOpen_v1",[Ie,Le]=p.useState("table"),[ke,Pe]=p.useState(!1),[et,kt]=p.useState(!1),Lt=p.useRef(new Map),[pt,Zt]=p.useState([]),qt=p.useMemo(()=>new Set(pt.map(ts)),[pt]),Gt=p.useMemo(()=>{const z={},G={};for(const[ee,ae]of Object.entries(U??{})){const Be=ts(ee),Je=D3(ae?.tags);z[Be]=Je,G[Be]=new Set(Je.map(ts))}return{tagsByModelKey:z,tagSetByModelKey:G}},[U]),[wt,lt]=p.useState(""),Yt=p.useDeferredValue(wt),kn=p.useMemo(()=>ts(Yt).split(/\s+/g).map(z=>z.trim()).filter(Boolean),[Yt]),pn=p.useCallback(()=>lt(""),[]),xn=p.useCallback(z=>{const G=ts(z);Zt(ee=>ee.some(Be=>ts(Be)===G)?ee.filter(Be=>ts(Be)!==G):[...ee,z])},[]),M=qt.size>0||kn.some(z=>z.length>=2),F=M||W,ie=p.useCallback(async z=>{const G=Ue==null;G&&xe(!0);try{const ee=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(H)}&withCount=1${ke?"&includeKeep=1":""}`,{cache:"no-store",signal:z});if(!ee.ok)return;const ae=await ee.json().catch(()=>null),Be=Array.isArray(ae?.items)?ae.items:[],Je=Number(ae?.count??ae?.totalCount??Be.length);ze(Be),st(Number.isFinite(Je)?Je:Be.length)}finally{G&&xe(!1)}},[H,ke]),De=p.useCallback(()=>Zt([]),[]);p.useEffect(()=>{try{const z=localStorage.getItem("finishedDownloads_pendingTags");if(!z)return;const G=JSON.parse(z),ee=Array.isArray(G)?G.map(ae=>String(ae||"").trim()).filter(Boolean):[];if(ee.length===0)return;yu.flushSync(()=>Zt(ee)),N!==1&&E(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const Ve=p.useCallback(()=>{Ye.current==null&&(Ye.current=window.setTimeout(()=>{Ye.current=null,Qe(z=>z+1)},80))},[N,O,H,ke]);p.useEffect(()=>{if(!F)return;const z=new AbortController,G=window.setTimeout(()=>{ie(z.signal).catch(()=>{})},250);return()=>{window.clearTimeout(G),z.abort()}},[F,ie]),p.useEffect(()=>{if(bt===0)return;const z=new AbortController;let G=!0,ee=!1;const ae=++be.current,Be=()=>{ee||(ee=!0,be.current===ae&&(Te.current=!1,ye.current&&(ye.current=!1,Ve())))};return be.current===ae&&(Te.current=!0),F?((async()=>{try{await ie(z.signal),G&&(hn.current=0)}catch{}finally{G&&Be()}})(),()=>{G=!1,z.abort(),Be()}):(xe(!0),(async()=>{try{const Je=await fetch(`/api/record/done?page=${N}&pageSize=${O}&sort=${encodeURIComponent(H)}&withCount=1${ke?"&includeKeep=1":""}`,{cache:"no-store",signal:z.signal});if(!G||z.signal.aborted)return;const We=Je.ok;if(Je.ok){const ut=await Je.json().catch(()=>null);if(!G||z.signal.aborted)return;const Mt=Array.isArray(ut?.items)?ut.items:Array.isArray(ut)?ut:[];ze(Mt);const Nt=Number(ut?.count??ut?.totalCount??Mt.length),jt=Number.isFinite(Nt)&&Nt>=0?Nt:0;st(jt);const Qt=Math.max(1,Math.ceil(jt/O));if(N>Qt){E(Qt),ze(null);return}}if(We)hn.current=0;else if(G&&!z.signal.aborted&&hn.current<2){hn.current+=1;const ut=hn.current;window.setTimeout(()=>{z.signal.aborted||Qe(Mt=>Mt+1)},400*ut)}}catch{}finally{G&&(xe(!1),Be())}})(),()=>{G=!1,z.abort(),Be()})},[bt,F,ie,N,O,H,ke,E]),p.useEffect(()=>{F||(ze(null),st(null))},[N,O,H,ke,F]),p.useEffect(()=>{if(!ke){M||(ze(null),st(null));return}if(M)return;const z=new AbortController;return(async()=>{try{const G=await fetch(`/api/record/done?page=${N}&pageSize=${O}&sort=${encodeURIComponent(H)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:z.signal});if(!G.ok)return;const ee=await G.json().catch(()=>null),ae=Array.isArray(ee?.items)?ee.items:[],Be=Number(ee?.count??ee?.totalCount??ae.length);ze(ae),st(Number.isFinite(Be)?Be:ae.length)}catch{}})(),()=>z.abort()},[ke,M,N,O,H]),p.useEffect(()=>{try{const z=localStorage.getItem(ht);Le(z==="table"||z==="cards"||z==="gallery"?z:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Le("table")}},[]),p.useEffect(()=>{try{localStorage.setItem(ht,Ie)}catch{}},[Ie]),p.useEffect(()=>{try{const z=localStorage.getItem(At);Pe(z==="1"||z==="true"||z==="yes")}catch{Pe(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(At,ke?"1":"0")}catch{}},[ke]),p.useEffect(()=>{try{const z=localStorage.getItem(he);kt(z==="1"||z==="true"||z==="yes")}catch{kt(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(he,et?"1":"0")}catch{}},[et]);const[yt,Vt]=p.useState({}),Jt=p.useRef({}),gn=p.useRef(null),[ln,_n]=p.useState({}),En=p.useRef({}),Ut=p.useRef(null),hn=p.useRef(0);p.useEffect(()=>{En.current=ln},[ln]);const cn=p.useCallback(()=>{Ut.current==null&&(Ut.current=window.setTimeout(()=>{Ut.current=null,_n({...En.current})},200))},[]);p.useEffect(()=>()=>{Ut.current!=null&&(window.clearTimeout(Ut.current),Ut.current=null)},[]),p.useEffect(()=>{Jt.current=yt},[yt]);const en=p.useCallback(()=>{gn.current==null&&(gn.current=window.setTimeout(()=>{gn.current=null,Vt({...Jt.current})},200))},[]);p.useEffect(()=>()=>{gn.current!=null&&(window.clearTimeout(gn.current),gn.current=null)},[]);const[zt,Dt]=p.useState(null),Ot=!a,Hn=p.useCallback(z=>{const ee=document.getElementById(z)?.querySelector("video");if(!ee)return!1;cd(ee,{muted:Ot});const ae=ee.play?.();return ae&&typeof ae.catch=="function"&&ae.catch(()=>{}),!0},[Ot]),Rt=p.useCallback(z=>{Dt(G=>G?.key===z?{key:z,nonce:G.nonce+1}:{key:z,nonce:1})},[]),qn=p.useCallback((z,G,ee)=>{const ae=Number.isFinite(G)&&G>0?G:0;Dt(Je=>Je?.key===z?{key:z,nonce:Je.nonce+1}:{key:z,nonce:1});const Be=Je=>{const ut=document.getElementById(ee)?.querySelector("video");if(!ut){Je>0&&requestAnimationFrame(()=>Be(Je-1));return}cd(ut,{muted:Ot});const Mt=()=>{try{const Gn=Number(ut.duration),rr=Number.isFinite(Gn)&&Gn>0?Math.max(0,Gn-.05):ae;ut.currentTime=Math.max(0,Math.min(ae,rr))}catch{}const Qt=ut.play?.();Qt&&typeof Qt.catch=="function"&&Qt.catch(()=>{})};if(ut.readyState>=1){Mt();return}const Nt=()=>{ut.removeEventListener("loadedmetadata",Nt),Mt()};ut.addEventListener("loadedmetadata",Nt,{once:!0});const jt=ut.play?.();jt&&typeof jt.catch=="function"&&jt.catch(()=>{})};requestAnimationFrame(()=>Be(8))},[Ot]),_i=p.useCallback(z=>{Dt(null),l(z)},[l]),Mn=p.useCallback((z,G)=>{const ee=Number.isFinite(G)&&G>=0?G:0;Dt(null),l(z,ee)},[l]),Wt=p.useCallback((z,G,ee)=>{const ae=Number.isFinite(G)?Math.floor(G):0,Be=Number.isFinite(ee)?Math.floor(ee):0;if(Be<=0){_i(z);return}const Je=vi(z),We=yt[Je]??z?.durationSeconds??0;if(!Number.isFinite(We)||We<=0){_i(z);return}const ut=Math.max(0,Math.min(ae,Be-1)),Mt=We/Be,Nt=ut*Mt;Mn(z,Nt)},[yt,vi,_i,Mn]),zn=p.useCallback((z,G)=>{ge(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),Kn=p.useCallback(z=>{Q(G=>{const ee=new Set(G);return ee.add(z),ee})},[]),[jn,Wn]=p.useState(()=>new Set),Cn=p.useCallback((z,G)=>{Wn(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),[fi,Xn]=p.useState(()=>new Set),li=p.useRef(new Map);p.useEffect(()=>()=>{for(const z of li.current.values())window.clearTimeout(z);li.current.clear()},[]);const _e=p.useCallback((z,G)=>{Xn(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),at=p.useCallback(z=>{const G=li.current.get(z);G!=null&&(window.clearTimeout(G),li.current.delete(z))},[]),Ct=p.useCallback(z=>{at(z),Q(G=>{const ee=new Set(G);return ee.delete(z),ee}),Xn(G=>{const ee=new Set(G);return ee.delete(z),ee}),ge(G=>{const ee=new Set(G);return ee.delete(z),ee}),Wn(G=>{const ee=new Set(G);return ee.delete(z),ee})},[at]),St=p.useCallback(z=>{_e(z,!0),at(z);const G=window.setTimeout(()=>{li.current.delete(z),Kn(z),_e(z,!1)},320);li.current.set(z,G)},[Kn,_e,at]),Pt=p.useCallback(async(z,G)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),G?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:z}})),await new Promise(ee=>requestAnimationFrame(()=>ee())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),await new Promise(ee=>window.setTimeout(ee,260))},[]),tn=p.useCallback(async(z,G,ee)=>{const ae=Math.max(1,ee?.attempts??4),Be=Math.max(50,ee?.baseDelayMs??220);let Je;for(let We=1;We<=ae;We++)try{return await Pt(z,{close:ee?.close??!0}),We>1?await Z1(Be*We):await Z1(80),await G()}catch(ut){if(Je=ut,!J1(ut)||We>=ae)throw ut;continue}throw Je instanceof Error?Je:new Error(String(Je??"Unbekannter Fehler"))},[Pt]),wn=p.useCallback(async z=>{const{file:G,rowKey:ee,setBusy:ae,isBusyNow:Be,optimisticRemove:Je,alreadyRemoved:We,run:ut,onSuccess:Mt,onError:Nt,labels:jt}=z;if(!G)return le.error(jt.invalidTitle,jt.invalidBody),{ok:!1};if(Be?.())return{ok:!1};ae?.(!0);try{Je&&!We&&St(ee);const Qt=await ut();return await Mt?.(Qt),{ok:!0,result:Qt}}catch(Qt){if(Je&&Ct(ee),await Nt?.(Qt),J1(Qt))le.error(jt.inUseTitle,`${G} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const Gn=Qt?.message?` — ${String(Qt.message)}`:"";le.error(jt.failTitle,`${jt.failPrefix??G}${Gn}`)}return{ok:!1}}finally{ae?.(!1)}},[le,St,Ct]),vt=p.useCallback(async(z,G)=>{const ee=ir(z.output||""),ae=vi(z);return(await wn({kind:"delete",job:z,file:ee,rowKey:ae,setBusy:Je=>zn(ae,Je),isBusyNow:()=>te.has(ae),optimisticRemove:!0,alreadyRemoved:G?.alreadyRemoved,labels:{invalidTitle:"Löschen nicht möglich",invalidBody:"Kein Dateiname gefunden kann nicht löschen.",inUseTitle:"Löschen fehlgeschlagen",failTitle:"Löschen fehlgeschlagen",failPrefix:ee},run:async()=>u?await tn(ee,async()=>await u(z),{close:!0,attempts:4,baseDelayMs:220}):await(await tn(ee,async()=>await Lp(`/api/record/delete?file=${encodeURIComponent(ee)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Je=>{if(u){const Mt=typeof Je?.undoToken=="string"?Je.undoToken:"";we(Mt?{kind:"delete",undoToken:Mt,originalFile:ee,rowKey:ae}:null);return}const We=Je?.from==="keep"?"keep":"done",ut=typeof Je?.undoToken=="string"?Je.undoToken:"";we(ut?{kind:"delete",undoToken:ut,originalFile:ee,rowKey:ae,from:We}:null),Ve(),$e(-1)}})).ok},[ir,vi,te,zn,u,tn,wn,Ve,$e]),fn=p.useCallback(async(z,G)=>{const ee=ir(z.output||""),ae=vi(z);return(await wn({kind:"keep",job:z,file:ee,rowKey:ae,setBusy:Je=>Cn(ae,Je),isBusyNow:()=>jn.has(ae)||te.has(ae),optimisticRemove:!0,alreadyRemoved:G?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:ee},run:async()=>S?await tn(ee,async()=>await S(z),{close:!0,attempts:4,baseDelayMs:220}):await(await tn(ee,async()=>await Lp(`/api/record/keep?file=${encodeURIComponent(ee)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Je=>{const We=typeof Je?.newFile=="string"&&Je.newFile?Je.newFile:ee;we({kind:"keep",keptFile:We,originalFile:ee,rowKey:ae}),Ve(),$e(ke?0:-1)}})).ok},[ir,vi,Cn,jn,te,tn,wn,Ve,$e,ke]),Ne=p.useCallback((z,G)=>{!z||!G||z===G||je(ee=>{const ae={...ee};for(const[Be,Je]of Object.entries(ae))(Be===z||Be===G||Je===z||Je===G)&&delete ae[Be];return ae[z]=G,ae})},[]),Tt=p.useCallback((z,G)=>{!z&&!G||je(ee=>{const ae={...ee};for(const[Be,Je]of Object.entries(ae))(Be===z||Be===G||Je===z||Je===G)&&delete ae[Be];return ae})},[]),_t=p.useCallback(async()=>{if(!Ke||Re)return;ct(!0);const z=G=>{Q(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),ge(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),Wn(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),Xn(ee=>{const ae=new Set(ee);return ae.delete(G),ae})};try{if(Ke.kind==="delete"){const G=await fetch(`/api/record/restore?token=${encodeURIComponent(Ke.undoToken)}`,{method:"POST"});if(!G.ok){const Je=await G.text().catch(()=>"");throw new Error(Je||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.restoredFile||Ke.originalFile);Ke.rowKey&&z(Ke.rowKey),z(Ke.originalFile),z(ae);const Be=Ke.from==="keep"&&!ke?0:1;$e(Be),Ve(),we(null);return}if(Ke.kind==="keep"){const G=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Ke.keptFile)}`,{method:"POST"});if(!G.ok){const Be=await G.text().catch(()=>"");throw new Error(Be||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.newFile||Ke.originalFile);Ke.rowKey&&z(Ke.rowKey),z(Ke.originalFile),z(ae),$e(1),Ve(),we(null);return}if(Ke.kind==="hot"){const G=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Ke.currentFile)}`,{method:"POST"});if(!G.ok){const Je=await G.text().catch(()=>"");throw new Error(Je||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.oldFile||Ke.currentFile),Be=String(ee?.newFile||"");Be&&Ne(ae,Be),Ve(),we(null);return}}catch(G){le.error("Undo fehlgeschlagen",String(G?.message||G))}finally{ct(!1)}},[Ke,Re,le,Ve,ke,$e,Ne]),[$t,Ht]=p.useState(()=>new Set),yn=p.useCallback((z,G)=>{Ht(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),Xt=p.useCallback(async z=>{const G=ir(z.output||""),ee=vi(z),ae=We=>ou(We)?$r(We):`HOT ${We}`,Be=G,Je=ae(Be);await wn({kind:"rename",job:z,file:G,rowKey:ee,setBusy:We=>yn(ee,We),isBusyNow:()=>$t.has(ee),optimisticRemove:!1,labels:{invalidTitle:"HOT nicht möglich",invalidBody:"Kein Dateiname gefunden kann nicht HOT togglen.",inUseTitle:"HOT umbenennen fehlgeschlagen",failTitle:"HOT umbenennen fehlgeschlagen",failPrefix:Be},run:async()=>(Ne(Be,Je),h?await h(z):await(await tn(Be,async()=>await Lp(`/api/record/toggle-hot?file=${encodeURIComponent(Be)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async We=>{const ut=typeof We?.oldFile=="string"&&We.oldFile?We.oldFile:Be,Mt=typeof We?.newFile=="string"&&We.newFile?We.newFile:Je;ut&&Mt&&ut!==Mt&&Ne(ut,Mt),we({kind:"hot",currentFile:Mt}),(!h||H==="file_asc"||H==="file_desc")&&Ve()},onError:async()=>{Tt(Be,Je),we(null)}})},[ir,vi,$t,yn,wn,Ne,Tt,h,tn,Ve,H]),On=p.useCallback(z=>{const G=vi(z),ee=ir(z.output||"");if(!G||!ee||te.has(G)||jn.has(G))return!1;zn(G,!0),St(G);const ae=`delete:${G}`,Be=k.enqueue(ae,async()=>{await vt(z,{alreadyRemoved:!0})});return Be||Ct(G),Be},[k,vi,ir,te,jn,zn,vt]),Vn=p.useCallback(z=>{const G=vi(z),ee=ir(z.output||"");if(!G||!ee||jn.has(G)||te.has(G))return!1;Cn(G,!0),St(G);const ae=`keep:${G}`,Be=k.enqueue(ae,async()=>{await fn(z,{alreadyRemoved:!0})});return Be||Ct(G),Be},[k,vi,ir,jn,te,Cn,fn]),mi=p.useCallback(z=>{const G=vi(z);if(!G||$t.has(G))return!1;const ee=`hot:${G}`;return k.enqueue(ee,async()=>{await Xt(z)})},[k,vi,Xt,$t]),$n=p.useCallback(z=>{const G=wy(z.output||""),ee=ir(G),ae=Oe[ee];if(!ae)return z;const Be=G.lastIndexOf("/"),Je=Be>=0?G.slice(0,Be+1):"";return{...z,output:Je+ae}},[Oe]),ji=Ue??e,Bi=gt??C,pi=p.useMemo(()=>{const z=new Map;for(const ee of ji){const ae=$n(ee);z.set(vi(ae),ae)}for(const ee of n){const ae=$n(ee),Be=vi(ae);z.has(Be)&&z.set(Be,{...z.get(Be),...ae})}return Array.from(z.values()).filter(ee=>P.has(vi(ee))||N3(ee.output)?!1:ee.status==="finished"||ee.status==="failed"||ee.status==="stopped")},[n,ji,P,$n]),gi=p.useRef(new Map);p.useEffect(()=>{const z=new Map;for(const G of pi){const ee=ir(G.output||"");ee&&z.set(ee,vi(G))}gi.current=z},[pi]),p.useEffect(()=>{const z=G=>{const ee=G.detail;if(!ee?.file)return;const ae=gi.current.get(ee.file)||ee.file;if(ee.phase==="start"){zn(ae,!0),St(ae);return}if(ee.phase==="error"){Ct(ae),Lt.current.get(ae)?.reset();return}if(ee.phase==="success"){zn(ae,!1);return}};return window.addEventListener("finished-downloads:delete",z),()=>window.removeEventListener("finished-downloads:delete",z)},[St,zn,Ve,Ct]),p.useEffect(()=>{const z=()=>{if(Te.current){ye.current||(ye.current=!0);return}Ye.current==null&&Ve()};return window.addEventListener("finished-downloads:reload",z),()=>window.removeEventListener("finished-downloads:reload",z)},[Ve]),p.useEffect(()=>{const z=G=>{const ee=G.detail,ae=String(ee?.oldFile??"").trim(),Be=String(ee?.newFile??"").trim();!ae||!Be||ae===Be||Ne(ae,Be)};return window.addEventListener("finished-downloads:rename",z),()=>window.removeEventListener("finished-downloads:rename",z)},[Ne]);const Pn=p.useMemo(()=>{const z=pi.filter(ee=>!P.has(vi(ee))),G=kn.length?z.filter(ee=>{const ae=ir(ee.output||""),Be=Lc(ee.output),Je=ts(Be),We=Gt.tagsByModelKey[Je]??[],ut=ts([ae,$r(ae),Be,ee.id,We.join(" ")].join(" "));for(const Mt of kn)if(!ut.includes(Mt))return!1;return!0}):z;return qt.size===0?G:G.filter(ee=>{const ae=ts(Lc(ee.output)),Be=Gt.tagSetByModelKey[ae];if(!Be||Be.size===0)return!1;for(const Je of qt)if(!Be.has(Je))return!1;return!0})},[pi,P,qt,Gt,kn]),Ri=F?Pn.length:Bi,ei=p.useMemo(()=>{if(!F)return Pn;const z=(N-1)*O,G=z+O;return Pn.slice(Math.max(0,z),Math.max(0,G))},[F,Pn,N,O]),ti=!F&&Ri===0,An=M&&Pn.length===0,ii=W&&Pn.length===0,Pi=L&&(ti||ii||An);p.useEffect(()=>{if(!M)return;const z=Math.max(1,Math.ceil(Pn.length/O));N>z&&E(z)},[M,Pn.length,N,O,E]),p.useEffect(()=>{if(!(X==="hover"&&!R&&(Ie==="cards"||Ie==="gallery"||Ie==="table"))){V(null),ue.current?.disconnect(),ue.current=null;return}if(Ie==="cards"&&zt?.key){V(zt.key);return}ue.current?.disconnect();const G=new IntersectionObserver(ee=>{let ae=null,Be=0;for(const Je of ee){if(!Je.isIntersecting)continue;const We=q.current.get(Je.target);We&&Je.intersectionRatio>Be&&(Be=Je.intersectionRatio,ae=We)}ae&&V(Je=>Je===ae?Je:ae)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});ue.current=G;for(const[ee,ae]of j.current)q.current.set(ae,ee),G.observe(ae);return()=>{G.disconnect(),ue.current===G&&(ue.current=null)}},[Ie,X,R,zt?.key]);const Oi=z=>{const G=vi(z),ee=yt[G]??z?.durationSeconds;if(typeof ee=="number"&&Number.isFinite(ee)&&ee>0)return Y1(ee*1e3);const ae=Date.parse(String(z.startedAt||"")),Be=Date.parse(String(z.endedAt||""));return Number.isFinite(ae)&&Number.isFinite(Be)&&Be>ae?Y1(Be-ae):"—"},se=p.useCallback(z=>G=>{const ee=j.current.get(z);ee&&ue.current&&ue.current.unobserve(ee),G?(j.current.set(z,G),q.current.set(G,z),ue.current?.observe(G)):j.current.delete(z)},[]),I=p.useCallback((z,G)=>{if(!Number.isFinite(G)||G<=0)return;const ee=vi(z),ae=Jt.current[ee];typeof ae=="number"&&Math.abs(ae-G)<.5||(Jt.current={...Jt.current,[ee]:G},en())},[en]),ce=p.useCallback((z,G,ee)=>{if(!Number.isFinite(G)||!Number.isFinite(ee)||G<=0||ee<=0)return;const ae=vi(z),Be=En.current[ae];Be&&Be.w===G&&Be.h===ee||(En.current={...En.current,[ae]:{w:G,h:ee}},cn())},[cn]),pe=Q1("(max-width: 639px)"),Ce="mt-10",Ae="mb-2";return p.useEffect(()=>{if(!pe||Ie!=="cards")return;const z=ei[0];if(!z){V(null);return}const G=vi(z);V(ae=>ae===G?ae:null);const ee=window.setTimeout(()=>{V(ae=>ae===G?ae:G)},140);return()=>window.clearTimeout(ee)},[pe,Ie,ei,vi]),p.useEffect(()=>{pe||(Lt.current=new Map)},[pe]),p.useEffect(()=>{ti&&N!==1&&E(1)},[ti,N,E]),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"sticky top-[56px] z-20",children:c.jsxs("div",{className:`\r
rounded-xl border border-gray-200/70 bg-white/80 shadow-sm\r
backdrop-blur supports-[backdrop-filter]:bg-white/60\r
dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40\r
`,children:[c.jsxs("div",{className:"flex items-center gap-3 p-3",children:[c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Ri})]}),c.jsxs("div",{className:"sm:hidden flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Ri})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[L?c.jsx(X1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"}):null,c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("input",{value:wt,onChange:z=>lt(z.target.value),placeholder:"Suchen…",className:`\r
h-9 w-full max-w-[420px] rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r
`}),(wt||"").trim()!==""?c.jsx(sn,{size:"sm",variant:"soft",onClick:pn,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(wa,{label:"Behaltene Downloads anzeigen",checked:ke,onChange:z=>{N!==1&&E(1),Pe(z)}})}),Ie!=="table"&&c.jsxs("div",{className:"hidden sm:block",children:[c.jsx("label",{className:"sr-only",htmlFor:"finished-sort",children:"Sortierung"}),c.jsxs("select",{id:"finished-sort",value:H,onChange:z=>{const G=z.target.value;Y(G),N!==1&&E(1)},className:`\r
h-9 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r
`,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}),c.jsx(sn,{size:"md",variant:"soft",disabled:!Ke||Re,onClick:_t,title:Ke?`Letzte Aktion rückgängig machen (${Ke.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Fg,{value:Ie,onChange:z=>Le(z),size:pe?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(bN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(hN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(pN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Galerie",srLabel:"Galerie"}]}),c.jsxs("button",{type:"button",className:`sm:hidden relative inline-flex items-center justify-center rounded-md border border-gray-200 bg-white p-2 shadow-sm\r
hover:bg-gray-50 dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-white/10`,onClick:()=>kt(z=>!z),"aria-expanded":et,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(DA,{className:"size-5"}),M||ke?c.jsx("span",{className:"absolute -top-1 -right-1 h-2.5 w-2.5 rounded-full bg-indigo-500 ring-2 ring-white dark:ring-gray-950"}):null]})]})]}),pt.length>0?c.jsxs("div",{className:"hidden sm:flex items-center gap-2 border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[pt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:xn},z)),c.jsx(sn,{className:`\r
ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r
text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r
`,size:"sm",variant:"soft",onClick:De,children:"Zurücksetzen"})]})]}):null,c.jsxs("div",{id:"finished-mobile-options",className:["sm:hidden overflow-hidden transition-[max-height,opacity] duration-200 ease-in-out",et?"max-h-[720px] opacity-100":"max-h-0 opacity-0"].join(" "),children:[c.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 p-3",children:c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{value:wt,onChange:z=>lt(z.target.value),placeholder:"Suchen…",className:`\r
h-10 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r
`}),(wt||"").trim()!==""?c.jsx(sn,{size:"sm",variant:"soft",onClick:pn,children:"Clear"}):null]})}),c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Keep anzeigen"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Behaltene Downloads in der Liste"})]}),c.jsx(Bg,{checked:ke,onChange:z=>{N!==1&&E(1),Pe(z)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),Ie!=="table"?c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:[c.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:"Sortierung"}),c.jsxs("select",{id:"finished-sort-mobile",value:H,onChange:z=>{const G=z.target.value;Y(G),N!==1&&E(1)},className:`\r
w-full h-10 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r
dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r
`,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}):null]})}),pt.length>0?c.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[pt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:xn},z)),c.jsx(sn,{className:`\r
ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r
text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r
`,size:"sm",variant:"soft",onClick:De,children:"Zurücksetzen"})]})]})}):null]})]})}),Pi?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Lade Downloads…"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Bitte warte einen Moment."})]}),c.jsx(X1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):ti||ii?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:c.jsx("span",{className:"text-lg",children:"📁"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine abgeschlossenen Downloads"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Im Zielordner ist aktuell nichts vorhanden."})]})]})}):An?c.jsxs(Ns,{grayBody:!0,children:[c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),pt.length>0||(wt||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[pt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:De,children:"Tag-Filter zurücksetzen"}):null,(wt||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:pn,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[Ie==="cards"&&c.jsx("div",{className:pe?`${Ce} ${Ae}`:"",children:c.jsx(s3,{rows:ei,isSmall:pe,isLoading:L,blurPreviews:t,durations:yt,teaserKey:Z,teaserPlayback:X,teaserAudio:a,hoverTeaserKey:ne,inlinePlay:zt,deletingKeys:te,keepingKeys:jn,removingKeys:fi,swipeRefs:Lt,keyFor:vi,baseName:ir,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,lower:ts,onOpenPlayer:l,openPlayer:_i,onOpenPlayerAt:Mn,handleScrubberClickIndex:Wt,startInlineAt:qn,startInline:Rt,tryAutoplayInline:Hn,registerTeaserHost:se,handleDuration:I,deleteVideo:vt,keepVideo:fn,releasePlayingFile:Pt,modelsByKey:U,onToggleHot:Xt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:qt,onToggleTagFilter:xn,onHoverPreviewKeyChange:me,assetNonce:B??0,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi})}),Ie==="table"&&c.jsx(m3,{rows:ei,isLoading:L,keyFor:vi,baseName:ir,lower:ts,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,resolutions:ln,durations:yt,canHover:R,teaserAudio:a,hoverTeaserKey:ne,setHoverTeaserKey:me,teaserPlayback:X,teaserKey:Z,registerTeaserHost:se,handleDuration:I,handleResolution:ce,blurPreviews:t,assetNonce:B,deletingKeys:te,keepingKeys:jn,removingKeys:fi,modelsByKey:U,activeTagSet:qt,onToggleTagFilter:xn,onOpenPlayer:l,handleScrubberClickIndex:Wt,onSortModeChange:Y,page:N,onPageChange:E,onToggleHot:Xt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,deleteVideo:vt,keepVideo:fn,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi}),Ie==="gallery"&&c.jsx(b3,{rows:ei,isLoading:L,blurPreviews:t,durations:yt,handleDuration:I,teaserKey:Z,teaserPlayback:X,teaserAudio:a,hoverTeaserKey:ne,keyFor:vi,baseName:ir,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,deletingKeys:te,keepingKeys:jn,removingKeys:fi,deletedKeys:P,registerTeaserHost:se,onOpenPlayer:l,handleScrubberClickIndex:Wt,deleteVideo:vt,keepVideo:fn,onToggleHot:Xt,lower:ts,modelsByKey:U,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:qt,onToggleTagFilter:xn,onHoverPreviewKeyChange:me,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi}),c.jsx(kf,{page:N,pageSize:O,totalItems:Ri,onPageChange:z=>{yu.flushSync(()=>{Dt(null),V(null),me(null)});for(const G of ei){const ee=ir(G.output||"");ee&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:ee}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:ee}})))}window.scrollTo({top:0,behavior:"auto"}),E(z)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Ip,e2;function i0(){if(e2)return Ip;e2=1;var n;return typeof window<"u"?n=window:typeof gf<"u"?n=gf:typeof self<"u"?n=self:n={},Ip=n,Ip}var O3=i0();const de=Du(O3),L3={},I3=Object.freeze(Object.defineProperty({__proto__:null,default:L3},Symbol.toStringTag,{value:"Module"})),B3=QE(I3);var Bp,t2;function Fw(){if(t2)return Bp;t2=1;var n=typeof gf<"u"?gf:typeof window<"u"?window:{},e=B3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Bp=t,Bp}var P3=Fw();const xt=Du(P3);var Wh={exports:{}},Pp={exports:{}},n2;function F3(){return n2||(n2=1,(function(n){function e(){return n.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var l in a)({}).hasOwnProperty.call(a,l)&&(t[l]=a[l])}return t},n.exports.__esModule=!0,n.exports.default=n.exports,e.apply(null,arguments)}n.exports=e,n.exports.__esModule=!0,n.exports.default=n.exports})(Pp)),Pp.exports}var Fp,i2;function U3(){if(i2)return Fp;i2=1,Fp=e;var n=Object.prototype.toString;function e(t){if(!t)return!1;var i=n.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return Fp}var Up,r2;function z3(){if(r2)return Up;r2=1;function n(a,l){var u=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(u)return(u=u.call(a)).next.bind(u);if(Array.isArray(a)||(u=e(a))||l){u&&(a=u);var h=0;return function(){return h>=a.length?{done:!0}:{done:!1,value:a[h++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(a,l){if(a){if(typeof a=="string")return t(a,l);var u=Object.prototype.toString.call(a).slice(8,-1);if(u==="Object"&&a.constructor&&(u=a.constructor.name),u==="Map"||u==="Set")return Array.from(a);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return t(a,l)}}function t(a,l){(l==null||l>a.length)&&(l=a.length);for(var u=0,h=new Array(l);u<l;u++)h[u]=a[u];return h}var i=(function(){function a(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var l=a.prototype;return l.getIsEnabled=function(){return this.enabled_},l.enable=function(){this.enabled_=!0},l.disable=function(){this.enabled_=!1},l.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},l.addInterceptor=function(h,f){this.typeToInterceptorsMap_.has(h)||this.typeToInterceptorsMap_.set(h,new Set);var g=this.typeToInterceptorsMap_.get(h);return g.has(f)?!1:(g.add(f),!0)},l.removeInterceptor=function(h,f){var g=this.typeToInterceptorsMap_.get(h);return g&&g.has(f)?(g.delete(f),!0):!1},l.clearInterceptorsByType=function(h){var f=this.typeToInterceptorsMap_.get(h);return f?(this.typeToInterceptorsMap_.delete(h),this.typeToInterceptorsMap_.set(h,new Set),!0):!1},l.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},l.getForType=function(h){return this.typeToInterceptorsMap_.get(h)||new Set},l.execute=function(h,f){for(var g=this.getForType(h),_=n(g),S;!(S=_()).done;){var C=S.value;try{f=C(f)}catch{}}return f},a})();return Up=i,Up}var zp,s2;function $3(){if(s2)return zp;s2=1;var n=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(l){this.maxAttempts_=l},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(l){this.delayFactor_=l},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(l){this.fuzzFactor_=l},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(l){this.initialDelay_=l},i.createRetry=function(l){var u=l===void 0?{}:l,h=u.maxAttempts,f=u.delayFactor,g=u.fuzzFactor,_=u.initialDelay;return new e({maxAttempts:h||this.maxAttempts_,delayFactor:f||this.delayFactor_,fuzzFactor:g||this.fuzzFactor_,initialDelay:_||this.initialDelay_})},t})(),e=(function(){function t(a){this.maxAttempts_=a.maxAttempts,this.delayFactor_=a.delayFactor,this.fuzzFactor_=a.fuzzFactor,this.currentDelay_=a.initialDelay,this.currentAttempt_=1}var i=t.prototype;return i.moveToNextAttempt=function(){this.currentAttempt_++;var l=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+l},i.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},i.getCurrentDelay=function(){return this.currentDelay_},i.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},i.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},i.getCurrentFuzzedDelay=function(){var l=this.getCurrentMinPossibleDelay(),u=this.getCurrentMaxPossibleDelay();return l+Math.random()*(u-l)},t})();return zp=n,zp}var $p,a2;function H3(){if(a2)return $p;a2=1;var n=i0(),e=function(a,l){return l===void 0&&(l=!1),function(u,h,f){if(u){a(u);return}if(h.statusCode>=400&&h.statusCode<=599){var g=f;if(l)if(n.TextDecoder){var _=t(h.headers&&h.headers["content-type"]);try{g=new TextDecoder(_).decode(f)}catch{}}else g=String.fromCharCode.apply(null,new Uint8Array(f));a({cause:g});return}a(null,f)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(a,l){var u=l.split("="),h=u[0],f=u[1];return h.trim()==="charset"?f.trim():a},"utf-8")}return $p=e,$p}var o2;function q3(){if(o2)return Wh.exports;o2=1;var n=i0(),e=F3(),t=U3(),i=z3(),a=$3();g.httpHandler=H3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(O){var E={};return O&&O.trim().split(`
`).forEach(function(B){var H=B.indexOf(":"),Y=B.slice(0,H).trim().toLowerCase(),U=B.slice(H+1).trim();typeof E[Y]>"u"?E[Y]=U:Array.isArray(E[Y])?E[Y].push(U):E[Y]=[E[Y],U]}),E};Wh.exports=g,Wh.exports.default=g,g.XMLHttpRequest=n.XMLHttpRequest||C,g.XDomainRequest="withCredentials"in new g.XMLHttpRequest?g.XMLHttpRequest:n.XDomainRequest,u(["get","put","post","patch","head","delete"],function(N){g[N==="delete"?"del":N]=function(O,E,B){return E=f(O,E,B),E.method=N.toUpperCase(),_(E)}});function u(N,O){for(var E=0;E<N.length;E++)O(N[E])}function h(N){for(var O in N)if(N.hasOwnProperty(O))return!1;return!0}function f(N,O,E){var B=N;return t(O)?(E=O,typeof N=="string"&&(B={uri:N})):B=e({},O,{uri:N}),B.callback=E,B}function g(N,O,E){return O=f(N,O,E),_(O)}function _(N){if(typeof N.callback>"u")throw new Error("callback argument missing");if(N.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var O={uri:N.uri||N.url,headers:N.headers||{},body:N.body,metadata:N.metadata||{},retry:N.retry,timeout:N.timeout},E=g.requestInterceptorsStorage.execute(N.requestType,O);N.uri=E.uri,N.headers=E.headers,N.body=E.body,N.metadata=E.metadata,N.retry=E.retry,N.timeout=E.timeout}var B=!1,H=function(Q,te,ge){B||(B=!0,N.callback(Q,te,ge))};function Y(){X.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(W,0)}function U(){var P=void 0;if(X.response?P=X.response:P=X.responseText||S(X),me)try{P=JSON.parse(P)}catch{}return P}function re(P){if(clearTimeout(ue),clearTimeout(N.retryTimeout),P instanceof Error||(P=new Error(""+(P||"Unknown XMLHttpRequest Error"))),P.statusCode=0,!le&&g.retryManager.getIsEnabled()&&N.retry&&N.retry.shouldRetry()){N.retryTimeout=setTimeout(function(){N.retry.moveToNextAttempt(),N.xhr=X,_(N)},N.retry.getCurrentFuzzedDelay());return}if(N.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var Q={headers:q.headers||{},body:q.body,responseUrl:X.responseURL,responseType:X.responseType},te=g.responseInterceptorsStorage.execute(N.requestType,Q);q.body=te.body,q.headers=te.headers}return H(P,q)}function W(){if(!le){var P;clearTimeout(ue),clearTimeout(N.retryTimeout),N.useXDR&&X.status===void 0?P=200:P=X.status===1223?204:X.status;var Q=q,te=null;if(P!==0?(Q={body:U(),statusCode:P,method:j,headers:{},url:k,rawRequest:X},X.getAllResponseHeaders&&(Q.headers=l(X.getAllResponseHeaders()))):te=new Error("Internal XMLHttpRequest Error"),N.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var ge={headers:Q.headers||{},body:Q.body,responseUrl:X.responseURL,responseType:X.responseType},L=g.responseInterceptorsStorage.execute(N.requestType,ge);Q.body=L.body,Q.headers=L.headers}return H(te,Q,Q.body)}}var X=N.xhr||null;X||(N.cors||N.useXDR?X=new g.XDomainRequest:X=new g.XMLHttpRequest);var R,le,k=X.url=N.uri||N.url,j=X.method=N.method||"GET",Z=N.body||N.data,V=X.headers=N.headers||{},ne=!!N.sync,me=!1,ue,q={body:void 0,headers:{},statusCode:0,method:j,url:k,rawRequest:X};if("json"in N&&N.json!==!1&&(me=!0,V.accept||V.Accept||(V.Accept="application/json"),j!=="GET"&&j!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),Z=JSON.stringify(N.json===!0?Z:N.json))),X.onreadystatechange=Y,X.onload=W,X.onerror=re,X.onprogress=function(){},X.onabort=function(){le=!0,clearTimeout(N.retryTimeout)},X.ontimeout=re,X.open(j,k,!ne,N.username,N.password),ne||(X.withCredentials=!!N.withCredentials),!ne&&N.timeout>0&&(ue=setTimeout(function(){if(!le){le=!0,X.abort("timeout");var P=new Error("XMLHttpRequest timeout");P.code="ETIMEDOUT",re(P)}},N.timeout)),X.setRequestHeader)for(R in V)V.hasOwnProperty(R)&&X.setRequestHeader(R,V[R]);else if(N.headers&&!h(N.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in N&&(X.responseType=N.responseType),"beforeSend"in N&&typeof N.beforeSend=="function"&&N.beforeSend(X),X.send(Z||null),X}function S(N){try{if(N.responseType==="document")return N.responseXML;var O=N.responseXML&&N.responseXML.documentElement.nodeName==="parsererror";if(N.responseType===""&&!O)return N.responseXML}catch{}return null}function C(){}return Wh.exports}var V3=q3();const Uw=Du(V3);var Hp={exports:{}},qp,l2;function G3(){if(l2)return qp;l2=1;var n=Fw(),e=Object.create||(function(){function k(){}return function(j){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return k.prototype=j,new k}})();function t(k,j){this.name="ParsingError",this.code=k.code,this.message=j||k.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(k){function j(V,ne,me,ue){return(V|0)*3600+(ne|0)*60+(me|0)+(ue|0)/1e3}var Z=k.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return Z?Z[3]?j(Z[1],Z[2],Z[3].replace(":",""),Z[4]):Z[1]>59?j(Z[1],Z[2],0,Z[4]):j(0,Z[1],Z[2],Z[4]):null}function a(){this.values=e(null)}a.prototype={set:function(k,j){!this.get(k)&&j!==""&&(this.values[k]=j)},get:function(k,j,Z){return Z?this.has(k)?this.values[k]:j[Z]:this.has(k)?this.values[k]:j},has:function(k){return k in this.values},alt:function(k,j,Z){for(var V=0;V<Z.length;++V)if(j===Z[V]){this.set(k,j);break}},integer:function(k,j){/^-?\d+$/.test(j)&&this.set(k,parseInt(j,10))},percent:function(k,j){return j.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(j=parseFloat(j),j>=0&&j<=100)?(this.set(k,j),!0):!1}};function l(k,j,Z,V){var ne=V?k.split(V):[k];for(var me in ne)if(typeof ne[me]=="string"){var ue=ne[me].split(Z);if(ue.length===2){var q=ue[0].trim(),P=ue[1].trim();j(q,P)}}}function u(k,j,Z){var V=k;function ne(){var q=i(k);if(q===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return k=k.replace(/^[^\sa-zA-Z-]+/,""),q}function me(q,P){var Q=new a;l(q,function(te,ge){switch(te){case"region":for(var L=Z.length-1;L>=0;L--)if(Z[L].id===ge){Q.set(te,Z[L].region);break}break;case"vertical":Q.alt(te,ge,["rl","lr"]);break;case"line":var xe=ge.split(","),Te=xe[0];Q.integer(te,Te),Q.percent(te,Te)&&Q.set("snapToLines",!1),Q.alt(te,Te,["auto"]),xe.length===2&&Q.alt("lineAlign",xe[1],["start","center","end"]);break;case"position":xe=ge.split(","),Q.percent(te,xe[0]),xe.length===2&&Q.alt("positionAlign",xe[1],["start","center","end"]);break;case"size":Q.percent(te,ge);break;case"align":Q.alt(te,ge,["start","center","end","left","right"]);break}},/:/,/\s/),P.region=Q.get("region",null),P.vertical=Q.get("vertical","");try{P.line=Q.get("line","auto")}catch{}P.lineAlign=Q.get("lineAlign","start"),P.snapToLines=Q.get("snapToLines",!0),P.size=Q.get("size",100);try{P.align=Q.get("align","center")}catch{P.align=Q.get("align","middle")}try{P.position=Q.get("position","auto")}catch{P.position=Q.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},P.align)}P.positionAlign=Q.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},P.align)}function ue(){k=k.replace(/^\s+/,"")}if(ue(),j.startTime=ne(),ue(),k.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);k=k.substr(3),ue(),j.endTime=ne(),ue(),me(k,j)}var h=n.createElement&&n.createElement("textarea"),f={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},g={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},_={v:"title",lang:"lang"},S={rt:"ruby"};function C(k,j){function Z(){if(!j)return null;function Te(be){return j=j.substr(be.length),be}var ye=j.match(/^([^<]*)(<[^>]*>?)?/);return Te(ye[1]?ye[1]:ye[2])}function V(Te){return h.innerHTML=Te,Te=h.textContent,h.textContent="",Te}function ne(Te,ye){return!S[ye.localName]||S[ye.localName]===Te.localName}function me(Te,ye){var be=f[Te];if(!be)return null;var mt=k.document.createElement(be),Ke=_[Te];return Ke&&ye&&(mt[Ke]=ye.trim()),mt}for(var ue=k.document.createElement("div"),q=ue,P,Q=[];(P=Z())!==null;){if(P[0]==="<"){if(P[1]==="/"){Q.length&&Q[Q.length-1]===P.substr(2).replace(">","")&&(Q.pop(),q=q.parentNode);continue}var te=i(P.substr(1,P.length-2)),ge;if(te){ge=k.document.createProcessingInstruction("timestamp",te),q.appendChild(ge);continue}var L=P.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!L||(ge=me(L[1],L[3]),!ge)||!ne(q,ge))continue;if(L[2]){var xe=L[2].split(".");xe.forEach(function(Te){var ye=/^bg_/.test(Te),be=ye?Te.slice(3):Te;if(g.hasOwnProperty(be)){var mt=ye?"background-color":"color",Ke=g[be];ge.style[mt]=Ke}}),ge.className=xe.join(" ")}Q.push(L[1]),q.appendChild(ge),q=ge;continue}q.appendChild(k.document.createTextNode(V(P)))}return ue}var N=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function O(k){for(var j=0;j<N.length;j++){var Z=N[j];if(k>=Z[0]&&k<=Z[1])return!0}return!1}function E(k){var j=[],Z="",V;if(!k||!k.childNodes)return"ltr";function ne(q,P){for(var Q=P.childNodes.length-1;Q>=0;Q--)q.push(P.childNodes[Q])}function me(q){if(!q||!q.length)return null;var P=q.pop(),Q=P.textContent||P.innerText;if(Q){var te=Q.match(/^.*(\n|\r)/);return te?(q.length=0,te[0]):Q}if(P.tagName==="ruby")return me(q);if(P.childNodes)return ne(q,P),me(q)}for(ne(j,k);Z=me(j);)for(var ue=0;ue<Z.length;ue++)if(V=Z.charCodeAt(ue),O(V))return"rtl";return"ltr"}function B(k){if(typeof k.line=="number"&&(k.snapToLines||k.line>=0&&k.line<=100))return k.line;if(!k.track||!k.track.textTrackList||!k.track.textTrackList.mediaElement)return-1;for(var j=k.track,Z=j.textTrackList,V=0,ne=0;ne<Z.length&&Z[ne]!==j;ne++)Z[ne].mode==="showing"&&V++;return++V*-1}function H(){}H.prototype.applyStyles=function(k,j){j=j||this.div;for(var Z in k)k.hasOwnProperty(Z)&&(j.style[Z]=k[Z])},H.prototype.formatStyle=function(k,j){return k===0?0:k+j};function Y(k,j,Z){H.call(this),this.cue=j,this.cueDiv=C(k,j.text);var V={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:j.vertical===""?"horizontal-tb":j.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(V,this.cueDiv),this.div=k.document.createElement("div"),V={direction:E(this.cueDiv),writingMode:j.vertical===""?"horizontal-tb":j.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:j.align==="middle"?"center":j.align,font:Z.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(V),this.div.appendChild(this.cueDiv);var ne=0;switch(j.positionAlign){case"start":case"line-left":ne=j.position;break;case"center":ne=j.position-j.size/2;break;case"end":case"line-right":ne=j.position-j.size;break}j.vertical===""?this.applyStyles({left:this.formatStyle(ne,"%"),width:this.formatStyle(j.size,"%")}):this.applyStyles({top:this.formatStyle(ne,"%"),height:this.formatStyle(j.size,"%")}),this.move=function(me){this.applyStyles({top:this.formatStyle(me.top,"px"),bottom:this.formatStyle(me.bottom,"px"),left:this.formatStyle(me.left,"px"),right:this.formatStyle(me.right,"px"),height:this.formatStyle(me.height,"px"),width:this.formatStyle(me.width,"px")})}}Y.prototype=e(H.prototype),Y.prototype.constructor=Y;function U(k){var j,Z,V,ne;if(k.div){Z=k.div.offsetHeight,V=k.div.offsetWidth,ne=k.div.offsetTop;var me=(me=k.div.childNodes)&&(me=me[0])&&me.getClientRects&&me.getClientRects();k=k.div.getBoundingClientRect(),j=me?Math.max(me[0]&&me[0].height||0,k.height/me.length):0}this.left=k.left,this.right=k.right,this.top=k.top||ne,this.height=k.height||Z,this.bottom=k.bottom||ne+(k.height||Z),this.width=k.width||V,this.lineHeight=j!==void 0?j:k.lineHeight}U.prototype.move=function(k,j){switch(j=j!==void 0?j:this.lineHeight,k){case"+x":this.left+=j,this.right+=j;break;case"-x":this.left-=j,this.right-=j;break;case"+y":this.top+=j,this.bottom+=j;break;case"-y":this.top-=j,this.bottom-=j;break}},U.prototype.overlaps=function(k){return this.left<k.right&&this.right>k.left&&this.top<k.bottom&&this.bottom>k.top},U.prototype.overlapsAny=function(k){for(var j=0;j<k.length;j++)if(this.overlaps(k[j]))return!0;return!1},U.prototype.within=function(k){return this.top>=k.top&&this.bottom<=k.bottom&&this.left>=k.left&&this.right<=k.right},U.prototype.overlapsOppositeAxis=function(k,j){switch(j){case"+x":return this.left<k.left;case"-x":return this.right>k.right;case"+y":return this.top<k.top;case"-y":return this.bottom>k.bottom}},U.prototype.intersectPercentage=function(k){var j=Math.max(0,Math.min(this.right,k.right)-Math.max(this.left,k.left)),Z=Math.max(0,Math.min(this.bottom,k.bottom)-Math.max(this.top,k.top)),V=j*Z;return V/(this.height*this.width)},U.prototype.toCSSCompatValues=function(k){return{top:this.top-k.top,bottom:k.bottom-this.bottom,left:this.left-k.left,right:k.right-this.right,height:this.height,width:this.width}},U.getSimpleBoxPosition=function(k){var j=k.div?k.div.offsetHeight:k.tagName?k.offsetHeight:0,Z=k.div?k.div.offsetWidth:k.tagName?k.offsetWidth:0,V=k.div?k.div.offsetTop:k.tagName?k.offsetTop:0;k=k.div?k.div.getBoundingClientRect():k.tagName?k.getBoundingClientRect():k;var ne={left:k.left,right:k.right,top:k.top||V,height:k.height||j,bottom:k.bottom||V+(k.height||j),width:k.width||Z};return ne};function re(k,j,Z,V){function ne(be,mt){for(var Ke,we=new U(be),Re=1,ct=0;ct<mt.length;ct++){for(;be.overlapsOppositeAxis(Z,mt[ct])||be.within(Z)&&be.overlapsAny(V);)be.move(mt[ct]);if(be.within(Z))return be;var Oe=be.intersectPercentage(Z);Re>Oe&&(Ke=new U(be),Re=Oe),be=new U(we)}return Ke||we}var me=new U(j),ue=j.cue,q=B(ue),P=[];if(ue.snapToLines){var Q;switch(ue.vertical){case"":P=["+y","-y"],Q="height";break;case"rl":P=["+x","-x"],Q="width";break;case"lr":P=["-x","+x"],Q="width";break}var te=me.lineHeight,ge=te*Math.round(q),L=Z[Q]+te,xe=P[0];Math.abs(ge)>L&&(ge=ge<0?-1:1,ge*=Math.ceil(L/te)*te),q<0&&(ge+=ue.vertical===""?Z.height:Z.width,P=P.reverse()),me.move(xe,ge)}else{var Te=me.lineHeight/Z.height*100;switch(ue.lineAlign){case"center":q-=Te/2;break;case"end":q-=Te;break}switch(ue.vertical){case"":j.applyStyles({top:j.formatStyle(q,"%")});break;case"rl":j.applyStyles({left:j.formatStyle(q,"%")});break;case"lr":j.applyStyles({right:j.formatStyle(q,"%")});break}P=["+y","-x","+x","-y"],me=new U(j)}var ye=ne(me,P);j.move(ye.toCSSCompatValues(Z))}function W(){}W.StringDecoder=function(){return{decode:function(k){if(!k)return"";if(typeof k!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(k))}}},W.convertCueToDOMTree=function(k,j){return!k||!j?null:C(k,j)};var X=.05,R="sans-serif",le="1.5%";return W.processCues=function(k,j,Z){if(!k||!j||!Z)return null;for(;Z.firstChild;)Z.removeChild(Z.firstChild);var V=k.document.createElement("div");V.style.position="absolute",V.style.left="0",V.style.right="0",V.style.top="0",V.style.bottom="0",V.style.margin=le,Z.appendChild(V);function ne(te){for(var ge=0;ge<te.length;ge++)if(te[ge].hasBeenReset||!te[ge].displayState)return!0;return!1}if(!ne(j)){for(var me=0;me<j.length;me++)V.appendChild(j[me].displayState);return}var ue=[],q=U.getSimpleBoxPosition(V),P=Math.round(q.height*X*100)/100,Q={font:P+"px "+R};(function(){for(var te,ge,L=0;L<j.length;L++)ge=j[L],te=new Y(k,ge,Q),V.appendChild(te.div),re(k,te,q,ue),ge.displayState=te.div,ue.push(U.getSimpleBoxPosition(te))})()},W.Parser=function(k,j,Z){Z||(Z=j,j={}),j||(j={}),this.window=k,this.vttjs=j,this.state="INITIAL",this.buffer="",this.decoder=Z||new TextDecoder("utf8"),this.regionList=[]},W.Parser.prototype={reportOrThrowError:function(k){if(k instanceof t)this.onparsingerror&&this.onparsingerror(k);else throw k},parse:function(k){var j=this;k&&(j.buffer+=j.decoder.decode(k,{stream:!0}));function Z(){for(var te=j.buffer,ge=0;ge<te.length&&te[ge]!=="\r"&&te[ge]!==`
`;)++ge;var L=te.substr(0,ge);return te[ge]==="\r"&&++ge,te[ge]===`
`&&++ge,j.buffer=te.substr(ge),L}function V(te){var ge=new a;if(l(te,function(xe,Te){switch(xe){case"id":ge.set(xe,Te);break;case"width":ge.percent(xe,Te);break;case"lines":ge.integer(xe,Te);break;case"regionanchor":case"viewportanchor":var ye=Te.split(",");if(ye.length!==2)break;var be=new a;if(be.percent("x",ye[0]),be.percent("y",ye[1]),!be.has("x")||!be.has("y"))break;ge.set(xe+"X",be.get("x")),ge.set(xe+"Y",be.get("y"));break;case"scroll":ge.alt(xe,Te,["up"]);break}},/=/,/\s/),ge.has("id")){var L=new(j.vttjs.VTTRegion||j.window.VTTRegion);L.width=ge.get("width",100),L.lines=ge.get("lines",3),L.regionAnchorX=ge.get("regionanchorX",0),L.regionAnchorY=ge.get("regionanchorY",100),L.viewportAnchorX=ge.get("viewportanchorX",0),L.viewportAnchorY=ge.get("viewportanchorY",100),L.scroll=ge.get("scroll",""),j.onregion&&j.onregion(L),j.regionList.push({id:ge.get("id"),region:L})}}function ne(te){var ge=new a;l(te,function(L,xe){switch(L){case"MPEGT":ge.integer(L+"S",xe);break;case"LOCA":ge.set(L+"L",i(xe));break}},/[^\d]:/,/,/),j.ontimestampmap&&j.ontimestampmap({MPEGTS:ge.get("MPEGTS"),LOCAL:ge.get("LOCAL")})}function me(te){te.match(/X-TIMESTAMP-MAP/)?l(te,function(ge,L){ge==="X-TIMESTAMP-MAP"&&ne(L)},/=/):l(te,function(ge,L){ge==="Region"&&V(L)},/:/)}try{var ue;if(j.state==="INITIAL"){if(!/\r\n|\n/.test(j.buffer))return this;ue=Z();var q=ue.match(/^WEBVTT([ \t].*)?$/);if(!q||!q[0])throw new t(t.Errors.BadSignature);j.state="HEADER"}for(var P=!1;j.buffer;){if(!/\r\n|\n/.test(j.buffer))return this;switch(P?P=!1:ue=Z(),j.state){case"HEADER":/:/.test(ue)?me(ue):ue||(j.state="ID");continue;case"NOTE":ue||(j.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(ue)){j.state="NOTE";break}if(!ue)continue;j.cue=new(j.vttjs.VTTCue||j.window.VTTCue)(0,0,"");try{j.cue.align="center"}catch{j.cue.align="middle"}if(j.state="CUE",ue.indexOf("-->")===-1){j.cue.id=ue;continue}case"CUE":try{u(ue,j.cue,j.regionList)}catch(te){j.reportOrThrowError(te),j.cue=null,j.state="BADCUE";continue}j.state="CUETEXT";continue;case"CUETEXT":var Q=ue.indexOf("-->")!==-1;if(!ue||Q&&(P=!0)){j.oncue&&j.oncue(j.cue),j.cue=null,j.state="ID";continue}j.cue.text&&(j.cue.text+=`
`),j.cue.text+=ue.replace(/\u2028/g,`
`).replace(/u2029/g,`
`);continue;case"BADCUE":ue||(j.state="ID");continue}}}catch(te){j.reportOrThrowError(te),j.state==="CUETEXT"&&j.cue&&j.oncue&&j.oncue(j.cue),j.cue=null,j.state=j.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var k=this;try{if(k.buffer+=k.decoder.decode(),(k.cue||k.state==="HEADER")&&(k.buffer+=`
`,k.parse()),k.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(j){k.reportOrThrowError(j)}return k.onflush&&k.onflush(),this}},qp=W,qp}var Vp,u2;function K3(){if(u2)return Vp;u2=1;var n="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(u){if(typeof u!="string")return!1;var h=e[u.toLowerCase()];return h?u.toLowerCase():!1}function a(u){if(typeof u!="string")return!1;var h=t[u.toLowerCase()];return h?u.toLowerCase():!1}function l(u,h,f){this.hasBeenReset=!1;var g="",_=!1,S=u,C=h,N=f,O=null,E="",B=!0,H="auto",Y="start",U="auto",re="auto",W=100,X="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(R){g=""+R}},pauseOnExit:{enumerable:!0,get:function(){return _},set:function(R){_=!!R}},startTime:{enumerable:!0,get:function(){return S},set:function(R){if(typeof R!="number")throw new TypeError("Start time must be set to a number.");S=R,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return C},set:function(R){if(typeof R!="number")throw new TypeError("End time must be set to a number.");C=R,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return N},set:function(R){N=""+R,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return O},set:function(R){O=R,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return E},set:function(R){var le=i(R);if(le===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");E=le,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return B},set:function(R){B=!!R,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return H},set:function(R){if(typeof R!="number"&&R!==n)throw new SyntaxError("Line: an invalid number or illegal string was specified.");H=R,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return Y},set:function(R){var le=a(R);le?(Y=le,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return U},set:function(R){if(R<0||R>100)throw new Error("Position must be between 0 and 100.");U=R,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return re},set:function(R){var le=a(R);le?(re=le,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return W},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");W=R,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return X},set:function(R){var le=a(R);if(!le)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");X=le,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Vp=l,Vp}var Gp,c2;function W3(){if(c2)return Gp;c2=1;var n={"":!0,up:!0};function e(a){if(typeof a!="string")return!1;var l=n[a.toLowerCase()];return l?a.toLowerCase():!1}function t(a){return typeof a=="number"&&a>=0&&a<=100}function i(){var a=100,l=3,u=0,h=100,f=0,g=100,_="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(S){if(!t(S))throw new Error("Width must be between 0 and 100.");a=S}},lines:{enumerable:!0,get:function(){return l},set:function(S){if(typeof S!="number")throw new TypeError("Lines must be set to a number.");l=S}},regionAnchorY:{enumerable:!0,get:function(){return h},set:function(S){if(!t(S))throw new Error("RegionAnchorX must be between 0 and 100.");h=S}},regionAnchorX:{enumerable:!0,get:function(){return u},set:function(S){if(!t(S))throw new Error("RegionAnchorY must be between 0 and 100.");u=S}},viewportAnchorY:{enumerable:!0,get:function(){return g},set:function(S){if(!t(S))throw new Error("ViewportAnchorY must be between 0 and 100.");g=S}},viewportAnchorX:{enumerable:!0,get:function(){return f},set:function(S){if(!t(S))throw new Error("ViewportAnchorX must be between 0 and 100.");f=S}},scroll:{enumerable:!0,get:function(){return _},set:function(S){var C=e(S);C===!1?console.warn("Scroll: an invalid or illegal string was specified."):_=C}}})}return Gp=i,Gp}var d2;function X3(){if(d2)return Hp.exports;d2=1;var n=i0(),e=Hp.exports={WebVTT:G3(),VTTCue:K3(),VTTRegion:W3()};n.vttjs=e,n.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,a=n.VTTCue,l=n.VTTRegion;return e.shim=function(){n.VTTCue=t,n.VTTRegion=i},e.restore=function(){n.VTTCue=a,n.VTTRegion=l},n.VTTCue||e.shim(),Hp.exports}var Y3=X3();const h2=Du(Y3);function Xi(){return Xi=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Xi.apply(null,arguments)}var f2="https://example.com",r0=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=de.location&&de.location.href||"");var i=/^\/\//.test(e),a=!de.location&&!/\/\//i.test(e);e=new de.URL(e,de.location||f2);var l=new URL(t,e);return a?l.href.slice(f2.length):i?l.href.slice(l.protocol.length):l.href},Ty=(function(){function n(){this.listeners={}}var e=n.prototype;return e.on=function(i,a){this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(a)},e.off=function(i,a){if(!this.listeners[i])return!1;var l=this.listeners[i].indexOf(a);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(l,1),l>-1},e.trigger=function(i){var a=this.listeners[i];if(a)if(arguments.length===2)for(var l=a.length,u=0;u<l;++u)a[u].call(this,arguments[1]);else for(var h=Array.prototype.slice.call(arguments,1),f=a.length,g=0;g<f;++g)a[g].apply(this,h)},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(a){i.push(a)})},n})(),Q3=function(e){return de.atob?de.atob(e):Buffer.from(e,"base64").toString("binary")};function zw(n){for(var e=Q3(n),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Z3 extends Ty{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
`);t>-1;t=this.buffer.indexOf(`
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const J3=" ",Kp=function(n){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(n||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},eD=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},kr=function(n){const e={};if(!n)return e;const t=n.split(eD());let i=t.length,a;for(;i--;)t[i]!==""&&(a=/([^=]*)=(.*)/.exec(t[i]).slice(1),a[0]=a[0].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^['"](.*)['"]$/g,"$1"),e[a[0]]=a[1]);return e},m2=n=>{const e=n.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class tD extends Ty{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((l,u)=>{const h=u(e);return h===e?l:l.concat([h])},[e]).forEach(l=>{for(let u=0;u<this.customParsers.length;u++)if(this.customParsers[u].call(this,l))return;if(l.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:l.slice(1)});return}if(l=l.replace("\r",""),t=/^#EXTM3U/.exec(l),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(l),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(l),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(l),t){i=Xi(Kp(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(l),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(l),t){if(i={type:"tag",tagType:"map"},t[1]){const u=kr(t[1]);u.URI&&(i.uri=u.URI),u.BYTERANGE&&(i.byterange=Kp(u.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(l),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=kr(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=m2(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(l),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=kr(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(l),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(l),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(l),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(l),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=kr(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(l),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=kr(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=kr(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(J3)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=kr(t[1]),["DURATION"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["INDEPENDENT","GAP"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/.test(i.attributes[u]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Kp(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=kr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/.test(i.attributes[u]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=kr(t[1]),["PART-TARGET"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=kr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(u){if(i.attributes.hasOwnProperty(u)){i.attributes[u]=parseInt(i.attributes[u],10);const h=u==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[h]=i.attributes[u],delete i.attributes[u]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=kr(t[1]),["LAST-MSN","LAST-PART"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseInt(i.attributes[u],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=kr(t[1]),["ID","CLASS"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=String(i.attributes[h]))}),["START-DATE","END-DATE"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=new Date(i.attributes[h]))}),["DURATION","PLANNED-DURATION"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=parseFloat(i.attributes[h]))}),["END-ON-NEXT"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=/YES/i.test(i.attributes[h]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=i.attributes[h].toString(16))});const u=/^X-([A-Z]+-)+[A-Z]+$/;for(const h in i.attributes){if(!u.test(h))continue;const f=/[0-9A-Fa-f]{6}/g.test(i.attributes[h]),g=/^\d+(\.\d+)?$/.test(i.attributes[h]);i.attributes[h]=f?i.attributes[h].toString(16):g?parseFloat(i.attributes[h]):String(i.attributes[h])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(l),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(l),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(l),t){i={type:"tag",tagType:"content-steering"},i.attributes=kr(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(l),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=kr(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=m2(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(l),t){i={type:"tag",tagType:"define"},i.attributes=kr(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:l.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:a}){typeof i!="function"&&(i=l=>l),this.customParsers.push(l=>{if(e.exec(l))return this.trigger("data",{type:"custom",data:i(l),customType:t,segment:a}),!0})}addTagMapper({expression:e,map:t}){const i=a=>e.test(a)?t(a):a;this.tagMappers.push(i)}}const nD=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),fo=function(n){const e={};return Object.keys(n).forEach(function(t){e[nD(t)]=n[t]}),e},Wp=function(n){const{serverControl:e,targetDuration:t,partTargetDuration:i}=n;if(!e)return;const a="#EXT-X-SERVER-CONTROL",l="holdBack",u="partHoldBack",h=t&&t*3,f=i&&i*2;t&&!e.hasOwnProperty(l)&&(e[l]=h,this.trigger("info",{message:`${a} defaulting HOLD-BACK to targetDuration * 3 (${h}).`})),h&&e[l]<h&&(this.trigger("warn",{message:`${a} clamping HOLD-BACK (${e[l]}) to targetDuration * 3 (${h})`}),e[l]=h),i&&!e.hasOwnProperty(u)&&(e[u]=i*3,this.trigger("info",{message:`${a} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[u]}).`})),i&&e[u]<f&&(this.trigger("warn",{message:`${a} clamping PART-HOLD-BACK (${e[u]}) to partTargetDuration * 2 (${f}).`}),e[u]=f)};class iD extends Ty{constructor(e={}){super(),this.lineStream=new Z3,this.parseStream=new tD,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let a={},l,u,h=!1;const f=function(){},g={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},_="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let S=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let C=0,N=0;const O={};this.on("end",()=>{a.uri||!a.parts&&!a.preloadHints||(!a.map&&l&&(a.map=l),!a.key&&u&&(a.key=u),!a.timeline&&typeof S=="number"&&(a.timeline=S),this.manifest.preloadSegment=a)}),this.parseStream.on("data",function(E){let B,H;if(t.manifest.definitions){for(const Y in t.manifest.definitions)if(E.uri&&(E.uri=E.uri.replace(`{$${Y}}`,t.manifest.definitions[Y])),E.attributes)for(const U in E.attributes)typeof E.attributes[U]=="string"&&(E.attributes[U]=E.attributes[U].replace(`{$${Y}}`,t.manifest.definitions[Y]))}({tag(){({version(){E.version&&(this.manifest.version=E.version)},"allow-cache"(){this.manifest.allowCache=E.allowed,"allowed"in E||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in E&&(a.byterange=Y,Y.length=E.length,"offset"in E||(E.offset=C)),"offset"in E&&(a.byterange=Y,Y.offset=E.offset),C=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),E.title&&(a.title=E.title),E.duration>0&&(a.duration=E.duration),E.duration===0&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!E.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(E.attributes.METHOD==="NONE"){u=null;return}if(!E.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(E.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:E.attributes};return}if(E.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:E.attributes.URI};return}if(E.attributes.KEYFORMAT===_){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(E.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(E.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),E.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(E.attributes.KEYID&&E.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:E.attributes.KEYFORMAT,keyId:E.attributes.KEYID.substring(2)},pssh:zw(E.attributes.URI.split(",")[1])};return}E.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:E.attributes.METHOD||"AES-128",uri:E.attributes.URI},typeof E.attributes.IV<"u"&&(u.iv=E.attributes.IV)},"media-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+E.number});return}this.manifest.mediaSequence=E.number},"discontinuity-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+E.number});return}this.manifest.discontinuitySequence=E.number,S=E.number},"playlist-type"(){if(!/VOD|EVENT/.test(E.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+E.playlist});return}this.manifest.playlistType=E.playlistType},map(){l={},E.uri&&(l.uri=E.uri),E.byterange&&(l.byterange=E.byterange),u&&(l.key=u)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||g,!E.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}a.attributes||(a.attributes={}),Xi(a.attributes,E.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||g,!(E.attributes&&E.attributes.TYPE&&E.attributes["GROUP-ID"]&&E.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[E.attributes.TYPE];Y[E.attributes["GROUP-ID"]]=Y[E.attributes["GROUP-ID"]]||{},B=Y[E.attributes["GROUP-ID"]],H={default:/yes/i.test(E.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(E.attributes.AUTOSELECT),E.attributes.LANGUAGE&&(H.language=E.attributes.LANGUAGE),E.attributes.URI&&(H.uri=E.attributes.URI),E.attributes["INSTREAM-ID"]&&(H.instreamId=E.attributes["INSTREAM-ID"]),E.attributes.CHARACTERISTICS&&(H.characteristics=E.attributes.CHARACTERISTICS),E.attributes.FORCED&&(H.forced=/yes/i.test(E.attributes.FORCED)),B[E.attributes.NAME]=H},discontinuity(){S+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=E.dateTimeString,this.manifest.dateTimeObject=E.dateTimeObject),a.dateTimeString=E.dateTimeString,a.dateTimeObject=E.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(E.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight((U,re)=>(re.programDateTime=U-re.duration*1e3,re.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(E.duration)||E.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+E.duration});return}this.manifest.targetDuration=E.duration,Wp.call(this,this.manifest)},start(){if(!E.attributes||isNaN(E.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:E.attributes["TIME-OFFSET"],precise:E.attributes.PRECISE}},"cue-out"(){a.cueOut=E.data},"cue-out-cont"(){a.cueOutCont=E.data},"cue-in"(){a.cueIn=E.data},skip(){this.manifest.skip=fo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",E.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const Y=this.manifest.segments.length,U=fo(E.attributes);a.parts=a.parts||[],a.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=N),N=U.byterange.offset+U.byterange.length);const re=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${re} for segment #${Y}`,E.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((W,X)=>{W.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${X} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=fo(E.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wp.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,U=fo(E.attributes),re=U.type&&U.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=re?N:0,re&&(N=U.byterange.offset+U.byterange.length)));const W=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${W} for segment #${Y}`,E.attributes,["TYPE","URI"]),!!U.type)for(let X=0;X<a.preloadHints.length-1;X++){const R=a.preloadHints[X];R.type&&R.type===U.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${W} for segment #${Y} has the same TYPE ${U.type} as preload hint #${X}`})}},"rendition-report"(){const Y=fo(E.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(Y);const U=this.manifest.renditionReports.length-1,re=["LAST-MSN","URI"];h&&re.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${U}`,E.attributes,re)},"part-inf"(){this.manifest.partInf=fo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",E.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Wp.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(fo(E.attributes));const Y=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${Y}`,E.attributes,["ID","START-DATE"]);const U=this.manifest.dateRanges[Y];U.endDate&&U.startDate&&new Date(U.endDate)<new Date(U.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),U.duration&&U.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),U.plannedDuration&&U.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const re=!!U.endOnNext;if(re&&!U.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),re&&(U.duration||U.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),U.duration&&U.endDate){const X=U.startDate.getTime()+U.duration*1e3;this.manifest.dateRanges[Y].endDate=new Date(X)}if(!O[U.id])O[U.id]=U;else{for(const X in O[U.id])if(U[X]&&JSON.stringify(O[U.id][X])!==JSON.stringify(U[X])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const W=this.manifest.dateRanges.findIndex(X=>X.id===U.id);this.manifest.dateRanges[W]=Xi(this.manifest.dateRanges[W],U),O[U.id]=Xi(O[U.id],U),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=fo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",E.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(U,re)=>{if(U in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${U}`});return}this.manifest.definitions[U]=re};if("QUERYPARAM"in E.attributes){if("NAME"in E.attributes||"IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const U=this.params.get(E.attributes.QUERYPARAM);if(!U){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${E.attributes.QUERYPARAM}`});return}Y(E.attributes.QUERYPARAM,decodeURIComponent(U));return}if("NAME"in E.attributes){if("IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in E.attributes)||typeof E.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${E.attributes.NAME}`});return}Y(E.attributes.NAME,E.attributes.VALUE);return}if("IMPORT"in E.attributes){if(!this.mainDefinitions[E.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${E.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(E.attributes.IMPORT,this.mainDefinitions[E.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:E.attributes,uri:E.uri,timeline:S}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",E.attributes,["BANDWIDTH","URI"])}}[E.tagType]||f).call(t)},uri(){a.uri=E.uri,i.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),u&&(a.key=u),a.timeline=S,l&&(a.map=l),N=0,this.lastProgramDateTime!==null&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=a.duration*1e3),a={}},comment(){},custom(){E.segment?(a.custom=a.custom||{},a.custom[E.customType]=E.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[E.customType]=E.data)}})[E.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const a=[];i.forEach(function(l){t.hasOwnProperty(l)||a.push(l)}),a.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${a.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var cl={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},rD=["video","audio","text"],p2=["Video","Audio","Text"],$w=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,a){var l=("00"+Number(i).toString(16)).slice(-2),u=("00"+Number(a).toString(16)).slice(-2);return"avc1."+l+"00"+u})},Ks=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(a){a=a.trim();var l;rD.forEach(function(u){var h=cl[u].exec(a.toLowerCase());if(!(!h||h.length<=1)){l=u;var f=a.substring(0,h[1].length),g=a.replace(f,"");i.push({type:f,details:g,mediaType:u})}}),l||i.push({type:a,details:"",mediaType:"unknown"})}),i},sD=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var a in i){var l=i[a];if(l.default&&l.playlists)return Ks(l.playlists[0].attributes.CODECS)}return null},Hw=function(e){return e===void 0&&(e=""),cl.audio.test(e.trim().toLowerCase())},aD=function(e){return e===void 0&&(e=""),cl.text.test(e.trim().toLowerCase())},_u=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(l){return $w(l.trim())}),i="video";t.length===1&&Hw(t[0])?i="audio":t.length===1&&aD(t[0])&&(i="application");var a="mp4";return t.every(function(l){return cl.mp4.test(l)})?a="mp4":t.every(function(l){return cl.webm.test(l)})?a="webm":t.every(function(l){return cl.ogg.test(l)})&&(a="ogg"),i+"/"+a+';codecs="'+e+'"'}},nd=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),de.MediaSource&&de.MediaSource.isTypeSupported&&de.MediaSource.isTypeSupported(_u(e))||t&&de.ManagedMediaSource&&de.ManagedMediaSource.isTypeSupported&&de.ManagedMediaSource.isTypeSupported(_u(e))||!1},Xp=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<p2.length;i++){var a=p2[i];if(cl["muxer"+a].test(t))return!0}return!1})},g2="mp4a.40.2",oD="avc1.4d400d",lD=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,uD=/^application\/dash\+xml/i,qw=function(e){return lD.test(e)?"hls":uD.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},cD=function(e){return e.toString(2).length},dD=function(e){return Math.ceil(cD(e)/8)},Vw=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},hD=function(e){return Vw(e)},an=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!hD(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},gr=de.BigInt||Number,Ug=[gr("0x1"),gr("0x100"),gr("0x10000"),gr("0x1000000"),gr("0x100000000"),gr("0x10000000000"),gr("0x1000000000000"),gr("0x100000000000000"),gr("0x10000000000000000")];(function(){var n=new Uint16Array([65484]),e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var fD=function(e,t){var i=t===void 0?{}:t,a=i.signed,l=a===void 0?!1:a,u=i.le,h=u===void 0?!1:u;e=an(e);var f=h?"reduce":"reduceRight",g=e[f]?e[f]:Array.prototype[f],_=g.call(e,function(C,N,O){var E=h?O:Math.abs(O+1-e.length);return C+gr(N)*Ug[E]},gr(0));if(l){var S=Ug[e.length]/gr(2)-gr(1);_=gr(_),_>S&&(_-=S,_-=S,_-=gr(2))}return Number(_)},mD=function(e,t){var i={},a=i.le,l=a===void 0?!1:a;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=gr(e);for(var u=dD(e),h=new Uint8Array(new ArrayBuffer(u)),f=0;f<u;f++){var g=l?f:Math.abs(f+1-h.length);h[g]=Number(e/Ug[f]&gr(255)),e<0&&(h[g]=Math.abs(~h[g]),h[g]-=f===0?1:2)}return h},Gw=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),a=0;a<e.length;a++)i[a]=e.charCodeAt(a);return i},pD=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(h){return h&&(h.byteLength||h.length)&&typeof h!="string"}),t.length<=1)return an(t[0]);var a=t.reduce(function(h,f,g){return h+(f.byteLength||f.length)},0),l=new Uint8Array(a),u=0;return t.forEach(function(h){h=an(h),l.set(h,u),u+=h.byteLength}),l},Ni=function(e,t,i){var a=i===void 0?{}:i,l=a.offset,u=l===void 0?0:l,h=a.mask,f=h===void 0?[]:h;e=an(e),t=an(t);var g=t.every?t.every:Array.prototype.every;return t.length&&e.length-u>=t.length&&g.call(t,function(_,S){var C=f[S]?f[S]&e[u+S]:e[u+S];return _===C})},gD=function(e,t,i){t.forEach(function(a){for(var l in e.mediaGroups[a])for(var u in e.mediaGroups[a][l]){var h=e.mediaGroups[a][l][u];i(h,a,l,u)}})},Ic={},xa={},Zo={},y2;function s0(){if(y2)return Zo;y2=1;function n(l,u,h){if(h===void 0&&(h=Array.prototype),l&&typeof h.find=="function")return h.find.call(l,u);for(var f=0;f<l.length;f++)if(Object.prototype.hasOwnProperty.call(l,f)){var g=l[f];if(u.call(void 0,g,f,l))return g}}function e(l,u){return u===void 0&&(u=Object),u&&typeof u.freeze=="function"?u.freeze(l):l}function t(l,u){if(l===null||typeof l!="object")throw new TypeError("target is not an object");for(var h in u)Object.prototype.hasOwnProperty.call(u,h)&&(l[h]=u[h]);return l}var i=e({HTML:"text/html",isHTML:function(l){return l===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(l){return l===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Zo.assign=t,Zo.find=n,Zo.freeze=e,Zo.MIME_TYPE=i,Zo.NAMESPACE=a,Zo}var b2;function Kw(){if(b2)return xa;b2=1;var n=s0(),e=n.find,t=n.NAMESPACE;function i(M){return M!==""}function a(M){return M?M.split(/[\t\n\f\r ]+/).filter(i):[]}function l(M,F){return M.hasOwnProperty(F)||(M[F]=!0),M}function u(M){if(!M)return[];var F=a(M);return Object.keys(F.reduce(l,{}))}function h(M){return function(F){return M&&M.indexOf(F)!==-1}}function f(M,F){for(var ie in M)Object.prototype.hasOwnProperty.call(M,ie)&&(F[ie]=M[ie])}function g(M,F){var ie=M.prototype;if(!(ie instanceof F)){let Ve=function(){};var De=Ve;Ve.prototype=F.prototype,Ve=new Ve,f(ie,Ve),M.prototype=ie=Ve}ie.constructor!=M&&(typeof M!="function"&&console.error("unknown Class:"+M),ie.constructor=M)}var _={},S=_.ELEMENT_NODE=1,C=_.ATTRIBUTE_NODE=2,N=_.TEXT_NODE=3,O=_.CDATA_SECTION_NODE=4,E=_.ENTITY_REFERENCE_NODE=5,B=_.ENTITY_NODE=6,H=_.PROCESSING_INSTRUCTION_NODE=7,Y=_.COMMENT_NODE=8,U=_.DOCUMENT_NODE=9,re=_.DOCUMENT_TYPE_NODE=10,W=_.DOCUMENT_FRAGMENT_NODE=11,X=_.NOTATION_NODE=12,R={},le={};R.INDEX_SIZE_ERR=(le[1]="Index size error",1),R.DOMSTRING_SIZE_ERR=(le[2]="DOMString size error",2);var k=R.HIERARCHY_REQUEST_ERR=(le[3]="Hierarchy request error",3);R.WRONG_DOCUMENT_ERR=(le[4]="Wrong document",4),R.INVALID_CHARACTER_ERR=(le[5]="Invalid character",5),R.NO_DATA_ALLOWED_ERR=(le[6]="No data allowed",6),R.NO_MODIFICATION_ALLOWED_ERR=(le[7]="No modification allowed",7);var j=R.NOT_FOUND_ERR=(le[8]="Not found",8);R.NOT_SUPPORTED_ERR=(le[9]="Not supported",9);var Z=R.INUSE_ATTRIBUTE_ERR=(le[10]="Attribute in use",10);R.INVALID_STATE_ERR=(le[11]="Invalid state",11),R.SYNTAX_ERR=(le[12]="Syntax error",12),R.INVALID_MODIFICATION_ERR=(le[13]="Invalid modification",13),R.NAMESPACE_ERR=(le[14]="Invalid namespace",14),R.INVALID_ACCESS_ERR=(le[15]="Invalid access",15);function V(M,F){if(F instanceof Error)var ie=F;else ie=this,Error.call(this,le[M]),this.message=le[M],Error.captureStackTrace&&Error.captureStackTrace(this,V);return ie.code=M,F&&(this.message=this.message+": "+F),ie}V.prototype=Error.prototype,f(R,V);function ne(){}ne.prototype={length:0,item:function(M){return M>=0&&M<this.length?this[M]:null},toString:function(M,F){for(var ie=[],De=0;De<this.length;De++)Yt(this[De],ie,M,F);return ie.join("")},filter:function(M){return Array.prototype.filter.call(this,M)},indexOf:function(M){return Array.prototype.indexOf.call(this,M)}};function me(M,F){this._node=M,this._refresh=F,ue(this)}function ue(M){var F=M._node._inc||M._node.ownerDocument._inc;if(M._inc!==F){var ie=M._refresh(M._node);if(xn(M,"length",ie.length),!M.$$length||ie.length<M.$$length)for(var De=ie.length;De in M;De++)Object.prototype.hasOwnProperty.call(M,De)&&delete M[De];f(ie,M),M._inc=F}}me.prototype.item=function(M){return ue(this),this[M]||null},g(me,ne);function q(){}function P(M,F){for(var ie=M.length;ie--;)if(M[ie]===F)return ie}function Q(M,F,ie,De){if(De?F[P(F,De)]=ie:F[F.length++]=ie,M){ie.ownerElement=M;var Ve=M.ownerDocument;Ve&&(De&&mt(Ve,M,De),be(Ve,M,ie))}}function te(M,F,ie){var De=P(F,ie);if(De>=0){for(var Ve=F.length-1;De<Ve;)F[De]=F[++De];if(F.length=Ve,M){var yt=M.ownerDocument;yt&&(mt(yt,M,ie),ie.ownerElement=null)}}else throw new V(j,new Error(M.tagName+"@"+ie))}q.prototype={length:0,item:ne.prototype.item,getNamedItem:function(M){for(var F=this.length;F--;){var ie=this[F];if(ie.nodeName==M)return ie}},setNamedItem:function(M){var F=M.ownerElement;if(F&&F!=this._ownerElement)throw new V(Z);var ie=this.getNamedItem(M.nodeName);return Q(this._ownerElement,this,M,ie),ie},setNamedItemNS:function(M){var F=M.ownerElement,ie;if(F&&F!=this._ownerElement)throw new V(Z);return ie=this.getNamedItemNS(M.namespaceURI,M.localName),Q(this._ownerElement,this,M,ie),ie},removeNamedItem:function(M){var F=this.getNamedItem(M);return te(this._ownerElement,this,F),F},removeNamedItemNS:function(M,F){var ie=this.getNamedItemNS(M,F);return te(this._ownerElement,this,ie),ie},getNamedItemNS:function(M,F){for(var ie=this.length;ie--;){var De=this[ie];if(De.localName==F&&De.namespaceURI==M)return De}return null}};function ge(){}ge.prototype={hasFeature:function(M,F){return!0},createDocument:function(M,F,ie){var De=new ye;if(De.implementation=this,De.childNodes=new ne,De.doctype=ie||null,ie&&De.appendChild(ie),F){var Ve=De.createElementNS(M,F);De.appendChild(Ve)}return De},createDocumentType:function(M,F,ie){var De=new Pe;return De.name=M,De.nodeName=M,De.publicId=F||"",De.systemId=ie||"",De}};function L(){}L.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(M,F){return Ye(this,M,F)},replaceChild:function(M,F){Ye(this,M,F,Qe),F&&this.removeChild(F)},removeChild:function(M){return we(this,M)},appendChild:function(M){return this.insertBefore(M,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(M){return pn(this.ownerDocument||this,this,M)},normalize:function(){for(var M=this.firstChild;M;){var F=M.nextSibling;F&&F.nodeType==N&&M.nodeType==N?(this.removeChild(F),M.appendData(F.data)):(M.normalize(),M=F)}},isSupported:function(M,F){return this.ownerDocument.implementation.hasFeature(M,F)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(M){for(var F=this;F;){var ie=F._nsMap;if(ie){for(var De in ie)if(Object.prototype.hasOwnProperty.call(ie,De)&&ie[De]===M)return De}F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},lookupNamespaceURI:function(M){for(var F=this;F;){var ie=F._nsMap;if(ie&&Object.prototype.hasOwnProperty.call(ie,M))return ie[M];F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},isDefaultNamespace:function(M){var F=this.lookupPrefix(M);return F==null}};function xe(M){return M=="<"&&"&lt;"||M==">"&&"&gt;"||M=="&"&&"&amp;"||M=='"'&&"&quot;"||"&#"+M.charCodeAt()+";"}f(_,L),f(_,L.prototype);function Te(M,F){if(F(M))return!0;if(M=M.firstChild)do if(Te(M,F))return!0;while(M=M.nextSibling)}function ye(){this.ownerDocument=this}function be(M,F,ie){M&&M._inc++;var De=ie.namespaceURI;De===t.XMLNS&&(F._nsMap[ie.prefix?ie.localName:""]=ie.value)}function mt(M,F,ie,De){M&&M._inc++;var Ve=ie.namespaceURI;Ve===t.XMLNS&&delete F._nsMap[ie.prefix?ie.localName:""]}function Ke(M,F,ie){if(M&&M._inc){M._inc++;var De=F.childNodes;if(ie)De[De.length++]=ie;else{for(var Ve=F.firstChild,yt=0;Ve;)De[yt++]=Ve,Ve=Ve.nextSibling;De.length=yt,delete De[De.length]}}}function we(M,F){var ie=F.previousSibling,De=F.nextSibling;return ie?ie.nextSibling=De:M.firstChild=De,De?De.previousSibling=ie:M.lastChild=ie,F.parentNode=null,F.previousSibling=null,F.nextSibling=null,Ke(M.ownerDocument,M),F}function Re(M){return M&&(M.nodeType===L.DOCUMENT_NODE||M.nodeType===L.DOCUMENT_FRAGMENT_NODE||M.nodeType===L.ELEMENT_NODE)}function ct(M){return M&&(je(M)||Ue(M)||Oe(M)||M.nodeType===L.DOCUMENT_FRAGMENT_NODE||M.nodeType===L.COMMENT_NODE||M.nodeType===L.PROCESSING_INSTRUCTION_NODE)}function Oe(M){return M&&M.nodeType===L.DOCUMENT_TYPE_NODE}function je(M){return M&&M.nodeType===L.ELEMENT_NODE}function Ue(M){return M&&M.nodeType===L.TEXT_NODE}function ze(M,F){var ie=M.childNodes||[];if(e(ie,je)||Oe(F))return!1;var De=e(ie,Oe);return!(F&&De&&ie.indexOf(De)>ie.indexOf(F))}function gt(M,F){var ie=M.childNodes||[];function De(yt){return je(yt)&&yt!==F}if(e(ie,De))return!1;var Ve=e(ie,Oe);return!(F&&Ve&&ie.indexOf(Ve)>ie.indexOf(F))}function st(M,F,ie){if(!Re(M))throw new V(k,"Unexpected parent node type "+M.nodeType);if(ie&&ie.parentNode!==M)throw new V(j,"child not in parent");if(!ct(F)||Oe(F)&&M.nodeType!==L.DOCUMENT_NODE)throw new V(k,"Unexpected node type "+F.nodeType+" for parent node type "+M.nodeType)}function bt(M,F,ie){var De=M.childNodes||[],Ve=F.childNodes||[];if(F.nodeType===L.DOCUMENT_FRAGMENT_NODE){var yt=Ve.filter(je);if(yt.length>1||e(Ve,Ue))throw new V(k,"More than one element or text in fragment");if(yt.length===1&&!ze(M,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(je(F)&&!ze(M,ie))throw new V(k,"Only one element can be added and only after doctype");if(Oe(F)){if(e(De,Oe))throw new V(k,"Only one doctype is allowed");var Vt=e(De,je);if(ie&&De.indexOf(Vt)<De.indexOf(ie))throw new V(k,"Doctype can only be inserted before an element");if(!ie&&Vt)throw new V(k,"Doctype can not be appended since element is present")}}function Qe(M,F,ie){var De=M.childNodes||[],Ve=F.childNodes||[];if(F.nodeType===L.DOCUMENT_FRAGMENT_NODE){var yt=Ve.filter(je);if(yt.length>1||e(Ve,Ue))throw new V(k,"More than one element or text in fragment");if(yt.length===1&&!gt(M,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(je(F)&&!gt(M,ie))throw new V(k,"Only one element can be added and only after doctype");if(Oe(F)){let gn=function(ln){return Oe(ln)&&ln!==ie};var Jt=gn;if(e(De,gn))throw new V(k,"Only one doctype is allowed");var Vt=e(De,je);if(ie&&De.indexOf(Vt)<De.indexOf(ie))throw new V(k,"Doctype can only be inserted before an element")}}function Ye(M,F,ie,De){st(M,F,ie),M.nodeType===L.DOCUMENT_NODE&&(De||bt)(M,F,ie);var Ve=F.parentNode;if(Ve&&Ve.removeChild(F),F.nodeType===W){var yt=F.firstChild;if(yt==null)return F;var Vt=F.lastChild}else yt=Vt=F;var Jt=ie?ie.previousSibling:M.lastChild;yt.previousSibling=Jt,Vt.nextSibling=ie,Jt?Jt.nextSibling=yt:M.firstChild=yt,ie==null?M.lastChild=Vt:ie.previousSibling=Vt;do{yt.parentNode=M;var gn=M.ownerDocument||M;tt(yt,gn)}while(yt!==Vt&&(yt=yt.nextSibling));return Ke(M.ownerDocument||M,M),F.nodeType==W&&(F.firstChild=F.lastChild=null),F}function tt(M,F){if(M.ownerDocument!==F){if(M.ownerDocument=F,M.nodeType===S&&M.attributes)for(var ie=0;ie<M.attributes.length;ie++){var De=M.attributes.item(ie);De&&(De.ownerDocument=F)}for(var Ve=M.firstChild;Ve;)tt(Ve,F),Ve=Ve.nextSibling}}function $e(M,F){F.parentNode&&F.parentNode.removeChild(F),F.parentNode=M,F.previousSibling=M.lastChild,F.nextSibling=null,F.previousSibling?F.previousSibling.nextSibling=F:M.firstChild=F,M.lastChild=F,Ke(M.ownerDocument,M,F);var ie=M.ownerDocument||M;return tt(F,ie),F}ye.prototype={nodeName:"#document",nodeType:U,doctype:null,documentElement:null,_inc:1,insertBefore:function(M,F){if(M.nodeType==W){for(var ie=M.firstChild;ie;){var De=ie.nextSibling;this.insertBefore(ie,F),ie=De}return M}return Ye(this,M,F),tt(M,this),this.documentElement===null&&M.nodeType===S&&(this.documentElement=M),M},removeChild:function(M){return this.documentElement==M&&(this.documentElement=null),we(this,M)},replaceChild:function(M,F){Ye(this,M,F,Qe),tt(M,this),F&&this.removeChild(F),je(M)&&(this.documentElement=M)},importNode:function(M,F){return kn(this,M,F)},getElementById:function(M){var F=null;return Te(this.documentElement,function(ie){if(ie.nodeType==S&&ie.getAttribute("id")==M)return F=ie,!0}),F},getElementsByClassName:function(M){var F=u(M);return new me(this,function(ie){var De=[];return F.length>0&&Te(ie.documentElement,function(Ve){if(Ve!==ie&&Ve.nodeType===S){var yt=Ve.getAttribute("class");if(yt){var Vt=M===yt;if(!Vt){var Jt=u(yt);Vt=F.every(h(Jt))}Vt&&De.push(Ve)}}}),De})},createElement:function(M){var F=new ht;F.ownerDocument=this,F.nodeName=M,F.tagName=M,F.localName=M,F.childNodes=new ne;var ie=F.attributes=new q;return ie._ownerElement=F,F},createDocumentFragment:function(){var M=new pt;return M.ownerDocument=this,M.childNodes=new ne,M},createTextNode:function(M){var F=new Ie;return F.ownerDocument=this,F.appendData(M),F},createComment:function(M){var F=new Le;return F.ownerDocument=this,F.appendData(M),F},createCDATASection:function(M){var F=new ke;return F.ownerDocument=this,F.appendData(M),F},createProcessingInstruction:function(M,F){var ie=new Zt;return ie.ownerDocument=this,ie.tagName=ie.nodeName=ie.target=M,ie.nodeValue=ie.data=F,ie},createAttribute:function(M){var F=new At;return F.ownerDocument=this,F.name=M,F.nodeName=M,F.localName=M,F.specified=!0,F},createEntityReference:function(M){var F=new Lt;return F.ownerDocument=this,F.nodeName=M,F},createElementNS:function(M,F){var ie=new ht,De=F.split(":"),Ve=ie.attributes=new q;return ie.childNodes=new ne,ie.ownerDocument=this,ie.nodeName=F,ie.tagName=F,ie.namespaceURI=M,De.length==2?(ie.prefix=De[0],ie.localName=De[1]):ie.localName=F,Ve._ownerElement=ie,ie},createAttributeNS:function(M,F){var ie=new At,De=F.split(":");return ie.ownerDocument=this,ie.nodeName=F,ie.name=F,ie.namespaceURI=M,ie.specified=!0,De.length==2?(ie.prefix=De[0],ie.localName=De[1]):ie.localName=F,ie}},g(ye,L);function ht(){this._nsMap={}}ht.prototype={nodeType:S,hasAttribute:function(M){return this.getAttributeNode(M)!=null},getAttribute:function(M){var F=this.getAttributeNode(M);return F&&F.value||""},getAttributeNode:function(M){return this.attributes.getNamedItem(M)},setAttribute:function(M,F){var ie=this.ownerDocument.createAttribute(M);ie.value=ie.nodeValue=""+F,this.setAttributeNode(ie)},removeAttribute:function(M){var F=this.getAttributeNode(M);F&&this.removeAttributeNode(F)},appendChild:function(M){return M.nodeType===W?this.insertBefore(M,null):$e(this,M)},setAttributeNode:function(M){return this.attributes.setNamedItem(M)},setAttributeNodeNS:function(M){return this.attributes.setNamedItemNS(M)},removeAttributeNode:function(M){return this.attributes.removeNamedItem(M.nodeName)},removeAttributeNS:function(M,F){var ie=this.getAttributeNodeNS(M,F);ie&&this.removeAttributeNode(ie)},hasAttributeNS:function(M,F){return this.getAttributeNodeNS(M,F)!=null},getAttributeNS:function(M,F){var ie=this.getAttributeNodeNS(M,F);return ie&&ie.value||""},setAttributeNS:function(M,F,ie){var De=this.ownerDocument.createAttributeNS(M,F);De.value=De.nodeValue=""+ie,this.setAttributeNode(De)},getAttributeNodeNS:function(M,F){return this.attributes.getNamedItemNS(M,F)},getElementsByTagName:function(M){return new me(this,function(F){var ie=[];return Te(F,function(De){De!==F&&De.nodeType==S&&(M==="*"||De.tagName==M)&&ie.push(De)}),ie})},getElementsByTagNameNS:function(M,F){return new me(this,function(ie){var De=[];return Te(ie,function(Ve){Ve!==ie&&Ve.nodeType===S&&(M==="*"||Ve.namespaceURI===M)&&(F==="*"||Ve.localName==F)&&De.push(Ve)}),De})}},ye.prototype.getElementsByTagName=ht.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=ht.prototype.getElementsByTagNameNS,g(ht,L);function At(){}At.prototype.nodeType=C,g(At,L);function he(){}he.prototype={data:"",substringData:function(M,F){return this.data.substring(M,M+F)},appendData:function(M){M=this.data+M,this.nodeValue=this.data=M,this.length=M.length},insertData:function(M,F){this.replaceData(M,0,F)},appendChild:function(M){throw new Error(le[k])},deleteData:function(M,F){this.replaceData(M,F,"")},replaceData:function(M,F,ie){var De=this.data.substring(0,M),Ve=this.data.substring(M+F);ie=De+ie+Ve,this.nodeValue=this.data=ie,this.length=ie.length}},g(he,L);function Ie(){}Ie.prototype={nodeName:"#text",nodeType:N,splitText:function(M){var F=this.data,ie=F.substring(M);F=F.substring(0,M),this.data=this.nodeValue=F,this.length=F.length;var De=this.ownerDocument.createTextNode(ie);return this.parentNode&&this.parentNode.insertBefore(De,this.nextSibling),De}},g(Ie,he);function Le(){}Le.prototype={nodeName:"#comment",nodeType:Y},g(Le,he);function ke(){}ke.prototype={nodeName:"#cdata-section",nodeType:O},g(ke,he);function Pe(){}Pe.prototype.nodeType=re,g(Pe,L);function et(){}et.prototype.nodeType=X,g(et,L);function kt(){}kt.prototype.nodeType=B,g(kt,L);function Lt(){}Lt.prototype.nodeType=E,g(Lt,L);function pt(){}pt.prototype.nodeName="#document-fragment",pt.prototype.nodeType=W,g(pt,L);function Zt(){}Zt.prototype.nodeType=H,g(Zt,L);function qt(){}qt.prototype.serializeToString=function(M,F,ie){return Gt.call(M,F,ie)},L.prototype.toString=Gt;function Gt(M,F){var ie=[],De=this.nodeType==9&&this.documentElement||this,Ve=De.prefix,yt=De.namespaceURI;if(yt&&Ve==null){var Ve=De.lookupPrefix(yt);if(Ve==null)var Vt=[{namespace:yt,prefix:null}]}return Yt(this,ie,M,F,Vt),ie.join("")}function wt(M,F,ie){var De=M.prefix||"",Ve=M.namespaceURI;if(!Ve||De==="xml"&&Ve===t.XML||Ve===t.XMLNS)return!1;for(var yt=ie.length;yt--;){var Vt=ie[yt];if(Vt.prefix===De)return Vt.namespace!==Ve}return!0}function lt(M,F,ie){M.push(" ",F,'="',ie.replace(/[<>&"\t\n\r]/g,xe),'"')}function Yt(M,F,ie,De,Ve){if(Ve||(Ve=[]),De)if(M=De(M),M){if(typeof M=="string"){F.push(M);return}}else return;switch(M.nodeType){case S:var yt=M.attributes,Vt=yt.length,Dt=M.firstChild,Jt=M.tagName;ie=t.isHTML(M.namespaceURI)||ie;var gn=Jt;if(!ie&&!M.prefix&&M.namespaceURI){for(var ln,_n=0;_n<yt.length;_n++)if(yt.item(_n).name==="xmlns"){ln=yt.item(_n).value;break}if(!ln)for(var En=Ve.length-1;En>=0;En--){var Ut=Ve[En];if(Ut.prefix===""&&Ut.namespace===M.namespaceURI){ln=Ut.namespace;break}}if(ln!==M.namespaceURI)for(var En=Ve.length-1;En>=0;En--){var Ut=Ve[En];if(Ut.namespace===M.namespaceURI){Ut.prefix&&(gn=Ut.prefix+":"+Jt);break}}}F.push("<",gn);for(var hn=0;hn<Vt;hn++){var cn=yt.item(hn);cn.prefix=="xmlns"?Ve.push({prefix:cn.localName,namespace:cn.value}):cn.nodeName=="xmlns"&&Ve.push({prefix:"",namespace:cn.value})}for(var hn=0;hn<Vt;hn++){var cn=yt.item(hn);if(wt(cn,ie,Ve)){var en=cn.prefix||"",zt=cn.namespaceURI;lt(F,en?"xmlns:"+en:"xmlns",zt),Ve.push({prefix:en,namespace:zt})}Yt(cn,F,ie,De,Ve)}if(Jt===gn&&wt(M,ie,Ve)){var en=M.prefix||"",zt=M.namespaceURI;lt(F,en?"xmlns:"+en:"xmlns",zt),Ve.push({prefix:en,namespace:zt})}if(Dt||ie&&!/^(?:meta|link|img|br|hr|input)$/i.test(Jt)){if(F.push(">"),ie&&/^script$/i.test(Jt))for(;Dt;)Dt.data?F.push(Dt.data):Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;else for(;Dt;)Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;F.push("</",gn,">")}else F.push("/>");return;case U:case W:for(var Dt=M.firstChild;Dt;)Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;return;case C:return lt(F,M.name,M.value);case N:return F.push(M.data.replace(/[<&>]/g,xe));case O:return F.push("<![CDATA[",M.data,"]]>");case Y:return F.push("<!--",M.data,"-->");case re:var Ot=M.publicId,Hn=M.systemId;if(F.push("<!DOCTYPE ",M.name),Ot)F.push(" PUBLIC ",Ot),Hn&&Hn!="."&&F.push(" ",Hn),F.push(">");else if(Hn&&Hn!=".")F.push(" SYSTEM ",Hn,">");else{var Rt=M.internalSubset;Rt&&F.push(" [",Rt,"]"),F.push(">")}return;case H:return F.push("<?",M.target," ",M.data,"?>");case E:return F.push("&",M.nodeName,";");default:F.push("??",M.nodeName)}}function kn(M,F,ie){var De;switch(F.nodeType){case S:De=F.cloneNode(!1),De.ownerDocument=M;case W:break;case C:ie=!0;break}if(De||(De=F.cloneNode(!1)),De.ownerDocument=M,De.parentNode=null,ie)for(var Ve=F.firstChild;Ve;)De.appendChild(kn(M,Ve,ie)),Ve=Ve.nextSibling;return De}function pn(M,F,ie){var De=new F.constructor;for(var Ve in F)if(Object.prototype.hasOwnProperty.call(F,Ve)){var yt=F[Ve];typeof yt!="object"&&yt!=De[Ve]&&(De[Ve]=yt)}switch(F.childNodes&&(De.childNodes=new ne),De.ownerDocument=M,De.nodeType){case S:var Vt=F.attributes,Jt=De.attributes=new q,gn=Vt.length;Jt._ownerElement=De;for(var ln=0;ln<gn;ln++)De.setAttributeNode(pn(M,Vt.item(ln),!0));break;case C:ie=!0}if(ie)for(var _n=F.firstChild;_n;)De.appendChild(pn(M,_n,ie)),_n=_n.nextSibling;return De}function xn(M,F,ie){M[F]=ie}try{if(Object.defineProperty){let M=function(F){switch(F.nodeType){case S:case W:var ie=[];for(F=F.firstChild;F;)F.nodeType!==7&&F.nodeType!==8&&ie.push(M(F)),F=F.nextSibling;return ie.join("");default:return F.nodeValue}};var rt=M;Object.defineProperty(me.prototype,"length",{get:function(){return ue(this),this.$$length}}),Object.defineProperty(L.prototype,"textContent",{get:function(){return M(this)},set:function(F){switch(this.nodeType){case S:case W:for(;this.firstChild;)this.removeChild(this.firstChild);(F||String(F))&&this.appendChild(this.ownerDocument.createTextNode(F));break;default:this.data=F,this.value=F,this.nodeValue=F}}}),xn=function(F,ie,De){F["$$"+ie]=De}}}catch{}return xa.DocumentType=Pe,xa.DOMException=V,xa.DOMImplementation=ge,xa.Element=ht,xa.Node=L,xa.NodeList=ne,xa.XMLSerializer=qt,xa}var Bc={},Yp={},v2;function yD(){return v2||(v2=1,(function(n){var e=s0().freeze;n.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),n.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"",backsim:"∽",backsimeq:"⋍",Backslash:"",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"",Bernoullis:"",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"",caps:"∩︀",caret:"",caron:"ˇ",Cayleys:"",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"",dd:"",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:"",emsp13:"",emsp14:"",ENG:"Ŋ",eng:"ŋ",ensp:"",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"",escr:"",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"",ExponentialE:"",exponentiale:"",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"",frown:"⌢",Fscr:"",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:"",half:"½",hamilt:"",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"",hfr:"𝔥",HilbertSpace:"",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"",hyphen:"",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"",Imacr:"Ī",imacr:"ī",image:"",ImaginaryI:"",imagline:"",imagpart:"",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"",Lscr:"",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"",lsquor:"",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:"",Mellintrf:"",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"",midast:"*",midcir:"⫰",middot:"·",minus:"",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:"",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"",operp:"⦹",oplus:"⊕",Or:"⩔",or:"",orarr:"↻",ord:"⩝",order:"",orderof:"",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"",pointint:"⨕",Popf:"",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"",primes:"",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:"",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"",rationals:"",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"",real:"",realine:"",realpart:"",reals:"",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"",Rscr:"",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"",rsquor:"",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"",setmn:"",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"",smashp:"⨳",smeparsl:"⧤",smid:"",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"",ThickSpace:"",thinsp:"",ThinSpace:"",thkap:"≈",thksim:"",THORN:"Þ",thorn:"þ",Tilde:"",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"",vee:"",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:"",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),n.entityMap=n.HTML_ENTITIES})(Yp)),Yp}var Xh={},x2;function bD(){if(x2)return Xh;x2=1;var n=s0().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),a=0,l=1,u=2,h=3,f=4,g=5,_=6,S=7;function C(k,j){this.message=k,this.locator=j,Error.captureStackTrace&&Error.captureStackTrace(this,C)}C.prototype=new Error,C.prototype.name=C.name;function N(){}N.prototype={parse:function(k,j,Z){var V=this.domBuilder;V.startDocument(),re(j,j={}),O(k,j,Z,V,this.errorHandler),V.endDocument()}};function O(k,j,Z,V,ne){function me($e){if($e>65535){$e-=65536;var ht=55296+($e>>10),At=56320+($e&1023);return String.fromCharCode(ht,At)}else return String.fromCharCode($e)}function ue($e){var ht=$e.slice(1,-1);return Object.hasOwnProperty.call(Z,ht)?Z[ht]:ht.charAt(0)==="#"?me(parseInt(ht.substr(1).replace("x","0x"))):(ne.error("entity not found:"+$e),$e)}function q($e){if($e>ye){var ht=k.substring(ye,$e).replace(/&#?\w+;/g,ue);L&&P(ye),V.characters(ht,0,$e-ye),ye=$e}}function P($e,ht){for(;$e>=te&&(ht=ge.exec(k));)Q=ht.index,te=Q+ht[0].length,L.lineNumber++;L.columnNumber=$e-Q+1}for(var Q=0,te=0,ge=/.*(?:\r\n?|\n)|.*$/g,L=V.locator,xe=[{currentNSMap:j}],Te={},ye=0;;){try{var be=k.indexOf("<",ye);if(be<0){if(!k.substr(ye).match(/^\s*$/)){var mt=V.doc,Ke=mt.createTextNode(k.substr(ye));mt.appendChild(Ke),V.currentElement=Ke}return}switch(be>ye&&q(be),k.charAt(be+1)){case"/":var st=k.indexOf(">",be+3),we=k.substring(be+2,st).replace(/[ \t\n\r]+$/g,""),Re=xe.pop();st<0?(we=k.substring(be+2).replace(/[\s<].*/,""),ne.error("end tag name: "+we+" is not complete:"+Re.tagName),st=be+1+we.length):we.match(/\s</)&&(we=we.replace(/[\s<].*/,""),ne.error("end tag name: "+we+" maybe not complete"),st=be+1+we.length);var ct=Re.localNSMap,Oe=Re.tagName==we,je=Oe||Re.tagName&&Re.tagName.toLowerCase()==we.toLowerCase();if(je){if(V.endElement(Re.uri,Re.localName,we),ct)for(var Ue in ct)Object.prototype.hasOwnProperty.call(ct,Ue)&&V.endPrefixMapping(Ue);Oe||ne.fatalError("end tag name: "+we+" is not match the current start tagName:"+Re.tagName)}else xe.push(Re);st++;break;case"?":L&&P(be),st=X(k,be,V);break;case"!":L&&P(be),st=W(k,be,V,ne);break;default:L&&P(be);var ze=new R,gt=xe[xe.length-1].currentNSMap,st=B(k,be,ze,gt,ue,ne),bt=ze.length;if(!ze.closed&&U(k,st,ze.tagName,Te)&&(ze.closed=!0,Z.nbsp||ne.warning("unclosed xml attribute")),L&&bt){for(var Qe=E(L,{}),Ye=0;Ye<bt;Ye++){var tt=ze[Ye];P(tt.offset),tt.locator=E(L,{})}V.locator=Qe,H(ze,V,gt)&&xe.push(ze),V.locator=L}else H(ze,V,gt)&&xe.push(ze);n.isHTML(ze.uri)&&!ze.closed?st=Y(k,st,ze.tagName,ue,V):st++}}catch($e){if($e instanceof C)throw $e;ne.error("element parse error: "+$e),st=-1}st>ye?ye=st:q(Math.max(be,ye)+1)}}function E(k,j){return j.lineNumber=k.lineNumber,j.columnNumber=k.columnNumber,j}function B(k,j,Z,V,ne,me){function ue(L,xe,Te){Z.attributeNames.hasOwnProperty(L)&&me.fatalError("Attribute "+L+" redefined"),Z.addValue(L,xe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,ne),Te)}for(var q,P,Q=++j,te=a;;){var ge=k.charAt(Q);switch(ge){case"=":if(te===l)q=k.slice(j,Q),te=h;else if(te===u)te=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(te===h||te===l)if(te===l&&(me.warning('attribute value must after "="'),q=k.slice(j,Q)),j=Q+1,Q=k.indexOf(ge,j),Q>0)P=k.slice(j,Q),ue(q,P,j-1),te=g;else throw new Error("attribute value no end '"+ge+"' match");else if(te==f)P=k.slice(j,Q),ue(q,P,j),me.warning('attribute "'+q+'" missed start quot('+ge+")!!"),j=Q+1,te=g;else throw new Error('attribute value must after "="');break;case"/":switch(te){case a:Z.setTagName(k.slice(j,Q));case g:case _:case S:te=S,Z.closed=!0;case f:case l:break;case u:Z.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return me.error("unexpected end of input"),te==a&&Z.setTagName(k.slice(j,Q)),Q;case">":switch(te){case a:Z.setTagName(k.slice(j,Q));case g:case _:case S:break;case f:case l:P=k.slice(j,Q),P.slice(-1)==="/"&&(Z.closed=!0,P=P.slice(0,-1));case u:te===u&&(P=q),te==f?(me.warning('attribute "'+P+'" missed quot(")!'),ue(q,P,j)):((!n.isHTML(V[""])||!P.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+P+'" missed value!! "'+P+'" instead!!'),ue(P,P,j));break;case h:throw new Error("attribute value missed!!")}return Q;case"€":ge=" ";default:if(ge<=" ")switch(te){case a:Z.setTagName(k.slice(j,Q)),te=_;break;case l:q=k.slice(j,Q),te=u;break;case f:var P=k.slice(j,Q);me.warning('attribute "'+P+'" missed quot(")!!'),ue(q,P,j);case g:te=_;break}else switch(te){case u:Z.tagName,(!n.isHTML(V[""])||!q.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+q+'" missed value!! "'+q+'" instead2!!'),ue(q,q,j),j=Q,te=l;break;case g:me.warning('attribute space is required"'+q+'"!!');case _:te=l,j=Q;break;case h:te=f,j=Q;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}Q++}}function H(k,j,Z){for(var V=k.tagName,ne=null,ge=k.length;ge--;){var me=k[ge],ue=me.qName,q=me.value,L=ue.indexOf(":");if(L>0)var P=me.prefix=ue.slice(0,L),Q=ue.slice(L+1),te=P==="xmlns"&&Q;else Q=ue,P=null,te=ue==="xmlns"&&"";me.localName=Q,te!==!1&&(ne==null&&(ne={},re(Z,Z={})),Z[te]=ne[te]=q,me.uri=n.XMLNS,j.startPrefixMapping(te,q))}for(var ge=k.length;ge--;){me=k[ge];var P=me.prefix;P&&(P==="xml"&&(me.uri=n.XML),P!=="xmlns"&&(me.uri=Z[P||""]))}var L=V.indexOf(":");L>0?(P=k.prefix=V.slice(0,L),Q=k.localName=V.slice(L+1)):(P=null,Q=k.localName=V);var xe=k.uri=Z[P||""];if(j.startElement(xe,Q,V,k),k.closed){if(j.endElement(xe,Q,V),ne)for(P in ne)Object.prototype.hasOwnProperty.call(ne,P)&&j.endPrefixMapping(P)}else return k.currentNSMap=Z,k.localNSMap=ne,!0}function Y(k,j,Z,V,ne){if(/^(?:script|textarea)$/i.test(Z)){var me=k.indexOf("</"+Z+">",j),ue=k.substring(j+1,me);if(/[&<]/.test(ue))return/^script$/i.test(Z)?(ne.characters(ue,0,ue.length),me):(ue=ue.replace(/&#?\w+;/g,V),ne.characters(ue,0,ue.length),me)}return j+1}function U(k,j,Z,V){var ne=V[Z];return ne==null&&(ne=k.lastIndexOf("</"+Z+">"),ne<j&&(ne=k.lastIndexOf("</"+Z)),V[Z]=ne),ne<j}function re(k,j){for(var Z in k)Object.prototype.hasOwnProperty.call(k,Z)&&(j[Z]=k[Z])}function W(k,j,Z,V){var ne=k.charAt(j+2);switch(ne){case"-":if(k.charAt(j+3)==="-"){var me=k.indexOf("-->",j+4);return me>j?(Z.comment(k,j+4,me-j-4),me+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(j+3,6)=="CDATA["){var me=k.indexOf("]]>",j+9);return Z.startCDATA(),Z.characters(k,j+9,me-j-9),Z.endCDATA(),me+3}var ue=le(k,j),q=ue.length;if(q>1&&/!doctype/i.test(ue[0][0])){var P=ue[1][0],Q=!1,te=!1;q>3&&(/^public$/i.test(ue[2][0])?(Q=ue[3][0],te=q>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(te=ue[3][0]));var ge=ue[q-1];return Z.startDTD(P,Q,te),Z.endDTD(),ge.index+ge[0].length}}return-1}function X(k,j,Z){var V=k.indexOf("?>",j);if(V){var ne=k.substring(j,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return ne?(ne[0].length,Z.processingInstruction(ne[1],ne[2]),V+2):-1}return-1}function R(){this.attributeNames={}}R.prototype={setTagName:function(k){if(!i.test(k))throw new Error("invalid tagName:"+k);this.tagName=k},addValue:function(k,j,Z){if(!i.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:j,offset:Z}},length:0,getLocalName:function(k){return this[k].localName},getLocator:function(k){return this[k].locator},getQName:function(k){return this[k].qName},getURI:function(k){return this[k].uri},getValue:function(k){return this[k].value}};function le(k,j){var Z,V=[],ne=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(ne.lastIndex=j,ne.exec(k);Z=ne.exec(k);)if(V.push(Z),Z[1])return V}return Xh.XMLReader=N,Xh.ParseError=C,Xh}var _2;function vD(){if(_2)return Bc;_2=1;var n=s0(),e=Kw(),t=yD(),i=bD(),a=e.DOMImplementation,l=n.NAMESPACE,u=i.ParseError,h=i.XMLReader;function f(B){return B.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function g(B){this.options=B||{locator:{}}}g.prototype.parseFromString=function(B,H){var Y=this.options,U=new h,re=Y.domBuilder||new S,W=Y.errorHandler,X=Y.locator,R=Y.xmlns||{},le=/\/x?html?$/.test(H),k=le?t.HTML_ENTITIES:t.XML_ENTITIES;X&&re.setDocumentLocator(X),U.errorHandler=_(W,re,X),U.domBuilder=Y.domBuilder||re,le&&(R[""]=l.HTML),R.xml=R.xml||l.XML;var j=Y.normalizeLineEndings||f;return B&&typeof B=="string"?U.parse(j(B),R,k):U.errorHandler.error("invalid doc source"),re.doc};function _(B,H,Y){if(!B){if(H instanceof S)return H;B=H}var U={},re=B instanceof Function;Y=Y||{};function W(X){var R=B[X];!R&&re&&(R=B.length==2?function(le){B(X,le)}:B),U[X]=R&&function(le){R("[xmldom "+X+"] "+le+N(Y))}||function(){}}return W("warning"),W("error"),W("fatalError"),U}function S(){this.cdata=!1}function C(B,H){H.lineNumber=B.lineNumber,H.columnNumber=B.columnNumber}S.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(B,H,Y,U){var re=this.doc,W=re.createElementNS(B,Y||H),X=U.length;E(this,W),this.currentElement=W,this.locator&&C(this.locator,W);for(var R=0;R<X;R++){var B=U.getURI(R),le=U.getValue(R),Y=U.getQName(R),k=re.createAttributeNS(B,Y);this.locator&&C(U.getLocator(R),k),k.value=k.nodeValue=le,W.setAttributeNode(k)}},endElement:function(B,H,Y){var U=this.currentElement;U.tagName,this.currentElement=U.parentNode},startPrefixMapping:function(B,H){},endPrefixMapping:function(B){},processingInstruction:function(B,H){var Y=this.doc.createProcessingInstruction(B,H);this.locator&&C(this.locator,Y),E(this,Y)},ignorableWhitespace:function(B,H,Y){},characters:function(B,H,Y){if(B=O.apply(this,arguments),B){if(this.cdata)var U=this.doc.createCDATASection(B);else var U=this.doc.createTextNode(B);this.currentElement?this.currentElement.appendChild(U):/^\s*$/.test(B)&&this.doc.appendChild(U),this.locator&&C(this.locator,U)}},skippedEntity:function(B){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(B){(this.locator=B)&&(B.lineNumber=0)},comment:function(B,H,Y){B=O.apply(this,arguments);var U=this.doc.createComment(B);this.locator&&C(this.locator,U),E(this,U)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(B,H,Y){var U=this.doc.implementation;if(U&&U.createDocumentType){var re=U.createDocumentType(B,H,Y);this.locator&&C(this.locator,re),E(this,re),this.doc.doctype=re}},warning:function(B){console.warn("[xmldom warning] "+B,N(this.locator))},error:function(B){console.error("[xmldom error] "+B,N(this.locator))},fatalError:function(B){throw new u(B,this.locator)}};function N(B){if(B)return`
@`+(B.systemId||"")+"#[line:"+B.lineNumber+",col:"+B.columnNumber+"]"}function O(B,H,Y){return typeof B=="string"?B.substr(H,Y):B.length>=H+Y||H?new java.lang.String(B,H,Y)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){S.prototype[B]=function(){return null}});function E(B,H){B.currentElement?B.currentElement.appendChild(H):B.doc.appendChild(H)}return Bc.__DOMHandler=S,Bc.normalizeLineEndings=f,Bc.DOMParser=g,Bc}var w2;function xD(){if(w2)return Ic;w2=1;var n=Kw();return Ic.DOMImplementation=n.DOMImplementation,Ic.XMLSerializer=n.XMLSerializer,Ic.DOMParser=vD().DOMParser,Ic}var _D=xD();const T2=n=>!!n&&typeof n=="object",ur=(...n)=>n.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):T2(e[i])&&T2(t[i])?e[i]=ur(e[i],t[i]):e[i]=t[i]}),e),{}),Ww=n=>Object.keys(n).map(e=>n[e]),wD=(n,e)=>{const t=[];for(let i=n;i<e;i++)t.push(i);return t},wu=n=>n.reduce((e,t)=>e.concat(t),[]),Xw=n=>{if(!n.length)return[];const e=[];for(let t=0;t<n.length;t++)e.push(n[t]);return e},TD=(n,e)=>n.reduce((t,i,a)=>(i[e]&&t.push(a),t),[]),SD=(n,e)=>Ww(n.reduce((t,i)=>(i.forEach(a=>{t[e(a)]=a}),t),{}));var Tu={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:n="",source:e="",range:t="",indexRange:i=""})=>{const a={uri:e,resolvedUri:r0(n||"",e)};if(t||i){const u=(t||i).split("-");let h=de.BigInt?de.BigInt(u[0]):parseInt(u[0],10),f=de.BigInt?de.BigInt(u[1]):parseInt(u[1],10);h<Number.MAX_SAFE_INTEGER&&typeof h=="bigint"&&(h=Number(h)),f<Number.MAX_SAFE_INTEGER&&typeof f=="bigint"&&(f=Number(f));let g;typeof f=="bigint"||typeof h=="bigint"?g=de.BigInt(f)-de.BigInt(h)+de.BigInt(1):g=f-h+1,typeof g=="bigint"&&g<Number.MAX_SAFE_INTEGER&&(g=Number(g)),a.byterange={length:g,offset:h}}return a},kD=n=>{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=de.BigInt(n.offset)+de.BigInt(n.length)-de.BigInt(1):e=n.offset+n.length-1,`${n.offset}-${e}`},S2=n=>(n&&typeof n!="number"&&(n=parseInt(n,10)),isNaN(n)?null:n),ED={static(n){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:a}=n,l=S2(n.endNumber),u=e/t;return typeof l=="number"?{start:0,end:l}:typeof a=="number"?{start:0,end:a/u}:{start:0,end:i/u}},dynamic(n){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:a=1,duration:l,periodStart:u=0,minimumUpdatePeriod:h=0,timeShiftBufferDepth:f=1/0}=n,g=S2(n.endNumber),_=(e+t)/1e3,S=i+u,N=_+h-S,O=Math.ceil(N*a/l),E=Math.floor((_-S-f)*a/l),B=Math.floor((_-S)*a/l);return{start:Math.max(0,E),end:typeof g=="number"?g:Math.min(O,B)}}},CD=n=>e=>{const{duration:t,timescale:i=1,periodStart:a,startNumber:l=1}=n;return{number:l+e,duration:t/i,timeline:a,time:e*t}},Sy=n=>{const{type:e,duration:t,timescale:i=1,periodDuration:a,sourceDuration:l}=n,{start:u,end:h}=ED[e](n),f=wD(u,h).map(CD(n));if(e==="static"){const g=f.length-1,_=typeof a=="number"?a:l;f[g].duration=_-t/i*g}return f},Yw=n=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:a="",periodStart:l,presentationTime:u,number:h=0,duration:f}=n;if(!e)throw new Error(Tu.NO_BASE_URL);const g=fd({baseUrl:e,source:t.sourceURL,range:t.range}),_=fd({baseUrl:e,source:e,indexRange:a});if(_.map=g,f){const S=Sy(n);S.length&&(_.duration=S[0].duration,_.timeline=S[0].timeline)}else i&&(_.duration=i,_.timeline=l);return _.presentationTime=u||l,_.number=h,[_]},ky=(n,e,t)=>{const i=n.sidx.map?n.sidx.map:null,a=n.sidx.duration,l=n.timeline||0,u=n.sidx.byterange,h=u.offset+u.length,f=e.timescale,g=e.references.filter(B=>B.referenceType!==1),_=[],S=n.endList?"static":"dynamic",C=n.sidx.timeline;let N=C,O=n.mediaSequence||0,E;typeof e.firstOffset=="bigint"?E=de.BigInt(h)+e.firstOffset:E=h+e.firstOffset;for(let B=0;B<g.length;B++){const H=e.references[B],Y=H.referencedSize,U=H.subsegmentDuration;let re;typeof E=="bigint"?re=E+de.BigInt(Y)-de.BigInt(1):re=E+Y-1;const W=`${E}-${re}`,R=Yw({baseUrl:t,timescale:f,timeline:l,periodStart:C,presentationTime:N,number:O,duration:U,sourceDuration:a,indexRange:W,type:S})[0];i&&(R.map=i),_.push(R),typeof E=="bigint"?E+=de.BigInt(Y):E+=Y,N+=U/f,O++}return n.segments=_,n},AD=["AUDIO","SUBTITLES"],ND=1/60,Qw=n=>SD(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),DD=(n,e)=>{for(let t=0;t<n.length;t++)if(n[t].attributes.NAME===e)return n[t];return null},k2=n=>{let e=[];return gD(n,AD,(t,i,a,l)=>{e=e.concat(t.playlists||[])}),e},E2=({playlist:n,mediaSequence:e})=>{n.mediaSequence=e,n.segments.forEach((t,i)=>{t.number=n.mediaSequence+i})},MD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=DD(n,i.attributes.NAME);if(!a||i.sidx)return;const l=i.segments[0],u=a.segments.findIndex(function(f){return Math.abs(f.presentationTime-l.presentationTime)<ND});if(u===-1){E2({playlist:i,mediaSequence:a.mediaSequence+a.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!a.segments.length&&i.timeline>a.timeline||a.segments.length&&i.timeline>a.segments[a.segments.length-1].timeline)&&i.discontinuitySequence--;return}a.segments[u].discontinuity&&!l.discontinuity&&(l.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),E2({playlist:i,mediaSequence:a.segments[u].number})})},jD=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(k2(n)),i=e.playlists.concat(k2(e));return e.timelineStarts=Qw([n.timelineStarts,e.timelineStarts]),MD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},a0=n=>n&&n.uri+"-"+kD(n.byterange),Qp=n=>{const e=n.reduce(function(i,a){return i[a.attributes.baseUrl]||(i[a.attributes.baseUrl]=[]),i[a.attributes.baseUrl].push(a),i},{});let t=[];return Object.values(e).forEach(i=>{const a=Ww(i.reduce((l,u)=>{const h=u.attributes.id+(u.attributes.lang||"");return l[h]?(u.segments&&(u.segments[0]&&(u.segments[0].discontinuity=!0),l[h].segments.push(...u.segments)),u.attributes.contentProtection&&(l[h].attributes.contentProtection=u.attributes.contentProtection)):(l[h]=u,l[h].attributes.timelineStarts=[]),l[h].attributes.timelineStarts.push({start:u.attributes.periodStart,timeline:u.attributes.periodStart}),l},{}));t=t.concat(a)}),t.map(i=>(i.discontinuityStarts=TD(i.segments||[],"discontinuity"),i))},Ey=(n,e)=>{const t=a0(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&ky(n,i,n.sidx.resolvedUri),n},RD=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=Ey(n[t],e);return n},OD=({attributes:n,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:a,discontinuityStarts:l},u)=>{const h={attributes:{NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs,"PROGRAM-ID":1},uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuitySequence:a,discontinuityStarts:l,timelineStarts:n.timelineStarts,mediaSequence:i,segments:e};return n.contentProtection&&(h.contentProtection=n.contentProtection),n.serviceLocation&&(h.attributes.serviceLocation=n.serviceLocation),t&&(h.sidx=t),u&&(h.attributes.AUDIO="audio",h.attributes.SUBTITLES="subs"),h},LD=({attributes:n,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:a})=>{typeof e>"u"&&(e=[{uri:n.baseUrl,timeline:n.periodStart,resolvedUri:n.baseUrl||"",duration:n.sourceDuration,number:0}],n.duration=n.sourceDuration);const l={NAME:n.id,BANDWIDTH:n.bandwidth,"PROGRAM-ID":1};n.codecs&&(l.CODECS=n.codecs);const u={attributes:l,uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,timelineStarts:n.timelineStarts,discontinuityStarts:i,discontinuitySequence:a,mediaSequence:t,segments:e};return n.serviceLocation&&(u.attributes.serviceLocation=n.serviceLocation),u},ID=(n,e={},t=!1)=>{let i;const a=n.reduce((l,u)=>{const h=u.attributes.role&&u.attributes.role.value||"",f=u.attributes.lang||"";let g=u.attributes.label||"main";if(f&&!u.attributes.label){const S=h?` (${h})`:"";g=`${u.attributes.lang}${S}`}l[g]||(l[g]={language:f,autoselect:!0,default:h==="main",playlists:[],uri:""});const _=Ey(OD(u,t),e);return l[g].playlists.push(_),typeof i>"u"&&h==="main"&&(i=u,i.default=!0),l},{});if(!i){const l=Object.keys(a)[0];a[l].default=!0}return a},BD=(n,e={})=>n.reduce((t,i)=>{const a=i.attributes.label||i.attributes.lang||"text",l=i.attributes.lang||"und";return t[a]||(t[a]={language:l,default:!1,autoselect:!1,playlists:[],uri:""}),t[a].playlists.push(Ey(LD(i),e)),t},{}),PD=n=>n.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:a,language:l}=i;e[l]={autoselect:!1,default:!1,instreamId:a,language:l},i.hasOwnProperty("aspectRatio")&&(e[l].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[l].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[l]["3D"]=i["3D"])}),e),{}),FD=({attributes:n,segments:e,sidx:t,discontinuityStarts:i})=>{const a={attributes:{NAME:n.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:n.width,height:n.height},CODECS:n.codecs,BANDWIDTH:n.bandwidth,"PROGRAM-ID":1},uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuityStarts:i,timelineStarts:n.timelineStarts,segments:e};return n.frameRate&&(a.attributes["FRAME-RATE"]=n.frameRate),n.contentProtection&&(a.contentProtection=n.contentProtection),n.serviceLocation&&(a.attributes.serviceLocation=n.serviceLocation),t&&(a.sidx=t),a},UD=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",zD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",$D=({attributes:n})=>n.mimeType==="text/vtt"||n.contentType==="text",HD=(n,e)=>{n.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,a)=>{i.number=a})})},C2=n=>n?Object.keys(n).reduce((e,t)=>{const i=n[t];return e.concat(i.playlists)},[]):[],qD=({dashPlaylists:n,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:a,eventStream:l})=>{if(!n.length)return{};const{sourceDuration:u,type:h,suggestedPresentationDelay:f,minimumUpdatePeriod:g}=n[0].attributes,_=Qp(n.filter(UD)).map(FD),S=Qp(n.filter(zD)),C=Qp(n.filter($D)),N=n.map(re=>re.attributes.captionServices).filter(Boolean),O={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:RD(_,i)};g>=0&&(O.minimumUpdatePeriod=g*1e3),e&&(O.locations=e),t&&(O.contentSteering=t),h==="dynamic"&&(O.suggestedPresentationDelay=f),l&&l.length>0&&(O.eventStream=l);const E=O.playlists.length===0,B=S.length?ID(S,i,E):null,H=C.length?BD(C,i):null,Y=_.concat(C2(B),C2(H)),U=Y.map(({timelineStarts:re})=>re);return O.timelineStarts=Qw(U),HD(Y,O.timelineStarts),B&&(O.mediaGroups.AUDIO.audio=B),H&&(O.mediaGroups.SUBTITLES.subs=H),N.length&&(O.mediaGroups["CLOSED-CAPTIONS"].cc=PD(N)),a?jD({oldManifest:a,newManifest:O}):O},VD=(n,e,t)=>{const{NOW:i,clientOffset:a,availabilityStartTime:l,timescale:u=1,periodStart:h=0,minimumUpdatePeriod:f=0}=n,g=(i+a)/1e3,_=l+h,C=g+f-_;return Math.ceil((C*u-e)/t)},Zw=(n,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:a="",sourceDuration:l,timescale:u=1,startNumber:h=1,periodStart:f}=n,g=[];let _=-1;for(let S=0;S<e.length;S++){const C=e[S],N=C.d,O=C.r||0,E=C.t||0;_<0&&(_=E),E&&E>_&&(_=E);let B;if(O<0){const U=S+1;U===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=VD(n,_,N):B=(l*u-_)/N:B=(e[U].t-_)/N}else B=O+1;const H=h+g.length+B;let Y=h+g.length;for(;Y<H;)g.push({number:Y,duration:N/u,time:_,timeline:f}),_+=N,Y++}return g},GD=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,KD=n=>(e,t,i,a)=>{if(e==="$$")return"$";if(typeof n[t]>"u")return e;const l=""+n[t];return t==="RepresentationID"||(i?a=parseInt(a,10):a=1,l.length>=a)?l:`${new Array(a-l.length+1).join("0")}${l}`},A2=(n,e)=>n.replace(GD,KD(e)),WD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?Sy(n):Zw(n,e),XD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=fd({baseUrl:n.baseUrl,source:A2(i.sourceURL,t),range:i.range});return WD(n,e).map(u=>{t.Number=u.number,t.Time=u.time;const h=A2(n.media||"",t),f=n.timescale||1,g=n.presentationTimeOffset||0,_=n.periodStart+(u.time-g)/f;return{uri:h,timeline:u.timeline,duration:u.duration,resolvedUri:r0(n.baseUrl||"",h),map:a,number:u.number,presentationTime:_}})},YD=(n,e)=>{const{baseUrl:t,initialization:i={}}=n,a=fd({baseUrl:t,source:i.sourceURL,range:i.range}),l=fd({baseUrl:t,source:e.media,range:e.mediaRange});return l.map=a,l},QD=(n,e)=>{const{duration:t,segmentUrls:i=[],periodStart:a}=n;if(!t&&!e||t&&e)throw new Error(Tu.SEGMENT_TIME_UNSPECIFIED);const l=i.map(f=>YD(n,f));let u;return t&&(u=Sy(n)),e&&(u=Zw(n,e)),u.map((f,g)=>{if(l[g]){const _=l[g],S=n.timescale||1,C=n.presentationTimeOffset||0;return _.timeline=f.timeline,_.duration=f.duration,_.number=f.number,_.presentationTime=a+(f.time-C)/S,_}}).filter(f=>f)},ZD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=XD,t=ur(n,e.template)):e.base?(i=Yw,t=ur(n,e.base)):e.list&&(i=QD,t=ur(n,e.list));const a={attributes:n};if(!i)return a;const l=i(t,e.segmentTimeline);if(t.duration){const{duration:u,timescale:h=1}=t;t.duration=u/h}else l.length?t.duration=l.reduce((u,h)=>Math.max(u,Math.ceil(h.duration)),0):t.duration=0;return a.attributes=t,a.segments=l,e.base&&t.indexRange&&(a.sidx=l[0],a.segments=[]),a},JD=n=>n.map(ZD),Di=(n,e)=>Xw(n.childNodes).filter(({tagName:t})=>t===e),wd=n=>n.textContent.trim(),e4=n=>parseFloat(n.split("/").reduce((e,t)=>e/t)),Xl=n=>{const h=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(n);if(!h)return 0;const[f,g,_,S,C,N]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(_||0)*86400+parseFloat(S||0)*3600+parseFloat(C||0)*60+parseFloat(N||0)},t4=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),N2={mediaPresentationDuration(n){return Xl(n)},availabilityStartTime(n){return t4(n)/1e3},minimumUpdatePeriod(n){return Xl(n)},suggestedPresentationDelay(n){return Xl(n)},type(n){return n},timeShiftBufferDepth(n){return Xl(n)},start(n){return Xl(n)},width(n){return parseInt(n,10)},height(n){return parseInt(n,10)},bandwidth(n){return parseInt(n,10)},frameRate(n){return e4(n)},startNumber(n){return parseInt(n,10)},timescale(n){return parseInt(n,10)},presentationTimeOffset(n){return parseInt(n,10)},duration(n){const e=parseInt(n,10);return isNaN(e)?Xl(n):e},d(n){return parseInt(n,10)},t(n){return parseInt(n,10)},r(n){return parseInt(n,10)},presentationTime(n){return parseInt(n,10)},DEFAULT(n){return n}},er=n=>n&&n.attributes?Xw(n.attributes).reduce((e,t)=>{const i=N2[t.name]||N2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},n4={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},o0=(n,e)=>e.length?wu(n.map(function(t){return e.map(function(i){const a=wd(i),l=r0(t.baseUrl,a),u=ur(er(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Cy=n=>{const e=Di(n,"SegmentTemplate")[0],t=Di(n,"SegmentList")[0],i=t&&Di(t,"SegmentURL").map(S=>ur({tag:"SegmentURL"},er(S))),a=Di(n,"SegmentBase")[0],l=t||e,u=l&&Di(l,"SegmentTimeline")[0],h=t||a||e,f=h&&Di(h,"Initialization")[0],g=e&&er(e);g&&f?g.initialization=f&&er(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const _={template:g,segmentTimeline:u&&Di(u,"S").map(S=>er(S)),list:t&&ur(er(t),{segmentUrls:i,initialization:er(f)}),base:a&&ur(er(a),{initialization:er(f)})};return Object.keys(_).forEach(S=>{_[S]||delete _[S]}),_},i4=(n,e,t)=>i=>{const a=Di(i,"BaseURL"),l=o0(e,a),u=ur(n,er(i)),h=Cy(i);return l.map(f=>({segmentInfo:ur(t,h),attributes:ur(u,f)}))},r4=n=>n.reduce((e,t)=>{const i=er(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=n4[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Di(t,"cenc:pssh")[0];if(l){const u=wd(l);e[a].pssh=u&&zw(u)}}return e},{}),s4=n=>{if(n.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof n.value!="string"?[]:n.value.split(";")).map(t=>{let i,a;return a=t,/^CC\d=/.test(t)?[i,a]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:a}});if(n.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof n.value!="string"?[]:n.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[a,l=""]=t.split("=");i.channel=a,i.language=t,l.split(",").forEach(u=>{const[h,f]=u.split(":");h==="lang"?i.language=f:h==="er"?i.easyReader=Number(f):h==="war"?i.aspectRatio=Number(f):h==="3D"&&(i["3D"]=Number(f))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},a4=n=>wu(Di(n.node,"EventStream").map(e=>{const t=er(e),i=t.schemeIdUri;return Di(e,"Event").map(a=>{const l=er(a),u=l.presentationTime||0,h=t.timescale||1,f=l.duration||0,g=u/h+n.attributes.start;return{schemeIdUri:i,value:t.value,id:l.id,start:g,end:g+f/h,messageData:wd(a)||l.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),o4=(n,e,t)=>i=>{const a=er(i),l=o0(e,Di(i,"BaseURL")),u=Di(i,"Role")[0],h={role:er(u)};let f=ur(n,a,h);const g=Di(i,"Accessibility")[0],_=s4(er(g));_&&(f=ur(f,{captionServices:_}));const S=Di(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=ur(f,{label:B})}const C=r4(Di(i,"ContentProtection"));Object.keys(C).length&&(f=ur(f,{contentProtection:C}));const N=Cy(i),O=Di(i,"Representation"),E=ur(t,N);return wu(O.map(i4(f,l,E)))},l4=(n,e)=>(t,i)=>{const a=o0(e,Di(t.node,"BaseURL")),l=ur(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Di(t.node,"AdaptationSet"),h=Cy(t.node);return wu(u.map(o4(l,a,h)))},u4=(n,e)=>{if(n.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!n.length)return null;const t=ur({serverURL:wd(n[0])},er(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},c4=({attributes:n,priorPeriodAttributes:e,mpdType:t})=>typeof n.start=="number"?n.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,d4=(n,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:a=0,eventHandler:l=function(){}}=e,u=Di(n,"Period");if(!u.length)throw new Error(Tu.INVALID_NUMBER_OF_PERIOD);const h=Di(n,"Location"),f=er(n),g=o0([{baseUrl:t}],Di(n,"BaseURL")),_=Di(n,"ContentSteering");f.type=f.type||"static",f.sourceDuration=f.mediaPresentationDuration||0,f.NOW=i,f.clientOffset=a,h.length&&(f.locations=h.map(wd));const S=[];return u.forEach((C,N)=>{const O=er(C),E=S[N-1];O.start=c4({attributes:O,priorPeriodAttributes:E?E.attributes:null,mpdType:f.type}),S.push({node:C,attributes:O})}),{locations:f.locations,contentSteeringInfo:u4(_,l),representationInfo:wu(S.map(l4(f,g))),eventStream:wu(S.map(a4))}},Jw=n=>{if(n==="")throw new Error(Tu.DASH_EMPTY_MANIFEST);const e=new _D.DOMParser;let t,i;try{t=e.parseFromString(n,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Tu.DASH_INVALID_XML);return i},h4=n=>{const e=Di(n,"UTCTiming")[0];if(!e)return null;const t=er(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Tu.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},f4=(n,e={})=>{const t=d4(Jw(n),e),i=JD(t.representationInfo);return qD({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},m4=n=>h4(Jw(n));var Zp,D2;function p4(){if(D2)return Zp;D2=1;var n=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),a;return i.getBigUint64?(a=i.getBigUint64(0),a<Number.MAX_SAFE_INTEGER?Number(a):a):i.getUint32(0)*n+i.getUint32(4)};return Zp={getUint64:e,MAX_UINT32:n},Zp}var Jp,M2;function g4(){if(M2)return Jp;M2=1;var n=p4().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},l=12;a.version===0?(a.earliestPresentationTime=i.getUint32(l),a.firstOffset=i.getUint32(l+4),l+=8):(a.earliestPresentationTime=n(t.subarray(l)),a.firstOffset=n(t.subarray(l+8)),l+=16),l+=2;var u=i.getUint16(l);for(l+=2;u>0;l+=12,u--)a.references.push({referenceType:(t[l]&128)>>>7,referencedSize:i.getUint32(l)&2147483647,subsegmentDuration:i.getUint32(l+4),startsWithSap:!!(t[l+8]&128),sapType:(t[l+8]&112)>>>4,sapDeltaTime:i.getUint32(l+8)&268435455});return a};return Jp=e,Jp}var y4=g4();const b4=Du(y4);var v4=an([73,68,51]),x4=function(e,t){t===void 0&&(t=0),e=an(e);var i=e[t+5],a=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],l=(i&16)>>4;return l?a+20:a+10},Kc=function n(e,t){return t===void 0&&(t=0),e=an(e),e.length-t<10||!Ni(e,v4,{offset:t})?t:(t+=x4(e,t),n(e,t))},j2=function(e){return typeof e=="string"?Gw(e):e},_4=function(e){return Array.isArray(e)?e.map(function(t){return j2(t)}):[j2(e)]},w4=function n(e,t,i){i===void 0&&(i=!1),t=_4(t),e=an(e);var a=[];if(!t.length)return a;for(var l=0;l<e.length;){var u=(e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3])>>>0,h=e.subarray(l+4,l+8);if(u===0)break;var f=l+u;if(f>e.length){if(i)break;f=e.length}var g=e.subarray(l+8,f);Ni(h,t[0])&&(t.length===1?a.push(g):a.push.apply(a,n(g,t.slice(1),i))),l=f}return a},Yh={EBML:an([26,69,223,163]),DocType:an([66,130]),Segment:an([24,83,128,103]),SegmentInfo:an([21,73,169,102]),Tracks:an([22,84,174,107]),Track:an([174]),TrackNumber:an([215]),DefaultDuration:an([35,227,131]),TrackEntry:an([174]),TrackType:an([131]),FlagDefault:an([136]),CodecID:an([134]),CodecPrivate:an([99,162]),VideoTrack:an([224]),AudioTrack:an([225]),Cluster:an([31,67,182,117]),Timestamp:an([231]),TimestampScale:an([42,215,177]),BlockGroup:an([160]),BlockDuration:an([155]),Block:an([161]),SimpleBlock:an([163])},zg=[128,64,32,16,8,4,2,1],T4=function(e){for(var t=1,i=0;i<zg.length&&!(e&zg[i]);i++)t++;return t},Ef=function(e,t,i,a){i===void 0&&(i=!0),a===void 0&&(a=!1);var l=T4(e[t]),u=e.subarray(t,t+l);return i&&(u=Array.prototype.slice.call(e,t,t+l),u[0]^=zg[l-1]),{length:l,value:fD(u,{signed:a}),bytes:u}},R2=function n(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return n(t)}):typeof e=="number"?mD(e):e},S4=function(e){return Array.isArray(e)?e.map(function(t){return R2(t)}):[R2(e)]},k4=function n(e,t,i){if(i>=t.length)return t.length;var a=Ef(t,i,!1);if(Ni(e.bytes,a.bytes))return i;var l=Ef(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},O2=function n(e,t){t=S4(t),e=an(e);var i=[];if(!t.length)return i;for(var a=0;a<e.length;){var l=Ef(e,a,!1),u=Ef(e,a+l.length),h=a+l.length+u.length;u.value===127&&(u.value=k4(l,e,h),u.value!==e.length&&(u.value-=h));var f=h+u.value>e.length?e.length:h+u.value,g=e.subarray(h,f);Ni(t[0],l.bytes)&&(t.length===1?i.push(g):i=i.concat(n(g,t.slice(1))));var _=l.length+u.length+g.length;a+=_}return i},E4=an([0,0,0,1]),C4=an([0,0,1]),A4=an([0,0,3]),N4=function(e){for(var t=[],i=1;i<e.length-2;)Ni(e.subarray(i,i+3),A4)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var a=e.length-t.length,l=new Uint8Array(a),u=0;for(i=0;i<a;u++,i++)u===t[0]&&(u++,t.shift()),l[i]=e[u];return l},eT=function(e,t,i,a){e=an(e),i=[].concat(i);for(var l=0,u,h=0;l<e.length&&(h<a||u);){var f=void 0;if(Ni(e.subarray(l),E4)?f=4:Ni(e.subarray(l),C4)&&(f=3),!f){l++;continue}if(h++,u)return N4(e.subarray(u,l));var g=void 0;t==="h264"?g=e[l+f]&31:t==="h265"&&(g=e[l+f]>>1&63),i.indexOf(g)!==-1&&(u=l+f),l+=f+(t==="h264"?1:2)}return e.subarray(0,0)},D4=function(e,t,i){return eT(e,"h264",t,i)},M4=function(e,t,i){return eT(e,"h265",t,i)},Er={webm:an([119,101,98,109]),matroska:an([109,97,116,114,111,115,107,97]),flac:an([102,76,97,67]),ogg:an([79,103,103,83]),ac3:an([11,119]),riff:an([82,73,70,70]),avi:an([65,86,73]),wav:an([87,65,86,69]),"3gp":an([102,116,121,112,51,103]),mp4:an([102,116,121,112]),fmp4:an([115,116,121,112]),mov:an([102,116,121,112,113,116]),moov:an([109,111,111,118]),moof:an([109,111,111,102])},Su={aac:function(e){var t=Kc(e);return Ni(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Kc(e);return Ni(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=O2(e,[Yh.EBML,Yh.DocType])[0];return Ni(t,Er.webm)},mkv:function(e){var t=O2(e,[Yh.EBML,Yh.DocType])[0];return Ni(t,Er.matroska)},mp4:function(e){if(Su["3gp"](e)||Su.mov(e))return!1;if(Ni(e,Er.mp4,{offset:4})||Ni(e,Er.fmp4,{offset:4})||Ni(e,Er.moof,{offset:4})||Ni(e,Er.moov,{offset:4}))return!0},mov:function(e){return Ni(e,Er.mov,{offset:4})},"3gp":function(e){return Ni(e,Er["3gp"],{offset:4})},ac3:function(e){var t=Kc(e);return Ni(e,Er.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=Kc(e);return Ni(e,Er.flac,{offset:t})},ogg:function(e){return Ni(e,Er.ogg)},avi:function(e){return Ni(e,Er.riff)&&Ni(e,Er.avi,{offset:8})},wav:function(e){return Ni(e,Er.riff)&&Ni(e,Er.wav,{offset:8})},h264:function(e){return D4(e,7,3).length},h265:function(e){return M4(e,[32,33],3).length}},$g=Object.keys(Su).filter(function(n){return n!=="ts"&&n!=="h264"&&n!=="h265"}).concat(["ts","h264","h265"]);$g.forEach(function(n){var e=Su[n];Su[n]=function(t){return e(an(t))}});var j4=Su,Ay=function(e){e=an(e);for(var t=0;t<$g.length;t++){var i=$g[t];if(j4[i](e))return i}return""},R4=function(e){return w4(e,["moof"]).length>0},eg,L2;function O4(){if(L2)return eg;L2=1;var n=9e4,e,t,i,a,l,u,h;return e=function(f){return f*n},t=function(f,g){return f*g},i=function(f){return f/n},a=function(f,g){return f/g},l=function(f,g){return e(a(f,g))},u=function(f,g){return t(i(f),g)},h=function(f,g,_){return i(_?f:f-g)},eg={ONE_SECOND_IN_TS:n,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:a,audioTsToVideoTs:l,videoTsToAudioTs:u,metadataTsToSeconds:h},eg}var ll=O4();var Hg="8.23.4";const ka={},Eo=function(n,e){return ka[n]=ka[n]||[],e&&(ka[n]=ka[n].concat(e)),ka[n]},L4=function(n,e){Eo(n,e)},tT=function(n,e){const t=Eo(n).indexOf(e);return t<=-1?!1:(ka[n]=ka[n].slice(),ka[n].splice(t,1),!0)},I4=function(n,e){Eo(n,[].concat(e).map(t=>{const i=(...a)=>(tT(n,i),t(...a));return i}))},Cf={prefixed:!0},hf=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],I2=hf[0];let Wc;for(let n=0;n<hf.length;n++)if(hf[n][1]in xt){Wc=hf[n];break}if(Wc){for(let n=0;n<Wc.length;n++)Cf[I2[n]]=Wc[n];Cf.prefixed=Wc[0]!==I2[0]}let Ur=[];const B4=(n,e,t)=>(i,a,l)=>{const u=e.levels[a],h=new RegExp(`^(${u})$`);let f=n;if(i!=="log"&&l.unshift(i.toUpperCase()+":"),t&&(f=`%c${n}`,l.unshift(t)),l.unshift(f+":"),Ur){Ur.push([].concat(l));const _=Ur.length-1e3;Ur.splice(0,_>0?_:0)}if(!de.console)return;let g=de.console[i];!g&&i==="debug"&&(g=de.console.info||de.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](de.console,l)};function qg(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=B4(n,l,t),l.createLogger=(u,h,f)=>{const g=h!==void 0?h:e,_=f!==void 0?f:t,S=`${n} ${g} ${u}`;return qg(S,g,_)},l.createNewLogger=(u,h,f)=>qg(u,h,f),l.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},l.level=u=>{if(typeof u=="string"){if(!l.levels.hasOwnProperty(u))throw new Error(`"${u}" in not a valid log level`);i=u}return i},l.history=()=>Ur?[].concat(Ur):[],l.history.filter=u=>(Ur||[]).filter(h=>new RegExp(`.*${u}.*`).test(h[0])),l.history.clear=()=>{Ur&&(Ur.length=0)},l.history.disable=()=>{Ur!==null&&(Ur.length=0,Ur=null)},l.history.enable=()=>{Ur===null&&(Ur=[])},l.error=(...u)=>a("error",i,u),l.warn=(...u)=>a("warn",i,u),l.debug=(...u)=>a("debug",i,u),l}const Dn=qg("VIDEOJS"),nT=Dn.createLogger,P4=Object.prototype.toString,iT=function(n){return ea(n)?Object.keys(n):[]};function lu(n,e){iT(n).forEach(t=>e(n[t],t))}function rT(n,e,t=0){return iT(n).reduce((i,a)=>e(i,n[a],a),t)}function ea(n){return!!n&&typeof n=="object"}function ku(n){return ea(n)&&P4.call(n)==="[object Object]"&&n.constructor===Object}function hi(...n){const e={};return n.forEach(t=>{t&&lu(t,(i,a)=>{if(!ku(i)){e[a]=i;return}ku(e[a])||(e[a]={}),e[a]=hi(e[a],i)})}),e}function sT(n={}){const e=[];for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];e.push(i)}return e}function l0(n,e,t,i=!0){const a=u=>Object.defineProperty(n,e,{value:u,enumerable:!0,writable:!0}),l={configurable:!0,enumerable:!0,get(){const u=t();return a(u),u}};return i&&(l.set=a),Object.defineProperty(n,e,l)}var F4=Object.freeze({__proto__:null,each:lu,reduce:rT,isObject:ea,isPlain:ku,merge:hi,values:sT,defineLazyProperty:l0});let Ny=!1,aT=null,js=!1,oT,lT=!1,uu=!1,cu=!1,ta=!1,Dy=null,u0=null;const U4=!!(de.cast&&de.cast.framework&&de.cast.framework.CastReceiverContext);let uT=null,Af=!1,c0=!1,Nf=!1,d0=!1,Df=!1,Mf=!1,jf=!1;const md=!!(Mu()&&("ontouchstart"in de||de.navigator.maxTouchPoints||de.DocumentTouch&&de.document instanceof de.DocumentTouch)),mo=de.navigator&&de.navigator.userAgentData;mo&&mo.platform&&mo.brands&&(js=mo.platform==="Android",uu=!!mo.brands.find(n=>n.brand==="Microsoft Edge"),cu=!!mo.brands.find(n=>n.brand==="Chromium"),ta=!uu&&cu,Dy=u0=(mo.brands.find(n=>n.brand==="Chromium")||{}).version||null,c0=mo.platform==="Windows");if(!cu){const n=de.navigator&&de.navigator.userAgent||"";Ny=/iPod/i.test(n),aT=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),js=/Android/i.test(n),oT=(function(){const e=n.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),lT=/Firefox/i.test(n),uu=/Edg/i.test(n),cu=/Chrome/i.test(n)||/CriOS/i.test(n),ta=!uu&&cu,Dy=u0=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),uT=(function(){const e=/MSIE\s(\d+)\.\d/.exec(n);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(n)&&/rv:11.0/.test(n)&&(t=11),t})(),Df=/Tizen/i.test(n),Mf=/Web0S/i.test(n),jf=Df||Mf,Af=/Safari/i.test(n)&&!ta&&!js&&!uu&&!jf,c0=/Windows/i.test(n),Nf=/iPad/i.test(n)||Af&&md&&!/iPhone/i.test(n),d0=/iPhone/i.test(n)&&!Nf}const xr=d0||Nf||Ny,h0=(Af||xr)&&!ta;var cT=Object.freeze({__proto__:null,get IS_IPOD(){return Ny},get IOS_VERSION(){return aT},get IS_ANDROID(){return js},get ANDROID_VERSION(){return oT},get IS_FIREFOX(){return lT},get IS_EDGE(){return uu},get IS_CHROMIUM(){return cu},get IS_CHROME(){return ta},get CHROMIUM_VERSION(){return Dy},get CHROME_VERSION(){return u0},IS_CHROMECAST_RECEIVER:U4,get IE_VERSION(){return uT},get IS_SAFARI(){return Af},get IS_WINDOWS(){return c0},get IS_IPAD(){return Nf},get IS_IPHONE(){return d0},get IS_TIZEN(){return Df},get IS_WEBOS(){return Mf},get IS_SMART_TV(){return jf},TOUCH_ENABLED:md,IS_IOS:xr,IS_ANY_SAFARI:h0});function B2(n){return typeof n=="string"&&!!n.trim()}function z4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Mu(){return xt===de.document}function ju(n){return ea(n)&&n.nodeType===1}function dT(){try{return de.parent!==de.self}catch{return!0}}function hT(n){return function(e,t){if(!B2(e))return xt[n](null);B2(t)&&(t=xt.querySelector(t));const i=ju(t)?t:xt;return i[n]&&i[n](e)}}function dn(n="div",e={},t={},i){const a=xt.createElement(n);return Object.getOwnPropertyNames(e).forEach(function(l){const u=e[l];l==="textContent"?Ao(a,u):(a[l]!==u||l==="tabIndex")&&(a[l]=u)}),Object.getOwnPropertyNames(t).forEach(function(l){a.setAttribute(l,t[l])}),i&&My(a,i),a}function Ao(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function Vg(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function id(n,e){return z4(e),n.classList.contains(e)}function dl(n,...e){return n.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n}function f0(n,...e){return n?(n.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n):(Dn.warn("removeClass was called with an element that doesn't exist"),null)}function fT(n,e,t){return typeof t=="function"&&(t=t(n,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>n.classList.toggle(i,t)),n}function mT(n,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?n.removeAttribute(t):n.setAttribute(t,i===!0?"":i)})}function vo(n){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(n&&n.attributes&&n.attributes.length>0){const i=n.attributes;for(let a=i.length-1;a>=0;a--){const l=i[a].name;let u=i[a].value;t.includes(l)&&(u=u!==null),e[l]=u}}return e}function pT(n,e){return n.getAttribute(e)}function Eu(n,e,t){n.setAttribute(e,t)}function m0(n,e){n.removeAttribute(e)}function gT(){xt.body.focus(),xt.onselectstart=function(){return!1}}function yT(){xt.onselectstart=function(){return!0}}function Cu(n){if(n&&n.getBoundingClientRect&&n.parentNode){const e=n.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Au(n,"height"))),t.width||(t.width=parseFloat(Au(n,"width"))),t}}function pd(n){if(!n||n&&!n.offsetParent)return{left:0,top:0,width:0,height:0};const e=n.offsetWidth,t=n.offsetHeight;let i=0,a=0;for(;n.offsetParent&&n!==xt[Cf.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function p0(n,e){const t={x:0,y:0};if(xr){let _=n;for(;_&&_.nodeName.toLowerCase()!=="html";){const S=Au(_,"transform");if(/^matrix/.test(S)){const C=S.slice(7,-1).split(/,\s/).map(Number);t.x+=C[4],t.y+=C[5]}else if(/^matrix3d/.test(S)){const C=S.slice(9,-1).split(/,\s/).map(Number);t.x+=C[12],t.y+=C[13]}if(_.assignedSlot&&_.assignedSlot.parentElement&&de.WebKitCSSMatrix){const C=de.getComputedStyle(_.assignedSlot.parentElement).transform,N=new de.WebKitCSSMatrix(C);t.x+=N.m41,t.y+=N.m42}_=_.parentNode||_.host}}const i={},a=pd(e.target),l=pd(n),u=l.width,h=l.height;let f=e.offsetY-(l.top-a.top),g=e.offsetX-(l.left-a.left);return e.changedTouches&&(g=e.changedTouches[0].pageX-l.left,f=e.changedTouches[0].pageY+l.top,xr&&(g-=t.x,f-=t.y)),i.y=1-Math.max(0,Math.min(1,f/h)),i.x=Math.max(0,Math.min(1,g/u)),i}function bT(n){return ea(n)&&n.nodeType===3}function g0(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function vT(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),ju(e)||bT(e))return e;if(typeof e=="string"&&/\S/.test(e))return xt.createTextNode(e)}).filter(e=>e)}function My(n,e){return vT(e).forEach(t=>n.appendChild(t)),n}function xT(n,e){return My(g0(n),e)}function gd(n){return n.button===void 0&&n.buttons===void 0||n.button===0&&n.buttons===void 0||n.type==="mouseup"&&n.button===0&&n.buttons===0||n.type==="mousedown"&&n.button===0&&n.buttons===0?!0:!(n.button!==0||n.buttons!==1)}const Co=hT("querySelector"),_T=hT("querySelectorAll");function Au(n,e){if(!n||!e)return"";if(typeof de.getComputedStyle=="function"){let t;try{t=de.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function wT(n){[...xt.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(a=>a.cssText).join(""),i=xt.createElement("style");i.textContent=t,n.document.head.appendChild(i)}catch{const i=xt.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,n.document.head.appendChild(i)}})}var TT=Object.freeze({__proto__:null,isReal:Mu,isEl:ju,isInFrame:dT,createEl:dn,textContent:Ao,prependTo:Vg,hasClass:id,addClass:dl,removeClass:f0,toggleClass:fT,setAttributes:mT,getAttributes:vo,getAttribute:pT,setAttribute:Eu,removeAttribute:m0,blockTextSelection:gT,unblockTextSelection:yT,getBoundingClientRect:Cu,findPosition:pd,getPointerPosition:p0,isTextNode:bT,emptyEl:g0,normalizeContent:vT,appendContent:My,insertContent:xT,isSingleLeftClick:gd,$:Co,$$:_T,computedStyle:Au,copyStyleSheetsToWindow:wT});let ST=!1,Gg;const $4=function(){if(Gg.options.autoSetup===!1)return;const n=Array.prototype.slice.call(xt.getElementsByTagName("video")),e=Array.prototype.slice.call(xt.getElementsByTagName("audio")),t=Array.prototype.slice.call(xt.getElementsByTagName("video-js")),i=n.concat(e,t);if(i&&i.length>0)for(let a=0,l=i.length;a<l;a++){const u=i[a];if(u&&u.getAttribute)u.player===void 0&&u.getAttribute("data-setup")!==null&&Gg(u);else{Kg(1);break}}else ST||Kg(1)};function Kg(n,e){Mu()&&(e&&(Gg=e),de.setTimeout($4,n))}function Wg(){ST=!0,de.removeEventListener("load",Wg)}Mu()&&(xt.readyState==="complete"?Wg():de.addEventListener("load",Wg));const kT=function(n){const e=xt.createElement("style");return e.className=n,e},ET=function(n,e){n.styleSheet?n.styleSheet.cssText=e:n.textContent=e};var Ar=new WeakMap;const H4=3;let q4=H4;function ys(){return q4++}function P2(n,e){if(!Ar.has(n))return;const t=Ar.get(n);t.handlers[e].length===0&&(delete t.handlers[e],n.removeEventListener?n.removeEventListener(e,t.dispatcher,!1):n.detachEvent&&n.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&Ar.delete(n)}function jy(n,e,t,i){t.forEach(function(a){n(e,a,i)})}function y0(n){if(n.fixed_)return n;function e(){return!0}function t(){return!1}if(!n||!n.isPropagationStopped||!n.isImmediatePropagationStopped){const i=n||de.event;n={};const a=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const l in i)a.includes(l)||l==="returnValue"&&i.preventDefault||(n[l]=i[l]);if(n.target||(n.target=n.srcElement||xt),n.relatedTarget||(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement),n.preventDefault=function(){i.preventDefault&&i.preventDefault(),n.returnValue=!1,i.returnValue=!1,n.defaultPrevented=!0},n.defaultPrevented=!1,n.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),n.cancelBubble=!0,i.cancelBubble=!0,n.isPropagationStopped=e},n.isPropagationStopped=t,n.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),n.isImmediatePropagationStopped=e,n.stopPropagation()},n.isImmediatePropagationStopped=t,n.clientX!==null&&n.clientX!==void 0){const l=xt.documentElement,u=xt.body;n.pageX=n.clientX+(l&&l.scrollLeft||u&&u.scrollLeft||0)-(l&&l.clientLeft||u&&u.clientLeft||0),n.pageY=n.clientY+(l&&l.scrollTop||u&&u.scrollTop||0)-(l&&l.clientTop||u&&u.clientTop||0)}n.which=n.charCode||n.keyCode,n.button!==null&&n.button!==void 0&&(n.button=n.button&1?0:n.button&4?1:n.button&2?2:0)}return n.fixed_=!0,n}let Qh;const V4=function(){if(typeof Qh!="boolean"){Qh=!1;try{const n=Object.defineProperty({},"passive",{get(){Qh=!0}});de.addEventListener("test",null,n),de.removeEventListener("test",null,n)}catch{}}return Qh},G4=["touchstart","touchmove"];function ss(n,e,t){if(Array.isArray(e))return jy(ss,n,e,t);Ar.has(n)||Ar.set(n,{});const i=Ar.get(n);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=ys()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(a,l){if(i.disabled)return;a=y0(a);const u=i.handlers[a.type];if(u){const h=u.slice(0);for(let f=0,g=h.length;f<g&&!a.isImmediatePropagationStopped();f++)try{h[f].call(n,a,l)}catch(_){Dn.error(_)}}}),i.handlers[e].length===1)if(n.addEventListener){let a=!1;V4()&&G4.indexOf(e)>-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function _r(n,e,t){if(!Ar.has(n))return;const i=Ar.get(n);if(!i.handlers)return;if(Array.isArray(e))return jy(_r,n,e,t);const a=function(u,h){i.handlers[h]=[],P2(u,h)};if(e===void 0){for(const u in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},u)&&a(n,u);return}const l=i.handlers[e];if(l){if(!t){a(n,e);return}if(t.guid)for(let u=0;u<l.length;u++)l[u].guid===t.guid&&l.splice(u--,1);P2(n,e)}}function Ru(n,e,t){const i=Ar.has(n)?Ar.get(n):{},a=n.parentNode||n.ownerDocument;if(typeof e=="string"?e={type:e,target:n}:e.target||(e.target=n),e=y0(e),i.dispatcher&&i.dispatcher.call(n,e,t),a&&!e.isPropagationStopped()&&e.bubbles===!0)Ru.call(null,a,e,t);else if(!a&&!e.defaultPrevented&&e.target&&e.target[e.type]){Ar.has(e.target)||Ar.set(e.target,{});const l=Ar.get(e.target);e.target[e.type]&&(l.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),l.disabled=!1)}return!e.defaultPrevented}function b0(n,e,t){if(Array.isArray(e))return jy(b0,n,e,t);const i=function(){_r(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),ss(n,e,i)}function Ry(n,e,t){const i=function(){_r(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),ss(n,e,i)}var K4=Object.freeze({__proto__:null,fixEvent:y0,on:ss,off:_r,trigger:Ru,one:b0,any:Ry});const bs=30,Si=function(n,e,t){e.guid||(e.guid=ys());const i=e.bind(n);return i.guid=t?t+"_"+e.guid:e.guid,i},na=function(n,e){let t=de.performance.now();return function(...a){const l=de.performance.now();l-t>=e&&(n(...a),t=l)}},CT=function(n,e,t,i=de){let a;const l=()=>{i.clearTimeout(a),a=null},u=function(){const h=this,f=arguments;let g=function(){a=null,g=null,t||n.apply(h,f)};!a&&t&&n.apply(h,f),i.clearTimeout(a),a=i.setTimeout(g,e)};return u.cancel=l,u};var W4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:bs,bind_:Si,throttle:na,debounce:CT});let Pc;class as{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},ss(this,e,t),this.addEventListener=i}off(e,t){_r(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},b0(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Ry(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=y0(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ru(this,e)}queueTrigger(e){Pc||(Pc=new Map);const t=e.type||e;let i=Pc.get(this);i||(i=new Map,Pc.set(this,i));const a=i.get(t);i.delete(t),de.clearTimeout(a);const l=de.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Pc.delete(this)),this.trigger(e)},0);i.set(t,l)}}as.prototype.allowedEvents_={};as.prototype.addEventListener=as.prototype.on;as.prototype.removeEventListener=as.prototype.off;as.prototype.dispatchEvent=as.prototype.trigger;const v0=n=>typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:n.name_?n.name_:n.constructor&&n.constructor.name?n.constructor.name:typeof n,Aa=n=>n instanceof as||!!n.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof n[e]=="function"),X4=(n,e)=>{Aa(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Xg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,Rf=(n,e,t)=>{if(!n||!n.nodeName&&!Aa(n))throw new Error(`Invalid target for ${v0(e)}#${t}; must be a DOM node or evented object.`)},AT=(n,e,t)=>{if(!Xg(n))throw new Error(`Invalid event type for ${v0(e)}#${t}; must be a non-empty string or array.`)},NT=(n,e,t)=>{if(typeof n!="function")throw new Error(`Invalid listener for ${v0(e)}#${t}; must be a function.`)},tg=(n,e,t)=>{const i=e.length<3||e[0]===n||e[0]===n.eventBusEl_;let a,l,u;return i?(a=n.eventBusEl_,e.length>=3&&e.shift(),[l,u]=e):(a=e[0],l=e[1],u=e[2]),Rf(a,n,t),AT(l,n,t),NT(u,n,t),u=Si(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},Jo=(n,e,t,i)=>{Rf(n,n,e),n.nodeName?K4[e](n,t,i):n[e](t,i)},Y4={on(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"on");if(Jo(t,"on",i,a),!e){const l=()=>this.off(t,i,a);l.guid=a.guid;const u=()=>this.off("dispose",l);u.guid=a.guid,Jo(this,"on","dispose",l),Jo(t,"on","dispose",u)}},one(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"one");if(e)Jo(t,"one",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"one",i,l)}},any(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"any");if(e)Jo(t,"any",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"any",i,l)}},off(n,e,t){if(!n||Xg(n))_r(this.eventBusEl_,n,e);else{const i=n,a=e;Rf(i,this,"off"),AT(a,this,"off"),NT(t,this,"off"),t=Si(this,t),this.off("dispose",t),i.nodeName?(_r(i,a,t),_r(i,"dispose",t)):Aa(i)&&(i.off(a,t),i.off("dispose",t))}},trigger(n,e){Rf(this.eventBusEl_,this,"trigger");const t=n&&typeof n!="string"?n.type:n;if(!Xg(t))throw new Error(`Invalid event type for ${v0(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ru(this.eventBusEl_,n,e)}};function Oy(n,e={}){const{eventBusKey:t}=e;if(t){if(!n[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);n.eventBusEl_=n[t]}else n.eventBusEl_=dn("span",{className:"vjs-event-bus"});return Object.assign(n,Y4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Ar.has(i)&&Ar.delete(i)}),de.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const Q4={state:{},setState(n){typeof n=="function"&&(n=n());let e;return lu(n,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Aa(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function DT(n,e){return Object.assign(n,Q4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Aa(n)&&n.on("statechanged",n.handleStateChanged),n}const rd=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toLowerCase())},qi=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},MT=function(n,e){return qi(n)===qi(e)};var Z4=Object.freeze({__proto__:null,toLowerCase:rd,toTitleCase:qi,titleCaseEquals:MT});class nt{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=hi({},this.options_),t=this.options_=hi(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const a=e&&e.id&&e.id()||"no_player";this.id_=`${a}_component_${ys()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(a=>this.addClass(a)),["on","off","one","any","trigger"].forEach(a=>{this[a]=void 0}),t.evented!==!1&&(Oy(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),DT(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=hi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return dn(e,t,i)}localize(e,t,i=e){const a=this.player_.language&&this.player_.language(),l=this.player_.languages&&this.player_.languages(),u=l&&l[a],h=a&&a.split("-")[0],f=l&&l[h];let g=i;return u&&u[e]?g=u[e]:f&&f[e]&&(g=f[e]),t&&(g=g.replace(/\{(\d+)\}/g,function(_,S){const C=t[S-1];let N=C;return typeof C>"u"&&(N=_),N})),g}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,a)=>i.concat(a),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",a=dn("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),l=xt.createElementNS(i,"svg");l.setAttributeNS(null,"viewBox","0 0 512 512");const u=xt.createElementNS(i,"use");return l.appendChild(u),u.setAttributeNS(null,"href",`#vjs-icon-${e}`),a.appendChild(l),this.iconIsSet_?t.replaceChild(a,t.querySelector(".vjs-icon-placeholder")):t.appendChild(a),this.iconIsSet_=!0,a}addChild(e,t={},i=this.children_.length){let a,l;if(typeof e=="string"){l=qi(e);const u=t.componentClass||l;t.name=l;const h=nt.getComponent(u);if(!h)throw new Error(`Component ${u} does not exist`);if(typeof h!="function")return null;a=new h(this.player_||this,t)}else a=e;if(a.parentComponent_&&a.parentComponent_.removeChild(a),this.children_.splice(i,0,a),a.parentComponent_=this,typeof a.id=="function"&&(this.childIndex_[a.id()]=a),l=l||a.name&&qi(a.name()),l&&(this.childNameIndex_[l]=a,this.childNameIndex_[rd(l)]=a),typeof a.el=="function"&&a.el()){let u=null;this.children_[i+1]&&(this.children_[i+1].el_?u=this.children_[i+1].el_:ju(this.children_[i+1])&&(u=this.children_[i+1])),this.contentEl().insertBefore(a.el(),u)}return a}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let a=this.children_.length-1;a>=0;a--)if(this.children_[a]===e){t=!0,this.children_.splice(a,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[qi(e.name())]=null,this.childNameIndex_[rd(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=u=>{const h=u.name;let f=u.opts;if(t[h]!==void 0&&(f=t[h]),f===!1)return;f===!0&&(f={}),f.playerOptions=this.options_.playerOptions;const g=this.addChild(h,f);g&&(this[h]=g)};let a;const l=nt.getComponent("Tech");Array.isArray(e)?a=e:a=Object.keys(e),a.concat(Object.keys(this.options_).filter(function(u){return!a.some(function(h){return typeof h=="string"?u===h:u===h.name})})).map(u=>{let h,f;return typeof u=="string"?(h=u,f=e[h]||this.options_[h]||{}):(h=u.name,f=u),{name:h,opts:f}}).filter(u=>{const h=nt.getComponent(u.opts.componentClass||qi(u.name));return h&&!l.isTech(h)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Co(e,t||this.contentEl())}$$(e,t){return _T(e,t||this.contentEl())}hasClass(e){return id(this.el_,e)}addClass(...e){dl(this.el_,...e)}removeClass(...e){f0(this.el_,...e)}toggleClass(e,t){fT(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return pT(this.el_,e)}setAttribute(e,t){Eu(this.el_,e,t)}removeAttribute(e){m0(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const a=this.el_.style[e],l=a.indexOf("px");return parseInt(l!==-1?a.slice(0,l):this.el_["offset"+qi(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Au(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${qi(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,a=200;let l;this.on("touchstart",function(h){h.touches.length===1&&(t={pageX:h.touches[0].pageX,pageY:h.touches[0].pageY},e=de.performance.now(),l=!0)}),this.on("touchmove",function(h){if(h.touches.length>1)l=!1;else if(t){const f=h.touches[0].pageX-t.pageX,g=h.touches[0].pageY-t.pageY;Math.sqrt(f*f+g*g)>i&&(l=!1)}});const u=function(){l=!1};this.on("touchleave",u),this.on("touchcancel",u),this.on("touchend",function(h){t=null,l===!0&&de.performance.now()-e<a&&(h.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Si(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(a){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Si(this,e),this.clearTimersOnDispose_(),i=de.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),de.clearTimeout(e)),e}setInterval(e,t){e=Si(this,e),this.clearTimersOnDispose_();const i=de.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),de.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Si(this,e),t=de.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Si(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),de.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,a)=>this[t](a))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(l){const u=de.getComputedStyle(l,null),h=u.getPropertyValue("visibility");return u.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(h)}function i(l){return!(!t(l.parentElement)||!t(l)||l.style.opacity==="0"||de.getComputedStyle(l).height==="0px"||de.getComputedStyle(l).width==="0px")}function a(l){if(l.offsetWidth+l.offsetHeight+l.getBoundingClientRect().height+l.getBoundingClientRect().width===0)return!1;const u={x:l.getBoundingClientRect().left+l.offsetWidth/2,y:l.getBoundingClientRect().top+l.offsetHeight/2};if(u.x<0||u.x>(xt.documentElement.clientWidth||de.innerWidth)||u.y<0||u.y>(xt.documentElement.clientHeight||de.innerHeight))return!1;let h=xt.elementFromPoint(u.x,u.y);for(;h;){if(h===l)return!0;if(h.parentNode)h=h.parentNode;else return!1}}return e||(e=this.el()),!!(a(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=nt.getComponent("Tech"),a=i&&i.isTech(t),l=nt===t||nt.prototype.isPrototypeOf(t.prototype);if(a||!l){let h;throw a?h="techs must be registered using Tech.registerTech()":h="must be a Component subclass",new Error(`Illegal component, "${e}"; ${h}.`)}e=qi(e),nt.components_||(nt.components_={});const u=nt.getComponent("Player");if(e==="Player"&&u&&u.players){const h=u.players,f=Object.keys(h);if(h&&f.length>0){for(let g=0;g<f.length;g++)if(h[f[g]]!==null)throw new Error("Can not register Player component after player has been created.")}}return nt.components_[e]=t,nt.components_[rd(e)]=t,t}static getComponent(e){if(!(!e||!nt.components_))return nt.components_[e]}}nt.registerComponent("Component",nt);function J4(n,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${n}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function F2(n,e,t,i){return J4(n,i,t.length-1),t[i][e]}function ng(n){let e;return n===void 0||n.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:n.length,start:F2.bind(null,"start",0,n),end:F2.bind(null,"end",1,n)},de.Symbol&&de.Symbol.iterator&&(e[de.Symbol.iterator]=()=>(n||[]).values()),e}function Ms(n,e){return Array.isArray(n)?ng(n):n===void 0||e===void 0?ng():ng([[n,e]])}const jT=function(n,e){n=n<0?0:n;let t=Math.floor(n%60),i=Math.floor(n/60%60),a=Math.floor(n/3600);const l=Math.floor(e/60%60),u=Math.floor(e/3600);return(isNaN(n)||n===1/0)&&(a=i=t="-"),a=a>0||u>0?a+":":"",i=((a||l>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,a+i+t};let Ly=jT;function RT(n){Ly=n}function OT(){Ly=jT}function bl(n,e=n){return Ly(n,e)}var eM=Object.freeze({__proto__:null,createTimeRanges:Ms,createTimeRange:Ms,setFormatTime:RT,resetFormatTime:OT,formatTime:bl});function LT(n,e){let t=0,i,a;if(!e)return 0;(!n||!n.length)&&(n=Ms(0,0));for(let l=0;l<n.length;l++)i=n.start(l),a=n.end(l),a>e&&(a=e),t+=a-i;return t/e}function Ii(n){if(n instanceof Ii)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:ea(n)&&(typeof n.code=="number"&&(this.code=n.code),Object.assign(this,n)),this.message||(this.message=Ii.defaultMessages[this.code]||"")}Ii.prototype.code=0;Ii.prototype.message="";Ii.prototype.status=null;Ii.prototype.metadata=null;Ii.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ii.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Ii.MEDIA_ERR_CUSTOM=0;Ii.prototype.MEDIA_ERR_CUSTOM=0;Ii.MEDIA_ERR_ABORTED=1;Ii.prototype.MEDIA_ERR_ABORTED=1;Ii.MEDIA_ERR_NETWORK=2;Ii.prototype.MEDIA_ERR_NETWORK=2;Ii.MEDIA_ERR_DECODE=3;Ii.prototype.MEDIA_ERR_DECODE=3;Ii.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.MEDIA_ERR_ENCRYPTED=5;Ii.prototype.MEDIA_ERR_ENCRYPTED=5;function sd(n){return n!=null&&typeof n.then=="function"}function Xs(n){sd(n)&&n.then(null,e=>{})}const Yg=function(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,a)=>(n[i]&&(t[i]=n[i]),t),{cues:n.cues&&Array.prototype.map.call(n.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},tM=function(n){const e=n.$$("track"),t=Array.prototype.map.call(e,a=>a.track);return Array.prototype.map.call(e,function(a){const l=Yg(a.track);return a.src&&(l.src=a.src),l}).concat(Array.prototype.filter.call(n.textTracks(),function(a){return t.indexOf(a)===-1}).map(Yg))},nM=function(n,e){return n.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(a=>i.addCue(a))}),e.textTracks()};var Qg={textTracksToJson:tM,jsonToTextTracks:nM,trackToJson:Yg};const ig="vjs-modal-dialog";class Ou extends nt{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=dn("div",{className:`${ig}-content`},{role:"document"}),this.descEl_=dn("p",{className:`${ig}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ao(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${ig} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const a=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=a,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,a=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),xT(t,e),this.trigger("modalfill"),a?i.insertBefore(t,a):i.appendChild(t);const l=this.getChild("closeButton");l&&i.appendChild(l.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),g0(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=xt.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let a;for(let l=0;l<t.length;l++)if(i===t[l]){a=l;break}xt.activeElement===this.el_&&(a=0),e.shiftKey&&a===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&a===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof de.HTMLAnchorElement||t instanceof de.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof de.HTMLInputElement||t instanceof de.HTMLSelectElement||t instanceof de.HTMLTextAreaElement||t instanceof de.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof de.HTMLIFrameElement||t instanceof de.HTMLObjectElement||t instanceof de.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ou.prototype.options_={pauseOnOpen:!0,temporary:!0};nt.registerComponent("ModalDialog",Ou);class vl extends as{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Aa(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,a=this.length;i<a;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,a=this.length;i<a;i++){const l=this[i];if(l.id===e){t=l;break}}return t}}vl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const n in vl.prototype.allowedEvents_)vl.prototype["on"+n]=null;const rg=function(n,e){for(let t=0;t<n.length;t++)!Object.keys(n[t]).length||e.id===n[t].id||(n[t].enabled=!1)};class IT extends vl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){rg(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&rg(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,rg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const sg=function(n,e){for(let t=0;t<n.length;t++)!Object.keys(n[t]).length||e.id===n[t].id||(n[t].selected=!1)};class BT extends vl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){sg(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&sg(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,sg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Iy extends vl{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class iM{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,a=this.trackElements_.length;i<a;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class Of{constructor(e){Of.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const a=e.length;this.cues_=e,this.length_=e.length;const l=function(u){""+u in this||Object.defineProperty(this,""+u,{get(){return this.cues_[u]}})};if(t<a)for(i=t;i<a;i++)l.call(this,i)}getCueById(e){let t=null;for(let i=0,a=this.length;i<a;i++){const l=this[i];if(l.id===e){t=l;break}}return t}}const rM={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},sM={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},aM={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},U2={disabled:"disabled",hidden:"hidden",showing:"showing"};class By extends as{constructor(e={}){super();const t={id:e.id||"vjs_track_"+ys(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const a in t)Object.defineProperty(this,a,{get(){return t[a]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(a){a!==i&&(i=a,this.trigger("labelchange"))}})}}const Py=function(n){return new URL(n,xt.baseURI)},PT=function(n){return new URL(n,xt.baseURI).href},Fy=function(n){if(typeof n=="string"){const t=n.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},x0=function(n,e=de.location){return Py(n).origin!==e.origin};var oM=Object.freeze({__proto__:null,parseUrl:Py,getAbsoluteURL:PT,getFileExtension:Fy,isCrossOrigin:x0});const z2=function(n,e){const t=new de.WebVTT.Parser(de,de.vttjs,de.WebVTT.StringDecoder()),i=[];t.oncue=function(a){e.addCue(a)},t.onparsingerror=function(a){i.push(a)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(n),i.length>0&&(de.console&&de.console.groupCollapsed&&de.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>Dn.error(a)),de.console&&de.console.groupEnd&&de.console.groupEnd()),t.flush()},$2=function(n,e){const t={uri:n},i=x0(n);i&&(t.cors=i);const a=e.tech_.crossOrigin()==="use-credentials";a&&(t.withCredentials=a),Uw(t,Si(this,function(l,u,h){if(l)return Dn.error(l,u);e.loaded_=!0,typeof de.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],f=>{if(f.type==="vttjserror"){Dn.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return z2(h,e)}):z2(h,e)}))};class Td extends By{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=hi(e,{kind:aM[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=U2[t.mode]||"disabled";const a=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const l=new Of(this.cues_),u=new Of(this.activeCues_);let h=!1;this.timeupdateHandler=Si(this,function(g={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){g.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,h&&(this.trigger("cuechange"),h=!1),g.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const f=()=>{this.stopTracking()};this.tech_.one("dispose",f),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return a},set(){}},mode:{get(){return i},set(g){U2[g]&&i!==g&&(i=g,!this.preload_&&i!=="disabled"&&this.cues.length===0&&$2(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?l:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return u;const g=this.tech_.currentTime(),_=[];for(let S=0,C=this.cues.length;S<C;S++){const N=this.cues[S];N.startTime<=g&&N.endTime>=g&&_.push(N)}if(h=!1,_.length!==this.activeCues_.length)h=!0;else for(let S=0;S<_.length;S++)this.activeCues_.indexOf(_[S])===-1&&(h=!0);return this.activeCues_=_,u.setCues_(this.activeCues_),u},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&$2(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new de.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const a in e)a in t||(t[a]=e[a]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let a=0;a<i.length;a++)i[a]!==this&&i[a].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return Qg.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Td.prototype.allowedEvents_={cuechange:"cuechange"};class FT extends By{constructor(e={}){const t=hi(e,{kind:sM[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(a){typeof a!="boolean"||a===i||(i=a,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class UT extends By{constructor(e={}){const t=hi(e,{kind:rM[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(a){typeof a!="boolean"||a===i||(i=a,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Da extends as{constructor(e={}){super();let t;const i=new Td(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=Da.NONE,i.addEventListener("loadeddata",()=>{t=Da.LOADED,this.trigger({type:"load",target:this})})}}Da.prototype.allowedEvents_={load:"load"};Da.NONE=0;Da.LOADING=1;Da.LOADED=2;Da.ERROR=3;const gs={audio:{ListClass:IT,TrackClass:FT,capitalName:"Audio"},video:{ListClass:BT,TrackClass:UT,capitalName:"Video"},text:{ListClass:Iy,TrackClass:Td,capitalName:"Text"}};Object.keys(gs).forEach(function(n){gs[n].getterName=`${n}Tracks`,gs[n].privateName=`${n}Tracks_`});const Nu={remoteText:{ListClass:Iy,TrackClass:Td,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:iM,TrackClass:Da,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Cr=Object.assign({},gs,Nu);Nu.names=Object.keys(Nu);gs.names=Object.keys(gs);Cr.names=[].concat(Nu.names).concat(gs.names);function lM(n,e,t,i,a={}){const l=n.textTracks();a.kind=e,t&&(a.label=t),i&&(a.language=i),a.tech=n;const u=new Cr.text.TrackClass(a);return l.addTrack(u),u}class vn extends nt{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Cr.names.forEach(i=>{const a=Cr[i];e&&e[a.getterName]&&(this[a.privateName]=e[a.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Cr.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Si(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ms(0,0)}bufferedPercent(){return LT(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(gs.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let a=i.length;for(;a--;){const l=i[a];t==="text"&&this.removeRemoteTextTrack(l),i.removeTrack(l)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ii(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ms(0,0):Ms()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){gs.names.forEach(e=>{const t=gs[e],i=()=>{this.trigger(`${e}trackchange`)},a=this[t.getterName]();a.addEventListener("removetrack",i),a.addEventListener("addtrack",i),this.on("dispose",()=>{a.removeEventListener("removetrack",i),a.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!de.WebVTT)if(xt.body.contains(this.el())){if(!this.options_["vtt.js"]&&ku(h2)&&Object.keys(h2).length>0){this.trigger("vttjsloaded");return}const e=xt.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),de.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=h=>e.addTrack(h.track),a=h=>e.removeTrack(h.track);t.on("addtrack",i),t.on("removetrack",a),this.addWebVttScript_();const l=()=>this.trigger("texttrackchange"),u=()=>{l();for(let h=0;h<e.length;h++){const f=e[h];f.removeEventListener("cuechange",l),f.mode==="showing"&&f.addEventListener("cuechange",l)}};u(),e.addEventListener("change",u),e.addEventListener("addtrack",u),e.addEventListener("removetrack",u),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",a),e.removeEventListener("change",u),e.removeEventListener("addtrack",u),e.removeEventListener("removetrack",u);for(let h=0;h<e.length;h++)e[h].removeEventListener("cuechange",l)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return lM(this,e,t,i)}createRemoteTextTrack(e){const t=hi(e,{tech:this});return new Nu.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=ys();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return vn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof vn||e instanceof vn||e===vn}static registerTech(e,t){if(vn.techs_||(vn.techs_={}),!vn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!vn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!vn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qi(e),vn.techs_[e]=t,vn.techs_[rd(e)]=t,e!=="Tech"&&vn.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(vn.techs_&&vn.techs_[e])return vn.techs_[e];if(e=qi(e),de&&de.videojs&&de.videojs[e])return Dn.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),de.videojs[e]}}}Cr.names.forEach(function(n){const e=Cr[n];vn.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});vn.prototype.featuresVolumeControl=!0;vn.prototype.featuresMuteControl=!0;vn.prototype.featuresFullscreenResize=!1;vn.prototype.featuresPlaybackRate=!1;vn.prototype.featuresProgressEvents=!1;vn.prototype.featuresSourceset=!1;vn.prototype.featuresTimeupdateEvents=!1;vn.prototype.featuresNativeTextTracks=!1;vn.prototype.featuresVideoFrameCallback=!1;vn.withSourceHandlers=function(n){n.registerSourceHandler=function(t,i){let a=n.sourceHandlers;a||(a=n.sourceHandlers=[]),i===void 0&&(i=a.length),a.splice(i,0,t)},n.canPlayType=function(t){const i=n.sourceHandlers||[];let a;for(let l=0;l<i.length;l++)if(a=i[l].canPlayType(t),a)return a;return""},n.selectSourceHandler=function(t,i){const a=n.sourceHandlers||[];let l;for(let u=0;u<a.length;u++)if(l=a[u].canHandleSource(t,i),l)return a[u];return null},n.canPlaySource=function(t,i){const a=n.selectSourceHandler(t,i);return a?a.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},n.prototype),n.prototype.setSource=function(t){let i=n.selectSourceHandler(t,this.options_);i||(n.nativeSourceHandler?i=n.nativeSourceHandler:Dn.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==n.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},n.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};nt.registerComponent("Tech",vn);vn.registerTech("Tech",vn);vn.defaultTechOrder_=[];const hl={},Lf={},If={};function uM(n,e){hl[n]=hl[n]||[],hl[n].push(e)}function cM(n,e,t){n.setTimeout(()=>il(e,hl[e.type],t,n),1)}function dM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function hM(n,e,t){return n.reduceRight(Uy(t),e[t]())}function fM(n,e,t,i){return e[t](n.reduce(Uy(t),i))}function H2(n,e,t,i=null){const a="call"+qi(t),l=n.reduce(Uy(a),i),u=l===If,h=u?null:e[t](l);return gM(n,t,h,u),h}const mM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},pM={setCurrentTime:1,setMuted:1,setVolume:1},q2={play:1,pause:1};function Uy(n){return(e,t)=>e===If?If:t[n]?t[n](e):e}function gM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function yM(n){Lf.hasOwnProperty(n.id())&&delete Lf[n.id()]}function bM(n,e){const t=Lf[n.id()];let i=null;if(t==null)return i=e(n),Lf[n.id()]=[[e,i]],i;for(let a=0;a<t.length;a++){const[l,u]=t[a];l===e&&(i=u)}return i===null&&(i=e(n),t.push([e,i])),i}function il(n={},e=[],t,i,a=[],l=!1){const[u,...h]=e;if(typeof u=="string")il(n,hl[u],t,i,a,l);else if(u){const f=bM(i,u);if(!f.setSource)return a.push(f),il(n,h,t,i,a,l);f.setSource(Object.assign({},n),function(g,_){if(g)return il(n,h,t,i,a,l);a.push(f),il(_,n.type===_.type?h:hl[_.type],t,i,a,l)})}else h.length?il(n,h,t,i,a,l):l?t(n,a):il(n,hl["*"],t,i,a,!0)}const vM={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Bf=function(n=""){const e=Fy(n);return vM[e.toLowerCase()]||""},xM=(n,e)=>{if(!e)return"";if(n.cache_.source.src===e&&n.cache_.source.type)return n.cache_.source.type;const t=n.cache_.sources.filter(a=>a.src===e);if(t.length)return t[0].type;const i=n.$$("source");for(let a=0;a<i.length;a++){const l=i[a];if(l.type&&l.src&&l.src===e)return l.type}return Bf(e)},zT=function(n){if(Array.isArray(n)){let e=[];n.forEach(function(t){t=zT(t),Array.isArray(t)?e=e.concat(t):ea(t)&&e.push(t)}),n=e}else typeof n=="string"&&n.trim()?n=[V2({src:n})]:ea(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?n=[V2(n)]:n=[];return n};function V2(n){if(!n.type){const e=Bf(n.src);e&&(n.type=e)}return n}var _M=`<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
<path d="M16 10v28l22-14z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-pause">
<path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-audio">
<path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-captions">
<path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
<path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
<path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
<path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
<path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
<path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
<path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
<path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
</symbol>
<symbol viewBox="0 0 24 24" id="vjs-icon-hd">
<path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
</symbol>
<symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
<path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
<path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
<path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
<path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-share">
<path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-cog">
<path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-square">
<path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-circle">
<circle cx="24" cy="24" r="20"></circle>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
<path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-replay">
<path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
<path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
<path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
<path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
<path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
<path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
<path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
</symbol>
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
<path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
</symbol>
<symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
<g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
<path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
<path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
<path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-cast">
<path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
</symbol>
<symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
<path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
</symbol>
<symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
<path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
<path fill="none" d="M-1-3h24v24H-1z"></path>
</symbol>
<symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
<path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
</symbol>
<symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
<path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
</symbol>
<symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
</symbol>
<symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
<path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
</symbol>
<symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
</symbol>
</defs>
</svg>`;const G2=Df?10009:Mf?461:8,Yl={codes:{play:415,pause:19,ff:417,rw:412,back:G2},names:{415:"play",19:"pause",417:"ff",412:"rw",[G2]:"back"},isEventKey(n,e){return e=e.toLowerCase(),!!(this.names[n.keyCode]&&this.names[n.keyCode]===e)},getEventName(n){if(this.names[n.keyCode])return this.names[n.keyCode];if(this.codes[n.code]){const e=this.codes[n.code];return this.names[e]}return null}},K2=5;class wM extends as{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(Yl.isEventKey(t,"play")||Yl.isEventKey(t,"pause")||Yl.isEventKey(t,"ff")||Yl.isEventKey(t,"rw")){t.preventDefault();const i=Yl.getEventName(t);this.performMediaAction_(i)}else Yl.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+K2);break;case"rw":this.userSeek_(this.player_.currentTime()-K2);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const a=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(a&&a.name()==="CloseButton"?this.refocusComponent():(this.pause(),a&&a.el()&&(this.lastFocusedComponent_=a)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(a){for(const l of a)l.hasOwnProperty("el_")&&l.getIsFocusable()&&l.getIsAvailableToBeFocused(l.el())&&t.push(l),l.hasOwnProperty("children_")&&l.children_.length>0&&i(l.children_)}return e.children_.forEach(a=>{if(a.hasOwnProperty("el_"))if(a.getIsFocusable&&a.getIsAvailableToBeFocused&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el())){t.push(a);return}else a.hasOwnProperty("children_")&&a.children_.length>0?i(a.children_):a.hasOwnProperty("items")&&a.items.length>0?i(a.items):this.findSuitableDOMChild(a)&&t.push(a);if(a.name_==="ErrorDisplay"&&a.opened_){const l=a.el_.querySelector(".vjs-errors-ok-button-container");l&&l.querySelectorAll("button").forEach((h,f)=>{t.push({name:()=>"ModalButton"+(f+1),el:()=>h,getPositions:()=>{const g=h.getBoundingClientRect(),_={x:g.x,y:g.y,width:g.width,height:g.height,top:g.top,right:g.right,bottom:g.bottom,left:g.left},S={x:g.left+g.width/2,y:g.top+g.height/2,width:0,height:0,top:g.top+g.height/2,right:g.left+g.width/2,bottom:g.top+g.height/2,left:g.left+g.width/2};return{boundingClientRect:_,center:S}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:g=>!0,focus:()=>h.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let a=0;a<i.children.length;a++){const l=i.children[a],u=t(l);if(u)return u}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),a=this.focusableComponents.filter(u=>u!==t&&this.isInDirection_(i.boundingClientRect,u.getPositions().boundingClientRect,e)),l=this.findBestCandidate_(i.center,a,e);l?this.focus(l):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let a=1/0,l=null;for(const u of t){const h=u.getPositions().center,f=this.calculateDistance_(e,h,i);f<a&&(a=f,l=u)}return l}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const a=Math.abs(e.x-t.x),l=Math.abs(e.y-t.y);let u;switch(i){case"right":case"left":u=a+l*100;break;case"up":u=l*2+a*.5;break;case"down":u=l*5+a;break;default:u=a+l}return u}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class TM extends nt{constructor(e,t,i){const a=hi({createEl:!1},t);if(super(e,a,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let l=0,u=t.playerOptions.techOrder;l<u.length;l++){const h=qi(u[l]);let f=vn.getTech(h);if(h||(f=nt.getComponent(h)),f&&f.isSupported()){e.loadTech_(h);break}}else e.src(t.playerOptions.sources)}}nt.registerComponent("MediaLoader",TM);class _0 extends nt{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Dn.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const a=dn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=dn("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ao(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("ClickableComponent",_0);class Zg extends _0{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return dn("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(dn("picture",{className:"vjs-poster",tabIndex:-1},{},dn("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xs(this.player_.play()):this.player_.pause())}}Zg.prototype.crossorigin=Zg.prototype.crossOrigin;nt.registerComponent("PosterImage",Zg);const fs="#222",W2="#ccc",SM={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function ag(n,e){let t;if(n.length===4)t=n[1]+n[1]+n[2]+n[2]+n[3]+n[3];else if(n.length===7)t=n.slice(1);else throw new Error("Invalid color code provided, "+n+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Vs(n,e,t){try{n.style[e]=t}catch{return}}function X2(n){return n?`${n}px`:""}class kM extends nt{constructor(e,t,i){super(e,t,i);const a=u=>this.updateDisplay(u),l=u=>{this.updateDisplayOverlay(),this.updateDisplay(u)};e.on("loadstart",u=>this.toggleDisplay(u)),e.on("useractive",a),e.on("userinactive",a),e.on("texttrackchange",a),e.on("loadedmetadata",u=>{this.updateDisplayOverlay(),this.preselectTrack(u)}),e.ready(Si(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=de.screen.orientation||de,h=de.screen.orientation?"change":"orientationchange";u.addEventListener(h,l),e.on("dispose",()=>u.removeEventListener(h,l));const f=this.options_.playerOptions.tracks||[];for(let g=0;g<f.length;g++)this.player_.addRemoteTextTrack(f[g],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let a,l,u;for(let h=0;h<t.length;h++){const f=t[h];i&&i.enabled&&i.language&&i.language===f.language&&f.kind in e?f.kind===i.kind?u=f:u||(u=f):i&&!i.enabled?(u=null,a=null,l=null):f.default&&(f.kind==="descriptions"&&!a?a=f:f.kind in e&&!l&&(l=f))}u?u.mode="showing":l?l.mode="showing":a&&(a.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof de.WebVTT=="function"&&de.WebVTT.processCues(de,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const u=[];for(let h=0;h<e.length;++h){const f=e[h];f.mode==="showing"&&u.push(f)}this.updateForTrack(u);return}let i=null,a=null,l=e.length;for(;l--;){const u=e[l];u.mode==="showing"&&(u.kind==="descriptions"?i=u:a=u)}if(a?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(a)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!de.CSS.supports("inset","10px")){const u=this.el_,h=u.querySelectorAll(".vjs-text-track-cue"),f=this.player_.controlBar.el_.getBoundingClientRect().height,g=this.player_.el_.getBoundingClientRect().height;u.style="",Vs(u,"position","relative"),Vs(u,"height",g-f+"px"),Vs(u,"top","unset"),jf?Vs(u,"bottom",g+"px"):Vs(u,"bottom","0px"),h.length>0&&h.forEach(_=>{if(_.style.inset){const S=_.style.inset.split(" ");S.length===3&&Object.assign(_.style,{top:S[0],right:S[1],bottom:S[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!de.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,a=this.player_.videoWidth()/this.player_.videoHeight();let l=0,u=0;Math.abs(i-a)>.1&&(i>a?l=Math.round((e-t*a)/2):u=Math.round((t-e/a)/2)),Vs(this.el_,"insetInline",X2(l)),Vs(this.el_,"insetBlock",X2(u))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let a=i.length;for(;a--;){const l=i[a];if(!l)continue;const u=l.displayState;if(t.color&&(u.firstChild.style.color=t.color),t.textOpacity&&Vs(u.firstChild,"color",ag(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(u.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Vs(u.firstChild,"backgroundColor",ag(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Vs(u,"backgroundColor",ag(t.windowColor,t.windowOpacity)):u.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?u.firstChild.style.textShadow=`2px 2px 3px ${fs}, 2px 2px 4px ${fs}, 2px 2px 5px ${fs}`:t.edgeStyle==="raised"?u.firstChild.style.textShadow=`1px 1px ${fs}, 2px 2px ${fs}, 3px 3px ${fs}`:t.edgeStyle==="depressed"?u.firstChild.style.textShadow=`1px 1px ${W2}, 0 1px ${W2}, -1px -1px ${fs}, 0 -1px ${fs}`:t.edgeStyle==="uniform"&&(u.firstChild.style.textShadow=`0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}`)),t.fontPercent&&t.fontPercent!==1){const h=de.parseFloat(u.style.fontSize);u.style.fontSize=h*t.fontPercent+"px",u.style.height="auto",u.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?u.firstChild.style.fontVariant="small-caps":u.firstChild.style.fontFamily=SM[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof de.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const a=e[i];for(let l=0;l<a.activeCues.length;++l)t.push(a.activeCues[l])}de.WebVTT.processCues(de,t,this.el_);for(let i=0;i<e.length;++i){const a=e[i];for(let l=0;l<a.activeCues.length;++l){const u=a.activeCues[l].displayState;dl(u,"vjs-text-track-cue","vjs-text-track-cue-"+(a.language?a.language:i)),a.language&&Eu(u,"lang",a.language)}this.player_.textTrackSettings&&this.updateDisplayState(a)}}}nt.registerComponent("TextTrackDisplay",kM);class EM extends nt{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=dn("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),a=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return a.appendChild(i),a}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}nt.registerComponent("LoadingSpinner",EM);class wr extends _0{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const a=dn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}addChild(e,t={}){const i=this.constructor.name;return Dn.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),nt.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}nt.registerComponent("Button",wr);class $T extends wr{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Xs(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),a=i&&i.getChild("playToggle");if(!a){this.player_.tech(!0).focus();return}const l=()=>a.focus();sd(t)?t.then(l,()=>{}):this.setTimeout(l,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}$T.prototype.controlText_="Play Video";nt.registerComponent("BigPlayButton",$T);class CM extends wr{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("CloseButton",CM);class HT extends wr{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Xs(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}HT.prototype.controlText_="Play";nt.registerComponent("PlayToggle",HT);class Lu extends nt{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=dn("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=dn("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=bl(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Dn.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=xt.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Lu.prototype.labelText_="Time";Lu.prototype.controlText_="Time";nt.registerComponent("TimeDisplay",Lu);class zy extends Lu{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}zy.prototype.labelText_="Current Time";zy.prototype.controlText_="Current Time";nt.registerComponent("CurrentTimeDisplay",zy);class $y extends Lu{constructor(e,t){super(e,t);const i=a=>this.updateContent(a);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}$y.prototype.labelText_="Duration";$y.prototype.controlText_="Duration";nt.registerComponent("DurationDisplay",$y);class AM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}nt.registerComponent("TimeDivider",AM);class Hy extends Lu{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(dn("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Hy.prototype.labelText_="Remaining Time";Hy.prototype.controlText_="Remaining Time";nt.registerComponent("RemainingTimeDisplay",Hy);class NM extends nt{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=dn("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(dn("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(xt.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}nt.registerComponent("LiveDisplay",NM);class qT extends wr{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=dn("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}qT.prototype.controlText_="Seek to live, currently playing live";nt.registerComponent("SeekToLive",qT);function Sd(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var DM=Object.freeze({__proto__:null,clamp:Sd});class qy extends nt{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ta&&e.preventDefault(),gT(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;yT(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Sd(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=p0(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,a=t&&t.horizontalSeek;i?a&&e.key==="ArrowLeft"||!a&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):a&&e.key==="ArrowRight"||!a&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}nt.registerComponent("Slider",qy);const og=(n,e)=>Sd(n/e*100,0,100).toFixed(2)+"%";class MM extends nt{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=dn("span",{className:"vjs-control-text"}),i=dn("span",{textContent:this.localize("Loaded")}),a=xt.createTextNode(": ");return this.percentageEl_=dn("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(a),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),a=t&&t.isLive()?t.seekableEnd():this.player_.duration(),l=this.player_.bufferedEnd(),u=this.partEls_,h=og(l,a);this.percent_!==h&&(this.el_.style.width=h,Ao(this.percentageEl_,h),this.percent_=h);for(let f=0;f<i.length;f++){const g=i.start(f),_=i.end(f);let S=u[f];S||(S=this.el_.appendChild(dn()),u[f]=S),!(S.dataset.start===g&&S.dataset.end===_)&&(S.dataset.start=g,S.dataset.end=_,S.style.left=og(g,l),S.style.width=og(_-g,l))}for(let f=u.length;f>i.length;f--)this.el_.removeChild(u[f-1]);u.length=i.length})}}nt.registerComponent("LoadProgressBar",MM);class jM extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const a=pd(this.el_),l=Cu(this.player_.el()),u=e.width*t;if(!l||!a)return;let h=e.left-l.left+u,f=e.width-u+(l.right-e.right);f||(f=e.width-u,h=u);let g=a.width/2;h<g?g+=g-h:f<g&&(g=f),g<0?g=0:g>a.width&&(g=a.width),g=Math.round(g),this.el_.style.right=`-${g}px`,this.write(i)}write(e){Ao(this.el_,e)}updateTime(e,t,i,a){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let l;const u=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const h=this.player_.liveTracker.liveWindow(),f=h-t*h;l=(f<1?"":"-")+bl(f,h)}else l=bl(i,u);this.update(e,t,l),a&&a()})}}nt.registerComponent("TimeTooltip",jM);class Vy extends nt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const a=this.getChild("timeTooltip");if(!a)return;const l=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,l)}}Vy.prototype.options_={children:[]};!xr&&!js&&Vy.prototype.options_.children.push("timeTooltip");nt.registerComponent("PlayProgressBar",Vy);class VT extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}VT.prototype.options_={children:["timeTooltip"]};nt.registerComponent("MouseTimeDisplay",VT);class w0 extends qy{constructor(e,t){t=hi(w0.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(xr||js)||e.options_.disableSeekWhileScrubbingOnSTV;(!xr&&!js||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Si(this,this.update),this.update=na(this.update_,bs),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in xt&&"visibilityState"in xt&&this.on(xt,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){xt.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,bs))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(xt.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),a=this.player_.liveTracker;let l=this.player_.duration();a&&a.isLive()&&(l=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==l)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[bl(i,l),bl(l,l)],"{1} of {2}")),this.currentTime_=i,this.duration_=l),this.bar&&this.bar.update(Cu(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){gd(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!gd(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const a=this.calculateDistance(e),l=this.player_.liveTracker;if(!l||!l.isLive())i=a*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(a>=.99){l.seekToLiveEdge();return}const u=l.seekableStart(),h=l.liveCurrentTime();if(i=u+a*l.liveWindow(),i>=h&&(i=h),i<=u&&(i=u+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xs(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in xt&&"visibilityState"in xt&&this.off(xt,"visibilitychange",this.toggleVisibility_),super.dispose()}}w0.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};nt.registerComponent("SeekBar",w0);class GT extends nt{constructor(e,t){super(e,t),this.handleMouseMove=na(Si(this,this.handleMouseMove),bs),this.throttledHandleMouseSeek=na(Si(this,this.handleMouseSeek),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),a=t.getChild("mouseTimeDisplay");if(!i&&!a)return;const l=t.el(),u=pd(l);let h=p0(l,e).x;h=Sd(h,0,1),a&&a.update(u,h),i&&i.update(u,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Xs(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}GT.prototype.options_={children:["seekBar"]};nt.registerComponent("ProgressControl",GT);class KT extends wr{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){xt.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in de?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof xt.exitPictureInPicture=="function"&&super.show()}}KT.prototype.controlText_="Picture-in-Picture";nt.registerComponent("PictureInPictureToggle",KT);class WT extends wr{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),xt[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}WT.prototype.controlText_="Fullscreen";nt.registerComponent("FullscreenToggle",WT);const RM=function(n,e){e.tech_&&!e.tech_.featuresVolumeControl&&n.addClass("vjs-hidden"),n.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};class OM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}nt.registerComponent("VolumeLevel",OM);class LM extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,a){if(!i){const l=Cu(this.el_),u=Cu(this.player_.el()),h=e.width*t;if(!u||!l)return;const f=e.left-u.left+h,g=e.width-h+(u.right-e.right);let _=l.width/2;f<_?_+=_-f:g<_&&(_=g),_<0?_=0:_>l.width&&(_=l.width),this.el_.style.right=`-${_}px`}this.write(`${a}%`)}write(e){Ao(this.el_,e)}updateVolume(e,t,i,a,l){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,a.toFixed(0)),l&&l()})}}nt.registerComponent("VolumeLevelTooltip",LM);class XT extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const a=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,a,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}XT.prototype.options_={children:["volumeLevelTooltip"]};nt.registerComponent("MouseVolumeLevelDisplay",XT);class T0 extends qy{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){gd(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),a=Cu(i),l=this.vertical();let u=p0(i,e);u=l?u.y:u.x,u=Sd(u,0,1),t.update(a,u,l)}gd(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}T0.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!xr&&!js&&T0.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");T0.prototype.playerEvent="volumechange";nt.registerComponent("VolumeBar",T0);class YT extends nt{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||ku(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),RM(this,e),this.throttledHandleMouseMove=na(Si(this,this.handleMouseMove),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}YT.prototype.options_={children:["volumeBar"]};nt.registerComponent("VolumeControl",YT);const IM=function(n,e){e.tech_&&!e.tech_.featuresMuteControl&&n.addClass("vjs-hidden"),n.on(e,"loadstart",function(){e.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};class QT extends wr{constructor(e,t){super(e,t),IM(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const a=i<.1?.1:i;this.player_.volume(a),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),xr&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),f0(this.el_,[0,1,2,3].reduce((i,a)=>i+`${a?" ":""}vjs-vol-${a}`,"")),dl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}QT.prototype.controlText_="Mute";nt.registerComponent("MuteToggle",QT);class ZT extends nt{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||ku(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),ss(xt,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_r(xt,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}ZT.prototype.options_={children:["muteToggle","volumeControl"]};nt.registerComponent("VolumePanel",ZT);class JT extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()?i.seekableEnd():this.player_.duration();let l;t+this.skipTime<=a?l=t+this.skipTime:l=a,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}JT.prototype.controlText_="Skip Forward";nt.registerComponent("SkipForward",JT);class eS extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()&&i.seekableStart();let l;a&&t-this.skipTime<=a?l=a:t>=this.skipTime?l=t-this.skipTime:l=0,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}eS.prototype.controlText_="Skip Backward";nt.registerComponent("SkipBackward",eS);class tS extends nt{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof nt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof nt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=dn(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),ss(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||xt.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(a=>a.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}nt.registerComponent("Menu",tS);class Gy extends nt{constructor(e,t={}){super(e,t),this.menuButton_=new wr(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=wr.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const a=l=>this.handleClick(l);this.handleMenuKeyUp_=l=>this.handleMenuKeyUp(l),this.on(this.menuButton_,"tap",a),this.on(this.menuButton_,"click",a),this.on(this.menuButton_,"keydown",l=>this.handleKeyDown(l)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),ss(xt,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",l=>this.handleMouseLeave(l)),this.on("keydown",l=>this.handleSubmenuKeyDown(l))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new tS(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=dn("li",{className:"vjs-menu-title",textContent:qi(this.options_.title),tabIndex:-1}),i=new nt(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=wr.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),_r(xt,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),xr&&dT())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}nt.registerComponent("MenuButton",Gy);class Ky extends Gy{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const a=Si(this,this.update);i.addEventListener("removetrack",a),i.addEventListener("addtrack",a),i.addEventListener("labelchange",a),this.player_.on("ready",a),this.player_.on("dispose",function(){i.removeEventListener("removetrack",a),i.removeEventListener("addtrack",a),i.removeEventListener("labelchange",a)})}}nt.registerComponent("TrackButton",Ky);class kd extends _0{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const a=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),l=dn("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?a.appendChild(l):a.replaceChild(l,a.querySelector(".vjs-icon-placeholder")),a}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}nt.registerComponent("MenuItem",kd);class Ed extends kd{constructor(e,t){const i=t.track,a=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const l=(...h)=>{this.handleTracksChange.apply(this,h)},u=(...h)=>{this.handleSelectedLanguageChange.apply(this,h)};if(e.on(["loadstart","texttrackchange"],l),a.addEventListener("change",l),a.addEventListener("selectedlanguagechange",u),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],l),a.removeEventListener("change",l),a.removeEventListener("selectedlanguagechange",u)}),a.onchange===void 0){let h;this.on(["tap","click"],function(){if(typeof de.Event!="object")try{h=new de.Event("change")}catch{}h||(h=xt.createEvent("Event"),h.initEvent("change",!0,!0)),a.dispatchEvent(h)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let a=0;a<i.length;a++){const l=i[a];this.kinds.indexOf(l.kind)!==-1&&(l===t?l.mode!=="showing"&&(l.mode="showing"):l.mode!=="disabled"&&(l.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}nt.registerComponent("TextTrackMenuItem",Ed);class nS extends Ed{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let a=0,l=t.length;a<l;a++){const u=t[a];if(this.options_.kinds.indexOf(u.kind)>-1&&u.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let a=0,l=t.length;a<l;a++){const u=t[a];if(["captions","descriptions","subtitles"].indexOf(u.kind)>-1&&u.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}nt.registerComponent("OffTextTrackMenuItem",nS);class Iu extends Ky{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ed){let i;this.label_&&(i=`${this.label_} off`),e.push(new nS(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const a=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let l=0;l<a.length;l++){const u=a[l];if(this.kinds_.indexOf(u.kind)>-1){const h=new t(this.player_,{track:u,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});h.addClass(`vjs-${u.kind}-menu-item`),e.push(h)}}return e}}nt.registerComponent("TextTrackButton",Iu);class iS extends kd{constructor(e,t){const i=t.track,a=t.cue,l=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=a.text,t.selected=a.startTime<=l&&l<a.endTime,super(e,t),this.track=i,this.cue=a}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}nt.registerComponent("ChaptersTrackMenuItem",iS);class Wy extends Iu{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(a=>{a.selected(this.track_.activeCues[0]===a.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(qi(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,a=t.length;i<a;i++){const l=t[i],u=new iS(this.player_,{track:this.track_,cue:l});e.push(u)}return e}}Wy.prototype.kind_="chapters";Wy.prototype.controlText_="Chapters";nt.registerComponent("ChaptersButton",Wy);class Xy extends Iu{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const a=e.textTracks(),l=Si(this,this.handleTracksChange);a.addEventListener("change",l),this.on("dispose",function(){a.removeEventListener("change",l)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let a=0,l=t.length;a<l;a++){const u=t[a];if(u.kind!==this.kind_&&u.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Xy.prototype.kind_="descriptions";Xy.prototype.controlText_="Descriptions";nt.registerComponent("DescriptionsButton",Xy);class Yy extends Iu{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Yy.prototype.kind_="subtitles";Yy.prototype.controlText_="Subtitles";nt.registerComponent("SubtitlesButton",Yy);class Qy extends Ed{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}nt.registerComponent("CaptionSettingsMenuItem",Qy);class Zy extends Iu{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Qy(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Zy.prototype.kind_="captions";Zy.prototype.controlText_="Captions";nt.registerComponent("CaptionsButton",Zy);class rS extends Ed{createEl(e,t,i){const a=super.createEl(e,t,i),l=a.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",a):l.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(dn("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),a}}nt.registerComponent("SubsCapsMenuItem",rS);class Jy extends Iu{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(qi(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Qy(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,rS),e}}Jy.prototype.kinds_=["captions","subtitles"];Jy.prototype.controlText_="Subtitles";nt.registerComponent("SubsCapsButton",Jy);class sS extends kd{constructor(e,t){const i=t.track,a=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const l=(...u)=>{this.handleTracksChange.apply(this,u)};a.addEventListener("change",l),this.on("dispose",()=>{a.removeEventListener("change",l)})}createEl(e,t,i){const a=super.createEl(e,t,i),l=a.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(l.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(dn("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),a}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const a=t[i];a!==this.track&&(a.enabled=a===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}nt.registerComponent("AudioTrackMenuItem",sS);class aS extends Ky{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const a=t[i];e.push(new sS(this.player_,{track:a,selectable:!0,multiSelectable:!1}))}return e}}aS.prototype.controlText_="Audio Track";nt.registerComponent("AudioTrackButton",aS);class eb extends kd{constructor(e,t){const i=t.rate,a=parseFloat(i,10);t.label=i,t.selected=a===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=a,this.on(e,"ratechange",l=>this.update(l))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}eb.prototype.contentElType="button";nt.registerComponent("PlaybackRateMenuItem",eb);class oS extends Gy{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=dn("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new eb(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}oS.prototype.controlText_="Playback Rate";nt.registerComponent("PlaybackRateMenuButton",oS);class lS extends nt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}nt.registerComponent("Spacer",lS);class BM extends lS{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}nt.registerComponent("CustomControlSpacer",BM);class uS extends nt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}uS.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};nt.registerComponent("ControlBar",uS);class cS extends Ou{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}cS.prototype.options_=Object.assign({},Ou.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});nt.registerComponent("ErrorDisplay",cS);class dS extends nt{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),dn("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${ys()}`)+"-"+t[1].replace(/\W+/g,""),a=dn("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return a.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),a}))}}nt.registerComponent("TextTrackSelect",dS);class fl extends nt{constructor(e,t={}){super(e,t);const i=dn("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const a=this.options_.selects;for(const l of a){const u=this.options_.selectConfigs[l],h=u.className,f=u.id.replace("%s",this.options_.id_);let g=null;const _=`vjs_select_${ys()}`;if(this.options_.type==="colors"){g=dn("span",{className:h});const C=dn("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});C.setAttribute("for",_),g.appendChild(C)}const S=new dS(e,{SelectOptions:u.options,legendId:this.options_.legendId,id:_,labelId:f});this.addChild(S),this.options_.type==="colors"&&(g.appendChild(S.el()),this.el().appendChild(g))}}createEl(){return dn("fieldset",{className:this.options_.className})}}nt.registerComponent("TextTrackFieldset",fl);class hS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(u)}createEl(){return dn("div",{className:"vjs-track-settings-colors"})}}nt.registerComponent("TextTrackSettingsColors",hS);class fS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(u)}createEl(){return dn("div",{className:"vjs-track-settings-font"})}}nt.registerComponent("TextTrackSettingsFont",fS);class mS extends nt{constructor(e,t={}){super(e,t);const i=new wr(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const a=this.localize("Done"),l=new wr(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return dn("div",{className:"vjs-track-settings-controls"})}}nt.registerComponent("TrackSettingsControls",mS);const lg="vjs-text-track-settings",Y2=["#000","Black"],Q2=["#00F","Blue"],Z2=["#0FF","Cyan"],J2=["#0F0","Green"],e_=["#F0F","Magenta"],t_=["#F00","Red"],n_=["#FFF","White"],i_=["#FF0","Yellow"],ug=["1","Opaque"],cg=["0.5","Semi-Transparent"],r_=["0","Transparent"],xo={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Y2,n_,t_,J2,Q2,i_,e_,Z2],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ug,cg,r_],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[n_,Y2,t_,J2,Q2,i_,e_,Z2],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:n=>n==="1.00"?null:Number(n)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ug,cg],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[r_,cg,ug],className:"vjs-window-opacity vjs-opacity"}};xo.windowColor.options=xo.backgroundColor.options;function pS(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function PM(n,e){const t=n.options[n.options.selectedIndex].value;return pS(t,e)}function FM(n,e,t){if(e){for(let i=0;i<n.options.length;i++)if(pS(n.options[i].value,t)===e){n.selectedIndex=i;break}}}class UM extends Ou{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=dn("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new hS(e,{textTrackComponentid:this.id_,selectConfigs:xo,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new fS(e,{textTrackComponentid:this.id_,selectConfigs:xo,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const a=new mS(e);this.addChild(a)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),lu(xo,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return rT(xo,(e,t,i)=>{const a=PM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){lu(xo,(t,i)=>{FM(this.$(t.selector),e[i],t.parser)})}setDefaults(){lu(xo,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(de.localStorage.getItem(lg))}catch(t){Dn.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?de.localStorage.setItem(lg,JSON.stringify(e)):de.localStorage.removeItem(lg)}catch(t){Dn.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}nt.registerComponent("TextTrackSettings",UM);class zM extends nt{constructor(e,t){let i=t.ResizeObserver||de.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=hi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||de.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=CT(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const l=this.debouncedHandler_;let u=this.unloadListener_=function(){_r(this,"resize",l),_r(this,"unload",u),u=null};ss(this.el_.contentWindow,"unload",u),ss(this.el_.contentWindow,"resize",l)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}nt.registerComponent("ResizeManager",zM);const $M={trackingThreshold:20,liveTolerance:15};class HM extends nt{constructor(e,t){const i=hi($M,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=a=>this.handlePlay(a),this.handleFirstTimeupdate_=a=>this.handleFirstTimeupdate(a),this.handleSeeked_=a=>this.handleSeeked(a),this.seekToLiveEdge_=a=>this.seekToLiveEdge(a),this.reset_(),this.on(this.player_,"durationchange",a=>this.handleDurationchange(a)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(de.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const a=this.liveCurrentTime(),l=this.player_.currentTime();let u=this.player_.paused()||this.seekedBehindLive_||Math.abs(a-l)>this.options_.liveTolerance;(!this.timeupdateSeen_||a===1/0)&&(u=!1),u!==this.behindLiveEdge_&&(this.behindLiveEdge_=u,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,bs),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}nt.registerComponent("LiveTracker",HM);class qM extends nt{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:dn("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ys()}`}),description:dn("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ys()}`})},dn("div",{className:"vjs-title-bar"},{},sT(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(a=>{const l=this.state[a],u=this.els[a],h=i[a];g0(u),l&&Ao(u,l),t&&(t.removeAttribute(h),l&&t.setAttribute(h,u.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}nt.registerComponent("TitleBar",qM);const VM={initialDisplay:4e3,position:[],takeFocus:!1};class GM extends wr{constructor(e,t){t=hi(VM,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=dn("button",{},{type:"button",class:this.buildCSSClass()},dn("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}nt.registerComponent("TransientButton",GM);const Jg=n=>{const e=n.el();if(e.hasAttribute("src"))return n.triggerSourceset(e.src),!0;const t=n.$$("source"),i=[];let a="";if(!t.length)return!1;for(let l=0;l<t.length;l++){const u=t[l].src;u&&i.indexOf(u)===-1&&i.push(u)}return i.length?(i.length===1&&(a=i[0]),n.triggerSourceset(a),!0):!1},KM=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(n){const e=xt.createElement(this.nodeName.toLowerCase());e.innerHTML=n;const t=xt.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",de.Element.prototype.appendChild.call(this,t),this.innerHTML}}),gS=(n,e)=>{let t={};for(let i=0;i<n.length&&(t=Object.getOwnPropertyDescriptor(n[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},WM=n=>gS([n.el(),de.HTMLMediaElement.prototype,de.Element.prototype,KM],"innerHTML"),s_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=WM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Jg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",hi(i,{set:a(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(l=>{e[l]=t[l]}),Object.defineProperty(e,"innerHTML",i)},n.one("sourceset",e.resetSourceWatch_)},XM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?PT(de.Element.prototype.getAttribute.call(this,"src")):""},set(n){return de.Element.prototype.setAttribute.call(this,"src",n),n}}),YM=n=>gS([n.el(),de.HTMLMediaElement.prototype,XM],"src"),QM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=YM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",hi(t,{set:l=>{const u=t.set.call(e,l);return n.triggerSourceset(e.src),u}})),e.setAttribute=(l,u)=>{const h=i.call(e,l,u);return/src/i.test(l)&&n.triggerSourceset(e.src),h},e.load=()=>{const l=a.call(e);return Jg(n)||(n.triggerSourceset(""),s_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Jg(n)||s_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Bt extends vn{constructor(e,t){super(e,t);const i=e.source;let a=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const l=this.el_.childNodes;let u=l.length;const h=[];for(;u--;){const f=l[u];f.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(f),this.remoteTextTracks().addTrack(f.track),this.textTracks().addTrack(f.track),!a&&!this.el_.hasAttribute("crossorigin")&&x0(f.src)&&(a=!0)):h.push(f))}for(let f=0;f<h.length;f++)this.el_.removeChild(h[f])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&a&&Dn.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(md||d0)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Bt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){QM(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let l=0;l<e.length;l++){const u=e[l];u.kind==="metadata"&&t.push({track:u,storedMode:u.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const a=()=>{for(let l=0;l<t.length;l++){const u=t[l];u.track.mode==="disabled"&&u.track.mode!==u.storedMode&&(u.track.mode=u.storedMode)}e.removeEventListener("change",a)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",a),e.addEventListener("change",a)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",a)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(a=>{this.el()[`${i}Tracks`].removeEventListener(a,this[`${i}TracksListeners_`][a])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=gs[e],i=this.el()[t.getterName],a=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const l={change:h=>{const f={type:"change",target:a,currentTarget:a,srcElement:a};a.trigger(f),e==="text"&&this[Nu.remoteText.getterName]().trigger(f)},addtrack(h){a.addTrack(h.track)},removetrack(h){a.removeTrack(h.track)}},u=function(){const h=[];for(let f=0;f<a.length;f++){let g=!1;for(let _=0;_<i.length;_++)if(i[_]===a[f]){g=!0;break}g||h.push(a[f])}for(;h.length;)a.removeTrack(h.shift())};this[t.getterName+"Listeners_"]=l,Object.keys(l).forEach(h=>{const f=l[h];i.addEventListener(h,f),this.on("dispose",g=>i.removeEventListener(h,f))}),this.on("loadstart",u),this.on("dispose",h=>this.off("loadstart",u))}proxyNativeTracks_(){gs.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),Bt.disposeMediaElement(e),e=i}else{e=xt.createElement("video");const i=this.options_.tag&&vo(this.options_.tag),a=hi({},i);(!md||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,mT(e,Object.assign(a,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Eu(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const a=t[i],l=this.options_[a];typeof l<"u"&&(l?Eu(e,a,a):m0(e,a),e[a]=l)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const a=function(){i=!0};this.on("loadstart",a);const l=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",l),this.ready(function(){this.off("loadstart",a),this.off("loadedmetadata",l),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&h0?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Dn(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&js&&ta&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xs(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Dn.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const a=dn("source",{},i);return this.el_.appendChild(a),!0}removeSourceElement(e){if(!e)return Dn.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Dn.warn(`No matching source element found with src: ${e}`),!1}reset(){Bt.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=xt.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),de.performance&&(e.creationTime=de.performance.now()),e}}l0(Bt,"TEST_VID",function(){if(!Mu())return;const n=xt.createElement("video"),e=xt.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Bt.isSupported=function(){try{Bt.TEST_VID.volume=.5}catch{return!1}return!!(Bt.TEST_VID&&Bt.TEST_VID.canPlayType)};Bt.canPlayType=function(n){return Bt.TEST_VID.canPlayType(n)};Bt.canPlaySource=function(n,e){return Bt.canPlayType(n.type)};Bt.canControlVolume=function(){try{const n=Bt.TEST_VID.volume;Bt.TEST_VID.volume=n/2+.1;const e=n!==Bt.TEST_VID.volume;return e&&xr?(de.setTimeout(()=>{Bt&&Bt.prototype&&(Bt.prototype.featuresVolumeControl=n!==Bt.TEST_VID.volume)}),!1):e}catch{return!1}};Bt.canMuteVolume=function(){try{const n=Bt.TEST_VID.muted;return Bt.TEST_VID.muted=!n,Bt.TEST_VID.muted?Eu(Bt.TEST_VID,"muted","muted"):m0(Bt.TEST_VID,"muted","muted"),n!==Bt.TEST_VID.muted}catch{return!1}};Bt.canControlPlaybackRate=function(){if(js&&ta&&u0<58)return!1;try{const n=Bt.TEST_VID.playbackRate;return Bt.TEST_VID.playbackRate=n/2+.1,n!==Bt.TEST_VID.playbackRate}catch{return!1}};Bt.canOverrideAttributes=function(){try{const n=()=>{};Object.defineProperty(xt.createElement("video"),"src",{get:n,set:n}),Object.defineProperty(xt.createElement("audio"),"src",{get:n,set:n}),Object.defineProperty(xt.createElement("video"),"innerHTML",{get:n,set:n}),Object.defineProperty(xt.createElement("audio"),"innerHTML",{get:n,set:n})}catch{return!1}return!0};Bt.supportsNativeTextTracks=function(){return h0||xr&&ta};Bt.supportsNativeVideoTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.videoTracks)};Bt.supportsNativeAudioTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.audioTracks)};Bt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([n,e]){l0(Bt.prototype,n,()=>Bt[e](),!0)});Bt.prototype.featuresVolumeControl=Bt.canControlVolume();Bt.prototype.movingMediaElementInDOM=!xr;Bt.prototype.featuresFullscreenResize=!0;Bt.prototype.featuresProgressEvents=!0;Bt.prototype.featuresTimeupdateEvents=!0;Bt.prototype.featuresVideoFrameCallback=!!(Bt.TEST_VID&&Bt.TEST_VID.requestVideoFrameCallback);Bt.disposeMediaElement=function(n){if(n){for(n.parentNode&&n.parentNode.removeChild(n);n.hasChildNodes();)n.removeChild(n.firstChild);n.removeAttribute("src"),typeof n.load=="function"&&(function(){try{n.load()}catch{}})()}};Bt.resetMediaElement=function(n){if(!n)return;const e=n.querySelectorAll("source");let t=e.length;for(;t--;)n.removeChild(e[t]);n.removeAttribute("src"),typeof n.load=="function"&&(function(){try{n.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Bt.prototype["set"+qi(n)]=function(e){this.el_[n]=e,e?this.el_.setAttribute(n,n):this.el_.removeAttribute(n)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Bt.prototype["set"+qi(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]()}});vn.withSourceHandlers(Bt);Bt.nativeSourceHandler={};Bt.nativeSourceHandler.canPlayType=function(n){try{return Bt.TEST_VID.canPlayType(n)}catch{return""}};Bt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Bt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Fy(n.src);return Bt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Bt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Bt.nativeSourceHandler.dispose=function(){};Bt.registerSourceHandler(Bt.nativeSourceHandler);vn.registerTech("Html5",Bt);const yS=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],dg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ey=["tiny","xsmall","small","medium","large","xlarge","huge"],ff={};ey.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;ff[n]=`vjs-layout-${e}`});const ZM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let Mi=class nu extends nt{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${ys()}`,t=Object.assign(nu.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const u=e.closest("[lang]");u&&(t.language=u.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=u=>this.documentFullscreenChange_(u),this.boundFullWindowOnEscKey_=u=>this.fullWindowOnEscKey(u),this.boundUpdateStyleEl_=u=>this.updateStyleEl_(u),this.boundApplyInitTime_=u=>this.applyInitTime_(u),this.boundUpdateCurrentBreakpoint_=u=>this.updateCurrentBreakpoint_(u),this.boundHandleTechClick_=u=>this.handleTechClick_(u),this.boundHandleTechDoubleClick_=u=>this.handleTechDoubleClick_(u),this.boundHandleTechTouchStart_=u=>this.handleTechTouchStart_(u),this.boundHandleTechTouchMove_=u=>this.handleTechTouchMove_(u),this.boundHandleTechTouchEnd_=u=>this.handleTechTouchEnd_(u),this.boundHandleTechTap_=u=>this.handleTechTap_(u),this.boundUpdatePlayerHeightOnAudioOnlyMode_=u=>this.updatePlayerHeightOnAudioOnlyMode_(u),this.isFullscreen_=!1,this.log=nT(this.id_),this.fsApi_=Cf,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&vo(e),this.language(this.options_.language),t.languages){const u={};Object.getOwnPropertyNames(t.languages).forEach(function(h){u[h.toLowerCase()]=t.languages[h]}),this.languages_=u}else this.languages_=nu.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(u=>{if(typeof this[u]!="function")throw new Error(`plugin "${u}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Oy(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ss(xt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const a=hi(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(u=>{this[u](t.plugins[u])}),t.debug&&this.debug(!0),this.options_.playerOptions=a,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const h=new de.DOMParser().parseFromString(_M,"image/svg+xml");if(h.querySelector("parsererror"))Dn.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const g=h.documentElement;g.style.display="none",this.el_.appendChild(g),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new wM(this),this.addClass("vjs-spatial-navigation-enabled")),md&&this.addClass("vjs-touch-enabled"),xr||this.addClass("vjs-workinghover"),nu.players[this.id_]=this;const l=Hg.split(".")[0];this.addClass(`vjs-v${l}`),this.userActive(!0),this.reportUserActivity(),this.one("play",u=>this.listenForUserActivity_(u)),this.on("keydown",u=>this.handleKeyDown(u)),this.on("languagechange",u=>this.handleLanguagechange(u)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),_r(xt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_r(xt,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),nu.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),yM(this),Cr.names.forEach(e=>{const t=Cr[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const a=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:a||(t=this.el_=super.createEl("div"));const l=vo(e);if(a){for(t=this.el_=e,e=this.tag=xt.createElement("video");t.children.length;)e.appendChild(t.firstChild);id(t,"video-js")||dl(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(f=>{try{e[f]=t[f]}catch{}})}e.setAttribute("tabindex","-1"),l.tabindex="-1",ta&&c0&&(e.setAttribute("role","application"),l.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in l&&delete l.width,"height"in l&&delete l.height,Object.getOwnPropertyNames(l).forEach(function(f){a&&f==="class"||t.setAttribute(f,l[f]),a&&e.setAttribute(f,l[f])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const u=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(f=>cT[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),de.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=kT("vjs-styles-dimensions");const f=Co(".vjs-styles-defaults"),g=Co("head");g.insertBefore(this.styleEl_,f?f.nextSibling:g.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const h=e.getElementsByTagName("a");for(let f=0;f<h.length;f++){const g=h.item(f);dl(g,"vjs-hidden"),g.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),Vg(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Dn.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const a=parseFloat(t);if(isNaN(a)){Dn.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=a,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Aa(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),X4(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(de.VIDEOJS_NO_DYNAMIC_STYLE===!0){const h=typeof this.width_=="number"?this.width_:this.options_.width,f=typeof this.height_=="number"?this.height_:this.options_.height,g=this.tech_&&this.tech_.el();g&&(h>=0&&(g.width=h),f>=0&&(g.height=f));return}let e,t,i,a;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const l=i.split(":"),u=l[1]/l[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/u:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*u,/^[^a-zA-Z]/.test(this.id())?a="dimensions-"+this.id():a=this.id()+"-dimensions",this.addClass(a),ET(this.styleEl_,`
.${a} {
width: ${e}px;
height: ${t}px;
}
.${a}.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: ${u*100}%;
}
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=qi(e),a=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(vn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let l=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(l=!1);const u={source:t,autoplay:l,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${a}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Cr.names.forEach(f=>{const g=Cr[f];u[g.getterName]=this[g.privateName]}),Object.assign(u,this.options_[i]),Object.assign(u,this.options_[a]),Object.assign(u,this.options_[e.toLowerCase()]),this.tag&&(u.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(u.startTime=this.cache_.currentTime);const h=vn.getTech(e);if(!h)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new h(u),this.tech_.ready(Si(this,this.handleTechReady_),!0),Qg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),yS.forEach(f=>{this.on(this.tech_,f,g=>this[`handleTech${qi(f)}_`](g))}),Object.keys(dg).forEach(f=>{this.on(this.tech_,f,g=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${dg[f]}_`].bind(this),event:g});return}this[`handleTech${dg[f]}_`](g)})}),this.on(this.tech_,"loadstart",f=>this.handleTechLoadStart_(f)),this.on(this.tech_,"sourceset",f=>this.handleTechSourceset_(f)),this.on(this.tech_,"waiting",f=>this.handleTechWaiting_(f)),this.on(this.tech_,"ended",f=>this.handleTechEnded_(f)),this.on(this.tech_,"seeking",f=>this.handleTechSeeking_(f)),this.on(this.tech_,"play",f=>this.handleTechPlay_(f)),this.on(this.tech_,"pause",f=>this.handleTechPause_(f)),this.on(this.tech_,"durationchange",f=>this.handleTechDurationChange_(f)),this.on(this.tech_,"fullscreenchange",(f,g)=>this.handleTechFullscreenChange_(f,g)),this.on(this.tech_,"fullscreenerror",(f,g)=>this.handleTechFullscreenError_(f,g)),this.on(this.tech_,"enterpictureinpicture",f=>this.handleTechEnterPictureInPicture_(f)),this.on(this.tech_,"leavepictureinpicture",f=>this.handleTechLeavePictureInPicture_(f)),this.on(this.tech_,"error",f=>this.handleTechError_(f)),this.on(this.tech_,"posterchange",f=>this.handleTechPosterChange_(f)),this.on(this.tech_,"textdata",f=>this.handleTechTextData_(f)),this.on(this.tech_,"ratechange",f=>this.handleTechRateChange_(f)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&Vg(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Cr.names.forEach(e=>{const t=Cr[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Qg.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Dn.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
See https://github.com/videojs/video.js/issues/2617 for more info.
`),this.tech_}version(){return{"video.js":Hg}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const a=this.muted();this.muted(!0);const l=()=>{this.muted(a)};this.playTerminatedQueue_.push(l);const u=this.play();if(sd(u))return u.catch(h=>{throw l(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${h||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),sd(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!sd(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=xM(this,t)),this.cache_.source=hi({},e,{src:t,type:i});const a=this.cache_.sources.filter(f=>f.src&&f.src===t),l=[],u=this.$$("source"),h=[];for(let f=0;f<u.length;f++){const g=vo(u[f]);l.push(g),g.src&&g.src===t&&h.push(g.src)}h.length&&!a.length?this.cache_.sources=l:a.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=l=>this.updateSourceCaches_(l);const i=this.currentSource().src,a=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(a)&&(!this.lastSource_||this.lastSource_.tech!==a&&this.lastSource_.player!==i)&&(t=()=>{}),t(a),e.src||this.tech_.any(["sourceset","loadstart"],l=>{if(l.type==="sourceset")return;const u=this.techGet_("currentSrc");this.lastSource_.tech=u,this.updateSourceCaches_(u)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Xs(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!xt.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let a=xt[this.fsApi_.fullscreenElement]===i;!a&&i.matches&&(a=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(a)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in pM)return fM(this.middleware_,this.tech_,e,t);if(e in q2)return H2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Dn(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in mM)return hM(this.middleware_,this.tech_,e);if(e in q2)return H2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Dn(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Dn(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Dn(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Xs){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(h0||xr);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=u=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const a=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),a===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(a)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ms(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Ms(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ms(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return LT(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,a)=>{function l(){t.off("fullscreenerror",h),t.off("fullscreenchange",u)}function u(){l(),i()}function h(g,_){l(),a(_)}t.one("fullscreenchange",u),t.one("fullscreenerror",h);const f=t.requestFullscreenHelper_(e);f&&(f.then(l,l),f.then(i,a))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function a(){e.off("fullscreenerror",u),e.off("fullscreenchange",l)}function l(){a(),t()}function u(f,g){a(),i(g)}e.one("fullscreenchange",l),e.one("fullscreenerror",u);const h=e.exitFullscreenHelper_();h&&(h.then(a,a),h.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=xt[this.fsApi_.exitFullscreen]();return e&&Xs(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=xt.documentElement.style.overflow,ss(xt,"keydown",this.boundFullWindowOnEscKey_),xt.documentElement.style.overflow="hidden",dl(xt.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_r(xt,"keydown",this.boundFullWindowOnEscKey_),xt.documentElement.style.overflow=this.docOrigOverflow,f0(xt.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&de.documentPictureInPicture){const e=xt.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(dn("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),de.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(wT(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const a=i.target.querySelector(".video-js");e.parentNode.replaceChild(a,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in xt&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(de.documentPictureInPicture&&de.documentPictureInPicture.window)return de.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in xt)return xt.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(a=>{const l=a.tagName.toLowerCase();if(a.isContentEditable)return!0;const u=["button","checkbox","hidden","radio","reset","submit"];return l==="input"?u.indexOf(a.type)===-1:["textarea"].indexOf(l)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=u=>e.key.toLowerCase()==="f",muteKey:a=u=>e.key.toLowerCase()==="m",playPauseKey:l=u=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const u=nt.getComponent("FullscreenToggle");xt[this.fsApi_.fullscreenEnabled]!==!1&&u.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),nt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):l.call(this,e)&&(e.preventDefault(),e.stopPropagation(),nt.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,a=this.options_.techOrder;i<a.length;i++){const l=a[i];let u=vn.getTech(l);if(u||(u=nt.getComponent(l)),!u){Dn.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`);continue}if(u.isSupported()&&(t=u.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(h=>[h,vn.getTech(h)]).filter(([h,f])=>f?f.isSupported():(Dn.error(`The "${h}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(h,f,g){let _;return h.some(S=>f.some(C=>{if(_=g(S,C),_)return!0})),_};let a;const l=h=>(f,g)=>h(g,f),u=([h,f],g)=>{if(f.canPlaySource(g,this.options_[h.toLowerCase()]))return{source:g,tech:h}};return this.options_.sourceOrder?a=i(e,t,l(u)):a=i(t,e,u),a||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=zT(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),cM(this,i[0],(a,l)=>{if(this.middleware_=l,t||(this.cache_.sources=i),this.updateSourceCaches_(a),this.src_(a)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}dM(l,this.tech_)}),i.length>1){const a=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},l=()=>{this.off("error",a)};this.one("error",a),this.one("playing",l),this.resetRetryOnError_=()=>{this.off("error",a),this.off("playing",l)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?MT(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Xs(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Aa(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:a}=this.controlBar||{},{seekBar:l}=i||{};e&&e.updateContent(),t&&t.updateContent(),a&&a.updateContent(),l&&(l.update(),l.loadProgressBar&&l.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Eo("beforeerror").forEach(t=>{const i=t(this,e);if(!(ea(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Ii(e),this.addClass("vjs-error"),Dn.error(`(CODE:${this.error_.code} ${Ii.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Eo("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const a=Si(this,this.reportUserActivity),l=function(S){(S.screenX!==t||S.screenY!==i)&&(t=S.screenX,i=S.screenY,a())},u=function(){a(),this.clearInterval(e),e=this.setInterval(a,250)},h=function(S){a(),this.clearInterval(e)};this.on("mousedown",u),this.on("mousemove",l),this.on("mouseup",h),this.on("mouseleave",h);const f=this.getChild("controlBar");f&&!xr&&!js&&(f.on("mouseenter",function(S){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),f.on("mouseleave",function(S){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",a),this.on("keyup",a);let g;const _=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(g);const S=this.options_.inactivityTimeout;S<=0||(g=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},S))};this.setInterval(_,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(a=>{a!==t&&a.el_&&!a.hasClass("vjs-hidden")&&(a.hide(),this.audioOnlyCache_.hiddenChildren.push(a))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Aa(this)&&this.trigger("languagechange"))}languages(){return hi(nu.prototype.options_.languages,this.languages_)}toJSON(){const e=hi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let a=t[i];a=hi(a),a.player=void 0,e.tracks[i]=a}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Ou(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<ey.length;i++){const a=ey[i],l=this.breakpoints_[a];if(t<=l){if(e===a)return;e&&this.removeClass(ff[e]),this.addClass(ff[a]),this.breakpoint_=a;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},ZM,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return ff[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=hi(e);const{artist:a,artwork:l,description:u,poster:h,src:f,textTracks:g,title:_}=this.cache_.media;!l&&h&&(this.cache_.media.artwork=[{src:h,type:Bf(h)}]),i&&this.crossOrigin(i),f&&this.src(f),h&&this.poster(h),Array.isArray(g)&&g.forEach(S=>this.addRemoteTextTrack(S,!1)),this.titleBar&&this.titleBar.update({title:_,description:u||a||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),l=>({kind:l.kind,label:l.label,language:l.language,src:l.src})),a={src:t,textTracks:i};return e&&(a.poster=e,a.artwork=[{src:a.poster,type:Bf(a.poster)}]),a}return hi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=vo(e),a=i["data-setup"];if(id(e,"vjs-fill")&&(i.fill=!0),id(e,"vjs-fluid")&&(i.fluid=!0),a!==null)try{Object.assign(i,JSON.parse(a||"{}"))}catch(l){Dn.error("data-setup",l)}if(Object.assign(t,i),e.hasChildNodes()){const l=e.childNodes;for(let u=0,h=l.length;u<h;u++){const f=l[u],g=f.nodeName.toLowerCase();g==="source"?t.sources.push(vo(f)):g==="track"&&t.tracks.push(vo(f))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};Mi.prototype.videoTracks=()=>{};Mi.prototype.audioTracks=()=>{};Mi.prototype.textTracks=()=>{};Mi.prototype.remoteTextTracks=()=>{};Mi.prototype.remoteTextTrackEls=()=>{};Cr.names.forEach(function(n){const e=Cr[n];Mi.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Mi.prototype.crossorigin=Mi.prototype.crossOrigin;Mi.players={};const Fc=de.navigator;Mi.prototype.options_={techOrder:vn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Fc&&(Fc.languages&&Fc.languages[0]||Fc.userLanguage||Fc.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};yS.forEach(function(n){Mi.prototype[`handleTech${qi(n)}_`]=function(){return this.trigger(n)}});nt.registerComponent("Player",Mi);const Pf="plugin",du="activePlugins_",iu={},Ff=n=>iu.hasOwnProperty(n),mf=n=>Ff(n)?iu[n]:void 0,bS=(n,e)=>{n[du]=n[du]||{},n[du][e]=!0},Uf=(n,e,t)=>{const i=(t?"before":"")+"pluginsetup";n.trigger(i,e),n.trigger(i+":"+e.name,e)},JM=function(n,e){const t=function(){Uf(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return bS(this,n),Uf(this,{name:n,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},a_=(n,e)=>(e.prototype.name=n,function(...t){Uf(this,{name:n,plugin:e,instance:null},!0);const i=new e(this,...t);return this[n]=()=>i,Uf(this,i.getEventHash()),i});class Vr{constructor(e){if(this.constructor===Vr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Oy(this),delete this.trigger,DT(this,this.constructor.defaultState),bS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ru(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[du][e]=!1,this.player=this.state=null,t[e]=a_(e,iu[e])}static isBasic(e){const t=typeof e=="string"?mf(e):e;return typeof t=="function"&&!Vr.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Ff(e))Dn.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Mi.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return iu[e]=t,e!==Pf&&(Vr.isBasic(t)?Mi.prototype[e]=JM(e,t):Mi.prototype[e]=a_(e,t)),t}static deregisterPlugin(e){if(e===Pf)throw new Error("Cannot de-register base plugin.");Ff(e)&&(delete iu[e],delete Mi.prototype[e])}static getPlugins(e=Object.keys(iu)){let t;return e.forEach(i=>{const a=mf(i);a&&(t=t||{},t[i]=a)}),t}static getPluginVersion(e){const t=mf(e);return t&&t.VERSION||""}}Vr.getPlugin=mf;Vr.BASE_PLUGIN_NAME=Pf;Vr.registerPlugin(Pf,Vr);Mi.prototype.usingPlugin=function(n){return!!this[du]&&this[du][n]===!0};Mi.prototype.hasPlugin=function(n){return!!Ff(n)};function ej(n,e){let t=!1;return function(...i){return t||Dn.warn(n),t=!0,e.apply(this,i)}}function Rs(n,e,t,i){return ej(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var tj={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const vS=n=>n.indexOf("#")===0?n.slice(1):n;function Fe(n,e,t){let i=Fe.getPlayer(n);if(i)return e&&Dn.warn(`Player "${n}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const a=typeof n=="string"?Co("#"+vS(n)):n;if(!ju(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");const u=("getRootNode"in a?a.getRootNode()instanceof de.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;(!a.ownerDocument.defaultView||!u.contains(a))&&Dn.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(a.parentNode&&a.parentNode.hasAttribute&&a.parentNode.hasAttribute("data-vjs-player")?a.parentNode:a).cloneNode(!0)),Eo("beforesetup").forEach(f=>{const g=f(a,hi(e));if(!ea(g)||Array.isArray(g)){Dn.error("please return an object in beforesetup hooks");return}e=hi(e,g)});const h=nt.getComponent("Player");return i=new h(a,e,t),Eo("setup").forEach(f=>f(i)),i}Fe.hooks_=ka;Fe.hooks=Eo;Fe.hook=L4;Fe.hookOnce=I4;Fe.removeHook=tT;if(de.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Mu()){let n=Co(".vjs-styles-defaults");if(!n){n=kT("vjs-styles-defaults");const e=Co("head");e&&e.insertBefore(n,e.firstChild),ET(n,`
.video-js {
width: 300px;
height: 150px;
}
.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: 56.25%
}
`)}}Kg(1,Fe);Fe.VERSION=Hg;Fe.options=Mi.prototype.options_;Fe.getPlayers=()=>Mi.players;Fe.getPlayer=n=>{const e=Mi.players;let t;if(typeof n=="string"){const i=vS(n),a=e[i];if(a)return a;t=Co("#"+i)}else t=n;if(ju(t)){const{player:i,playerId:a}=t;if(i||e[a])return i||e[a]}};Fe.getAllPlayers=()=>Object.keys(Mi.players).map(n=>Mi.players[n]).filter(Boolean);Fe.players=Mi.players;Fe.getComponent=nt.getComponent;Fe.registerComponent=(n,e)=>(vn.isTech(e)&&Dn.warn(`The ${n} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),nt.registerComponent.call(nt,n,e));Fe.getTech=vn.getTech;Fe.registerTech=vn.registerTech;Fe.use=uM;Object.defineProperty(Fe,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Fe.middleware,"TERMINATOR",{value:If,writeable:!1,enumerable:!0});Fe.browser=cT;Fe.obj=F4;Fe.mergeOptions=Rs(9,"videojs.mergeOptions","videojs.obj.merge",hi);Fe.defineLazyProperty=Rs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",l0);Fe.bind=Rs(9,"videojs.bind","native Function.prototype.bind",Si);Fe.registerPlugin=Vr.registerPlugin;Fe.deregisterPlugin=Vr.deregisterPlugin;Fe.plugin=(n,e)=>(Dn.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Vr.registerPlugin(n,e));Fe.getPlugins=Vr.getPlugins;Fe.getPlugin=Vr.getPlugin;Fe.getPluginVersion=Vr.getPluginVersion;Fe.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Fe.options.languages=hi(Fe.options.languages,{[n]:e}),Fe.options.languages[n]};Fe.log=Dn;Fe.createLogger=nT;Fe.time=eM;Fe.createTimeRange=Rs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ms);Fe.createTimeRanges=Rs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ms);Fe.formatTime=Rs(9,"videojs.formatTime","videojs.time.formatTime",bl);Fe.setFormatTime=Rs(9,"videojs.setFormatTime","videojs.time.setFormatTime",RT);Fe.resetFormatTime=Rs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",OT);Fe.parseUrl=Rs(9,"videojs.parseUrl","videojs.url.parseUrl",Py);Fe.isCrossOrigin=Rs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",x0);Fe.EventTarget=as;Fe.any=Ry;Fe.on=ss;Fe.one=b0;Fe.off=_r;Fe.trigger=Ru;Fe.xhr=Uw;Fe.TrackList=vl;Fe.TextTrack=Td;Fe.TextTrackList=Iy;Fe.AudioTrack=FT;Fe.AudioTrackList=IT;Fe.VideoTrack=UT;Fe.VideoTrackList=BT;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(n=>{Fe[n]=function(){return Dn.warn(`videojs.${n}() is deprecated; use videojs.dom.${n}() instead`),TT[n].apply(null,arguments)}});Fe.computedStyle=Rs(9,"videojs.computedStyle","videojs.dom.computedStyle",Au);Fe.dom=TT;Fe.fn=W4;Fe.num=DM;Fe.str=Z4;Fe.url=oM;Fe.Error=tj;class nj{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class zf extends Fe.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new nj(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,a=this.length;i<a;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const a=this[t];if(a.id===e)return a}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}zf.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const n in zf.prototype.allowedEvents_)zf.prototype["on"+n]=null;var xS="4.1.0";const ij=function(n,e){const t=n.qualityLevels,i=new zf,a=function(){i.dispose(),n.qualityLevels=t,n.off("dispose",a)};return n.on("dispose",a),n.qualityLevels=()=>i,n.qualityLevels.VERSION=xS,i},_S=function(n){return ij(this,Fe.obj.merge({},n))};Fe.registerPlugin("qualityLevels",_S);_S.VERSION=xS;const zr=r0,$f=(n,e)=>e&&e.responseURL&&n!==e.responseURL?e.responseURL:n,xs=n=>Fe.log.debug?Fe.log.debug.bind(Fe,"VHS:",`${n} >`):function(){};function ri(...n){const e=Fe.obj||Fe;return(e.merge||e.mergeOptions).apply(e,n)}function cr(...n){const e=Fe.time||Fe;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function rj(n){if(n.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
`;for(let t=0;t<n.length;t++){const i=n.start(t),a=n.end(t);e+=`${i} --> ${a}. Duration (${a-i})
`}return e}const Ys=1/30,Qs=Ys*3,wS=function(n,e){const t=[];let i;if(n&&n.length)for(i=0;i<n.length;i++)e(n.start(i),n.end(i))&&t.push([n.start(i),n.end(i)]);return cr(t)},ru=function(n,e){return wS(n,function(t,i){return t-Qs<=e&&i+Qs>=e})},Zh=function(n,e){return wS(n,function(t){return t-Ys>=e})},sj=function(n){if(n.length<2)return cr();const e=[];for(let t=1;t<n.length;t++){const i=n.end(t-1),a=n.start(t);e.push([i,a])}return cr(e)},aj=function(n,e){let t=null,i=null,a=0;const l=[],u=[];if(!n||!n.length||!e||!e.length)return cr();let h=n.length;for(;h--;)l.push({time:n.start(h),type:"start"}),l.push({time:n.end(h),type:"end"});for(h=e.length;h--;)l.push({time:e.start(h),type:"start"}),l.push({time:e.end(h),type:"end"});for(l.sort(function(f,g){return f.time-g.time}),h=0;h<l.length;h++)l[h].type==="start"?(a++,a===2&&(t=l[h].time)):l[h].type==="end"&&(a--,a===1&&(i=l[h].time)),t!==null&&i!==null&&(u.push([t,i]),t=null,i=null);return cr(u)},TS=n=>{const e=[];if(!n||!n.length)return"";for(let t=0;t<n.length;t++)e.push(n.start(t)+" => "+n.end(t));return e.join(", ")},oj=function(n,e,t=1){return((n.length?n.end(n.length-1):0)-e)/t},ul=n=>{const e=[];for(let t=0;t<n.length;t++)e.push({start:n.start(t),end:n.end(t)});return e},lj=function(n,e){if(n===e)return!1;if(!n&&e||!e&&n||n.length!==e.length)return!0;for(let t=0;t<n.length;t++)if(n.start(t)!==e.start(t)||n.end(t)!==e.end(t))return!0;return!1},hg=function(n){if(!(!n||!n.length||!n.end))return n.end(n.length-1)},tb=function(n,e){let t=0;if(!n||!n.length)return t;for(let i=0;i<n.length;i++){const a=n.start(i),l=n.end(i);if(!(e>l)){if(e>a&&e<=l){t+=l-e;continue}t+=l-a}}return t},nb=(n,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=n.partTargetDuration)}),t},ty=n=>(n.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(a,l){e.push({duration:a.duration,segmentIndex:i,partIndex:l,part:a,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),SS=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},kS=({preloadSegment:n})=>{if(!n)return;const{parts:e,preloadHints:t}=n;let i=(t||[]).reduce((a,l)=>a+(l.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},ES=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=SS(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},uj=function(n,e){let t=0,i=e-n.mediaSequence,a=n.segments[i];if(a){if(typeof a.start<"u")return{result:a.start,precise:!0};if(typeof a.end<"u")return{result:a.end-a.duration,precise:!0}}for(;i--;){if(a=n.segments[i],typeof a.end<"u")return{result:t+a.end,precise:!0};if(t+=nb(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},cj=function(n,e){let t=0,i,a=e-n.mediaSequence;for(;a<n.segments.length;a++){if(i=n.segments[a],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=nb(n,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},CS=function(n,e,t){if(typeof e>"u"&&(e=n.mediaSequence+n.segments.length),e<n.mediaSequence)return 0;const i=uj(n,e);if(i.precise)return i.result;const a=cj(n,e);return a.precise?a.result:i.result+t},AS=function(n,e,t){if(!n)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(n.totalDuration)return n.totalDuration;if(!n.endList)return de.Infinity}return CS(n,e,t)},ad=function({defaultDuration:n,durationList:e,startIndex:t,endIndex:i}){let a=0;if(t>i&&([t,i]=[i,t]),t<0){for(let l=t;l<Math.min(0,i);l++)a+=n;t=0}for(let l=t;l<i;l++)a+=e[l].duration;return a},NS=function(n,e,t,i){if(!n||!n.segments)return null;if(n.endList)return AS(n);if(e===null)return null;e=e||0;let a=CS(n,n.mediaSequence+n.segments.length,e);return t&&(i=typeof i=="number"?i:ES(null,n),a-=i),Math.max(0,a)},dj=function(n,e,t){const a=e||0;let l=NS(n,e,!0,t);return l===null?cr():(l<a&&(l=a),cr(a,l))},hj=function({playlist:n,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:a,exactManifestTimings:l}){let u=e-a;const h=ty(n);let f=0;for(let g=0;g<h.length;g++){const _=h[g];if(t===_.segmentIndex&&!(typeof i=="number"&&typeof _.partIndex=="number"&&i!==_.partIndex)){f=g;break}}if(u<0){if(f>0)for(let g=f-1;g>=0;g--){const _=h[g];if(u+=_.duration,l){if(u<0)continue}else if(u+Ys<=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a-ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e}}if(f<0){for(let g=f;g<0;g++)if(u-=n.targetDuration,u<0)return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e};f=0}for(let g=f;g<h.length;g++){const _=h[g];u-=_.duration;const S=_.duration>Ys,C=u===0,N=S&&u+Ys>=0;if(!((C||N)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-Ys>=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a+ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:e}},DS=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},ib=function(n){return n.excludeUntil&&n.excludeUntil===1/0},S0=function(n){const e=DS(n);return!n.disabled&&!e},fj=function(n){return n.disabled},mj=function(n){for(let e=0;e<n.segments.length;e++)if(n.segments[e].key)return!0;return!1},MS=function(n,e){return e.attributes&&e.attributes[n]},pj=function(n,e,t,i=0){return MS("BANDWIDTH",t)?(n*t.attributes.BANDWIDTH-i*8)/e:NaN},ny=(n,e)=>{if(n.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(i=>S0(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},rb=(n,e)=>!n&&!e||!n&&e||n&&!e?!1:!!(n===e||n.id&&e.id&&n.id===e.id||n.resolvedUri&&e.resolvedUri&&n.resolvedUri===e.resolvedUri||n.uri&&e.uri&&n.uri===e.uri),o_=function(n,e){const t=n&&n.mediaGroups&&n.mediaGroups.AUDIO||{};let i=!1;for(const a in t){for(const l in t[a])if(i=e(t[a][l]),i)break;if(i)break}return!!i},Cd=n=>{if(!n||!n.playlists||!n.playlists.length)return o_(n,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<n.playlists.length;e++){const t=n.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(l=>Hw(l))||o_(n,l=>rb(t,l))))return!1}return!0};var Hr={liveEdgeDelay:ES,duration:AS,seekable:dj,getMediaInfoForTime:hj,isEnabled:S0,isDisabled:fj,isExcluded:DS,isIncompatible:ib,playlistEnd:NS,isAes:mj,hasAttribute:MS,estimateSegmentRequestTime:pj,isLowestEnabledRendition:ny,isAudioOnly:Cd,playlistMatch:rb,segmentDurationWithParts:nb};const{log:jS}=Fe,hu=(n,e)=>`${n}-${e}`,RS=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,gj=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new iD;n&&u.on("warn",n),e&&u.on("info",e),i.forEach(g=>u.addParser(g)),a.forEach(g=>u.addTagMapper(g)),u.push(t),u.end();const h=u.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(g){h.hasOwnProperty(g)&&delete h[g]}),h.segments&&h.segments.forEach(function(g){["parts","preloadHints"].forEach(function(_){g.hasOwnProperty(_)&&delete g[_]})})),!h.targetDuration){let g=10;h.segments&&h.segments.length&&(g=h.segments.reduce((_,S)=>Math.max(_,S.duration),0)),n&&n({message:`manifest has no targetDuration defaulting to ${g}`}),h.targetDuration=g}const f=SS(h);if(f.length&&!h.partTargetDuration){const g=f.reduce((_,S)=>Math.max(_,S.duration),0);n&&(n({message:`manifest has no partTargetDuration defaulting to ${g}`}),jS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),h.partTargetDuration=g}return h},Bu=(n,e)=>{n.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(n.mediaGroups[t])for(const i in n.mediaGroups[t])for(const a in n.mediaGroups[t][i]){const l=n.mediaGroups[t][i][a];e(l,t,i,a)}})},OS=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},yj=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];OS({playlist:t,id:hu(e,t.uri)}),t.resolvedUri=zr(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||jS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},bj=n=>{Bu(n,e=>{e.uri&&(e.resolvedUri=zr(n.uri,e.uri))})},vj=(n,e)=>{const t=hu(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:de.location.href,resolvedUri:de.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},LS=(n,e,t=RS)=>{n.uri=e;for(let a=0;a<n.playlists.length;a++)if(!n.playlists[a].uri){const l=`placeholder-uri-${a}`;n.playlists[a].uri=l}const i=Cd(n);Bu(n,(a,l,u,h)=>{if(!a.playlists||!a.playlists.length){if(i&&l==="AUDIO"&&!a.uri)for(let f=0;f<n.playlists.length;f++){const g=n.playlists[f];if(g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===u)return}a.playlists=[Xi({},a)]}a.playlists.forEach(function(f,g){const _=t(l,u,h,f),S=hu(g,_);f.uri?f.resolvedUri=f.resolvedUri||zr(n.uri,f.uri):(f.uri=g===0?_:S,f.resolvedUri=f.uri),f.id=f.id||S,f.attributes=f.attributes||{},n.playlists[f.id]=f,n.playlists[f.uri]=f})}),yj(n),bj(n)};class l_{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((a,l)=>(a.set(l.id,l),a),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,a)=>{if(!this.processedDateRanges_.has(a)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const l=e[i.class].push(i);i.classListIndex=l-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const a=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&a[i.classListIndex+1]?i.endTime=a[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,a)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(a)})}}const IS=22,ml=({requestType:n,request:e,error:t,parseFailure:i})=>{const a=e.status<200||e.status>299,l=e.status>=400&&e.status<=499,u={uri:e.uri,requestType:n},h=a&&!l||i;if(t&&l)u.error=Xi({},t),u.errorType=Fe.Error.NetworkRequestFailed;else if(e.aborted)u.errorType=Fe.Error.NetworkRequestAborted;else if(e.timedout)u.errorType=Fe.Error.NetworkRequestTimeout;else if(h){const f=i?Fe.Error.NetworkBodyParserFailed:Fe.Error.NetworkBadStatus;u.errorType=f,u.status=e.status,u.headers=e.headers}return u},xj=xs("CodecUtils"),BS=function(n){const e=n.attributes||{};if(e.CODECS)return Ks(e.CODECS)},PS=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},_j=(n,e)=>{if(!PS(n,e))return!0;const t=e.attributes||{},i=n.mediaGroups.AUDIO[t.AUDIO];for(const a in i)if(!i[a].uri&&!i[a].playlists)return!0;return!1},yd=function(n){const e={};return n.forEach(({mediaType:t,type:i,details:a})=>{e[t]=e[t]||[],e[t].push($w(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){xj(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},u_=function(n){let e=0;return n.audio&&e++,n.video&&e++,e},od=function(n,e){const t=e.attributes||{},i=yd(BS(e)||[]);if(PS(n,e)&&!i.audio&&!_j(n,e)){const a=yd(sD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:wj}=Fe,Tj=(n,e)=>{if(e.endList||!e.serverControl)return n;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let a=e.mediaSequence+e.segments.length;if(i){const l=i.parts||[],u=kS(e)-1;u>-1&&u!==l.length-1&&(t._HLS_part=u),(u>-1||l.length)&&a--}t._HLS_msn=a}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new de.URL(n);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(a){t.hasOwnProperty(a)&&i.searchParams.set(a,t[a])}),n=i.toString()}return n},Sj=(n,e)=>{if(!n)return e;const t=ri(n,e);if(n.preloadHints&&!e.preloadHints&&delete t.preloadHints,n.parts&&!e.parts)delete t.parts;else if(n.parts&&e.parts)for(let i=0;i<e.parts.length;i++)n.parts&&n.parts[i]&&(t.parts[i]=ri(n.parts[i],e.parts[i]));return!n.skipped&&e.skipped&&(t.skipped=!1),n.preload&&!e.preload&&(t.preload=!1),t},kj=(n,e,t)=>{const i=n.slice(),a=e.slice();t=t||0;const l=[];let u;for(let h=0;h<a.length;h++){const f=i[h+t],g=a[h];f?(u=f.map||u,l.push(Sj(f,g))):(u&&!g.map&&(g.map=u),l.push(g))}return l},FS=(n,e)=>{!n.resolvedUri&&n.uri&&(n.resolvedUri=zr(e,n.uri)),n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=zr(e,n.key.uri)),n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=zr(e,n.map.uri)),n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=zr(e,n.map.key.uri)),n.parts&&n.parts.length&&n.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))}),n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))})},US=function(n){const e=n.segments||[],t=n.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=n.targetDuration,t.preload=!0,e.push(t)}return e},zS=(n,e)=>n===e||n.segments&&e.segments&&n.segments.length===e.segments.length&&n.endList===e.endList&&n.mediaSequence===e.mediaSequence&&n.preloadSegment===e.preloadSegment,iy=(n,e,t=zS)=>{const i=ri(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=US(e);const l=ri(a,e);if(l.preloadSegment&&!e.preloadSegment&&delete l.preloadSegment,a.segments){if(e.skip){e.segments=e.segments||[];for(let u=0;u<e.skip.skippedSegments;u++)e.segments.unshift({skipped:!0})}l.segments=kj(a.segments,e.segments,e.mediaSequence-a.mediaSequence)}l.segments.forEach(u=>{FS(u,l.resolvedUri)});for(let u=0;u<i.playlists.length;u++)i.playlists[u].id===e.id&&(i.playlists[u]=l);return i.playlists[e.id]=l,i.playlists[e.uri]=l,Bu(n,(u,h,f,g)=>{if(u.playlists)for(let _=0;_<u.playlists.length;_++)e.id===u.playlists[_].id&&(u.playlists[_]=l)}),i},ry=(n,e)=>{const t=n.segments||[],i=t[t.length-1],a=i&&i.parts&&i.parts[i.parts.length-1],l=a&&a.duration||i&&i.duration;return e&&l?l*1e3:(n.partTargetDuration||n.targetDuration||10)*500},c_=(n,e,t)=>{if(!n)return;const i=[];return n.forEach(a=>{if(!a.attributes)return;const{BANDWIDTH:l,RESOLUTION:u,CODECS:h}=a.attributes;i.push({id:a.id,bandwidth:l,resolution:u,codecs:h})}),{type:e,isLive:t,renditions:i}};class su extends wj{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=xs("PlaylistLoader");const{withCredentials:a=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=a,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const l=t.options_;this.customTagParsers=l&&l.customTagParsers||[],this.customTagMappers=l&&l.customTagMappers||[],this.llhls=l&&l.llhls,this.dateRangesStorage_=new l_,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=zr(this.main.uri,e.uri);this.llhls&&(t=Tj(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,a)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:a,id:l}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[l],status:e.status,message:`HLS playlist request error at URL: ${a}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ml({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=gj({onwarn:({message:a})=>this.logger_(`m3u8-parser warn for ${e}: ${a}`),oninfo:({message:a})=>this.logger_(`m3u8-parser info for ${e}: ${a}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:Fe.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const a=i.attributes||{},{width:l,height:u}=a.RESOLUTION||{};if(l&&u)return!0;const h=BS(i)||[];return!!yd(h).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:a}){this.request=null,this.state="HAVE_METADATA";const l={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:l});const u=t||this.parseManifest_({url:i,manifestString:e});u.lastRequest=Date.now(),OS({playlist:u,uri:i,id:a});const h=iy(this.main,u);this.targetDuration=u.partTargetDuration||u.targetDuration,this.pendingMedia_=null,h?(this.main=h,this.media_=this.main.playlists[a]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ry(this.media(),!!h)),l.parsedPlaylist=c_(this.main.playlists,l.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:l}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),de.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new l_,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(de.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=de.setTimeout(this.media.bind(this,e,!1),h);return}const i=this.state,a=!this.media_||e.id!==this.media_.id,l=this.main.playlists[e.id];if(l&&l.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,a&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ry(e,!0)),!a)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const u={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:u}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(h,f)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=$f(e.resolvedUri,f),h)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:u}),this.haveMetadata({playlistString:f.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=de.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:ml({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=$f(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const a=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=c_(a.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(a)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,LS(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=US(i),i.segments.forEach(a=>{FS(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||de.location.href;this.main=vj(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,a=e.ID;let l=i.playlists.length;for(;l--;){const u=i.playlists[l];if(u.attributes["PATHWAY-ID"]===a){const h=u.resolvedUri,f=u.id;if(t){const g=this.createCloneURI_(u.resolvedUri,e),_=hu(a,g),S=this.createCloneAttributes_(a,u.attributes),C=this.createClonePlaylist_(u,_,e,S);i.playlists[l]=C,i.playlists[_]=C,i.playlists[g]=C}else i.playlists.splice(l,1);delete i.playlists[f],delete i.playlists[h]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,a=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!i.mediaGroups[l]||!i.mediaGroups[l][a])){for(const u in i.mediaGroups[l])if(u===a){for(const h in i.mediaGroups[l][u])i.mediaGroups[l][u][h].playlists.forEach((g,_)=>{const S=i.playlists[g.id],C=S.id,N=S.resolvedUri;delete i.playlists[C],delete i.playlists[N]});delete i.mediaGroups[l][u]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,a=i.playlists.length,l=this.createCloneURI_(t.resolvedUri,e),u=hu(e.ID,l),h=this.createCloneAttributes_(e.ID,t.attributes),f=this.createClonePlaylist_(t,u,e,h);i.playlists[a]=f,i.playlists[u]=f,i.playlists[l]=f,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],a=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!a.mediaGroups[l]||a.mediaGroups[l][t]))for(const u in a.mediaGroups[l]){if(u===i)a.mediaGroups[l][t]={};else continue;for(const h in a.mediaGroups[l][u]){const f=a.mediaGroups[l][u][h];a.mediaGroups[l][t][h]=Xi({},f);const g=a.mediaGroups[l][t][h],_=this.createCloneURI_(f.resolvedUri,e);g.resolvedUri=_,g.uri=_,g.playlists=[],f.playlists.forEach((S,C)=>{const N=a.playlists[S.id],O=RS(l,t,h),E=hu(t,O);if(N&&!a.playlists[E]){const B=this.createClonePlaylist_(N,E,e),H=B.resolvedUri;a.playlists[E]=B,a.playlists[H]=B}g.playlists[C]=this.createClonePlaylist_(S,E,e)})}}})}createClonePlaylist_(e,t,i,a){const l=this.createCloneURI_(e.resolvedUri,i),u={resolvedUri:l,uri:l,id:t};return e.segments&&(u.segments=[]),a&&(u.attributes=a),ri(e,u)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const a=t["URI-REPLACEMENT"].PARAMS;for(const l of Object.keys(a))i.searchParams.set(l,a[l]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(a=>{t[a]&&(i[a]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const a=e.contentProtection[i].attributes.keyId;t.add(a.toLowerCase())}return t}}const sy=function(n,e,t,i){const a=n.responseType==="arraybuffer"?n.response:n.responseText;!e&&a&&(n.responseTime=Date.now(),n.roundTripTime=n.responseTime-n.requestTime,n.bytesReceived=a.byteLength||a.length,n.bandwidth||(n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3))),t.headers&&(n.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(n.timedout=!0),!e&&!n.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(n&&(a||n.responseText)))),i(e,n)},Ej=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},Cj=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},$S=function(){const n=function e(t,i){t=ri({timeout:45e3},t);const a=e.beforeRequest||Fe.Vhs.xhr.beforeRequest,l=e._requestCallbackSet||Fe.Vhs.xhr._requestCallbackSet||new Set,u=e._responseCallbackSet||Fe.Vhs.xhr._responseCallbackSet;a&&typeof a=="function"&&(Fe.log.warn("beforeRequest is deprecated, use onRequest instead."),l.add(a));const h=Fe.Vhs.xhr.original===!0?Fe.xhr:Fe.Vhs.xhr,f=Ej(l,t);l.delete(a);const g=h(f||t,function(S,C){return Cj(u,g,S,C),sy(g,S,C,i)}),_=g.abort;return g.abort=function(){return g.aborted=!0,_.apply(g,arguments)},g.uri=t.uri,g.requestType=t.requestType,g.requestTime=Date.now(),g};return n.original=!0,n},Aj=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=de.BigInt(n.offset)+de.BigInt(n.length)-de.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},ay=function(n){const e={};return n.byterange&&(e.Range=Aj(n.byterange)),e},Nj=function(n,e){return n.start(e)+"-"+n.end(e)},Dj=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Mj=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},HS=function(n){const e={};return Object.keys(n).forEach(t=>{const i=n[t];Vw(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Hf=function(n){const e=n.byterange||{length:1/0,offset:0};return[e.length,e.offset,n.resolvedUri].join(",")},qS=function(n){return n.resolvedUri},VS=n=>{const e=Array.prototype.slice.call(n),t=16;let i="",a,l;for(let u=0;u<e.length/t;u++)a=e.slice(u*t,u*t+t).map(Dj).join(""),l=e.slice(u*t,u*t+t).map(Mj).join(""),i+=a+" "+l+`
`;return i},jj=({bytes:n})=>VS(n),Rj=n=>{let e="",t;for(t=0;t<n.length;t++)e+=Nj(n,t)+" ";return e};var Oj=Object.freeze({__proto__:null,createTransferableMessage:HS,initSegmentId:Hf,segmentKeyId:qS,hexDump:VS,tagDump:jj,textRanges:Rj});const GS=.25,Lj=(n,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,a=e.videoTimingInfo.transmuxedPresentationStart+t,l=n-a;return new Date(e.dateTimeObject.getTime()+l*1e3)},Ij=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,Bj=(n,e)=>{let t;try{t=new Date(n)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let f=0;f<e.segments.length-1;f++){i=e.segments[f];const g=new Date(e.segments[f+1].dateTimeObject);if(t<g)break}const a=e.segments[e.segments.length-1],l=a.dateTimeObject,u=a.videoTimingInfo?Ij(a.videoTimingInfo):a.duration+a.duration*GS,h=new Date(l.getTime()+u*1e3);return t>h?null:(t>new Date(l)&&(i=a),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Hr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Pj=(n,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let l=0;l<e.segments.length&&(i=e.segments[l],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(n<=t));l++);const a=e.segments[e.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<n)return null;if(n>t){if(n>t+a.duration*GS)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Fj=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},Uj=n=>{if(!n.segments||n.segments.length===0)return!1;for(let e=0;e<n.segments.length;e++)if(!n.segments[e].dateTimeObject)return!1;return!0},zj=({playlist:n,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!n||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=Pj(e,n);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const a={mediaSeconds:e},l=Lj(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},KS=({programTime:n,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:a=!0,tech:l,callback:u})=>{if(!u)throw new Error("seekToProgramTime: callback must be provided");if(typeof n>"u"||!e||!i)return u({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!l.hasStarted_)return u({message:"player must be playing a live stream to start buffering"});if(!Uj(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=Bj(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=Fj(f.dateTimeObject,n);if(h.type==="estimate"){if(t===0)return u({message:`${n} is not buffered yet. Try again`});i(h.estimatedStart+g),l.one("seeked",()=>{KS({programTime:n,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:a,tech:l,callback:u})});return}const _=f.start+g,S=()=>u(null,l.currentTime());l.one("seeked",S),a&&l.pause(),i(_)},fg=(n,e)=>{if(n.readyState===4)return e()},$j=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,C,N,O){return C.abort(),u=!0,t(S,C,N,O)},f=function(S,C){if(u)return;if(S)return S.metadata=ml({requestType:i,request:C,error:S}),h(S,C,"",a);const N=C.responseText.substring(a&&a.byteLength||0,C.responseText.length);if(a=pD(a,Gw(N,!0)),l=l||Kc(a),a.length<10||l&&a.length<l+2)return fg(C,()=>h(S,C,"",a));const O=Ay(a);return O==="ts"&&a.length<188?fg(C,()=>h(S,C,"",a)):!O&&a.length<376?fg(C,()=>h(S,C,"",a)):h(null,C,O,a)},_=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:C,loaded:N}){return sy(S,null,{statusCode:S.status},f)})}},function(S,C){return sy(_,S,C,f)});return _},{EventTarget:Hj}=Fe,d_=function(n,e){if(!zS(n,e)||n.sidx&&e.sidx&&(n.sidx.offset!==e.sidx.offset||n.sidx.length!==e.sidx.length))return!1;if(!n.sidx&&e.sidx||n.sidx&&!e.sidx||n.segments&&!e.segments||!n.segments&&e.segments)return!1;if(!n.segments&&!e.segments)return!0;for(let t=0;t<n.segments.length;t++){const i=n.segments[t],a=e.segments[t];if(i.uri!==a.uri)return!1;if(!i.byterange&&!a.byterange)continue;const l=i.byterange,u=a.byterange;if(l&&!u||!l&&u||l.offset!==u.offset||l.length!==u.length)return!1}return!0},qj=(n,e,t,i)=>{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},Vj=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=f4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return LS(l,e,qj),l},Gj=(n,e)=>{Bu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},Kj=(n,e,t)=>{let i=!0,a=ri(n,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let l=0;l<e.playlists.length;l++){const u=e.playlists[l];if(u.sidx){const f=a0(u.sidx);t&&t[f]&&t[f].sidx&&ky(u,t[f].sidx,u.sidx.resolvedUri)}const h=iy(a,u,d_);h&&(a=h,i=!1)}return Bu(e,(l,u,h,f)=>{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,_=iy(a,l.playlists[0],d_);_&&(a=_,f in a.mediaGroups[u][h]||(a.mediaGroups[u][h][f]=l),a.mediaGroups[u][h][f].playlists[0]=a.playlists[g],i=!1)}}),Gj(a,e),e.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(i=!1),i?null:a},Wj=(n,e)=>(!n.map&&!e.map||!!(n.map&&e.map&&n.map.byterange.offset===e.map.byterange.offset&&n.map.byterange.length===e.map.byterange.length))&&n.uri===e.uri&&n.byterange.offset===e.byterange.offset&&n.byterange.length===e.byterange.length,h_=(n,e)=>{const t={};for(const i in n){const l=n[i].sidx;if(l){const u=a0(l);if(!e[u])break;const h=e[u].sidxInfo;Wj(h,l)&&(t[u]=e[u])}}return t},Xj=(n,e)=>{let i=h_(n.playlists,e);return Bu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ri(i,h_(f,e))}}),i};class oy extends Hj{constructor(e,t,i={},a){super(),this.isPaused_=!0,this.mainPlaylistLoader_=a||this,a||(this.isMain_=!0);const{withCredentials:l=!1}=i;if(this.vhs_=t,this.withCredentials=l,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=xs("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const a=e.sidx&&a0(e.sidx);if(!e.sidx||!a||this.mainPlaylistLoader_.sidxMapping_[a]){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>i(!1),0);return}const l=$f(e.sidx.resolvedUri),u=(f,g)=>{if(this.requestErrored_(f,g,t))return;const _=this.mainPlaylistLoader_.sidxMapping_,{requestType:S}=g;let C;try{C=b4(an(g.response).subarray(8))}catch(N){N.metadata=ml({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(N,g,t);return}return _[a]={sidxInfo:e.sidx,sidx:C},ky(e,C,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=$j(l,this.vhs_.xhr,(f,g,_,S)=>{if(f)return u(f,g);if(!_||_!=="mp4"){const O=_||"unknown";return u({status:g.status,message:`Unsupported ${O} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:C,length:N}=e.sidx.byterange;if(S.length>=N+C)return u(f,{response:S.subarray(C,C+N),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:ay({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},de.clearTimeout(this.minimumUpdatePeriodTimeout_),de.clearTimeout(this.mediaRequest_),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,a=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(de.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,a)=>{if(i){const{requestType:u}=a;i.metadata=ml({requestType:u,request:a,error:i})}if(this.requestErrored_(i,a)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const l=a.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=a.responseText,a.responseHeaders&&a.responseHeaders.date?this.mainLoaded_=Date.parse(a.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=$f(this.mainPlaylistLoader_.srcUrl,a),l){this.handleMain_(),this.syncClientServerClock_(()=>e(a,l));return}return e(a,l)})}syncClientServerClock_(e){const t=m4(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:zr(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,a)=>{if(!this.request)return;if(i){const{requestType:u}=a;return this.error.metadata=ml({requestType:u,request:a,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let l;t.method==="HEAD"?!a.responseHeaders||!a.responseHeaders.date?l=this.mainLoaded_:l=Date.parse(a.responseHeaders.date):l=Date.parse(a.responseText),this.mainPlaylistLoader_.clientOffset_=l-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=Vj({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(l){this.error=l,this.error.metadata={errorType:Fe.Error.StreamingDashManifestParserError,error:l},this.trigger("error")}e&&(i=Kj(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const a=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(a&&a!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=a),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:l,endList:u}=i,h=[];i.playlists.forEach(g=>{h.push({id:g.id,bandwidth:g.attributes.BANDWIDTH,resolution:g.attributes.RESOLUTION,codecs:g.attributes.CODECS})});const f={duration:l,isLive:!u,renditions:h};t.parsedManifest=f,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(de.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=de.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=Xj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const a=()=>{this.media().endList||(this.mediaUpdateTimeout=de.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},ry(this.media(),!!i)))};a()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const a=e.contentProtection[i].attributes["cenc:default_KID"];a&&t.add(a.replace(/-/g,"").toLowerCase())}return t}}}var lr={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Yj=n=>{const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e.buffer},WS=function(n){return n.on=n.addEventListener,n.off=n.removeEventListener,n},Qj=function(n){try{return URL.createObjectURL(new Blob([n],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(n),URL.createObjectURL(t.getBlob())}},XS=function(n){return function(){const e=Qj(n),t=WS(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},YS=function(n){return`var browserWorkerPolyFill = ${WS.toString()};
browserWorkerPolyFill(self);
`+n},QS=function(n){return n.toString().replace(/^function.+?{/,"").slice(0,-1)},Zj=YS(QS(function(){var n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var m={};this.on=function(v,w){m[v]||(m[v]=[]),m[v]=m[v].concat(w)},this.off=function(v,w){var x;return m[v]?(x=m[v].indexOf(w),m[v]=m[v].slice(),m[v].splice(x,1),x>-1):!1},this.trigger=function(v){var w,x,T,A;if(w=m[v],!!w)if(arguments.length===2)for(T=w.length,x=0;x<T;++x)w[x].call(this,arguments[1]);else{for(A=[],x=arguments.length,x=1;x<arguments.length;++x)A.push(arguments[x]);for(T=w.length,x=0;x<T;++x)w[x].apply(this,A)}},this.dispose=function(){m={}}}};e.prototype.pipe=function(m){return this.on("data",function(v){m.push(v)}),this.on("done",function(v){m.flush(v)}),this.on("partialdone",function(v){m.partialFlush(v)}),this.on("endedtimeline",function(v){m.endTimeline(v)}),this.on("reset",function(v){m.reset(v)}),m},e.prototype.push=function(m){this.trigger("data",m)},e.prototype.flush=function(m){this.trigger("done",m)},e.prototype.partialFlush=function(m){this.trigger("partialdone",m)},e.prototype.endTimeline=function(m){this.trigger("endedtimeline",m)},e.prototype.reset=function(m){this.trigger("reset",m)};var t=e,i=Math.pow(2,32),a=function(m){var v=new DataView(m.buffer,m.byteOffset,m.byteLength),w;return v.getBigUint64?(w=v.getBigUint64(0),w<Number.MAX_SAFE_INTEGER?Number(w):w):v.getUint32(0)*i+v.getUint32(4)},l={getUint64:a,MAX_UINT32:i},u=l.MAX_UINT32,h,f,g,_,S,C,N,O,E,B,H,Y,U,re,W,X,R,le,k,j,Z,V,ne,me,ue,q,P,Q,te,ge,L,xe,Te,ye,be,mt;(function(){var m;if(ne={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(m in ne)ne.hasOwnProperty(m)&&(ne[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);me=new Uint8Array([105,115,111,109]),q=new Uint8Array([97,118,99,49]),ue=new Uint8Array([0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Q=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),te={video:P,audio:Q},xe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),Te=new Uint8Array([0,0,0,0,0,0,0,0]),ye=Te,be=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),mt=Te,ge=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(m){var v=[],w=0,x,T,A;for(x=1;x<arguments.length;x++)v.push(arguments[x]);for(x=v.length;x--;)w+=v[x].byteLength;for(T=new Uint8Array(w+8),A=new DataView(T.buffer,T.byteOffset,T.byteLength),A.setUint32(0,T.byteLength),T.set(m,4),x=0,w=8;x<v.length;x++)T.set(v[x],w),w+=v[x].byteLength;return T},f=function(){return h(ne.dinf,h(ne.dref,xe))},g=function(m){return h(ne.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,m.audioobjecttype<<3|m.samplingfrequencyindex>>>1,m.samplingfrequencyindex<<7|m.channelcount<<3,6,1,2]))},_=function(){return h(ne.ftyp,me,ue,me,q)},X=function(m){return h(ne.hdlr,te[m])},S=function(m){return h(ne.mdat,m)},W=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,m.duration>>>24&255,m.duration>>>16&255,m.duration>>>8&255,m.duration&255,85,196,0,0]);return m.samplerate&&(v[12]=m.samplerate>>>24&255,v[13]=m.samplerate>>>16&255,v[14]=m.samplerate>>>8&255,v[15]=m.samplerate&255),h(ne.mdhd,v)},re=function(m){return h(ne.mdia,W(m),X(m.type),N(m))},C=function(m){return h(ne.mfhd,new Uint8Array([0,0,0,0,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255]))},N=function(m){return h(ne.minf,m.type==="video"?h(ne.vmhd,ge):h(ne.smhd,L),f(),le(m))},O=function(m,v){for(var w=[],x=v.length;x--;)w[x]=j(v[x]);return h.apply(null,[ne.moof,C(m)].concat(w))},E=function(m){for(var v=m.length,w=[];v--;)w[v]=Y(m[v]);return h.apply(null,[ne.moov,H(4294967295)].concat(w).concat(B(m)))},B=function(m){for(var v=m.length,w=[];v--;)w[v]=Z(m[v]);return h.apply(null,[ne.mvex].concat(w))},H=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return h(ne.mvhd,v)},R=function(m){var v=m.samples||[],w=new Uint8Array(4+v.length),x,T;for(T=0;T<v.length;T++)x=v[T].flags,w[T+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return h(ne.sdtp,w)},le=function(m){return h(ne.stbl,k(m),h(ne.stts,mt),h(ne.stsc,ye),h(ne.stsz,be),h(ne.stco,Te))},(function(){var m,v;k=function(w){return h(ne.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),w.type==="video"?m(w):v(w))},m=function(w){var x=w.sps||[],T=w.pps||[],A=[],K=[],J,oe;for(J=0;J<x.length;J++)A.push((x[J].byteLength&65280)>>>8),A.push(x[J].byteLength&255),A=A.concat(Array.prototype.slice.call(x[J]));for(J=0;J<T.length;J++)K.push((T[J].byteLength&65280)>>>8),K.push(T[J].byteLength&255),K=K.concat(Array.prototype.slice.call(T[J]));if(oe=[ne.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(w.width&65280)>>8,w.width&255,(w.height&65280)>>8,w.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h(ne.avcC,new Uint8Array([1,w.profileIdc,w.profileCompatibility,w.levelIdc,255].concat([x.length],A,[T.length],K))),h(ne.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],w.sarRatio){var fe=w.sarRatio[0],Ee=w.sarRatio[1];oe.push(h(ne.pasp,new Uint8Array([(fe&4278190080)>>24,(fe&16711680)>>16,(fe&65280)>>8,fe&255,(Ee&4278190080)>>24,(Ee&16711680)>>16,(Ee&65280)>>8,Ee&255])))}return h.apply(null,oe)},v=function(w){return h(ne.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(w.channelcount&65280)>>8,w.channelcount&255,(w.samplesize&65280)>>8,w.samplesize&255,0,0,0,0,(w.samplerate&65280)>>8,w.samplerate&255,0,0]),g(w))}})(),U=function(m){var v=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,0,(m.duration&4278190080)>>24,(m.duration&16711680)>>16,(m.duration&65280)>>8,m.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(m.width&65280)>>8,m.width&255,0,0,(m.height&65280)>>8,m.height&255,0,0]);return h(ne.tkhd,v)},j=function(m){var v,w,x,T,A,K,J;return v=h(ne.tfhd,new Uint8Array([0,0,0,58,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),K=Math.floor(m.baseMediaDecodeTime/u),J=Math.floor(m.baseMediaDecodeTime%u),w=h(ne.tfdt,new Uint8Array([1,0,0,0,K>>>24&255,K>>>16&255,K>>>8&255,K&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255])),A=92,m.type==="audio"?(x=V(m,A),h(ne.traf,v,w,x)):(T=R(m),x=V(m,T.length+A),h(ne.traf,v,w,x,T))},Y=function(m){return m.duration=m.duration||4294967295,h(ne.trak,U(m),re(m))},Z=function(m){var v=new Uint8Array([0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return m.type!=="video"&&(v[v.length-1]=0),h(ne.trex,v)},(function(){var m,v,w;w=function(x,T){var A=0,K=0,J=0,oe=0;return x.length&&(x[0].duration!==void 0&&(A=1),x[0].size!==void 0&&(K=2),x[0].flags!==void 0&&(J=4),x[0].compositionTimeOffset!==void 0&&(oe=8)),[0,0,A|K|J|oe,1,(x.length&4278190080)>>>24,(x.length&16711680)>>>16,(x.length&65280)>>>8,x.length&255,(T&4278190080)>>>24,(T&16711680)>>>16,(T&65280)>>>8,T&255]},v=function(x,T){var A,K,J,oe,fe,Ee;for(oe=x.samples||[],T+=20+16*oe.length,J=w(oe,T),K=new Uint8Array(J.length+oe.length*16),K.set(J),A=J.length,Ee=0;Ee<oe.length;Ee++)fe=oe[Ee],K[A++]=(fe.duration&4278190080)>>>24,K[A++]=(fe.duration&16711680)>>>16,K[A++]=(fe.duration&65280)>>>8,K[A++]=fe.duration&255,K[A++]=(fe.size&4278190080)>>>24,K[A++]=(fe.size&16711680)>>>16,K[A++]=(fe.size&65280)>>>8,K[A++]=fe.size&255,K[A++]=fe.flags.isLeading<<2|fe.flags.dependsOn,K[A++]=fe.flags.isDependedOn<<6|fe.flags.hasRedundancy<<4|fe.flags.paddingValue<<1|fe.flags.isNonSyncSample,K[A++]=fe.flags.degradationPriority&61440,K[A++]=fe.flags.degradationPriority&15,K[A++]=(fe.compositionTimeOffset&4278190080)>>>24,K[A++]=(fe.compositionTimeOffset&16711680)>>>16,K[A++]=(fe.compositionTimeOffset&65280)>>>8,K[A++]=fe.compositionTimeOffset&255;return h(ne.trun,K)},m=function(x,T){var A,K,J,oe,fe,Ee;for(oe=x.samples||[],T+=20+8*oe.length,J=w(oe,T),A=new Uint8Array(J.length+oe.length*8),A.set(J),K=J.length,Ee=0;Ee<oe.length;Ee++)fe=oe[Ee],A[K++]=(fe.duration&4278190080)>>>24,A[K++]=(fe.duration&16711680)>>>16,A[K++]=(fe.duration&65280)>>>8,A[K++]=fe.duration&255,A[K++]=(fe.size&4278190080)>>>24,A[K++]=(fe.size&16711680)>>>16,A[K++]=(fe.size&65280)>>>8,A[K++]=fe.size&255;return h(ne.trun,A)},V=function(x,T){return x.type==="audio"?m(x,T):v(x,T)}})();var Ke={ftyp:_,mdat:S,moof:O,moov:E,initSegment:function(m){var v=_(),w=E(m),x;return x=new Uint8Array(v.byteLength+w.byteLength),x.set(v),x.set(w,v.byteLength),x}},we=function(m){var v,w,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v<m.length;v++)w=m[v],w.nalUnitType==="access_unit_delimiter_rbsp"?(x.length&&(x.duration=w.dts-x.dts,T.byteLength+=x.byteLength,T.nalCount+=x.length,T.duration+=x.duration,T.push(x)),x=[w],x.byteLength=w.data.byteLength,x.pts=w.pts,x.dts=w.dts):(w.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(x.keyFrame=!0),x.duration=w.dts-x.dts,x.byteLength+=w.data.byteLength,x.push(w));return T.length&&(!x.duration||x.duration<=0)&&(x.duration=T[T.length-1].duration),T.byteLength+=x.byteLength,T.nalCount+=x.length,T.duration+=x.duration,T.push(x),T},Re=function(m){var v,w,x=[],T=[];for(x.byteLength=0,x.nalCount=0,x.duration=0,x.pts=m[0].pts,x.dts=m[0].dts,T.byteLength=0,T.nalCount=0,T.duration=0,T.pts=m[0].pts,T.dts=m[0].dts,v=0;v<m.length;v++)w=m[v],w.keyFrame?(x.length&&(T.push(x),T.byteLength+=x.byteLength,T.nalCount+=x.nalCount,T.duration+=x.duration),x=[w],x.nalCount=w.length,x.byteLength=w.byteLength,x.pts=w.pts,x.dts=w.dts,x.duration=w.duration):(x.duration+=w.duration,x.nalCount+=w.length,x.byteLength+=w.byteLength,x.push(w));return T.length&&x.duration<=0&&(x.duration=T[T.length-1].duration),T.byteLength+=x.byteLength,T.nalCount+=x.nalCount,T.duration+=x.duration,T.push(x),T},ct=function(m){var v;return!m[0][0].keyFrame&&m.length>1&&(v=m.shift(),m.byteLength-=v.byteLength,m.nalCount-=v.nalCount,m[0][0].dts=v.dts,m[0][0].pts=v.pts,m[0][0].duration+=v.duration),m},Oe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},je=function(m,v){var w=Oe();return w.dataOffset=v,w.compositionTimeOffset=m.pts-m.dts,w.duration=m.duration,w.size=4*m.length,w.size+=m.byteLength,m.keyFrame&&(w.flags.dependsOn=2,w.flags.isNonSyncSample=0),w},Ue=function(m,v){var w,x,T,A,K,J=v||0,oe=[];for(w=0;w<m.length;w++)for(A=m[w],x=0;x<A.length;x++)K=A[x],T=je(K,J),J+=T.size,oe.push(T);return oe},ze=function(m){var v,w,x,T,A,K,J=0,oe=m.byteLength,fe=m.nalCount,Ee=oe+4*fe,Xe=new Uint8Array(Ee),Et=new DataView(Xe.buffer);for(v=0;v<m.length;v++)for(T=m[v],w=0;w<T.length;w++)for(A=T[w],x=0;x<A.length;x++)K=A[x],Et.setUint32(J,K.data.byteLength),J+=4,Xe.set(K.data,J),J+=K.data.byteLength;return Xe},gt=function(m,v){var w,x=v||0,T=[];return w=je(m,x),T.push(w),T},st=function(m){var v,w,x=0,T=m.byteLength,A=m.length,K=T+4*A,J=new Uint8Array(K),oe=new DataView(J.buffer);for(v=0;v<m.length;v++)w=m[v],oe.setUint32(x,w.data.byteLength),x+=4,J.set(w.data,x),x+=w.data.byteLength;return J},bt={groupNalsIntoFrames:we,groupFramesIntoGops:Re,extendFirstKeyFrame:ct,generateSampleTable:Ue,concatenateNalData:ze,generateSampleTableForFrame:gt,concatenateNalDataForFrame:st},Qe=[33,16,5,32,164,27],Ye=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],tt=function(m){for(var v=[];m--;)v.push(0);return v},$e=function(m){return Object.keys(m).reduce(function(v,w){return v[w]=new Uint8Array(m[w].reduce(function(x,T){return x.concat(T)},[])),v},{})},ht,At=function(){if(!ht){var m={96e3:[Qe,[227,64],tt(154),[56]],88200:[Qe,[231],tt(170),[56]],64e3:[Qe,[248,192],tt(240),[56]],48e3:[Qe,[255,192],tt(268),[55,148,128],tt(54),[112]],44100:[Qe,[255,192],tt(268),[55,163,128],tt(84),[112]],32e3:[Qe,[255,192],tt(268),[55,234],tt(226),[112]],24e3:[Qe,[255,192],tt(268),[55,255,128],tt(268),[111,112],tt(126),[224]],16e3:[Qe,[255,192],tt(268),[55,255,128],tt(268),[111,255],tt(269),[223,108],tt(195),[1,192]],12e3:[Ye,tt(268),[3,127,248],tt(268),[6,255,240],tt(268),[13,255,224],tt(268),[27,253,128],tt(259),[56]],11025:[Ye,tt(268),[3,127,248],tt(268),[6,255,240],tt(268),[13,255,224],tt(268),[27,255,192],tt(268),[55,175,128],tt(108),[112]],8e3:[Ye,tt(268),[3,121,16],tt(47),[7]]};ht=$e(m)}return ht},he=9e4,Ie,Le,ke,Pe,et,kt,Lt;Ie=function(m){return m*he},Le=function(m,v){return m*v},ke=function(m){return m/he},Pe=function(m,v){return m/v},et=function(m,v){return Ie(Pe(m,v))},kt=function(m,v){return Le(ke(m),v)},Lt=function(m,v,w){return ke(w?m:m-v)};var pt={ONE_SECOND_IN_TS:he,secondsToVideoTs:Ie,secondsToAudioTs:Le,videoTsToSeconds:ke,audioTsToSeconds:Pe,audioTsToVideoTs:et,videoTsToAudioTs:kt,metadataTsToSeconds:Lt},Zt=At,qt=pt,Gt=function(m){var v,w,x=0;for(v=0;v<m.length;v++)w=m[v],x+=w.data.byteLength;return x},wt=function(m,v,w,x){var T,A=0,K=0,J=0,oe=0,fe,Ee,Xe;if(v.length&&(T=qt.audioTsToVideoTs(m.baseMediaDecodeTime,m.samplerate),A=Math.ceil(qt.ONE_SECOND_IN_TS/(m.samplerate/1024)),w&&x&&(K=T-Math.max(w,x),J=Math.floor(K/A),oe=J*A),!(J<1||oe>qt.ONE_SECOND_IN_TS/2))){for(fe=Zt()[m.samplerate],fe||(fe=v[0].data),Ee=0;Ee<J;Ee++)Xe=v[0],v.splice(0,0,{data:fe,dts:Xe.dts-A,pts:Xe.pts-A});return m.baseMediaDecodeTime-=Math.floor(qt.videoTsToAudioTs(oe,m.samplerate)),oe}},lt=function(m,v,w){return v.minSegmentDts>=w?m:(v.minSegmentDts=1/0,m.filter(function(x){return x.dts>=w?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},Yt=function(m){var v,w,x=[];for(v=0;v<m.length;v++)w=m[v],x.push({size:w.data.byteLength,duration:1024});return x},kn=function(m){var v,w,x=0,T=new Uint8Array(Gt(m));for(v=0;v<m.length;v++)w=m[v],T.set(w.data,x),x+=w.data.byteLength;return T},pn={prefixWithSilence:wt,trimAdtsFramesByEarliestDts:lt,generateSampleTable:Yt,concatenateFrameData:kn},xn=pt.ONE_SECOND_IN_TS,rt=function(m,v){typeof v.pts=="number"&&(m.timelineStartInfo.pts===void 0&&(m.timelineStartInfo.pts=v.pts),m.minSegmentPts===void 0?m.minSegmentPts=v.pts:m.minSegmentPts=Math.min(m.minSegmentPts,v.pts),m.maxSegmentPts===void 0?m.maxSegmentPts=v.pts:m.maxSegmentPts=Math.max(m.maxSegmentPts,v.pts)),typeof v.dts=="number"&&(m.timelineStartInfo.dts===void 0&&(m.timelineStartInfo.dts=v.dts),m.minSegmentDts===void 0?m.minSegmentDts=v.dts:m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.maxSegmentDts===void 0?m.maxSegmentDts=v.dts:m.maxSegmentDts=Math.max(m.maxSegmentDts,v.dts))},M=function(m){delete m.minSegmentDts,delete m.maxSegmentDts,delete m.minSegmentPts,delete m.maxSegmentPts},F=function(m,v){var w,x,T=m.minSegmentDts;return v||(T-=m.timelineStartInfo.dts),w=m.timelineStartInfo.baseMediaDecodeTime,w+=T,w=Math.max(0,w),m.type==="audio"&&(x=m.samplerate/xn,w*=x,w=Math.floor(w)),w},ie={clearDtsInfo:M,calculateTrackBaseMediaDecodeTime:F,collectDtsInfo:rt},De=4,Ve=128,yt=function(m){for(var v=0,w={payloadType:-1,payloadSize:0},x=0,T=0;v<m.byteLength&&m[v]!==Ve;){for(;m[v]===255;)x+=255,v++;for(x+=m[v++];m[v]===255;)T+=255,v++;if(T+=m[v++],!w.payload&&x===De){var A=String.fromCharCode(m[v+3],m[v+4],m[v+5],m[v+6]);if(A==="GA94"){w.payloadType=x,w.payloadSize=T,w.payload=m.subarray(v,v+T);break}else w.payload=void 0}v+=T,x=0,T=0}return w},Vt=function(m){return m.payload[0]!==181||(m.payload[1]<<8|m.payload[2])!==49||String.fromCharCode(m.payload[3],m.payload[4],m.payload[5],m.payload[6])!=="GA94"||m.payload[7]!==3?null:m.payload.subarray(8,m.payload.length-1)},Jt=function(m,v){var w=[],x,T,A,K;if(!(v[0]&64))return w;for(T=v[0]&31,x=0;x<T;x++)A=x*3,K={type:v[A+2]&3,pts:m},v[A+2]&4&&(K.ccData=v[A+3]<<8|v[A+4],w.push(K));return w},gn=function(m){for(var v=m.byteLength,w=[],x=1,T,A;x<v-2;)m[x]===0&&m[x+1]===0&&m[x+2]===3?(w.push(x+2),x+=2):x++;if(w.length===0)return m;T=v-w.length,A=new Uint8Array(T);var K=0;for(x=0;x<T;K++,x++)K===w[0]&&(K++,w.shift()),A[x]=m[K];return A},ln={parseSei:yt,parseUserData:Vt,parseCaptionPackets:Jt,discardEmulationPreventionBytes:gn,USER_DATA_REGISTERED_ITU_T_T35:De},_n=t,En=ln,Ut=function(m){m=m||{},Ut.prototype.init.call(this),this.parse708captions_=typeof m.parse708captions=="boolean"?m.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Wt(0,0),new Wt(0,1),new Wt(1,0),new Wt(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ot({captionServices:m.captionServices})),this.reset(),this.ccStreams_.forEach(function(v){v.on("data",this.trigger.bind(this,"data")),v.on("partialdone",this.trigger.bind(this,"partialdone")),v.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Ut.prototype=new _n,Ut.prototype.push=function(m){var v,w,x;if(m.nalUnitType==="sei_rbsp"&&(v=En.parseSei(m.escapedRBSP),!!v.payload&&v.payloadType===En.USER_DATA_REGISTERED_ITU_T_T35&&(w=En.parseUserData(v),!!w))){if(m.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(m.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}x=En.parseCaptionPackets(m.pts,w),this.captionPackets_=this.captionPackets_.concat(x),this.latestDts_!==m.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=m.dts}},Ut.prototype.flushCCStreams=function(m){this.ccStreams_.forEach(function(v){return m==="flush"?v.flush():v.partialFlush()},this)},Ut.prototype.flushStream=function(m){if(!this.captionPackets_.length){this.flushCCStreams(m);return}this.captionPackets_.forEach(function(v,w){v.presortIndex=w}),this.captionPackets_.sort(function(v,w){return v.pts===w.pts?v.presortIndex-w.presortIndex:v.pts-w.pts}),this.captionPackets_.forEach(function(v){v.type<2?this.dispatchCea608Packet(v):this.dispatchCea708Packet(v)},this),this.captionPackets_.length=0,this.flushCCStreams(m)},Ut.prototype.flush=function(){return this.flushStream("flush")},Ut.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ut.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(m){m.reset()})},Ut.prototype.dispatchCea608Packet=function(m){this.setsTextOrXDSActive(m)?this.activeCea608Channel_[m.type]=null:this.setsChannel1Active(m)?this.activeCea608Channel_[m.type]=0:this.setsChannel2Active(m)&&(this.activeCea608Channel_[m.type]=1),this.activeCea608Channel_[m.type]!==null&&this.ccStreams_[(m.type<<1)+this.activeCea608Channel_[m.type]].push(m)},Ut.prototype.setsChannel1Active=function(m){return(m.ccData&30720)===4096},Ut.prototype.setsChannel2Active=function(m){return(m.ccData&30720)===6144},Ut.prototype.setsTextOrXDSActive=function(m){return(m.ccData&28928)===256||(m.ccData&30974)===4138||(m.ccData&30974)===6186},Ut.prototype.dispatchCea708Packet=function(m){this.parse708captions_&&this.cc708Stream_.push(m)};var hn={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},cn=function(m){var v=hn[m]||m;return m&4096&&m===v?"":String.fromCharCode(v)},en=function(m){return 32<=m&&m<=127||160<=m&&m<=255},zt=function(m){this.windowNum=m,this.reset()};zt.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},zt.prototype.getText=function(){return this.rows.join(`
`)},zt.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},zt.prototype.newLine=function(m){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(m),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},zt.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},zt.prototype.addText=function(m){this.rows[this.rowIdx]+=m},zt.prototype.backspace=function(){if(!this.isEmpty()){var m=this.rows[this.rowIdx];this.rows[this.rowIdx]=m.substr(0,m.length-1)}};var Dt=function(m,v,w){this.serviceNum=m,this.text="",this.currentWindow=new zt(-1),this.windows=[],this.stream=w,typeof v=="string"&&this.createTextDecoder(v)};Dt.prototype.init=function(m,v){this.startPts=m;for(var w=0;w<8;w++)this.windows[w]=new zt(w),typeof v=="function"&&(this.windows[w].beforeRowOverflow=v)},Dt.prototype.setCurrentWindow=function(m){this.currentWindow=this.windows[m]},Dt.prototype.createTextDecoder=function(m){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(m)}catch(v){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+m+" encoding. "+v})}};var Ot=function(m){m=m||{},Ot.prototype.init.call(this);var v=this,w=m.captionServices||{},x={},T;Object.keys(w).forEach(A=>{T=w[A],/^SERVICE/.test(A)&&(x[A]=T.encoding)}),this.serviceEncodings=x,this.current708Packet=null,this.services={},this.push=function(A){A.type===3?(v.new708Packet(),v.add708Bytes(A)):(v.current708Packet===null&&v.new708Packet(),v.add708Bytes(A))}};Ot.prototype=new _n,Ot.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ot.prototype.add708Bytes=function(m){var v=m.ccData,w=v>>>8,x=v&255;this.current708Packet.ptsVals.push(m.pts),this.current708Packet.data.push(w),this.current708Packet.data.push(x)},Ot.prototype.push708Packet=function(){var m=this.current708Packet,v=m.data,w=null,x=null,T=0,A=v[T++];for(m.seq=A>>6,m.sizeCode=A&63;T<v.length;T++)A=v[T++],w=A>>5,x=A&31,w===7&&x>0&&(A=v[T++],w=A),this.pushServiceBlock(w,T,x),x>0&&(T+=x-1)},Ot.prototype.pushServiceBlock=function(m,v,w){var x,T=v,A=this.current708Packet.data,K=this.services[m];for(K||(K=this.initService(m,T));T<v+w&&T<A.length;T++)x=A[T],en(x)?T=this.handleText(T,K):x===24?T=this.multiByteCharacter(T,K):x===16?T=this.extendedCommands(T,K):128<=x&&x<=135?T=this.setCurrentWindow(T,K):152<=x&&x<=159?T=this.defineWindow(T,K):x===136?T=this.clearWindows(T,K):x===140?T=this.deleteWindows(T,K):x===137?T=this.displayWindows(T,K):x===138?T=this.hideWindows(T,K):x===139?T=this.toggleWindows(T,K):x===151?T=this.setWindowAttributes(T,K):x===144?T=this.setPenAttributes(T,K):x===145?T=this.setPenColor(T,K):x===146?T=this.setPenLocation(T,K):x===143?K=this.reset(T,K):x===8?K.currentWindow.backspace():x===12?K.currentWindow.clearText():x===13?K.currentWindow.pendingNewLine=!0:x===14?K.currentWindow.clearText():x===141&&T++},Ot.prototype.extendedCommands=function(m,v){var w=this.current708Packet.data,x=w[++m];return en(x)&&(m=this.handleText(m,v,{isExtended:!0})),m},Ot.prototype.getPts=function(m){return this.current708Packet.ptsVals[Math.floor(m/2)]},Ot.prototype.initService=function(m,v){var x="SERVICE"+m,w=this,x,T;return x in this.serviceEncodings&&(T=this.serviceEncodings[x]),this.services[m]=new Dt(m,T,w),this.services[m].init(this.getPts(v),function(A){w.flushDisplayed(A,w.services[m])}),this.services[m]},Ot.prototype.handleText=function(m,v,w){var x=w&&w.isExtended,T=w&&w.isMultiByte,A=this.current708Packet.data,K=x?4096:0,J=A[m],oe=A[m+1],fe=v.currentWindow,Ee,Xe;function Et(it){return it.map(It=>("0"+(It&255).toString(16)).slice(-2)).join("")}if(T?(Xe=[J,oe],m++):Xe=[J],v.textDecoder_&&!x)Ee=v.textDecoder_.decode(new Uint8Array(Xe));else if(T){const it=Et(Xe);Ee=String.fromCharCode(parseInt(it,16))}else Ee=cn(K|J);return fe.pendingNewLine&&!fe.isEmpty()&&fe.newLine(this.getPts(m)),fe.pendingNewLine=!1,fe.addText(Ee),m},Ot.prototype.multiByteCharacter=function(m,v){var w=this.current708Packet.data,x=w[m+1],T=w[m+2];return en(x)&&en(T)&&(m=this.handleText(++m,v,{isMultiByte:!0})),m},Ot.prototype.setCurrentWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;return v.setCurrentWindow(T),m},Ot.prototype.defineWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;v.setCurrentWindow(T);var A=v.currentWindow;return x=w[++m],A.visible=(x&32)>>5,A.rowLock=(x&16)>>4,A.columnLock=(x&8)>>3,A.priority=x&7,x=w[++m],A.relativePositioning=(x&128)>>7,A.anchorVertical=x&127,x=w[++m],A.anchorHorizontal=x,x=w[++m],A.anchorPoint=(x&240)>>4,A.rowCount=x&15,x=w[++m],A.columnCount=x&63,x=w[++m],A.windowStyle=(x&56)>>3,A.penStyle=x&7,A.virtualRowCount=A.rowCount+1,m},Ot.prototype.setWindowAttributes=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.winAttr;return x=w[++m],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=w[++m],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=w[++m],T.borderType+=(x&128)>>5,T.wordWrap=(x&64)>>6,T.printDirection=(x&48)>>4,T.scrollDirection=(x&12)>>2,T.justify=x&3,x=w[++m],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,m},Ot.prototype.flushDisplayed=function(m,v){for(var w=[],x=0;x<8;x++)v.windows[x].visible&&!v.windows[x].isEmpty()&&w.push(v.windows[x].getText());v.endPts=m,v.text=w.join(`
`),this.pushCaption(v),v.startPts=m},Ot.prototype.pushCaption=function(m){m.text!==""&&(this.trigger("data",{startPts:m.startPts,endPts:m.endPts,text:m.text,stream:"cc708_"+m.serviceNum}),m.text="",m.startPts=m.endPts)},Ot.prototype.displayWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=1);return m},Ot.prototype.hideWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=0);return m},Ot.prototype.toggleWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible^=1);return m},Ot.prototype.clearWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].clearText();return m},Ot.prototype.deleteWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].reset();return m},Ot.prototype.setPenAttributes=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penAttr;return x=w[++m],T.textTag=(x&240)>>4,T.offset=(x&12)>>2,T.penSize=x&3,x=w[++m],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,m},Ot.prototype.setPenColor=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penColor;return x=w[++m],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=w[++m],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=w[++m],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,m},Ot.prototype.setPenLocation=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=w[++m],T.row=x&15,x=w[++m],T.column=x&63,m},Ot.prototype.reset=function(m,v){var w=this.getPts(m);return this.flushDisplayed(w,v),this.initService(v.serviceNum,m)};var Hn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Rt=function(m){return m===null?"":(m=Hn[m]||m,String.fromCharCode(m))},qn=14,_i=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Mn=function(){for(var m=[],v=qn+1;v--;)m.push({text:"",indent:0,offset:0});return m},Wt=function(m,v){Wt.prototype.init.call(this),this.field_=m||0,this.dataChannel_=v||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(w){var x,T,A,K,J;if(x=w.ccData&32639,x===this.lastControlCode_){this.lastControlCode_=null;return}if((x&61440)===4096?this.lastControlCode_=x:x!==this.PADDING_&&(this.lastControlCode_=null),A=x>>>8,K=x&255,x!==this.PADDING_)if(x===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(x===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(w.pts),this.flushDisplayed(w.pts),T=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=T,this.startPts_=w.pts;else if(x===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(w.pts);else if(x===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(w.pts);else if(x===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(w.pts);else if(x===this.CARRIAGE_RETURN_)this.clearFormatting(w.pts),this.flushDisplayed(w.pts),this.shiftRowsUp_(),this.startPts_=w.pts;else if(x===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(x===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(w.pts),this.displayed_=Mn();else if(x===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Mn();else if(x===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(w.pts),this.displayed_=Mn()),this.mode_="paintOn",this.startPts_=w.pts;else if(this.isSpecialCharacter(A,K))A=(A&3)<<8,J=Rt(A|K),this[this.mode_](w.pts,J),this.column_++;else if(this.isExtCharacter(A,K))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),A=(A&3)<<8,J=Rt(A|K),this[this.mode_](w.pts,J),this.column_++;else if(this.isMidRowCode(A,K))this.clearFormatting(w.pts),this[this.mode_](w.pts," "),this.column_++,(K&14)===14&&this.addFormatting(w.pts,["i"]),(K&1)===1&&this.addFormatting(w.pts,["u"]);else if(this.isOffsetControlCode(A,K)){const fe=K&3;this.nonDisplayed_[this.row_].offset=fe,this.column_+=fe}else if(this.isPAC(A,K)){var oe=_i.indexOf(x&7968);if(this.mode_==="rollUp"&&(oe-this.rollUpRows_+1<0&&(oe=this.rollUpRows_-1),this.setRollUp(w.pts,oe)),oe!==this.row_&&oe>=0&&oe<=14&&(this.clearFormatting(w.pts),this.row_=oe),K&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(w.pts,["u"]),(x&16)===16){const fe=(x&14)>>1;this.column_=fe*4,this.nonDisplayed_[this.row_].indent+=fe}this.isColorPAC(K)&&(K&14)===14&&this.addFormatting(w.pts,["i"])}else this.isNormalChar(A)&&(K===0&&(K=null),J=Rt(A),J+=Rt(K),this[this.mode_](w.pts,J),this.column_+=J.length)}};Wt.prototype=new _n,Wt.prototype.flushDisplayed=function(m){const v=x=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+x+"."})},w=[];this.displayed_.forEach((x,T)=>{if(x&&x.text&&x.text.length){try{x.text=x.text.trim()}catch{v(T)}x.text.length&&w.push({text:x.text,line:T+1,position:10+Math.min(70,x.indent*10)+x.offset*2.5})}else x==null&&v(T)}),w.length&&this.trigger("data",{startPts:this.startPts_,endPts:m,content:w,stream:this.name_})},Wt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Mn(),this.nonDisplayed_=Mn(),this.lastControlCode_=null,this.column_=0,this.row_=qn,this.rollUpRows_=2,this.formatting_=[]},Wt.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Wt.prototype.isSpecialCharacter=function(m,v){return m===this.EXT_&&v>=48&&v<=63},Wt.prototype.isExtCharacter=function(m,v){return(m===this.EXT_+1||m===this.EXT_+2)&&v>=32&&v<=63},Wt.prototype.isMidRowCode=function(m,v){return m===this.EXT_&&v>=32&&v<=47},Wt.prototype.isOffsetControlCode=function(m,v){return m===this.OFFSET_&&v>=33&&v<=35},Wt.prototype.isPAC=function(m,v){return m>=this.BASE_&&m<this.BASE_+8&&v>=64&&v<=127},Wt.prototype.isColorPAC=function(m){return m>=64&&m<=79||m>=96&&m<=127},Wt.prototype.isNormalChar=function(m){return m>=32&&m<=127},Wt.prototype.setRollUp=function(m,v){if(this.mode_!=="rollUp"&&(this.row_=qn,this.mode_="rollUp",this.flushDisplayed(m),this.nonDisplayed_=Mn(),this.displayed_=Mn()),v!==void 0&&v!==this.row_)for(var w=0;w<this.rollUpRows_;w++)this.displayed_[v-w]=this.displayed_[this.row_-w],this.displayed_[this.row_-w]={text:"",indent:0,offset:0};v===void 0&&(v=this.row_),this.topRow_=v-this.rollUpRows_+1},Wt.prototype.addFormatting=function(m,v){this.formatting_=this.formatting_.concat(v);var w=v.reduce(function(x,T){return x+"<"+T+">"},"");this[this.mode_](m,w)},Wt.prototype.clearFormatting=function(m){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(w,x){return w+"</"+x+">"},"");this.formatting_=[],this[this.mode_](m,v)}},Wt.prototype.popOn=function(m,v){var w=this.nonDisplayed_[this.row_].text;w+=v,this.nonDisplayed_[this.row_].text=w},Wt.prototype.rollUp=function(m,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w},Wt.prototype.shiftRowsUp_=function(){var m;for(m=0;m<this.topRow_;m++)this.displayed_[m]={text:"",indent:0,offset:0};for(m=this.row_+1;m<qn+1;m++)this.displayed_[m]={text:"",indent:0,offset:0};for(m=this.topRow_;m<this.row_;m++)this.displayed_[m]=this.displayed_[m+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Wt.prototype.paintOn=function(m,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w};var zn={CaptionStream:Ut,Cea608Stream:Wt,Cea708Stream:Ot},Kn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},jn=t,Wn=8589934592,Cn=4294967296,fi="shared",Xn=function(m,v){var w=1;for(m>v&&(w=-1);Math.abs(v-m)>Cn;)m+=w*Wn;return m},li=function(m){var v,w;li.prototype.init.call(this),this.type_=m||fi,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==fi&&x.type!==this.type_||(w===void 0&&(w=x.dts),x.dts=Xn(x.dts,w),x.pts=Xn(x.pts,w),v=x.dts,this.trigger("data",x))},this.flush=function(){w=v,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){w=void 0,v=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};li.prototype=new jn;var _e={TimestampRolloverStream:li,handleRollover:Xn},at=(m,v,w)=>{if(!m)return-1;for(var x=w;x<m.length;x++)if(m[x]===v)return x;return-1},Ct={typedArrayIndexOf:at},St=Ct.typedArrayIndexOf,Pt={Utf8:3},tn=function(m,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+m[x].toString(16)).slice(-2);return T},wn=function(m,v,w){return decodeURIComponent(tn(m,v,w))},vt=function(m,v,w){return unescape(tn(m,v,w))},fn=function(m){return m[0]<<21|m[1]<<14|m[2]<<7|m[3]},Ne={APIC:function(m){var v=1,w,x,T="-->";m.data[0]===Pt.Utf8&&(w=St(m.data,0,v),!(w<0)&&(m.mimeType=vt(m.data,v,w),v=w+1,m.pictureType=m.data[v],v++,x=St(m.data,0,v),!(x<0)&&(m.description=wn(m.data,v,x),v=x+1,m.mimeType===T?m.url=vt(m.data,v,m.data.length):m.pictureData=m.data.subarray(v,m.data.length))))},"T*":function(m){m.data[0]===Pt.Utf8&&(m.value=wn(m.data,1,m.data.length).replace(/\0*$/,""),m.values=m.value.split("\0"))},TXXX:function(m){var v;m.data[0]===Pt.Utf8&&(v=St(m.data,0,1),v!==-1&&(m.description=wn(m.data,1,v),m.value=wn(m.data,v+1,m.data.length).replace(/\0*$/,""),m.data=m.value))},"W*":function(m){m.url=vt(m.data,0,m.data.length).replace(/\0.*$/,"")},WXXX:function(m){var v;m.data[0]===Pt.Utf8&&(v=St(m.data,0,1),v!==-1&&(m.description=wn(m.data,1,v),m.url=vt(m.data,v+1,m.data.length).replace(/\0.*$/,"")))},PRIV:function(m){var v;for(v=0;v<m.data.length;v++)if(m.data[v]===0){m.owner=vt(m.data,0,v);break}m.privateData=m.data.subarray(v+1),m.data=m.privateData}},Tt=function(m){var v,w,x=10,T=0,A=[];if(!(m.length<10||m[0]!==73||m[1]!==68||m[2]!==51)){T=fn(m.subarray(6,10)),T+=10;var K=m[5]&64;K&&(x+=4,x+=fn(m.subarray(10,14)),T-=fn(m.subarray(16,20)));do{if(v=fn(m.subarray(x+4,x+8)),v<1)break;w=String.fromCharCode(m[x],m[x+1],m[x+2],m[x+3]);var J={id:w,data:m.subarray(x+10,x+v+10)};J.key=J.id,Ne[J.id]?Ne[J.id](J):J.id[0]==="T"?Ne["T*"](J):J.id[0]==="W"&&Ne["W*"](J),A.push(J),x+=10,x+=v}while(x<T);return A}},_t={parseId3Frames:Tt,parseSyncSafeInteger:fn,frameParsers:Ne},$t=t,Ht=Kn,yn=_t,Xt;Xt=function(m){var v={descriptor:m&&m.descriptor},w=0,x=[],T=0,A;if(Xt.prototype.init.call(this),this.dispatchType=Ht.METADATA_STREAM_TYPE.toString(16),v.descriptor)for(A=0;A<v.descriptor.length;A++)this.dispatchType+=("00"+v.descriptor[A].toString(16)).slice(-2);this.push=function(K){var J,oe,fe,Ee,Xe,Et;if(K.type==="timed-metadata"){if(K.dataAlignmentIndicator&&(T=0,x.length=0),x.length===0&&(K.data.length<10||K.data[0]!==73||K.data[1]!==68||K.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(x.push(K),T+=K.data.byteLength,x.length===1&&(w=yn.parseSyncSafeInteger(K.data.subarray(6,10)),w+=10),!(T<w)){for(J={data:new Uint8Array(w),frames:[],pts:x[0].pts,dts:x[0].dts},Xe=0;Xe<w;)J.data.set(x[0].data.subarray(0,w-Xe),Xe),Xe+=x[0].data.byteLength,T-=x[0].data.byteLength,x.shift();oe=10,J.data[5]&64&&(oe+=4,oe+=yn.parseSyncSafeInteger(J.data.subarray(10,14)),w-=yn.parseSyncSafeInteger(J.data.subarray(16,20)));do{if(fe=yn.parseSyncSafeInteger(J.data.subarray(oe+4,oe+8)),fe<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Et=String.fromCharCode(J.data[oe],J.data[oe+1],J.data[oe+2],J.data[oe+3]),Ee={id:Et,data:J.data.subarray(oe+10,oe+fe+10)},Ee.key=Ee.id,yn.frameParsers[Ee.id]?yn.frameParsers[Ee.id](Ee):Ee.id[0]==="T"?yn.frameParsers["T*"](Ee):Ee.id[0]==="W"&&yn.frameParsers["W*"](Ee),Ee.owner==="com.apple.streaming.transportStreamTimestamp"){var it=Ee.data,It=(it[3]&1)<<30|it[4]<<22|it[5]<<14|it[6]<<6|it[7]>>>2;It*=4,It+=it[7]&3,Ee.timeStamp=It,J.pts===void 0&&J.dts===void 0&&(J.pts=Ee.timeStamp,J.dts=Ee.timeStamp),this.trigger("timestamp",Ee)}J.frames.push(Ee),oe+=10,oe+=fe}while(oe<w);this.trigger("data",J)}}}},Xt.prototype=new $t;var On=Xt,Vn=t,mi=zn,$n=Kn,ji=_e.TimestampRolloverStream,Bi,Yn,pi,gi=188,Pn=71;Bi=function(){var m=new Uint8Array(gi),v=0;Bi.prototype.init.call(this),this.push=function(w){var x=0,T=gi,A;for(v?(A=new Uint8Array(w.byteLength+v),A.set(m.subarray(0,v)),A.set(w,v),v=0):A=w;T<A.byteLength;){if(A[x]===Pn&&A[T]===Pn){this.trigger("data",A.subarray(x,T)),x+=gi,T+=gi;continue}x++,T++}x<A.byteLength&&(m.set(A.subarray(x),0),v=A.byteLength-x)},this.flush=function(){v===gi&&m[0]===Pn&&(this.trigger("data",m),v=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){v=0,this.trigger("reset")}},Bi.prototype=new Vn,Yn=function(){var m,v,w,x;Yn.prototype.init.call(this),x=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,m=function(T,A){var K=0;A.payloadUnitStartIndicator&&(K+=T[K]+1),A.type==="pat"?v(T.subarray(K),A):w(T.subarray(K),A)},v=function(T,A){A.section_number=T[7],A.last_section_number=T[8],x.pmtPid=(T[10]&31)<<8|T[11],A.pmtPid=x.pmtPid},w=function(T,A){var K,J,oe,fe;if(T[5]&1){for(x.programMapTable={video:null,audio:null,"timed-metadata":{}},K=(T[1]&15)<<8|T[2],J=3+K-4,oe=(T[10]&15)<<8|T[11],fe=12+oe;fe<J;){var Ee=T[fe],Xe=(T[fe+1]&31)<<8|T[fe+2];Ee===$n.H264_STREAM_TYPE&&x.programMapTable.video===null?x.programMapTable.video=Xe:Ee===$n.ADTS_STREAM_TYPE&&x.programMapTable.audio===null?x.programMapTable.audio=Xe:Ee===$n.METADATA_STREAM_TYPE&&(x.programMapTable["timed-metadata"][Xe]=Ee),fe+=((T[fe+3]&15)<<8|T[fe+4])+5}A.programMapTable=x.programMapTable}},this.push=function(T){var A={},K=4;if(A.payloadUnitStartIndicator=!!(T[1]&64),A.pid=T[1]&31,A.pid<<=8,A.pid|=T[2],(T[3]&48)>>>4>1&&(K+=T[K]+1),A.pid===0)A.type="pat",m(T.subarray(K),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",m(T.subarray(K),A),this.trigger("data",A);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,K,A]):this.processPes_(T,K,A)},this.processPes_=function(T,A,K){K.pid===this.programMapTable.video?K.streamType=$n.H264_STREAM_TYPE:K.pid===this.programMapTable.audio?K.streamType=$n.ADTS_STREAM_TYPE:K.streamType=this.programMapTable["timed-metadata"][K.pid],K.type="pes",K.data=T.subarray(A),this.trigger("data",K)}},Yn.prototype=new Vn,Yn.STREAM_TYPES={h264:27,adts:15},pi=function(){var m=this,v=!1,w={data:[],size:0},x={data:[],size:0},T={data:[],size:0},A,K=function(oe,fe){var Ee;const Xe=oe[0]<<16|oe[1]<<8|oe[2];fe.data=new Uint8Array,Xe===1&&(fe.packetLength=6+(oe[4]<<8|oe[5]),fe.dataAlignmentIndicator=(oe[6]&4)!==0,Ee=oe[7],Ee&192&&(fe.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,fe.pts*=4,fe.pts+=(oe[13]&6)>>>1,fe.dts=fe.pts,Ee&64&&(fe.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,fe.dts*=4,fe.dts+=(oe[18]&6)>>>1)),fe.data=oe.subarray(9+oe[8]))},J=function(oe,fe,Ee){var Xe=new Uint8Array(oe.size),Et={type:fe},it=0,It=0,mn=!1,Vi;if(!(!oe.data.length||oe.size<9)){for(Et.trackId=oe.data[0].pid,it=0;it<oe.data.length;it++)Vi=oe.data[it],Xe.set(Vi.data,It),It+=Vi.data.byteLength;K(Xe,Et),mn=fe==="video"||Et.packetLength<=oe.size,(Ee||mn)&&(oe.size=0,oe.data.length=0),mn&&m.trigger("data",Et)}};pi.prototype.init.call(this),this.push=function(oe){({pat:function(){},pes:function(){var fe,Ee;switch(oe.streamType){case $n.H264_STREAM_TYPE:fe=w,Ee="video";break;case $n.ADTS_STREAM_TYPE:fe=x,Ee="audio";break;case $n.METADATA_STREAM_TYPE:fe=T,Ee="timed-metadata";break;default:return}oe.payloadUnitStartIndicator&&J(fe,Ee,!0),fe.data.push(oe),fe.size+=oe.data.byteLength},pmt:function(){var fe={type:"metadata",tracks:[]};A=oe.programMapTable,A.video!==null&&fe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.video,codec:"avc",type:"video"}),A.audio!==null&&fe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.audio,codec:"adts",type:"audio"}),v=!0,m.trigger("data",fe)}})[oe.type]()},this.reset=function(){w.size=0,w.data.length=0,x.size=0,x.data.length=0,this.trigger("reset")},this.flushStreams_=function(){J(w,"video"),J(x,"audio"),J(T,"timed-metadata")},this.flush=function(){if(!v&&A){var oe={type:"metadata",tracks:[]};A.video!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.video,codec:"avc",type:"video"}),A.audio!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.audio,codec:"adts",type:"audio"}),m.trigger("data",oe)}v=!1,this.flushStreams_(),this.trigger("done")}},pi.prototype=new Vn;var Ri={PAT_PID:0,MP2T_PACKET_LENGTH:gi,TransportPacketStream:Bi,TransportParseStream:Yn,ElementaryStream:pi,TimestampRolloverStream:ji,CaptionStream:mi.CaptionStream,Cea608Stream:mi.Cea608Stream,Cea708Stream:mi.Cea708Stream,MetadataStream:On};for(var ei in $n)$n.hasOwnProperty(ei)&&(Ri[ei]=$n[ei]);var ti=Ri,An=t,ii=pt.ONE_SECOND_IN_TS,Pi,Oi=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Pi=function(m){var v,w=0;Pi.prototype.init.call(this),this.skipWarn_=function(x,T){this.trigger("log",{level:"warn",message:`adts skiping bytes ${x} to ${T} in frame ${w} outside syncword`})},this.push=function(x){var T=0,A,K,J,oe,fe;if(m||(w=0),x.type==="audio"){v&&v.length?(J=v,v=new Uint8Array(J.byteLength+x.data.byteLength),v.set(J),v.set(x.data,J.byteLength)):v=x.data;for(var Ee;T+7<v.length;){if(v[T]!==255||(v[T+1]&246)!==240){typeof Ee!="number"&&(Ee=T),T++;continue}if(typeof Ee=="number"&&(this.skipWarn_(Ee,T),Ee=null),K=(~v[T+1]&1)*2,A=(v[T+3]&3)<<11|v[T+4]<<3|(v[T+5]&224)>>5,oe=((v[T+6]&3)+1)*1024,fe=oe*ii/Oi[(v[T+2]&60)>>>2],v.byteLength-T<A)break;this.trigger("data",{pts:x.pts+w*fe,dts:x.dts+w*fe,sampleCount:oe,audioobjecttype:(v[T+2]>>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:Oi[(v[T+2]&60)>>>2],samplingfrequencyindex:(v[T+2]&60)>>>2,samplesize:16,data:v.subarray(T+7+K,T+A)}),w++,T+=A}typeof Ee=="number"&&(this.skipWarn_(Ee,T),Ee=null),v=v.subarray(T)}},this.flush=function(){w=0,this.trigger("done")},this.reset=function(){v=void 0,this.trigger("reset")},this.endTimeline=function(){v=void 0,this.trigger("endedtimeline")}},Pi.prototype=new An;var se=Pi,I;I=function(m){var v=m.byteLength,w=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=m.byteLength-v,A=new Uint8Array(4),K=Math.min(4,v);if(K===0)throw new Error("no bytes available");A.set(m.subarray(T,T+K)),w=new DataView(A.buffer).getUint32(0),x=K*8,v-=K},this.skipBits=function(T){var A;x>T?(w<<=T,x-=T):(T-=x,A=Math.floor(T/8),T-=A*8,v-=A,this.loadWord(),w<<=T,x-=T)},this.readBits=function(T){var A=Math.min(x,T),K=w>>>32-A;return x-=A,x>0?w<<=A:v>0&&this.loadWord(),A=T-A,A>0?K<<A|this.readBits(A):K},this.skipLeadingZeros=function(){var T;for(T=0;T<x;++T)if((w&2147483648>>>T)!==0)return w<<=T,x-=T,T;return this.loadWord(),T+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var T=this.skipLeadingZeros();return this.readBits(T+1)-1},this.readExpGolomb=function(){var T=this.readUnsignedExpGolomb();return 1&T?1+T>>>1:-1*(T>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var ce=I,pe=t,Ce=ce,Ae,z,G;z=function(){var m=0,v,w;z.prototype.init.call(this),this.push=function(x){var T;w?(T=new Uint8Array(w.byteLength+x.data.byteLength),T.set(w),T.set(x.data,w.byteLength),w=T):w=x.data;for(var A=w.byteLength;m<A-3;m++)if(w[m+2]===1){v=m+5;break}for(;v<A;)switch(w[v]){case 0:if(w[v-1]!==0){v+=2;break}else if(w[v-2]!==0){v++;break}m+3!==v-2&&this.trigger("data",w.subarray(m+3,v-2));do v++;while(w[v]!==1&&v<A);m=v-2,v+=3;break;case 1:if(w[v-1]!==0||w[v-2]!==0){v+=3;break}this.trigger("data",w.subarray(m+3,v-2)),m=v-2,v+=3;break;default:v+=3;break}w=w.subarray(m),v-=m,m=0},this.reset=function(){w=null,m=0,this.trigger("reset")},this.flush=function(){w&&w.byteLength>3&&this.trigger("data",w.subarray(m+3)),w=null,m=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},z.prototype=new pe,G={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ae=function(){var m=new z,v,w,x,T,A,K,J;Ae.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(w=oe.trackId,x=oe.pts,T=oe.dts,m.push(oe))},m.on("data",function(oe){var fe={trackId:w,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(fe.nalUnitTypeCode){case 5:fe.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:fe.nalUnitType="sei_rbsp",fe.escapedRBSP=A(oe.subarray(1));break;case 7:fe.nalUnitType="seq_parameter_set_rbsp",fe.escapedRBSP=A(oe.subarray(1)),fe.config=K(fe.escapedRBSP);break;case 8:fe.nalUnitType="pic_parameter_set_rbsp";break;case 9:fe.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",fe)}),m.on("done",function(){v.trigger("done")}),m.on("partialdone",function(){v.trigger("partialdone")}),m.on("reset",function(){v.trigger("reset")}),m.on("endedtimeline",function(){v.trigger("endedtimeline")}),this.flush=function(){m.flush()},this.partialFlush=function(){m.partialFlush()},this.reset=function(){m.reset()},this.endTimeline=function(){m.endTimeline()},J=function(oe,fe){var Ee=8,Xe=8,Et,it;for(Et=0;Et<oe;Et++)Xe!==0&&(it=fe.readExpGolomb(),Xe=(Ee+it+256)%256),Ee=Xe===0?Ee:Xe},A=function(oe){for(var fe=oe.byteLength,Ee=[],Xe=1,Et,it;Xe<fe-2;)oe[Xe]===0&&oe[Xe+1]===0&&oe[Xe+2]===3?(Ee.push(Xe+2),Xe+=2):Xe++;if(Ee.length===0)return oe;Et=fe-Ee.length,it=new Uint8Array(Et);var It=0;for(Xe=0;Xe<Et;It++,Xe++)It===Ee[0]&&(It++,Ee.shift()),it[Xe]=oe[It];return it},K=function(oe){var fe=0,Ee=0,Xe=0,Et=0,it,It,mn,Vi,Tr,zs,Ho,Ti,la,ks,$s,si=[1,1],ls,sr;if(it=new Ce(oe),It=it.readUnsignedByte(),Vi=it.readUnsignedByte(),mn=it.readUnsignedByte(),it.skipUnsignedExpGolomb(),G[It]&&(Tr=it.readUnsignedExpGolomb(),Tr===3&&it.skipBits(1),it.skipUnsignedExpGolomb(),it.skipUnsignedExpGolomb(),it.skipBits(1),it.readBoolean()))for($s=Tr!==3?8:12,sr=0;sr<$s;sr++)it.readBoolean()&&(sr<6?J(16,it):J(64,it));if(it.skipUnsignedExpGolomb(),zs=it.readUnsignedExpGolomb(),zs===0)it.readUnsignedExpGolomb();else if(zs===1)for(it.skipBits(1),it.skipExpGolomb(),it.skipExpGolomb(),Ho=it.readUnsignedExpGolomb(),sr=0;sr<Ho;sr++)it.skipExpGolomb();if(it.skipUnsignedExpGolomb(),it.skipBits(1),Ti=it.readUnsignedExpGolomb(),la=it.readUnsignedExpGolomb(),ks=it.readBits(1),ks===0&&it.skipBits(1),it.skipBits(1),it.readBoolean()&&(fe=it.readUnsignedExpGolomb(),Ee=it.readUnsignedExpGolomb(),Xe=it.readUnsignedExpGolomb(),Et=it.readUnsignedExpGolomb()),it.readBoolean()&&it.readBoolean()){switch(ls=it.readUnsignedByte(),ls){case 1:si=[1,1];break;case 2:si=[12,11];break;case 3:si=[10,11];break;case 4:si=[16,11];break;case 5:si=[40,33];break;case 6:si=[24,11];break;case 7:si=[20,11];break;case 8:si=[32,11];break;case 9:si=[80,33];break;case 10:si=[18,11];break;case 11:si=[15,11];break;case 12:si=[64,33];break;case 13:si=[160,99];break;case 14:si=[4,3];break;case 15:si=[3,2];break;case 16:si=[2,1];break;case 255:{si=[it.readUnsignedByte()<<8|it.readUnsignedByte(),it.readUnsignedByte()<<8|it.readUnsignedByte()];break}}si&&si[0]/si[1]}return{profileIdc:It,levelIdc:mn,profileCompatibility:Vi,width:(Ti+1)*16-fe*2-Ee*2,height:(2-ks)*(la+1)*16-Xe*2-Et*2,sarRatio:si}}},Ae.prototype=new pe;var ee={H264Stream:Ae},ae=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Be=function(m,v){var w=m[v+6]<<21|m[v+7]<<14|m[v+8]<<7|m[v+9],x=m[v+5],T=(x&16)>>4;return w=w>=0?w:0,T?w+20:w+10},Je=function(m,v){return m.length-v<10||m[v]!==73||m[v+1]!==68||m[v+2]!==51?v:(v+=Be(m,v),Je(m,v))},We=function(m){var v=Je(m,0);return m.length>=v+2&&(m[v]&255)===255&&(m[v+1]&240)===240&&(m[v+1]&22)===16},ut=function(m){return m[0]<<21|m[1]<<14|m[2]<<7|m[3]},Mt=function(m,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+m[x].toString(16)).slice(-2);return T},Nt=function(m,v,w){return unescape(Mt(m,v,w))},jt=function(m,v){var w=(m[v+5]&224)>>5,x=m[v+4]<<3,T=m[v+3]&6144;return T|x|w},Qt=function(m,v){return m[v]===73&&m[v+1]===68&&m[v+2]===51?"timed-metadata":m[v]&!0&&(m[v+1]&240)===240?"audio":null},Gn=function(m){for(var v=0;v+5<m.length;){if(m[v]!==255||(m[v+1]&246)!==240){v++;continue}return ae[(m[v+2]&60)>>>2]}return null},rr=function(m){var v,w,x,T;v=10,m[5]&64&&(v+=4,v+=ut(m.subarray(10,14)));do{if(w=ut(m.subarray(v+4,v+8)),w<1)return null;if(T=String.fromCharCode(m[v],m[v+1],m[v+2],m[v+3]),T==="PRIV"){x=m.subarray(v+10,v+w+10);for(var A=0;A<x.byteLength;A++)if(x[A]===0){var K=Nt(x,0,A);if(K==="com.apple.streaming.transportStreamTimestamp"){var J=x.subarray(A+1),oe=(J[3]&1)<<30|J[4]<<22|J[5]<<14|J[6]<<6|J[7]>>>2;return oe*=4,oe+=J[7]&3,oe}break}}v+=10,v+=w}while(v<m.byteLength);return null},dr={isLikelyAacData:We,parseId3TagSize:Be,parseAdtsSize:jt,parseType:Qt,parseSampleRate:Gn,parseAacTimestamp:rr},ja=t,No=dr,os;os=function(){var m=new Uint8Array,v=0;os.prototype.init.call(this),this.setTimestamp=function(w){v=w},this.push=function(w){var x=0,T=0,A,K,J,oe;for(m.length?(oe=m.length,m=new Uint8Array(w.byteLength+oe),m.set(m.subarray(0,oe)),m.set(w,oe)):m=w;m.length-T>=3;){if(m[T]===73&&m[T+1]===68&&m[T+2]===51){if(m.length-T<10||(x=No.parseId3TagSize(m,T),T+x>m.length))break;K={type:"timed-metadata",data:m.subarray(T,T+x)},this.trigger("data",K),T+=x;continue}else if((m[T]&255)===255&&(m[T+1]&240)===240){if(m.length-T<7||(x=No.parseAdtsSize(m,T),T+x>m.length))break;J={type:"audio",data:m.subarray(T,T+x),pts:v,dts:v},this.trigger("data",J),T+=x;continue}T++}A=m.length-T,A>0?m=m.subarray(T):m=new Uint8Array},this.reset=function(){m=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){m=new Uint8Array,this.trigger("endedtimeline")}},os.prototype=new ja;var wi=os,Fi=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],_s=Fi,Do=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],k0=Do,Ra=t,Mo=Ke,jo=bt,_l=pn,Kr=ie,ws=ti,Ro=pt,Ad=se,E0=ee.H264Stream,C0=wi,A0=dr.isLikelyAacData,Pu=pt.ONE_SECOND_IN_TS,Nd=_s,Dd=k0,wl,Oa,Tl,ra,N0=function(m,v){v.stream=m,this.trigger("log",v)},Md=function(m,v){for(var w=Object.keys(v),x=0;x<w.length;x++){var T=w[x];T==="headOfPipeline"||!v[T].on||v[T].on("log",N0.bind(m,T))}},jd=function(m,v){var w;if(m.length!==v.length)return!1;for(w=0;w<m.length;w++)if(m[w]!==v[w])return!1;return!0},Rd=function(m,v,w,x,T,A){var K=w-v,J=x-v,oe=T-w;return{start:{dts:m,pts:m+K},end:{dts:m+J,pts:m+oe},prependedContentDuration:A,baseMediaDecodeTime:m}};Oa=function(m,v){var w=[],x,T=0,A=0,K=1/0;v=v||{},x=v.firstSequenceNumber||0,Oa.prototype.init.call(this),this.push=function(J){Kr.collectDtsInfo(m,J),m&&Nd.forEach(function(oe){m[oe]=J[oe]}),w.push(J)},this.setEarliestDts=function(J){T=J},this.setVideoBaseMediaDecodeTime=function(J){K=J},this.setAudioAppendStart=function(J){A=J},this.flush=function(){var J,oe,fe,Ee,Xe,Et,it;if(w.length===0){this.trigger("done","AudioSegmentStream");return}J=_l.trimAdtsFramesByEarliestDts(w,m,T),m.baseMediaDecodeTime=Kr.calculateTrackBaseMediaDecodeTime(m,v.keepOriginalTimestamps),it=_l.prefixWithSilence(m,J,A,K),m.samples=_l.generateSampleTable(J),fe=Mo.mdat(_l.concatenateFrameData(J)),w=[],oe=Mo.moof(x,[m]),Ee=new Uint8Array(oe.byteLength+fe.byteLength),x++,Ee.set(oe),Ee.set(fe,oe.byteLength),Kr.clearDtsInfo(m),Xe=Math.ceil(Pu*1024/m.samplerate),J.length&&(Et=J.length*Xe,this.trigger("segmentTimingInfo",Rd(Ro.audioTsToVideoTs(m.baseMediaDecodeTime,m.samplerate),J[0].dts,J[0].pts,J[0].dts+Et,J[0].pts+Et,it||0)),this.trigger("timingInfo",{start:J[0].pts,end:J[0].pts+Et})),this.trigger("data",{track:m,boxes:Ee}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Kr.clearDtsInfo(m),w=[],this.trigger("reset")}},Oa.prototype=new Ra,wl=function(m,v){var w,x=[],T=[],A,K;v=v||{},w=v.firstSequenceNumber||0,wl.prototype.init.call(this),delete m.minPTS,this.gopCache_=[],this.push=function(J){Kr.collectDtsInfo(m,J),J.nalUnitType==="seq_parameter_set_rbsp"&&!A&&(A=J.config,m.sps=[J.data],Dd.forEach(function(oe){m[oe]=A[oe]},this)),J.nalUnitType==="pic_parameter_set_rbsp"&&!K&&(K=J.data,m.pps=[J.data]),x.push(J)},this.flush=function(){for(var J,oe,fe,Ee,Xe,Et,it=0,It,mn;x.length&&x[0].nalUnitType!=="access_unit_delimiter_rbsp";)x.shift();if(x.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(J=jo.groupNalsIntoFrames(x),fe=jo.groupFramesIntoGops(J),fe[0][0].keyFrame||(oe=this.getGopForFusion_(x[0],m),oe?(it=oe.duration,fe.unshift(oe),fe.byteLength+=oe.byteLength,fe.nalCount+=oe.nalCount,fe.pts=oe.pts,fe.dts=oe.dts,fe.duration+=oe.duration):fe=jo.extendFirstKeyFrame(fe)),T.length){var Vi;if(v.alignGopsAtEnd?Vi=this.alignGopsAtEnd_(fe):Vi=this.alignGopsAtStart_(fe),!Vi){this.gopCache_.unshift({gop:fe.pop(),pps:m.pps,sps:m.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Kr.clearDtsInfo(m),fe=Vi}Kr.collectDtsInfo(m,fe),m.samples=jo.generateSampleTable(fe),Xe=Mo.mdat(jo.concatenateNalData(fe)),m.baseMediaDecodeTime=Kr.calculateTrackBaseMediaDecodeTime(m,v.keepOriginalTimestamps),this.trigger("processedGopsInfo",fe.map(function(Tr){return{pts:Tr.pts,dts:Tr.dts,byteLength:Tr.byteLength}})),It=fe[0],mn=fe[fe.length-1],this.trigger("segmentTimingInfo",Rd(m.baseMediaDecodeTime,It.dts,It.pts,mn.dts+mn.duration,mn.pts+mn.duration,it)),this.trigger("timingInfo",{start:fe[0].pts,end:fe[fe.length-1].pts+fe[fe.length-1].duration}),this.gopCache_.unshift({gop:fe.pop(),pps:m.pps,sps:m.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.trigger("baseMediaDecodeTime",m.baseMediaDecodeTime),this.trigger("timelineStartInfo",m.timelineStartInfo),Ee=Mo.moof(w,[m]),Et=new Uint8Array(Ee.byteLength+Xe.byteLength),w++,Et.set(Ee),Et.set(Xe,Ee.byteLength),this.trigger("data",{track:m,boxes:Et}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),x=[],this.gopCache_.length=0,T.length=0,this.trigger("reset")},this.resetStream_=function(){Kr.clearDtsInfo(m),A=void 0,K=void 0},this.getGopForFusion_=function(J){var oe=45e3,fe=1/0,Ee,Xe,Et,it,It;for(It=0;It<this.gopCache_.length;It++)it=this.gopCache_[It],Et=it.gop,!(!(m.pps&&jd(m.pps[0],it.pps[0]))||!(m.sps&&jd(m.sps[0],it.sps[0])))&&(Et.dts<m.timelineStartInfo.dts||(Ee=J.dts-Et.dts-Et.duration,Ee>=-1e4&&Ee<=oe&&(!Xe||fe>Ee)&&(Xe=it,fe=Ee)));return Xe?Xe.gop:null},this.alignGopsAtStart_=function(J){var oe,fe,Ee,Xe,Et,it,It,mn;for(Et=J.byteLength,it=J.nalCount,It=J.duration,oe=fe=0;oe<T.length&&fe<J.length&&(Ee=T[oe],Xe=J[fe],Ee.pts!==Xe.pts);){if(Xe.pts>Ee.pts){oe++;continue}fe++,Et-=Xe.byteLength,it-=Xe.nalCount,It-=Xe.duration}return fe===0?J:fe===J.length?null:(mn=J.slice(fe),mn.byteLength=Et,mn.duration=It,mn.nalCount=it,mn.pts=mn[0].pts,mn.dts=mn[0].dts,mn)},this.alignGopsAtEnd_=function(J){var oe,fe,Ee,Xe,Et,it;for(oe=T.length-1,fe=J.length-1,Et=null,it=!1;oe>=0&&fe>=0;){if(Ee=T[oe],Xe=J[fe],Ee.pts===Xe.pts){it=!0;break}if(Ee.pts>Xe.pts){oe--;continue}oe===T.length-1&&(Et=fe),fe--}if(!it&&Et===null)return null;var It;if(it?It=fe:It=Et,It===0)return J;var mn=J.slice(It),Vi=mn.reduce(function(Tr,zs){return Tr.byteLength+=zs.byteLength,Tr.duration+=zs.duration,Tr.nalCount+=zs.nalCount,Tr},{byteLength:0,duration:0,nalCount:0});return mn.byteLength=Vi.byteLength,mn.duration=Vi.duration,mn.nalCount=Vi.nalCount,mn.pts=mn[0].pts,mn.dts=mn[0].dts,mn},this.alignGopsWith=function(J){T=J}},wl.prototype=new Ra,ra=function(m,v){this.numberOfTracks=0,this.metadataStream=v,m=m||{},typeof m.remux<"u"?this.remuxTracks=!!m.remux:this.remuxTracks=!0,typeof m.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=m.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ra.prototype.init.call(this),this.push=function(w){if(w.content||w.text)return this.pendingCaptions.push(w);if(w.frames)return this.pendingMetadata.push(w);this.pendingTracks.push(w.track),this.pendingBytes+=w.boxes.byteLength,w.track.type==="video"&&(this.videoTrack=w.track,this.pendingBoxes.push(w.boxes)),w.track.type==="audio"&&(this.audioTrack=w.track,this.pendingBoxes.unshift(w.boxes))}},ra.prototype=new Ra,ra.prototype.flush=function(m){var v=0,w={captions:[],captionStreams:{},metadata:[],info:{}},x,T,A,K=0,J;if(this.pendingTracks.length<this.numberOfTracks){if(m!=="VideoSegmentStream"&&m!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(K=this.videoTrack.timelineStartInfo.pts,Dd.forEach(function(oe){w.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(K=this.audioTrack.timelineStartInfo.pts,Nd.forEach(function(oe){w.info[oe]=this.audioTrack[oe]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?w.type=this.pendingTracks[0].type:w.type="combined",this.emittedTracks+=this.pendingTracks.length,A=Mo.initSegment(this.pendingTracks),w.initSegment=new Uint8Array(A.byteLength),w.initSegment.set(A),w.data=new Uint8Array(this.pendingBytes),J=0;J<this.pendingBoxes.length;J++)w.data.set(this.pendingBoxes[J],v),v+=this.pendingBoxes[J].byteLength;for(J=0;J<this.pendingCaptions.length;J++)x=this.pendingCaptions[J],x.startTime=Ro.metadataTsToSeconds(x.startPts,K,this.keepOriginalTimestamps),x.endTime=Ro.metadataTsToSeconds(x.endPts,K,this.keepOriginalTimestamps),w.captionStreams[x.stream]=!0,w.captions.push(x);for(J=0;J<this.pendingMetadata.length;J++)T=this.pendingMetadata[J],T.cueTime=Ro.metadataTsToSeconds(T.pts,K,this.keepOriginalTimestamps),w.metadata.push(T);for(w.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",w),J=0;J<w.captions.length;J++)x=w.captions[J],this.trigger("caption",x);for(J=0;J<w.metadata.length;J++)T=w.metadata[J],this.trigger("id3Frame",T)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ra.prototype.setRemux=function(m){this.remuxTracks=m},Tl=function(m){var v=this,w=!0,x,T;Tl.prototype.init.call(this),m=m||{},this.baseMediaDecodeTime=m.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new ws.MetadataStream,A.aacStream=new C0,A.audioTimestampRolloverStream=new ws.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new ws.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Ad,A.coalesceStream=new ra(m,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(K){A.aacStream.setTimestamp(K.timeStamp)}),A.aacStream.on("data",function(K){K.type!=="timed-metadata"&&K.type!=="audio"||A.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:v.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Oa(T,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x}))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,A)},this.setupTsPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="ts",A.metadataStream=new ws.MetadataStream,A.packetStream=new ws.TransportPacketStream,A.parseStream=new ws.TransportParseStream,A.elementaryStream=new ws.ElementaryStream,A.timestampRolloverStream=new ws.TimestampRolloverStream,A.adtsStream=new Ad,A.h264Stream=new E0,A.captionStream=new ws.CaptionStream(m),A.coalesceStream=new ra(m,A.metadataStream),A.headOfPipeline=A.packetStream,A.packetStream.pipe(A.parseStream).pipe(A.elementaryStream).pipe(A.timestampRolloverStream),A.timestampRolloverStream.pipe(A.h264Stream),A.timestampRolloverStream.pipe(A.adtsStream),A.timestampRolloverStream.pipe(A.metadataStream).pipe(A.coalesceStream),A.h264Stream.pipe(A.captionStream).pipe(A.coalesceStream),A.elementaryStream.on("data",function(K){var J;if(K.type==="metadata"){for(J=K.tracks.length;J--;)!x&&K.tracks[J].type==="video"?(x=K.tracks[J],x.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime):!T&&K.tracks[J].type==="audio"&&(T=K.tracks[J],T.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime);x&&!A.videoSegmentStream&&(A.coalesceStream.numberOfTracks++,A.videoSegmentStream=new wl(x,m),A.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!m.keepOriginalTimestamps&&(T.timelineStartInfo=oe,A.audioSegmentStream.setEarliestDts(oe.dts-v.baseMediaDecodeTime))}),A.videoSegmentStream.on("processedGopsInfo",v.trigger.bind(v,"gopInfo")),A.videoSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"videoSegmentTimingInfo")),A.videoSegmentStream.on("baseMediaDecodeTime",function(oe){T&&A.audioSegmentStream.setVideoBaseMediaDecodeTime(oe)}),A.videoSegmentStream.on("timingInfo",v.trigger.bind(v,"videoTimingInfo")),A.h264Stream.pipe(A.videoSegmentStream).pipe(A.coalesceStream)),T&&!A.audioSegmentStream&&(A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Oa(T,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.audioSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"audioSegmentTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream)),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x})}}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("id3Frame",function(K){K.dispatchType=A.metadataStream.dispatchType,v.trigger("id3Frame",K)}),A.coalesceStream.on("caption",this.trigger.bind(this,"caption")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,A)},this.setBaseMediaDecodeTime=function(A){var K=this.transmuxPipeline_;m.keepOriginalTimestamps||(this.baseMediaDecodeTime=A),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Kr.clearDtsInfo(T),K.audioTimestampRolloverStream&&K.audioTimestampRolloverStream.discontinuity()),x&&(K.videoSegmentStream&&(K.videoSegmentStream.gopCache_=[]),x.timelineStartInfo.dts=void 0,x.timelineStartInfo.pts=void 0,Kr.clearDtsInfo(x),K.captionStream.reset()),K.timestampRolloverStream&&K.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(A){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(A)},this.setRemux=function(A){var K=this.transmuxPipeline_;m.remux=A,K&&K.coalesceStream&&K.coalesceStream.setRemux(A)},this.alignGopsWith=function(A){x&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(A)},this.getLogTrigger_=function(A){var K=this;return function(J){J.stream=A,K.trigger("log",J)}},this.push=function(A){if(w){var K=A0(A);K&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!K&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),w=!1}this.transmuxPipeline_.headOfPipeline.push(A)},this.flush=function(){w=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Tl.prototype=new Ra;var D0={Transmuxer:Tl},M0=function(m){return m>>>0},j0=function(m){return("00"+m.toString(16)).slice(-2)},La={toUnsigned:M0,toHexString:j0},Oo=function(m){var v="";return v+=String.fromCharCode(m[0]),v+=String.fromCharCode(m[1]),v+=String.fromCharCode(m[2]),v+=String.fromCharCode(m[3]),v},Od=Oo,Ld=La.toUnsigned,Id=Od,Fu=function(m,v){var w=[],x,T,A,K,J;if(!v.length)return null;for(x=0;x<m.byteLength;)T=Ld(m[x]<<24|m[x+1]<<16|m[x+2]<<8|m[x+3]),A=Id(m.subarray(x+4,x+8)),K=T>1?x+T:m.byteLength,A===v[0]&&(v.length===1?w.push(m.subarray(x+8,K)):(J=Fu(m.subarray(x+8,K),v.slice(1)),J.length&&(w=w.concat(J)))),x=K;return w},Sl=Fu,Bd=La.toUnsigned,Ia=l.getUint64,R0=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ia(m.subarray(4)):v.baseMediaDecodeTime=Bd(m[4]<<24|m[5]<<16|m[6]<<8|m[7]),v},Uu=R0,O0=function(m){var v=new DataView(m.buffer,m.byteOffset,m.byteLength),w={version:m[0],flags:new Uint8Array(m.subarray(1,4)),trackId:v.getUint32(4)},x=w.flags[2]&1,T=w.flags[2]&2,A=w.flags[2]&8,K=w.flags[2]&16,J=w.flags[2]&32,oe=w.flags[0]&65536,fe=w.flags[0]&131072,Ee;return Ee=8,x&&(Ee+=4,w.baseDataOffset=v.getUint32(12),Ee+=4),T&&(w.sampleDescriptionIndex=v.getUint32(Ee),Ee+=4),A&&(w.defaultSampleDuration=v.getUint32(Ee),Ee+=4),K&&(w.defaultSampleSize=v.getUint32(Ee),Ee+=4),J&&(w.defaultSampleFlags=v.getUint32(Ee)),oe&&(w.durationIsEmpty=!0),!x&&fe&&(w.baseDataOffsetIsMoof=!0),w},zu=O0,Pd=function(m){return{isLeading:(m[0]&12)>>>2,dependsOn:m[0]&3,isDependedOn:(m[1]&192)>>>6,hasRedundancy:(m[1]&48)>>>4,paddingValue:(m[1]&14)>>>1,isNonSyncSample:m[1]&1,degradationPriority:m[2]<<8|m[3]}},Lo=Pd,Ba=Lo,L0=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4)),samples:[]},w=new DataView(m.buffer,m.byteOffset,m.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,A=v.flags[1]&1,K=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,fe=w.getUint32(4),Ee=8,Xe;for(x&&(v.dataOffset=w.getInt32(Ee),Ee+=4),T&&fe&&(Xe={flags:Ba(m.subarray(Ee,Ee+4))},Ee+=4,A&&(Xe.duration=w.getUint32(Ee),Ee+=4),K&&(Xe.size=w.getUint32(Ee),Ee+=4),oe&&(v.version===1?Xe.compositionTimeOffset=w.getInt32(Ee):Xe.compositionTimeOffset=w.getUint32(Ee),Ee+=4),v.samples.push(Xe),fe--);fe--;)Xe={},A&&(Xe.duration=w.getUint32(Ee),Ee+=4),K&&(Xe.size=w.getUint32(Ee),Ee+=4),J&&(Xe.flags=Ba(m.subarray(Ee,Ee+4)),Ee+=4),oe&&(v.version===1?Xe.compositionTimeOffset=w.getInt32(Ee):Xe.compositionTimeOffset=w.getUint32(Ee),Ee+=4),v.samples.push(Xe);return v},Io=L0,$u={tfdt:Uu,trun:Io},Hu={parseTfdt:$u.tfdt,parseTrun:$u.trun},qu=function(m){for(var v=0,w=String.fromCharCode(m[v]),x="";w!=="\0";)x+=w,v++,w=String.fromCharCode(m[v]);return x+=w,x},Vu={uint8ToCString:qu},Bo=Vu.uint8ToCString,Fd=l.getUint64,Ud=function(m){var v=4,w=m[0],x,T,A,K,J,oe,fe,Ee;if(w===0){x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length;var Xe=new DataView(m.buffer);A=Xe.getUint32(v),v+=4,J=Xe.getUint32(v),v+=4,oe=Xe.getUint32(v),v+=4,fe=Xe.getUint32(v),v+=4}else if(w===1){var Xe=new DataView(m.buffer);A=Xe.getUint32(v),v+=4,K=Fd(m.subarray(v)),v+=8,oe=Xe.getUint32(v),v+=4,fe=Xe.getUint32(v),v+=4,x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length}Ee=new Uint8Array(m.subarray(v,m.byteLength));var Et={scheme_id_uri:x,value:T,timescale:A||1,presentation_time:K,presentation_time_delta:J,event_duration:oe,id:fe,message_data:Ee};return B0(w,Et)?Et:void 0},I0=function(m,v,w,x){return m||m===0?m/v:x+w/v},B0=function(m,v){var w=v.scheme_id_uri!=="\0",x=m===0&&zd(v.presentation_time_delta)&&w,T=m===1&&zd(v.presentation_time)&&w;return!(m>1)&&x||T},zd=function(m){return m!==void 0||m!==null},P0={parseEmsgBox:Ud,scaleTime:I0},Po;typeof window<"u"?Po=window:typeof n<"u"?Po=n:typeof self<"u"?Po=self:Po={};var yr=Po,Os=La.toUnsigned,Pa=La.toHexString,Ci=Sl,sa=Od,kl=P0,Gu=zu,F0=Io,Fa=Uu,Ku=l.getUint64,Ua,El,Wu,Ls,aa,Fo,Xu,Ts=yr,$d=_t.parseId3Frames;Ua=function(m){var v={},w=Ci(m,["moov","trak"]);return w.reduce(function(x,T){var A,K,J,oe,fe;return A=Ci(T,["tkhd"])[0],!A||(K=A[0],J=K===0?12:20,oe=Os(A[J]<<24|A[J+1]<<16|A[J+2]<<8|A[J+3]),fe=Ci(T,["mdia","mdhd"])[0],!fe)?null:(K=fe[0],J=K===0?12:20,x[oe]=Os(fe[J]<<24|fe[J+1]<<16|fe[J+2]<<8|fe[J+3]),x)},v)},El=function(m,v){var w;w=Ci(v,["moof","traf"]);var x=w.reduce(function(T,A){var K=Ci(A,["tfhd"])[0],J=Os(K[4]<<24|K[5]<<16|K[6]<<8|K[7]),oe=m[J]||9e4,fe=Ci(A,["tfdt"])[0],Ee=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),Xe;fe[0]===1?Xe=Ku(fe.subarray(4,12)):Xe=Ee.getUint32(4);let Et;return typeof Xe=="bigint"?Et=Xe/Ts.BigInt(oe):typeof Xe=="number"&&!isNaN(Xe)&&(Et=Xe/oe),Et<Number.MAX_SAFE_INTEGER&&(Et=Number(Et)),Et<T&&(T=Et),T},1/0);return typeof x=="bigint"||isFinite(x)?x:0},Wu=function(m,v){var w=Ci(v,["moof","traf"]),x=0,T=0,A;if(w&&w.length){var K=Ci(w[0],["tfhd"])[0],J=Ci(w[0],["trun"])[0],oe=Ci(w[0],["tfdt"])[0];if(K){var fe=Gu(K);A=fe.trackId}if(oe){var Ee=Fa(oe);x=Ee.baseMediaDecodeTime}if(J){var Xe=F0(J);Xe.samples&&Xe.samples.length&&(T=Xe.samples[0].compositionTimeOffset||0)}}var Et=m[A]||9e4;typeof x=="bigint"&&(T=Ts.BigInt(T),Et=Ts.BigInt(Et));var it=(x+T)/Et;return typeof it=="bigint"&&it<Number.MAX_SAFE_INTEGER&&(it=Number(it)),it},Ls=function(m){var v=Ci(m,["moov","trak"]),w=[];return v.forEach(function(x){var T=Ci(x,["mdia","hdlr"]),A=Ci(x,["tkhd"]);T.forEach(function(K,J){var oe=sa(K.subarray(8,12)),fe=A[J],Ee,Xe,Et;oe==="vide"&&(Ee=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),Xe=Ee.getUint8(0),Et=Xe===0?Ee.getUint32(12):Ee.getUint32(20),w.push(Et))})}),w},Fo=function(m){var v=m[0],w=v===0?12:20;return Os(m[w]<<24|m[w+1]<<16|m[w+2]<<8|m[w+3])},aa=function(m){var v=Ci(m,["moov","trak"]),w=[];return v.forEach(function(x){var T={},A=Ci(x,["tkhd"])[0],K,J;A&&(K=new DataView(A.buffer,A.byteOffset,A.byteLength),J=K.getUint8(0),T.id=J===0?K.getUint32(12):K.getUint32(20));var oe=Ci(x,["mdia","hdlr"])[0];if(oe){var fe=sa(oe.subarray(8,12));fe==="vide"?T.type="video":fe==="soun"?T.type="audio":T.type=fe}var Ee=Ci(x,["mdia","minf","stbl","stsd"])[0];if(Ee){var Xe=Ee.subarray(8);T.codec=sa(Xe.subarray(4,8));var Et=Ci(Xe,[T.codec])[0],it,It;Et&&(/^[asm]vc[1-9]$/i.test(T.codec)?(it=Et.subarray(78),It=sa(it.subarray(4,8)),It==="avcC"&&it.length>11?(T.codec+=".",T.codec+=Pa(it[9]),T.codec+=Pa(it[10]),T.codec+=Pa(it[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(it=Et.subarray(28),It=sa(it.subarray(4,8)),It==="esds"&&it.length>20&&it[19]!==0?(T.codec+="."+Pa(it[19]),T.codec+="."+Pa(it[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var mn=Ci(x,["mdia","mdhd"])[0];mn&&(T.timescale=Fo(mn)),w.push(T)}),w},Xu=function(m,v=0){var w=Ci(m,["emsg"]);return w.map(x=>{var T=kl.parseEmsgBox(new Uint8Array(x)),A=$d(T.message_data);return{cueTime:kl.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,v),duration:kl.scaleTime(T.event_duration,T.timescale),frames:A}})};var za={findBox:Ci,parseType:sa,timescale:Ua,startTime:El,compositionStartTime:Wu,videoTrackIds:Ls,tracks:aa,getTimescaleFromMediaHeader:Fo,getEmsgID3:Xu};const{parseTrun:Hd}=Hu,{findBox:qd}=za;var Vd=yr,U0=function(m){var v=qd(m,["moof","traf"]),w=qd(m,["mdat"]),x=[];return w.forEach(function(T,A){var K=v[A];x.push({mdat:T,traf:K})}),x},Gd=function(m,v,w){var x=v,T=w.defaultSampleDuration||0,A=w.defaultSampleSize||0,K=w.trackId,J=[];return m.forEach(function(oe){var fe=Hd(oe),Ee=fe.samples;Ee.forEach(function(Xe){Xe.duration===void 0&&(Xe.duration=T),Xe.size===void 0&&(Xe.size=A),Xe.trackId=K,Xe.dts=x,Xe.compositionTimeOffset===void 0&&(Xe.compositionTimeOffset=0),typeof x=="bigint"?(Xe.pts=x+Vd.BigInt(Xe.compositionTimeOffset),x+=Vd.BigInt(Xe.duration)):(Xe.pts=x+Xe.compositionTimeOffset,x+=Xe.duration)}),J=J.concat(Ee)}),J},Yu={getMdatTrafPairs:U0,parseSamples:Gd},Qu=ln.discardEmulationPreventionBytes,Wr=zn.CaptionStream,$a=Sl,Nr=Uu,Ha=zu,{getMdatTrafPairs:Zu,parseSamples:Cl}=Yu,Al=function(m,v){for(var w=m,x=0;x<v.length;x++){var T=v[x];if(w<T.size)return T;w-=T.size}return null},Ju=function(m,v,w){var x=new DataView(m.buffer,m.byteOffset,m.byteLength),T={logs:[],seiNals:[]},A,K,J,oe;for(K=0;K+4<m.length;K+=J)if(J=x.getUint32(K),K+=4,!(J<=0))switch(m[K]&31){case 6:var fe=m.subarray(K+1,K+1+J),Ee=Al(K,v);if(A={nalUnitType:"sei_rbsp",size:J,data:fe,escapedRBSP:Qu(fe),trackId:w},Ee)A.pts=Ee.pts,A.dts=Ee.dts,oe=Ee;else if(oe)A.pts=oe.pts,A.dts=oe.dts;else{T.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+K+" for trackId "+w+". See mux.js#223."});break}T.seiNals.push(A);break}return T},oa=function(m,v){var w={},x=Zu(m);return x.forEach(function(T){var A=T.mdat,K=T.traf,J=$a(K,["tfhd"]),oe=Ha(J[0]),fe=oe.trackId,Ee=$a(K,["tfdt"]),Xe=Ee.length>0?Nr(Ee[0]).baseMediaDecodeTime:0,Et=$a(K,["trun"]),it,It;v===fe&&Et.length>0&&(it=Cl(Et,Xe,oe),It=Ju(A,it,fe),w[fe]||(w[fe]={seiNals:[],logs:[]}),w[fe].seiNals=w[fe].seiNals.concat(It.seiNals),w[fe].logs=w[fe].logs.concat(It.logs))}),w},Kd=function(m,v,w){var x;if(v===null)return null;x=oa(m,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:w}},Nl=function(){var m=!1,v,w,x,T,A,K;this.isInitialized=function(){return m},this.init=function(J){v=new Wr,m=!0,K=J?J.isPartial:!1,v.on("data",function(oe){oe.startTime=oe.startPts/T,oe.endTime=oe.endPts/T,A.captions.push(oe),A.captionStreams[oe.stream]=!0}),v.on("log",function(oe){A.logs.push(oe)})},this.isNewInit=function(J,oe){return J&&J.length===0||oe&&typeof oe=="object"&&Object.keys(oe).length===0?!1:x!==J[0]||T!==oe[x]},this.parse=function(J,oe,fe){var Ee;if(this.isInitialized()){if(!oe||!fe)return null;if(this.isNewInit(oe,fe))x=oe[0],T=fe[x];else if(x===null||!T)return w.push(J),null}else return null;for(;w.length>0;){var Xe=w.shift();this.parse(Xe,oe,fe)}return Ee=Kd(J,x,T),Ee&&Ee.logs&&(A.logs=A.logs.concat(Ee.logs)),Ee===null||!Ee.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ee.seiNals),this.flushStream(),A)},this.pushNals=function(J){if(!this.isInitialized()||!J||J.length===0)return null;J.forEach(function(oe){v.push(oe)})},this.flushStream=function(){if(!this.isInitialized())return null;K?v.partialFlush():v.flush()},this.clearParsedCaptions=function(){A.captions=[],A.captionStreams={},A.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;v.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){w=[],x=null,T=null,A?this.clearParsedCaptions():A={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},qa=Nl;const{parseTfdt:z0}=Hu,Ui=Sl,{getTimescaleFromMediaHeader:ec}=za,{parseSamples:Ss,getMdatTrafPairs:Wd}=Yu;var Is=function(){let m=9e4;this.init=function(v){const w=Ui(v,["moov","trak","mdia","mdhd"])[0];w&&(m=ec(w))},this.parseSegment=function(v){const w=[],x=Wd(v);let T=0;return x.forEach(function(A){const K=A.mdat,J=A.traf,oe=Ui(J,["tfdt"])[0],fe=Ui(J,["tfhd"])[0],Ee=Ui(J,["trun"]);if(oe&&(T=z0(oe).baseMediaDecodeTime),Ee.length&&fe){const Xe=Ss(Ee,T,fe);let Et=0;Xe.forEach(function(it){const It="utf-8",mn=new TextDecoder(It),Vi=K.slice(Et,Et+it.size);if(Ui(Vi,["vtte"])[0]){Et+=it.size;return}Ui(Vi,["vttc"]).forEach(function(Ho){const Ti=Ui(Ho,["payl"])[0],la=Ui(Ho,["sttg"])[0],ks=it.pts/m,$s=(it.pts+it.duration)/m;let si,ls;if(Ti)try{si=mn.decode(Ti)}catch(sr){console.error(sr)}if(la)try{ls=mn.decode(la)}catch(sr){console.error(sr)}it.duration&&si&&w.push({cueText:si,start:ks,end:$s,settings:ls})}),Et+=it.size})}}),w}},Uo=Kn,nc=function(m){var v=m[1]&31;return v<<=8,v|=m[2],v},Va=function(m){return!!(m[1]&64)},zo=function(m){var v=0;return(m[3]&48)>>>4>1&&(v+=m[4]+1),v},Dr=function(m,v){var w=nc(m);return w===0?"pat":w===v?"pmt":v?"pes":null},Ga=function(m){var v=Va(m),w=4+zo(m);return v&&(w+=m[w]+1),(m[w+10]&31)<<8|m[w+11]},Ka=function(m){var v={},w=Va(m),x=4+zo(m);if(w&&(x+=m[x]+1),!!(m[x+5]&1)){var T,A,K;T=(m[x+1]&15)<<8|m[x+2],A=3+T-4,K=(m[x+10]&15)<<8|m[x+11];for(var J=12+K;J<A;){var oe=x+J;v[(m[oe+1]&31)<<8|m[oe+2]]=m[oe],J+=((m[oe+3]&15)<<8|m[oe+4])+5}return v}},Dl=function(m,v){var w=nc(m),x=v[w];switch(x){case Uo.H264_STREAM_TYPE:return"video";case Uo.ADTS_STREAM_TYPE:return"audio";case Uo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},$o=function(m){var v=Va(m);if(!v)return null;var w=4+zo(m);if(w>=m.byteLength)return null;var x=null,T;return T=m[w+7],T&192&&(x={},x.pts=(m[w+9]&14)<<27|(m[w+10]&255)<<20|(m[w+11]&254)<<12|(m[w+12]&255)<<5|(m[w+13]&254)>>>3,x.pts*=4,x.pts+=(m[w+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(m[w+14]&14)<<27|(m[w+15]&255)<<20|(m[w+16]&254)<<12|(m[w+17]&255)<<5|(m[w+18]&254)>>>3,x.dts*=4,x.dts+=(m[w+18]&6)>>>1)),x},br=function(m){switch(m){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Mr=function(m){for(var v=4+zo(m),w=m.subarray(v),x=0,T=0,A=!1,K;T<w.byteLength-3;T++)if(w[T+2]===1){x=T+5;break}for(;x<w.byteLength;)switch(w[x]){case 0:if(w[x-1]!==0){x+=2;break}else if(w[x-2]!==0){x++;break}T+3!==x-2&&(K=br(w[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0));do x++;while(w[x]!==1&&x<w.length);T=x-2,x+=3;break;case 1:if(w[x-1]!==0||w[x-2]!==0){x+=3;break}K=br(w[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0),T=x-2,x+=3;break;default:x+=3;break}return w=w.subarray(T),x-=T,T=0,w&&w.byteLength>3&&(K=br(w[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},Bs={parseType:Dr,parsePat:Ga,parsePmt:Ka,parsePayloadUnitStartIndicator:Va,parsePesType:Dl,parsePesTime:$o,videoPacketContainsKeyFrame:Mr},Xr=Kn,hr=_e.handleRollover,Nn={};Nn.ts=Bs,Nn.aac=dr;var Ps=pt.ONE_SECOND_IN_TS,tr=188,jr=71,Xd=function(m,v){for(var w=0,x=tr,T,A;x<m.byteLength;){if(m[w]===jr&&m[x]===jr){switch(T=m.subarray(w,x),A=Nn.ts.parseType(T,v.pid),A){case"pat":v.pid=Nn.ts.parsePat(T);break;case"pmt":var K=Nn.ts.parsePmt(T);v.table=v.table||{},Object.keys(K).forEach(function(J){v.table[J]=K[J]});break}w+=tr,x+=tr;continue}w++,x++}},Yi=function(m,v,w){for(var x=0,T=tr,A,K,J,oe,fe,Ee=!1;T<=m.byteLength;){if(m[x]===jr&&(m[T]===jr||T===m.byteLength)){if(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K==="pes"&&(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="audio",w.audio.push(fe),Ee=!0))),Ee)break;x+=tr,T+=tr;continue}x++,T++}for(T=m.byteLength,x=T-tr,Ee=!1;x>=0;){if(m[x]===jr&&(m[T]===jr||T===m.byteLength)){if(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K==="pes"&&(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="audio",w.audio.push(fe),Ee=!0))),Ee)break;x-=tr,T-=tr;continue}x--,T--}},yi=function(m,v,w){for(var x=0,T=tr,A,K,J,oe,fe,Ee,Xe,Et,it=!1,It={data:[],size:0};T<m.byteLength;){if(m[x]===jr&&m[T]===jr){switch(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K){case"pes":if(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&(oe&&!it&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="video",w.video.push(fe),it=!0)),!w.firstKeyFrame)){if(oe&&It.size!==0){for(Ee=new Uint8Array(It.size),Xe=0;It.data.length;)Et=It.data.shift(),Ee.set(Et,Xe),Xe+=Et.byteLength;if(Nn.ts.videoPacketContainsKeyFrame(Ee)){var mn=Nn.ts.parsePesTime(Ee);mn?(w.firstKeyFrame=mn,w.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}It.size=0}It.data.push(A),It.size+=A.byteLength}break}if(it&&w.firstKeyFrame)break;x+=tr,T+=tr;continue}x++,T++}for(T=m.byteLength,x=T-tr,it=!1;x>=0;){if(m[x]===jr&&m[T]===jr){if(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K==="pes"&&(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&oe&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="video",w.video.push(fe),it=!0))),it)break;x-=tr,T-=tr;continue}x--,T--}},Ln=function(m,v){if(m.audio&&m.audio.length){var w=v;(typeof w>"u"||isNaN(w))&&(w=m.audio[0].dts),m.audio.forEach(function(A){A.dts=hr(A.dts,w),A.pts=hr(A.pts,w),A.dtsTime=A.dts/Ps,A.ptsTime=A.pts/Ps})}if(m.video&&m.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=m.video[0].dts),m.video.forEach(function(A){A.dts=hr(A.dts,x),A.pts=hr(A.pts,x),A.dtsTime=A.dts/Ps,A.ptsTime=A.pts/Ps}),m.firstKeyFrame){var T=m.firstKeyFrame;T.dts=hr(T.dts,x),T.pts=hr(T.pts,x),T.dtsTime=T.dts/Ps,T.ptsTime=T.pts/Ps}}},Fs=function(m){for(var v=!1,w=0,x=null,T=null,A=0,K=0,J;m.length-K>=3;){var oe=Nn.aac.parseType(m,K);switch(oe){case"timed-metadata":if(m.length-K<10){v=!0;break}if(A=Nn.aac.parseId3TagSize(m,K),A>m.length){v=!0;break}T===null&&(J=m.subarray(K,K+A),T=Nn.aac.parseAacTimestamp(J)),K+=A;break;case"audio":if(m.length-K<7){v=!0;break}if(A=Nn.aac.parseAdtsSize(m,K),A>m.length){v=!0;break}x===null&&(J=m.subarray(K,K+A),x=Nn.aac.parseSampleRate(J)),w++,K+=A;break;default:K++;break}if(v)return null}if(x===null||T===null)return null;var fe=Ps/x,Ee={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+w*1024*fe,pts:T+w*1024*fe}]};return Ee},Rr=function(m){var v={pid:null,table:null},w={};Xd(m,v);for(var x in v.table)if(v.table.hasOwnProperty(x)){var T=v.table[x];switch(T){case Xr.H264_STREAM_TYPE:w.video=[],yi(m,v,w),w.video.length===0&&delete w.video;break;case Xr.ADTS_STREAM_TYPE:w.audio=[],Yi(m,v,w),w.audio.length===0&&delete w.audio;break}}return w},ic=function(m,v){var w=Nn.aac.isLikelyAacData(m),x;return w?x=Fs(m):x=Rr(m),!x||!x.audio&&!x.video?null:(Ln(x,v),x)},Us={inspect:ic,parseAudioPes_:Yi};const Yd=function(m,v){v.on("data",function(w){const x=w.initSegment;w.initSegment={data:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength};const T=w.data;w.data=T.buffer,m.postMessage({action:"data",segment:w,byteOffset:T.byteOffset,byteLength:T.byteLength},[w.data])}),v.on("done",function(w){m.postMessage({action:"done"})}),v.on("gopInfo",function(w){m.postMessage({action:"gopInfo",gopInfo:w})}),v.on("videoSegmentTimingInfo",function(w){const x={start:{decode:pt.videoTsToSeconds(w.start.dts),presentation:pt.videoTsToSeconds(w.start.pts)},end:{decode:pt.videoTsToSeconds(w.end.dts),presentation:pt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:pt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=pt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(w){const x={start:{decode:pt.videoTsToSeconds(w.start.dts),presentation:pt.videoTsToSeconds(w.start.pts)},end:{decode:pt.videoTsToSeconds(w.end.dts),presentation:pt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:pt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=pt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(w){m.postMessage({action:"id3Frame",id3Frame:w})}),v.on("caption",function(w){m.postMessage({action:"caption",caption:w})}),v.on("trackinfo",function(w){m.postMessage({action:"trackinfo",trackInfo:w})}),v.on("audioTimingInfo",function(w){m.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:pt.videoTsToSeconds(w.start),end:pt.videoTsToSeconds(w.end)}})}),v.on("videoTimingInfo",function(w){m.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:pt.videoTsToSeconds(w.start),end:pt.videoTsToSeconds(w.end)}})}),v.on("log",function(w){m.postMessage({action:"log",log:w})})};class rc{constructor(v,w){this.options=w||{},this.self=v,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new D0.Transmuxer(this.options),Yd(this.self,this.transmuxer)}pushMp4Captions(v){this.captionParser||(this.captionParser=new qa,this.captionParser.init());const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.captionParser.parse(w,v.trackIds,v.timescales);this.self.postMessage({action:"mp4Captions",captions:x&&x.captions||[],logs:x&&x.logs||[],data:w.buffer},[w.buffer])}initMp4WebVttParser(v){this.webVttParser||(this.webVttParser=new Is);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.webVttParser.init(w)}getMp4WebVttText(v){this.webVttParser||(this.webVttParser=new Is);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.webVttParser.parseSegment(w);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:x||[],data:w.buffer},[w.buffer])}probeMp4StartTime({timescales:v,data:w}){const x=za.startTime(v,w);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:w},[w.buffer])}probeMp4Tracks({data:v}){const w=za.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:w,data:v},[v.buffer])}probeEmsgID3({data:v,offset:w}){const x=za.getEmsgID3(v,w);this.self.postMessage({action:"probeEmsgID3",id3Frames:x,emsgData:v},[v.buffer])}probeTs({data:v,baseStartTime:w}){const x=typeof w=="number"&&!isNaN(w)?w*pt.ONE_SECOND_IN_TS:void 0,T=Us.inspect(v,x);let A=null;T&&(A={hasVideo:T.video&&T.video.length===2||!1,hasAudio:T.audio&&T.audio.length===2||!1},A.hasVideo&&(A.videoStart=T.video[0].ptsTime),A.hasAudio&&(A.audioStart=T.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:A,data:v},[v.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(v){const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.transmuxer.push(w)}reset(){this.transmuxer.reset()}setTimestampOffset(v){const w=v.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(pt.secondsToVideoTs(w)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(pt.secondsToVideoTs(v.appendStart)))}setRemux(v){this.transmuxer.setRemux(v.remux)}flush(v){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(v){this.transmuxer.alignGopsWith(v.gopsToAlignWith.slice())}}self.onmessage=function(m){if(m.data.action==="init"&&m.data.options){this.messageHandlers=new rc(self,m.data.options);return}this.messageHandlers||(this.messageHandlers=new rc(self)),m.data&&m.data.action&&m.data.action!=="init"&&this.messageHandlers[m.data.action]&&this.messageHandlers[m.data.action](m.data)}}));var Jj=XS(Zj);const eR=(n,e,t)=>{const{type:i,initSegment:a,captions:l,captionStreams:u,metadata:h,videoFrameDtsTime:f,videoFramePtsTime:g}=n.data.segment;e.buffer.push({captions:l,captionStreams:u,metadata:h});const _=n.data.segment.boxes||{data:n.data.segment.data},S={type:i,data:new Uint8Array(_.data,_.data.byteOffset,_.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};typeof f<"u"&&(S.videoFrameDtsTime=f),typeof g<"u"&&(S.videoFramePtsTime=g),t(S)},tR=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},nR=(n,e)=>{e.gopInfo=n.data.gopInfo},ZS=n=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:a,remux:l,onData:u,onTrackInfo:h,onAudioTimingInfo:f,onVideoTimingInfo:g,onVideoSegmentTimingInfo:_,onAudioSegmentTimingInfo:S,onId3:C,onCaptions:N,onDone:O,onEndedTimeline:E,onTransmuxerLog:B,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:U}=n,re={buffer:[]};let W=H;const X=le=>{e.currentTransmux===n&&(le.data.action==="data"&&eR(le,re,u),le.data.action==="trackinfo"&&h(le.data.trackInfo),le.data.action==="gopInfo"&&nR(le,re),le.data.action==="audioTimingInfo"&&f(le.data.audioTimingInfo),le.data.action==="videoTimingInfo"&&g(le.data.videoTimingInfo),le.data.action==="videoSegmentTimingInfo"&&_(le.data.videoSegmentTimingInfo),le.data.action==="audioSegmentTimingInfo"&&S(le.data.audioSegmentTimingInfo),le.data.action==="id3Frame"&&C([le.data.id3Frame],le.data.id3Frame.dispatchType),le.data.action==="caption"&&N(le.data.caption),le.data.action==="endedtimeline"&&(W=!1,E()),le.data.action==="log"&&B(le.data.log),le.data.type==="transmuxed"&&(W||(e.onmessage=null,tR({transmuxedData:re,callback:O}),JS(e))))},R=()=>{const le={message:"Received an error message from the transmuxer worker",metadata:{errorType:Fe.Error.StreamingFailedToTransmuxSegment,segmentInfo:al({segment:Y})}};O(null,le)};if(e.onmessage=X,e.onerror=R,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(a)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:a}),typeof l<"u"&&e.postMessage({action:"setRemux",remux:l}),t.byteLength){const le=t instanceof ArrayBuffer?t:t.buffer,k=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:le,byteOffset:k,byteLength:t.byteLength},[le])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},JS=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():ZS(n.currentTransmux))},f_=(n,e)=>{n.postMessage({action:e}),JS(n)},ek=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,f_(e,n);return}e.transmuxQueue.push(f_.bind(null,e,n))},iR=n=>{ek("reset",n)},rR=n=>{ek("endTimeline",n)},tk=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,ZS(n);return}n.transmuxer.transmuxQueue.push(n)},sR=n=>{const e=new Jj;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:n}),e};var mg={reset:iR,endTimeline:rR,transmux:tk,createTransmuxer:sR};const fu=function(n){const e=n.transmuxer,t=n.endAction||n.action,i=n.callback,a=Xi({},n,{endAction:null,transmuxer:null,callback:null}),l=u=>{u.data.action===t&&(e.removeEventListener("message",l),u.data.data&&(u.data.data=new Uint8Array(u.data.data,n.byteOffset||0,n.byteLength||u.data.data.byteLength),n.data&&(n.data=u.data.data)),i(u.data))};if(e.addEventListener("message",l),n.data){const u=n.data instanceof ArrayBuffer;a.byteOffset=u?0:n.data.byteOffset,a.byteLength=n.data.byteLength;const h=[u?n.data:n.data.buffer];e.postMessage(a,h)}else e.postMessage(a)},Zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},nk="wvtt",ly=n=>{n.forEach(e=>{e.abort()})},aR=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),oR=n=>{const e=n.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=n.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},sb=(n,e)=>{const{requestType:t}=e,i=ml({requestType:t,request:e,error:n});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Zs.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Zs.ABORTED,xhr:e,metadata:i}:n?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Zs.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Zs.FAILURE,xhr:e,metadata:i}:null},m_=(n,e,t,i)=>(a,l)=>{const u=l.response,h=sb(a,l);if(h)return t(h,n);if(u.byteLength!==16)return t({status:l.status,message:"Invalid HLS key at URL: "+l.uri,code:Zs.FAILURE,xhr:l},n);const f=new DataView(u),g=new Uint32Array([f.getUint32(0),f.getUint32(4),f.getUint32(8),f.getUint32(12)]);for(let S=0;S<e.length;S++)e[S].bytes=g;const _={uri:l.uri};return i({type:"segmentkeyloadcomplete",segment:n,keyInfo:_}),t(null,n)},lR=(n,e)=>{e===nk&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},uR=(n,e,t)=>{e===nk&&fu({action:"getMp4WebVttText",data:n.bytes,transmuxer:n.transmuxer,callback:({data:i,mp4VttCues:a})=>{n.bytes=i,t(null,n,{mp4VttCues:a})}})},ik=(n,e)=>{const t=Ay(n.map.bytes);if(t!=="mp4"){const i=n.map.resolvedUri||n.map.uri,a=t||"unknown";return e({internal:!0,message:`Found unsupported ${a} container for initialization segment at URL: ${i}`,code:Zs.FAILURE,metadata:{mediaType:a}})}fu({action:"probeMp4Tracks",data:n.map.bytes,transmuxer:n.transmuxer,callback:({tracks:i,data:a})=>(n.map.bytes=a,i.forEach(function(l){n.map.tracks=n.map.tracks||{},!n.map.tracks[l.type]&&(n.map.tracks[l.type]=l,typeof l.id=="number"&&l.timescale&&(n.map.timescales=n.map.timescales||{},n.map.timescales[l.id]=l.timescale),l.type==="text"&&lR(n,l.codec))}),e(null))})},cR=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=sb(i,a);if(l)return e(l,n);const u=new Uint8Array(a.response);if(t({type:"segmentloaded",segment:n}),n.map.key)return n.map.encryptedBytes=u,e(null,n);n.map.bytes=u,ik(n,function(h){if(h)return h.xhr=a,h.status=a.status,e(h,n);e(null,n)})},dR=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=sb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:Yj(l.responseText.substring(n.lastReachedChar||0));return n.stats=aR(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},hR=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{const O=n.map&&n.map.tracks||{},E=!!(O.audio&&O.video);let B=i.bind(null,n,"audio","start");const H=i.bind(null,n,"audio","end");let Y=i.bind(null,n,"video","start");const U=i.bind(null,n,"video","end"),re=()=>tk({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:E,onData:W=>{W.type=W.type==="combined"?"video":W.type,_(n,W)},onTrackInfo:W=>{t&&(E&&(W.isMuxed=!0),t(n,W))},onAudioTimingInfo:W=>{B&&typeof W.start<"u"&&(B(W.start),B=null),H&&typeof W.end<"u"&&H(W.end)},onVideoTimingInfo:W=>{Y&&typeof W.start<"u"&&(Y(W.start),Y=null),U&&typeof W.end<"u"&&U(W.end)},onVideoSegmentTimingInfo:W=>{const X={pts:{start:W.start.presentation,end:W.end.presentation},dts:{start:W.start.decode,end:W.end.decode}};N({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:X}),a(W)},onAudioSegmentTimingInfo:W=>{const X={pts:{start:W.start.pts,end:W.end.pts},dts:{start:W.start.dts,end:W.end.dts}};N({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:X}),l(W)},onId3:(W,X)=>{u(n,W,X)},onCaptions:W=>{h(n,[W])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:C,onDone:(W,X)=>{S&&(W.type=W.type==="combined"?"video":W.type,N({type:"segmenttransmuxingcomplete",segment:n}),S(X,n,W))},segment:n,triggerSegmentEventFn:N});fu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:W=>{n.bytes=e=W.data;const X=W.result;X&&(t(n,{hasAudio:X.hasAudio,hasVideo:X.hasVideo,isMuxed:E}),t=null),re()}})},rk=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{let O=new Uint8Array(e);if(R4(O)){n.isFmp4=!0;const{tracks:E}=n.map;if(E.text&&(!E.audio||!E.video)){_(n,{data:O,type:"text"}),uR(n,E.text.codec,S);return}const H={isFmp4:!0,hasVideo:!!E.video,hasAudio:!!E.audio};E.audio&&E.audio.codec&&E.audio.codec!=="enca"&&(H.audioCodec=E.audio.codec),E.video&&E.video.codec&&E.video.codec!=="encv"&&(H.videoCodec=E.video.codec),E.video&&E.audio&&(H.isMuxed=!0),t(n,H);const Y=(U,re)=>{_(n,{data:O,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),re&&re.length&&u(n,re),U&&U.length&&h(n,U),S(null,n,{})};fu({action:"probeMp4StartTime",timescales:n.map.timescales,data:O,transmuxer:n.transmuxer,callback:({data:U,startTime:re})=>{e=U.buffer,n.bytes=O=U,H.hasAudio&&!H.isMuxed&&i(n,"audio","start",re),H.hasVideo&&i(n,"video","start",re),fu({action:"probeEmsgID3",data:O,transmuxer:n.transmuxer,offset:re,callback:({emsgData:W,id3Frames:X})=>{if(e=W.buffer,n.bytes=O=W,!E.video||!W.byteLength||!n.transmuxer){Y(void 0,X);return}fu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:O,timescales:n.map.timescales,trackIds:[E.video.id],callback:R=>{e=R.data.buffer,n.bytes=O=R.data,R.logs.forEach(function(le){C(ri(le,{stream:"mp4CaptionParser"}))}),Y(R.captions,X)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=Ay(O)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}hR({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})},sk=function({id:n,key:e,encryptedBytes:t,decryptionWorker:i,segment:a,doneFn:l},u){const h=g=>{if(g.data.source===n){i.removeEventListener("message",h);const _=g.data.decrypted;u(new Uint8Array(_.bytes,_.byteOffset,_.byteLength))}};i.onerror=()=>{const g="An error occurred in the decryption worker",_=al({segment:a}),S={message:g,metadata:{error:new Error(g),errorType:Fe.Error.StreamingFailedToDecryptSegment,segmentInfo:_,keyInfo:{uri:a.key.resolvedUri||a.map.key.resolvedUri}}};l(S,a)},i.addEventListener("message",h);let f;e.bytes.slice?f=e.bytes.slice():f=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(HS({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},fR=({decryptionWorker:n,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{N({type:"segmentdecryptionstart"}),sk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},O=>{e.bytes=O,N({type:"segmentdecryptioncomplete",segment:e}),rk({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})})},mR=({activeXhrs:n,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{let O=0,E=!1;return(B,H)=>{if(!E){if(B)return E=!0,ly(n),S(B,H);if(O+=1,O===n.length){const Y=function(){if(H.encryptedBytes)return fR({decryptionWorker:e,segment:H,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N});rk({segment:H,bytes:H.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return N({type:"segmentdecryptionstart",segment:H}),sk({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:S},U=>{H.map.bytes=U,N({type:"segmentdecryptioncomplete",segment:H}),ik(H,re=>{if(re)return ly(n),S(re,H);Y()})});Y()}}}},pR=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},gR=({segment:n,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_})=>S=>{if(!S.target.aborted)return n.stats=ri(n.stats,oR(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},yR=({xhr:n,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:a,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:H})=>{const Y=[],U=mR({activeXhrs:Y,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:H});if(i.key&&!i.key.bytes){const le=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&le.push(i.map.key);const k=ri(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),j=m_(i,le,U,H),Z={uri:i.key.resolvedUri};H({type:"segmentkeyloadstart",segment:i,keyInfo:Z});const V=n(k,j);Y.push(V)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const V=ri(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ne=m_(i,[i.map.key],U,H),me={uri:i.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:i,keyInfo:me});const ue=n(V,ne);Y.push(ue)}const k=ri(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:ay(i.map),requestType:"segment-media-initialization"}),j=cR({segment:i,finishProcessingFn:U,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:i});const Z=n(k,j);Y.push(Z)}const re=ri(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:ay(i),requestType:"segment"}),W=dR({segment:i,finishProcessingFn:U,responseType:re.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:i});const X=n(re,W);X.addEventListener("progress",gR({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O})),Y.push(X);const R={};return Y.forEach(le=>{le.addEventListener("loadend",pR({loadendState:R,abortFn:a}))}),()=>ly(Y)},Jh=xs("PlaylistSelector"),p_=function(n){if(!n||!n.playlist)return;const e=n.playlist;return JSON.stringify({id:e.id,bandwidth:n.bandwidth,width:n.width,height:n.height,codecs:e.attributes&&e.attributes.CODECS||""})},mu=function(n,e){if(!n)return"";const t=de.getComputedStyle(n);return t?t[e]:""},pu=function(n,e){const t=n.slice();n.sort(function(i,a){const l=e(i,a);return l===0?t.indexOf(i)-t.indexOf(a):l})},ab=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||de.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||de.Number.MAX_VALUE,t-i},bR=function(n,e){let t,i;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(t=n.attributes.RESOLUTION.width),t=t||de.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||de.Number.MAX_VALUE,t===i&&n.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?n.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let ak=function(n){const{main:e,bandwidth:t,playerWidth:i,playerHeight:a,playerObjectFit:l,limitRenditionByPlayerDimensions:u,playlistController:h}=n;if(!e)return;const f={bandwidth:t,width:i,height:a,limitRenditionByPlayerDimensions:u};let g=e.playlists;Hr.isAudioOnly(e)&&(g=h.getAudioTrackPlaylists_(),f.audioOnly=!0);let _=g.map(R=>{let le;const k=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,j=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return le=R.attributes&&R.attributes.BANDWIDTH,le=le||de.Number.MAX_VALUE,{bandwidth:le,width:k,height:j,playlist:R}});pu(_,(R,le)=>R.bandwidth-le.bandwidth),_=_.filter(R=>!Hr.isIncompatible(R.playlist));let S=_.filter(R=>Hr.isEnabled(R.playlist));S.length||(S=_.filter(R=>!Hr.isDisabled(R.playlist)));const C=S.filter(R=>R.bandwidth*lr.BANDWIDTH_VARIANCE<t);let N=C[C.length-1];const O=C.filter(R=>R.bandwidth===N.bandwidth)[0];if(u===!1){const R=O||S[0]||_[0];if(R&&R.playlist){let le="sortedPlaylistReps";return O&&(le="bandwidthBestRep"),S[0]&&(le="enabledPlaylistReps"),Jh(`choosing ${p_(R)} using ${le} with options`,f),R.playlist}return Jh("could not choose a playlist with options",f),null}const E=C.filter(R=>R.width&&R.height);pu(E,(R,le)=>R.width-le.width);const B=E.filter(R=>R.width===i&&R.height===a);N=B[B.length-1];const H=B.filter(R=>R.bandwidth===N.bandwidth)[0];let Y,U,re;H||(Y=E.filter(R=>l==="cover"?R.width>i&&R.height>a:R.width>i||R.height>a),U=Y.filter(R=>R.width===Y[0].width&&R.height===Y[0].height),N=U[U.length-1],re=U.filter(R=>R.bandwidth===N.bandwidth)[0]);let W;if(h.leastPixelDiffSelector){const R=E.map(le=>(le.pixelDiff=Math.abs(le.width-i)+Math.abs(le.height-a),le));pu(R,(le,k)=>le.pixelDiff===k.pixelDiff?k.bandwidth-le.bandwidth:le.pixelDiff-k.pixelDiff),W=R[0]}const X=W||re||H||O||S[0]||_[0];if(X&&X.playlist){let R="sortedPlaylistReps";return W?R="leastPixelDiffRep":re?R="resolutionPlusOneRep":H?R="resolutionBestRep":O?R="bandwidthBestRep":S[0]&&(R="enabledPlaylistReps"),Jh(`choosing ${p_(X)} using ${R} with options`,f),X.playlist}return Jh("could not choose a playlist with options",f),null};const g_=function(){let n=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),ak({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(mu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(mu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?mu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},vR=function(n){let e=-1,t=-1;if(n<0||n>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=n*this.systemBandwidth+(1-n)*e,t=this.systemBandwidth),ak({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(mu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(mu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?mu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},xR=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(O=>!Hr.isIncompatible(O));let _=g.filter(Hr.isEnabled);_.length||(_=g.filter(O=>!Hr.isDisabled(O)));const C=_.filter(Hr.hasAttribute.bind(null,"BANDWIDTH")).map(O=>{const B=f.getSyncPoint(O,a,h,t)?1:2,Y=Hr.estimateSegmentRequestTime(l,i,O)*B-u;return{playlist:O,rebufferingImpact:Y}}),N=C.filter(O=>O.rebufferingImpact<=0);return pu(N,(O,E)=>ab(E.playlist,O.playlist)),N.length?N[0]:(pu(C,(O,E)=>O.rebufferingImpact-E.rebufferingImpact),C[0]||null)},_R=function(){const n=this.playlists.main.playlists.filter(Hr.isEnabled);return pu(n,(t,i)=>ab(t,i)),n.filter(t=>!!od(this.playlists.main,t).video)[0]||null},wR=n=>{let e=0,t;return n.bytes&&(t=new Uint8Array(n.bytes),n.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function ok(n){try{return new URL(n).pathname.split("/").slice(-2).join("/")}catch{return""}}const TR=function(n,e,t){if(!n[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const a=e.textTracks().getTrackById(i);if(a)n[t]=a;else{const l=e.options_.vhs&&e.options_.vhs.captionServices||{};let u=t,h=t,f=!1;const g=l[i];g&&(u=g.label,h=g.language,f=g.default),n[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:f,label:u,language:h},!1).track}}},SR=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(a=>{const l=a.stream;a.content?a.content.forEach(u=>{const h=new i(a.startTime+t,a.endTime+t,u.text);h.line=u.line,h.align="left",h.position=u.position,h.positionAlign="line-left",n[l].addCue(h)}):n[l].addCue(new i(a.startTime+t,a.endTime+t,a.text))})},kR=function(n){Object.defineProperties(n.frame,{id:{get(){return Fe.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),n.value.key}},value:{get(){return Fe.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),n.value.data}},privateData:{get(){return Fe.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),n.value.data}}})},ER=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=de.WebKitDataCue||de.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(_=>{const S=_.cueTime+t;typeof S!="number"||de.isNaN(S)||S<0||!(S<1/0)||!_.frames||!_.frames.length||_.frames.forEach(C=>{const N=new a(S,S,C.value||C.url||C.data||"");N.frame=C,N.value=C,kR(N),l.addCue(N)})}),!l.cues||!l.cues.length))return;const u=l.cues,h=[];for(let _=0;_<u.length;_++)u[_]&&h.push(u[_]);const f=h.reduce((_,S)=>{const C=_[S.startTime]||[];return C.push(S),_[S.startTime]=C,_},{}),g=Object.keys(f).sort((_,S)=>Number(_)-Number(S));g.forEach((_,S)=>{const C=f[_],N=isFinite(i)?i:_,O=Number(g[S+1])||N;C.forEach(E=>{E.endTime=O})})},CR={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},AR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),NR=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(AR.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:CR[l],data:a[l]},(l==="scte35Out"||l==="scte35In")&&(u.value.data=new Uint8Array(u.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(u)}a.processDateRange()})},y_=(n,e,t)=>{n.metadataTrack_||(n.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Fe.browser.IS_ANY_SAFARI||(n.metadataTrack_.inBandMetadataTrackDispatchType=e))},Xc=function(n,e,t){let i,a;if(t&&t.cues)for(i=t.cues.length;i--;)a=t.cues[i],a.startTime>=n&&a.endTime<=e&&t.removeCue(a)},DR=function(n){const e=n.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const a=e[i],l=`${a.startTime}-${a.endTime}-${a.text}`;t[l]?n.removeCue(a):t[l]=a}},MR=(n,e,t)=>{if(typeof e>"u"||e===null||!n.length)return[];const i=Math.ceil((e-t+3)*ll.ONE_SECOND_IN_TS);let a;for(a=0;a<n.length&&!(n[a].pts>i);a++);return n.slice(a)},jR=(n,e,t)=>{if(!e.length)return n;if(t)return e.slice();const i=e[0].pts;let a=0;for(a;a<n.length&&!(n[a].pts>=i);a++);return n.slice(0,a).concat(e)},RR=(n,e,t,i)=>{const a=Math.ceil((e-i)*ll.ONE_SECOND_IN_TS),l=Math.ceil((t-i)*ll.ONE_SECOND_IN_TS),u=n.slice();let h=n.length;for(;h--&&!(n[h].pts<=l););if(h===-1)return u;let f=h+1;for(;f--&&!(n[f].pts<=a););return f=Math.max(f,0),u.splice(f,h-f+1),u},OR=function(n,e){if(!n&&!e||!n&&e||n&&!e)return!1;if(n===e)return!0;const t=Object.keys(n).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let a=0;a<t.length;a++){const l=t[a];if(l!==i[a]||n[l]!==e[l])return!1}return!0},LR=function(n,e,t){e=e||[];const i=[];let a=0;for(let l=0;l<e.length;l++){const u=e[l];if(n===u.timeline&&(i.push(l),a+=u.duration,a>t))return l}return i.length===0?0:i[i.length-1]},Uc=1,IR=500,b_=n=>typeof n=="number"&&isFinite(n),ef=1/60,BR=(n,e,t)=>n!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,PR=(n,e,t)=>{let i=e-lr.BACK_BUFFER_LENGTH;n.length&&(i=Math.max(i,n.start(0)));const a=e-t;return Math.min(a,i)},Ql=n=>{const{startOfSegment:e,duration:t,segment:i,part:a,playlist:{mediaSequence:l,id:u,segments:h=[]},mediaIndex:f,partIndex:g,timeline:_}=n,S=h.length-1;let C="mediaIndex/partIndex increment";n.getMediaInfoForTime?C=`getMediaInfoForTime (${n.getMediaInfoForTime})`:n.isSyncRequest&&(C="getSyncSegmentCandidate (isSyncRequest)"),n.independent&&(C+=` with independent ${n.independent}`);const N=typeof g=="number",O=n.segment.uri?"segment":"pre-segment",E=N?kS({preloadSegment:i})-1:0;return`${O} [${l+f}/${l+S}]`+(N?` part [${g}/${E}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(N?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${_}] selected by [${C}] playlist [${u}]`},v_=n=>`${n}TimingInfo`,FR=({segmentTimeline:n,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:a})=>!a&&n===e?null:n<e?t:i.length?i.end(i.length-1):t,uy=({timelineChangeController:n,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:a})=>{if(e===t)return!1;if(i==="audio"){const l=n.lastTimelineChange({type:"main"});return!l||l.to!==t}if(i==="main"&&a){const l=n.pendingTimelineChange({type:"audio"});return!(l&&l.to===t)}return!1},UR=n=>{if(!n)return!1;const e=n.pendingTimelineChange({type:"audio"}),t=n.pendingTimelineChange({type:"main"}),i=e&&t,a=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&a)},zR=n=>{const e=n.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=n.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},po=n=>{const e=n.pendingSegment_;if(!e)return;if(uy({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&UR(n.timelineChangeController_)){if(zR(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},$R=n=>{let e=0;return["video","audio"].forEach(function(t){const i=n[`${t}TimingInfo`];if(!i)return;const{start:a,end:l}=i;let u;typeof a=="bigint"||typeof l=="bigint"?u=de.BigInt(l)-de.BigInt(a):typeof a=="number"&&typeof l=="number"&&(u=l-a),typeof u<"u"&&u>e&&(e=u)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},x_=({segmentDuration:n,maxDuration:e})=>n?Math.round(n)>e+Ys:!1,HR=(n,e)=>{if(e!=="hls")return null;const t=$R({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo});if(!t)return null;const i=n.playlist.targetDuration,a=x_({segmentDuration:t,maxDuration:i*2}),l=x_({segmentDuration:t,maxDuration:i}),u=`Segment with index ${n.mediaIndex} from playlist ${n.playlist.id} has a duration of ${t} when the reported duration is ${n.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return a||l?{severity:a?"warn":"info",message:u}:null},al=({type:n,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),a=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:n||e.type,uri:e.resolvedUri||e.uri,start:a,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class cy extends Fe.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=xs(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Xi({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Xi({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():po(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return mg.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,de.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&mg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return cr();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:a}=e;if(i&&t&&!this.audioDisabled_&&!a)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];return t&&!a&&e.bytes&&(this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),a||e}segmentKey(e,t=!1){if(!e)return null;const i=qS(e);let a=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!a&&e.bytes&&(this.keyCache_[i]=a={resolvedUri:e.resolvedUri,bytes:e.bytes});const l={resolvedUri:(a||e).resolvedUri};return a&&(l.bytes=a.bytes),l}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,a=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let l=null;if(i&&(i.id?l=i.id:i.uri&&(l=i.uri)),this.logger_(`playlist update [${l} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
currentTime: ${this.currentTime_()}
bufferedEnd: ${hg(this.buffered_())}
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const u=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${u}]`),this.mediaIndex!==null)if(this.mediaIndex-=u,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const h=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!h.parts||!h.parts.length||!h.parts[this.partIndex])){const f=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=f}}a&&(a.mediaIndex-=u,a.mediaIndex<0?(a.mediaIndex=null,a.partIndex=null):(a.mediaIndex>=0&&(a.segment=e.segments[a.mediaIndex]),a.partIndex>=0&&a.segment.parts&&(a.part=a.segment.parts[a.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&mg.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},a=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let l=1;const u=()=>{l--,l===0&&i()};(a||!this.audioDisabled_)&&(l++,this.sourceUpdater_.removeAudio(e,t,u)),(a||this.loaderType_==="main")&&(this.gopBuffer_=RR(this.gopBuffer_,e,t,this.timeMapping_),l++,this.sourceUpdater_.removeVideo(e,t,u));for(const h in this.inbandTextTracks_)Xc(e,t,this.inbandTextTracks_[h]);Xc(e,t,this.segmentMetadataTrack_),u()}monitorBuffer_(){this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),IR)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const a=typeof e=="number"&&t.segments[e],l=e+1===t.segments.length,u=!a||!a.parts||i+1===a.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&l&&u}chooseNextRequest_(){const e=this.buffered_(),t=hg(e)||0,i=tb(e,this.currentTime_()),a=!this.hasPlayed_()&&i>=1,l=i>=this.goalBufferLength_(),u=this.playlist_.segments;if(!u.length||a||l)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const h={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(h.isSyncRequest)h.mediaIndex=LR(this.currentTimeline_,u,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${h.mediaIndex}`);else if(this.mediaIndex!==null){const C=u[this.mediaIndex],N=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=C.end?C.end:t,C.parts&&C.parts[N+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=N+1):h.mediaIndex=this.mediaIndex+1}else{let C,N,O;const E=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
For TargetTime: ${E}.
CurrentTime: ${this.currentTime_()}
BufferedEnd: ${t}
Fetch At Buffer: ${this.fetchAtBuffer_}
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const B=this.getSyncInfoFromMediaSequenceSync_(E);if(!B){const H="No sync info found while using media sequence sync";return this.error({message:H,metadata:{errorType:Fe.Error.StreamingFailedToSelectNextSegment,error:new Error(H)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${B.start} --> ${B.end})`),C=B.segmentIndex,N=B.partIndex,O=B.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const B=Hr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:E,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});C=B.segmentIndex,N=B.partIndex,O=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${E}`:`currentTime ${E}`,h.mediaIndex=C,h.startOfSegment=O,h.partIndex=N,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${h.mediaIndex} `)}const f=u[h.mediaIndex];let g=f&&typeof h.partIndex=="number"&&f.parts&&f.parts[h.partIndex];if(!f||typeof h.partIndex=="number"&&!g)return null;typeof h.partIndex!="number"&&f.parts&&(h.partIndex=0,g=f.parts[0]);const _=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&g&&!_&&!g.independent)if(h.partIndex===0){const C=u[h.mediaIndex-1],N=C.parts&&C.parts.length&&C.parts[C.parts.length-1];N&&N.independent&&(h.mediaIndex-=1,h.partIndex=C.parts.length-1,h.independent="previous segment")}else f.parts[h.partIndex-1].independent&&(h.partIndex-=1,h.independent="previous part");const S=this.mediaSource_&&this.mediaSource_.readyState==="ended";return h.mediaIndex>=u.length-1&&S&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,h.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(h))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const a=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return a?(a.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),a):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:a,startOfSegment:l,isSyncRequest:u,partIndex:h,forceTimestampOffset:f,getMediaInfoForTime:g}=e,_=i.segments[a],S=typeof h=="number"&&_.parts[h],C={requestId:"segment-loader-"+Math.random(),uri:S&&S.resolvedUri||_.resolvedUri,mediaIndex:a,partIndex:S?h:null,isSyncRequest:u,startOfSegment:l,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:_.timeline,duration:S&&S.duration||_.duration,segment:_,part:S,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:g,independent:t},N=typeof f<"u"?f:this.isPendingTimestampOffset_;C.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:_.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:N});const O=hg(this.sourceUpdater_.audioBuffered());return typeof O=="number"&&(C.audioAppendStart=O-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(C.gopsToAlignWith=MR(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),C}timestampOffsetForSegment_(e){return FR(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,a=this.pendingSegment_.duration,l=Hr.estimateSegmentRequestTime(a,i,this.playlist_,e.bytesReceived),u=oj(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=xR({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:u,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!h)return;const g=l-u-h.rebufferingImpact;let _=.5;u<=Ys&&(_=1),!(!h.playlist||h.playlist.uri===this.playlist_.uri||g<_)&&(this.bandwidth=h.playlist.attributes.BANDWIDTH*lr.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Ql(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:a}=t,l={segmentInfo:al({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:a}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:l}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},OR(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this))))}handleTimingInfo_(e,t,i,a){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const l=this.pendingSegment_,u=v_(t);l[u]=l[u]||{},l[u][i]=a,this.logger_(`timinginfo: ${t} - ${i} - ${a}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const a=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),l={};t.forEach(u=>{l[u.stream]=l[u.stream]||{startTime:1/0,captions:[],endTime:0};const h=l[u.stream];h.startTime=Math.min(h.startTime,u.startTime+a),h.endTime=Math.max(h.endTime,u.endTime+a),h.captions.push(u)}),Object.keys(l).forEach(u=>{const{startTime:h,endTime:f,captions:g}=l[u],_=this.inbandTextTracks_;this.logger_(`adding cues from ${h} -> ${f} for ${u}`),TR(_,this.vhs_.tech_,u),Xc(h,f,_[u]),SR({captionArray:g,inbandTextTracks:_,timestampOffset:a})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!uy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:a,isMuxed:l}=t;return!(a&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!l&&!e.audioTimingInfo||uy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){po(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[v_(t.type)].start;else{const a=this.getCurrentMediaInfo_(),l=this.loaderType_==="main"&&a&&a.hasVideo;let u;l&&(u=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:l,firstVideoFrameTimeForData:u,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const a=this.chooseNextRequest_();if(a.mediaIndex!==i.mediaIndex||a.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:a}){if(i){const l=Hf(i);if(this.activeInitSegmentId_===l)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=l}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=a,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},a){const l=this.sourceUpdater_.audioBuffered(),u=this.sourceUpdater_.videoBuffered();l.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ul(l).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ul(u).join(", "));const h=l.length?l.start(0):0,f=l.length?l.end(l.length-1):0,g=u.length?u.start(0):0,_=u.length?u.end(u.length-1):0;if(f-h<=Uc&&_-g<=Uc){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${ul(l).join(", ")}, video buffer: ${ul(u).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const C=this.currentTime_()-Uc;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${C}`),this.remove(0,C,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Uc}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=de.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Uc*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},a){if(a){if(a.code===IS){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",a),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:Fe.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:a,bytes:l}){if(!l){const h=[a];let f=a.byteLength;i&&(h.unshift(i),f+=i.byteLength),l=wR({bytes:f,segments:h})}const u={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:u}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:l},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:l}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const a=this.pendingSegment_.segment,l=`${e}TimingInfo`;a[l]||(a[l]={}),a[l].transmuxerPrependedSeconds=i.prependedContentDuration||0,a[l].transmuxedPresentationStart=i.start.presentation,a[l].transmuxedDecodeStart=i.start.decode,a[l].transmuxedPresentationEnd=i.end.presentation,a[l].transmuxedDecodeEnd=i.end.decode,a[l].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:a}=t;if(!a||!a.byteLength||i==="audio"&&this.audioDisabled_)return;const l=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:l,data:a})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){po(this),this.loadQueue_.push(()=>{const t=Xi({},e,{forceTimestampOffset:!0});Xi(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),a=this.mediaIndex!==null,l=e.timeline!==this.currentTimeline_&&e.timeline>0,u=i||a&&l;this.logger_(`Requesting
${ok(e.uri)}
${Ql(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=yR({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:u,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:h,level:f,stream:g})=>{this.logger_(`${Ql(e)} logged from transmuxer stream ${g} as a ${f}: ${h}`)},triggerSegmentEventFn:({type:h,segment:f,keyInfo:g,trackInfo:_,timingInfo:S})=>{const N={segmentInfo:al({segment:f})};g&&(N.keyInfo=g),_&&(N.trackInfo=_),S&&(N.timingInfo=S),this.trigger({type:h,metadata:N})}})}trimBackBuffer_(e){const t=PR(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,a=e.segment.key||e.segment.map&&e.segment.map.key,l=e.segment.map&&!e.segment.map.bytes,u={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:a,isMediaInitialization:l},h=e.playlist.segments[e.mediaIndex-1];if(h&&h.timeline===t.timeline&&(h.videoTimingInfo?u.baseStartTime=h.videoTimingInfo.transmuxedDecodeEnd:h.audioTimingInfo&&(u.baseStartTime=h.audioTimingInfo.transmuxedDecodeEnd)),t.key){const f=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);u.key=this.segmentKey(t.key),u.key.iv=f}return t.map&&(u.map=this.initSegmentForMap(t.map)),u}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<ef){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${ef}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Zs.ABORTED)return;if(this.pause(),e.code===Zs.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const a=this.pendingSegment_;this.saveBandwidthRelatedStats_(a.duration,t.stats),a.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=jR(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(a)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:a,currentVideoTimestampOffset:l,useVideoTimingInfo:u,videoTimingInfo:h,audioTimingInfo:f}){if(typeof e<"u")return e;if(!u)return f.start;const g=t.segments[i-1];return i===0||!g||typeof g.start>"u"||g.end!==a+l?a:h.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:a,isMuxed:l}=t,u=this.loaderType_==="main"&&a,h=!this.audioDisabled_&&i&&!l;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}u&&e.waitingOnAppends++,h&&e.waitingOnAppends++,u&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),h&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=BR(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),a=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;a&&(e.timingInfo.end=typeof a.end=="number"?a.end:a.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const f={segmentInfo:al({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:f})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=HR(e,this.sourceType_);if(t&&(t.severity==="warn"?Fe.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Ql(e)}`);return}this.logger_(`Appended ${Ql(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,a=e.part,l=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,u=a&&a.end&&this.currentTime_()-a.end>e.playlist.partTargetDuration*3;if(l||u){this.logger_(`bad ${l?"segment":"part"} ${Ql(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<ef){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${ef}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,a=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(a-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,a=t.end;if(!b_(i)||!b_(a))return;Xc(i,a,this.segmentMetadataTrack_);const l=de.WebKitDataCue||de.VTTCue,u={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:a},h=JSON.stringify(u),f=new l(i,a,h);f.value=u,this.segmentMetadataTrack_.addCue(f)}}function Ea(){}const lk=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},qR=["video","audio"],dy=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},VR=(n,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===n)return t}return null},gu=(n,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),gu("audio",e),gu("video",e));return}if(n!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||dy(n,e))){if(i.type!==n){if(t=VR(n,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[n]=i,i.action(n,e),!i.doneFn){e.queuePending[n]=null,gu(n,e);return}}},uk=(n,e)=>{const t=e[`${n}Buffer`],i=lk(n);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[n]=null,e[`${n}Buffer`]=null)},Ws=(n,e)=>n&&e&&Array.prototype.indexOf.call(n.sourceBuffers,e)!==-1,ns={appendBuffer:(n,e,t)=>(i,a)=>{const l=a[`${i}Buffer`];if(Ws(a.mediaSource,l)){a.logger_(`Appending segment ${e.mediaIndex}'s ${n.length} bytes to ${i}Buffer`);try{l.appendBuffer(n)}catch(u){a.logger_(`Error with code ${u.code} `+(u.code===IS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),a.queuePending[i]=null,t(u)}}},remove:(n,e)=>(t,i)=>{const a=i[`${t}Buffer`];if(Ws(i.mediaSource,a)){i.logger_(`Removing ${n} to ${e} from ${t}Buffer`);try{a.remove(n,e)}catch{i.logger_(`Remove ${n} to ${e} from ${t}Buffer failed`)}}},timestampOffset:n=>(e,t)=>{const i=t[`${e}Buffer`];Ws(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${n}`),i.timestampOffset=n)},callback:n=>(e,t)=>{n()},endOfStream:n=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${n||""})`);try{e.mediaSource.endOfStream(n)}catch(t){Fe.log.warn("Failed to call media source endOfStream",t)}}},duration:n=>e=>{e.logger_(`Setting mediaSource duration to ${n}`);try{e.mediaSource.duration=n}catch(t){Fe.log.warn("Failed to set media source duration",t)}},abort:()=>(n,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${n}Buffer`];if(Ws(e.mediaSource,t)){e.logger_(`calling abort on ${n}Buffer`);try{t.abort()}catch(i){Fe.log.warn(`Failed to abort on ${n}Buffer`,i)}}},addSourceBuffer:(n,e)=>t=>{const i=lk(n),a=_u(e);t.logger_(`Adding ${n}Buffer with codec ${e} to mediaSource`);const l=t.mediaSource.addSourceBuffer(a);l.addEventListener("updateend",t[`on${i}UpdateEnd_`]),l.addEventListener("error",t[`on${i}Error_`]),t.codecs[n]=e,t[`${n}Buffer`]=l},removeSourceBuffer:n=>e=>{const t=e[`${n}Buffer`];if(uk(n,e),!!Ws(e.mediaSource,t)){e.logger_(`Removing ${n}Buffer with codec ${e.codecs[n]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Fe.log.warn(`Failed to removeSourceBuffer ${n}Buffer`,i)}}},changeType:n=>(e,t)=>{const i=t[`${e}Buffer`],a=_u(n);if(!Ws(t.mediaSource,i))return;const l=n.substring(0,n.indexOf(".")),u=t.codecs[e];if(u.substring(0,u.indexOf("."))===l)return;const f={codecsChangeInfo:{from:u,to:n}};t.trigger({type:"codecschange",metadata:f}),t.logger_(`changing ${e}Buffer codec from ${u} to ${n}`);try{i.changeType(a),t.codecs[e]=n}catch(g){f.errorType=Fe.Error.StreamingCodecsChangeError,f.error=g,g.metadata=f,t.error_=g,t.trigger("error"),Fe.log.warn(`Failed to changeType on ${e}Buffer`,g)}}},is=({type:n,sourceUpdater:e,action:t,doneFn:i,name:a})=>{e.queue.push({type:n,action:t,doneFn:i,name:a}),gu(n,e)},__=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=rj(i);if(e.logger_(`received "updateend" event for ${n} Source Buffer: `,a),e.queuePending[n]){const l=e.queuePending[n].doneFn;e.queuePending[n]=null,l&&l(e[`${n}Error_`])}gu(n,e)};class ck extends Fe.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=xs("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=__("video",this),this.onAudioUpdateEnd_=__("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){is({type:"mediaSource",sourceUpdater:this,action:ns.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){is({type:e,sourceUpdater:this,action:ns.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Fe.log.error("removeSourceBuffer is not supported!");return}is({type:"mediaSource",sourceUpdater:this,action:ns.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Fe.browser.IS_FIREFOX&&de.MediaSource&&de.MediaSource.prototype&&typeof de.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return de.SourceBuffer&&de.SourceBuffer.prototype&&typeof de.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Fe.log.error("changeType is not supported!");return}is({type:e,sourceUpdater:this,action:ns.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:a,bytes:l}=e;if(this.processedAppend_=!0,a==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${l.length} until video append`);return}const u=t;if(is({type:a,sourceUpdater:this,action:ns.appendBuffer(l,i||{mediaIndex:-1},u),doneFn:t,name:"appendBuffer"}),a==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const h=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${h.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,h.forEach(f=>{this.appendBuffer.apply(this,f)})}}audioBuffered(){return Ws(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:cr()}videoBuffered(){return Ws(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:cr()}buffered(){const e=Ws(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Ws(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():aj(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ea){is({type:"mediaSource",sourceUpdater:this,action:ns.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ea){typeof e!="string"&&(e=void 0),is({type:"mediaSource",sourceUpdater:this,action:ns.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Ea){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}is({type:"audio",sourceUpdater:this,action:ns.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Ea){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}is({type:"video",sourceUpdater:this,action:ns.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(dy("audio",this)||dy("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(is({type:"audio",sourceUpdater:this,action:ns.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(is({type:"video",sourceUpdater:this,action:ns.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&is({type:"audio",sourceUpdater:this,action:ns.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&is({type:"video",sourceUpdater:this,action:ns.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),qR.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>uk(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const w_=n=>decodeURIComponent(escape(String.fromCharCode.apply(null,n))),GR=n=>{const e=new Uint8Array(n);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},T_=new Uint8Array(`
`.split("").map(n=>n.charCodeAt(0)));class KR extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class WR extends cy{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return cr();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return cr([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];if(t&&!a&&e.bytes){const l=T_.byteLength+e.bytes.byteLength,u=new Uint8Array(l);u.set(e.bytes),u.set(T_,e.bytes.byteLength),this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:u}}return a||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Xc(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Zs.TIMEOUT&&this.handleTimeout_(),e.code===Zs.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const a=this.pendingSegment_,l=i.mp4VttCues&&i.mp4VttCues.length;l&&(a.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(a.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const u=a.segment;if(u.map&&(u.map.bytes=t.map.bytes),a.bytes=t.bytes,typeof de.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}u.requested=!0;try{this.parseVTTCues_(a)}catch(h){this.stopForError({message:h.message,metadata:{errorType:Fe.Error.StreamingVttParserError,error:h}});return}if(l||this.updateTimeMapping_(a,this.syncController_.timelines[a.timeline],this.playlist_),a.cues.length?a.timingInfo={start:a.cues[0].startTime,end:a.cues[a.cues.length-1].endTime}:a.timingInfo={start:a.startOfSegment,end:a.startOfSegment+a.duration},a.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}a.byteLength=a.bytes.byteLength,this.mediaSecondsLoaded+=u.duration,a.cues.forEach(h=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new de.VTTCue(h.startTime,h.endTime,h.text):h)}),DR(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",a=t&&t.type==="text";i&&a&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const a=i.start+t,l=i.end+t,u=new de.VTTCue(a,l,i.cueText);i.settings&&i.settings.split(" ").forEach(h=>{const f=h.split(":"),g=f[0],_=f[1];u[g]=isNaN(_)?_:Number(_)}),e.cues.push(u)})}parseVTTCues_(e){let t,i=!1;if(typeof de.WebVTT!="function")throw new KR;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof de.TextDecoder=="function"?t=new de.TextDecoder("utf8"):(t=de.WebVTT.StringDecoder(),i=!0);const a=new de.WebVTT.Parser(de,de.vttjs,t);if(a.oncue=e.cues.push.bind(e.cues),a.ontimestampmap=u=>{e.timestampmap=u},a.onparsingerror=u=>{Fe.log.warn("Error encountered when parsing cues: "+u.message)},e.segment.map){let u=e.segment.map.bytes;i&&(u=w_(u)),a.parse(u)}let l=e.bytes;i&&(l=w_(l)),a.parse(l),a.flush()}updateTimeMapping_(e,t,i){const a=e.segment;if(!t)return;if(!e.cues.length){a.empty=!0;return}const{MPEGTS:l,LOCAL:u}=e.timestampmap,f=l/ll.ONE_SECOND_IN_TS-u+t.mapping;if(e.cues.forEach(g=>{const _=g.endTime-g.startTime,S=this.handleRollover_(g.startTime+f,t.time);g.startTime=Math.max(S,0),g.endTime=Math.max(S+_,0)}),!i.syncInfo){const g=e.cues[0].startTime,_=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(g,_-a.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*ll.ONE_SECOND_IN_TS;const a=t*ll.ONE_SECOND_IN_TS;let l;for(a<i?l=-8589934592:l=8589934592;Math.abs(i-a)>4294967296;)i+=l;return i/ll.ONE_SECOND_IN_TS}}const XR=function(n,e){const t=n.cues;for(let i=0;i<t.length;i++){const a=t[i];if(e>=a.adStartTime&&e<=a.adEndTime)return a}return null},YR=function(n,e,t=0){if(!n.segments)return;let i=t,a;for(let l=0;l<n.segments.length;l++){const u=n.segments[l];if(a||(a=XR(e,i+u.duration/2)),a){if("cueIn"in u){a.endTime=i,a.adEndTime=i,i+=u.duration,a=null;continue}if(i<a.endTime){i+=u.duration;continue}a.endTime+=u.duration}else if("cueOut"in u&&(a=new de.VTTCue(i,i+u.duration,u.cueOut),a.adStartTime=i,a.adEndTime=i+parseFloat(u.cueOut),e.addCue(a)),"cueOutCont"in u){const[h,f]=u.cueOutCont.split("/").map(parseFloat);a=new de.VTTCue(i,i+u.duration,""),a.adStartTime=i-h,a.adEndTime=a.adStartTime+f,e.addCue(a)}i+=u.duration}};class S_{constructor({start:e,end:t,segmentIndex:i,partIndex:a=null,appended:l=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=a,this.appended_=l}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class QR{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class dk{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:a}=e;if(this.isReliable_=this.isReliablePlaylist_(i,a),!!this.isReliable_)return this.updateStorage_(a,i,this.calculateBaseTime_(i,a,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const a of i)if(a.isInRange(e))return a}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const a=new Map;let l=`
`,u=i,h=t;this.start_=u,e.forEach((f,g)=>{const _=this.storage_.get(h),S=u,C=S+f.duration,N=!!(_&&_.segmentSyncInfo&&_.segmentSyncInfo.isAppended),O=new S_({start:S,end:C,appended:N,segmentIndex:g});f.syncInfo=O;let E=u;const B=(f.parts||[]).map((H,Y)=>{const U=E,re=E+H.duration,W=!!(_&&_.partsSyncInfo&&_.partsSyncInfo[Y]&&_.partsSyncInfo[Y].isAppended),X=new S_({start:U,end:re,appended:W,segmentIndex:g,partIndex:Y});return E=re,l+=`Media Sequence: ${h}.${Y} | Range: ${U} --> ${re} | Appended: ${W}
`,H.syncInfo=X,X});a.set(h,new QR(O,B)),l+=`${ok(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${C} | Appended: ${N}
`,h++,u=C}),this.end_=u,this.storage_=a,this.diagnostics_=l}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const a=Math.min(...this.storage_.keys());if(e<a){const l=a-e;let u=this.storage_.get(a).segmentSyncInfo.start;for(let h=0;h<l;h++){const f=t[h];u-=f.duration}return u}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class k_ extends dk{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const a=this.parent_.getSyncInfoForMediaSequence(e);return a?a.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const ZR=86400,pg=[{name:"VOD",run:(n,e,t,i,a)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(n,e,t,i,a,l)=>{const u=n.getMediaSequenceSync(l);if(!u||!u.isReliable)return null;const h=u.getSyncInfoForTime(a);return h?{time:h.start,partIndex:h.partIndex,segmentIndex:h.segmentIndex}:null}},{name:"ProgramDateTime",run:(n,e,t,i,a)=>{if(!Object.keys(n.timelineToDatetimeMappings).length)return null;let l=null,u=null;const h=ty(e);a=a||0;for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),_=h[g],S=_.segment,C=n.timelineToDatetimeMappings[S.timeline];if(!C||!S.dateTimeObject)continue;let O=S.dateTimeObject.getTime()/1e3+C;if(S.parts&&typeof _.partIndex=="number")for(let B=0;B<_.partIndex;B++)O+=S.parts[B].duration;const E=Math.abs(a-O);if(u!==null&&(E===0||u<E))break;u=E,l={time:O,segmentIndex:_.segmentIndex,partIndex:_.partIndex}}return l}},{name:"Segment",run:(n,e,t,i,a)=>{let l=null,u=null;a=a||0;const h=ty(e);for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),_=h[g],S=_.segment,C=_.part&&_.part.start||S&&S.start;if(S.timeline===i&&typeof C<"u"){const N=Math.abs(a-C);if(u!==null&&u<N)break;(!l||u===null||u>=N)&&(u=N,l={time:C,segmentIndex:_.segmentIndex,partIndex:_.partIndex})}}return l}},{name:"Discontinuity",run:(n,e,t,i,a)=>{let l=null;if(a=a||0,e.discontinuityStarts&&e.discontinuityStarts.length){let u=null;for(let h=0;h<e.discontinuityStarts.length;h++){const f=e.discontinuityStarts[h],g=e.discontinuitySequence+h+1,_=n.discontinuities[g];if(_){const S=Math.abs(a-_.time);if(u!==null&&u<S)break;(!l||u===null||u>=S)&&(u=S,l={time:_.time,segmentIndex:f,partIndex:null})}}}return l}},{name:"Playlist",run:(n,e,t,i,a)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class JR extends Fe.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new dk,i=new k_(t),a=new k_(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:a},this.logger_=xs("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,a,l){if(t!==1/0)return pg.find(({name:f})=>f==="VOD").run(this,e,t);const u=this.runStrategies_(e,t,i,a,l);if(!u.length)return null;for(const h of u){const{syncPoint:f,strategy:g}=h,{segmentIndex:_,time:S}=f;if(_<0)continue;const C=e.segments[_],N=S,O=N+C.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${_}. Time: [${N} -> ${O}]}`),a>=N&&a<O)return this.logger_("Found sync point with exact match: ",f),f}return this.selectSyncPoint_(u,{key:"time",value:a})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const a=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return a.segmentIndex>0&&(a.time*=-1),Math.abs(a.time+ad({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:a.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,a,l){const u=[];for(let h=0;h<pg.length;h++){const f=pg[h],g=f.run(this,e,t,i,a,l);g&&(g.strategy=f.name,u.push({strategy:f.name,syncPoint:g}))}return u}selectSyncPoint_(e,t){let i=e[0].syncPoint,a=Math.abs(e[0].syncPoint[t.key]-t.value),l=e[0].strategy;for(let u=1;u<e.length;u++){const h=Math.abs(e[u].syncPoint[t.key]-t.value);h<a&&(a=h,i=e[u].syncPoint,l=e[u].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${l}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>ZR){Fe.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let a=i-1;a>=0;a--){const l=e.segments[a];if(l&&typeof l.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+a,time:l.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),a=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:a.start}));const l=a.dateTimeObject;a.discontinuity&&t&&l&&(this.timelineToDatetimeMappings[a.timeline]=-(l.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const a=e.segment,l=e.part;let u=this.timelines[e.timeline],h,f;if(typeof e.timestampOffset=="number")u={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=u,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${u.time}] [mapping: ${u.mapping}]`)),h=e.startOfSegment,f=t.end+u.mapping;else if(u)h=t.start+u.mapping,f=t.end+u.mapping;else return!1;return l&&(l.start=h,l.end=f),(!a.start||h<a.start)&&(a.start=h),a.end=f,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let a=0;a<t.discontinuityStarts.length;a++){const l=t.discontinuityStarts[a],u=t.discontinuitySequence+a+1,h=l-e.mediaIndex,f=Math.abs(h);if(!this.discontinuities[u]||this.discontinuities[u].accuracy>f){let g;h<0?g=i.start-ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:l}):g=i.end+ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:l}),this.discontinuities[u]={time:g,accuracy:f}}}}dispose(){this.trigger("dispose"),this.off()}}class e8 extends Fe.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const a={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:a})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const t8=YS(QS(function(){var n=(function(){function E(){this.listeners={}}var B=E.prototype;return B.on=function(Y,U){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push(U)},B.off=function(Y,U){if(!this.listeners[Y])return!1;var re=this.listeners[Y].indexOf(U);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(re,1),re>-1},B.trigger=function(Y){var U=this.listeners[Y];if(U)if(arguments.length===2)for(var re=U.length,W=0;W<re;++W)U[W].call(this,arguments[1]);else for(var X=Array.prototype.slice.call(arguments,1),R=U.length,le=0;le<R;++le)U[le].apply(this,X)},B.dispose=function(){this.listeners={}},B.pipe=function(Y){this.on("data",function(U){Y.push(U)})},E})();function e(E){return E.subarray(0,E.byteLength-E[E.byteLength-1])}const t=function(){const E=[[[],[],[],[],[]],[[],[],[],[],[]]],B=E[0],H=E[1],Y=B[4],U=H[4];let re,W,X;const R=[],le=[];let k,j,Z,V,ne,me;for(re=0;re<256;re++)le[(R[re]=re<<1^(re>>7)*283)^re]=re;for(W=X=0;!Y[W];W^=k||1,X=le[X]||1)for(V=X^X<<1^X<<2^X<<3^X<<4,V=V>>8^V&255^99,Y[W]=V,U[V]=W,Z=R[j=R[k=R[W]]],me=Z*16843009^j*65537^k*257^W*16843008,ne=R[V]*257^V*16843008,re=0;re<4;re++)B[re][W]=ne=ne<<24^ne>>>8,H[re][V]=me=me<<24^me>>>8;for(re=0;re<5;re++)B[re]=B[re].slice(0),H[re]=H[re].slice(0);return E};let i=null;class a{constructor(B){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let H,Y,U;const re=this._tables[0][4],W=this._tables[1],X=B.length;let R=1;if(X!==4&&X!==6&&X!==8)throw new Error("Invalid aes key size");const le=B.slice(0),k=[];for(this._key=[le,k],H=X;H<4*X+28;H++)U=le[H-1],(H%X===0||X===8&&H%X===4)&&(U=re[U>>>24]<<24^re[U>>16&255]<<16^re[U>>8&255]<<8^re[U&255],H%X===0&&(U=U<<8^U>>>24^R<<24,R=R<<1^(R>>7)*283)),le[H]=le[H-X]^U;for(Y=0;H;Y++,H--)U=le[Y&3?H:H-4],H<=4||Y<4?k[Y]=U:k[Y]=W[0][re[U>>>24]]^W[1][re[U>>16&255]]^W[2][re[U>>8&255]]^W[3][re[U&255]]}decrypt(B,H,Y,U,re,W){const X=this._key[1];let R=B^X[0],le=U^X[1],k=Y^X[2],j=H^X[3],Z,V,ne;const me=X.length/4-2;let ue,q=4;const P=this._tables[1],Q=P[0],te=P[1],ge=P[2],L=P[3],xe=P[4];for(ue=0;ue<me;ue++)Z=Q[R>>>24]^te[le>>16&255]^ge[k>>8&255]^L[j&255]^X[q],V=Q[le>>>24]^te[k>>16&255]^ge[j>>8&255]^L[R&255]^X[q+1],ne=Q[k>>>24]^te[j>>16&255]^ge[R>>8&255]^L[le&255]^X[q+2],j=Q[j>>>24]^te[R>>16&255]^ge[le>>8&255]^L[k&255]^X[q+3],q+=4,R=Z,le=V,k=ne;for(ue=0;ue<4;ue++)re[(3&-ue)+W]=xe[R>>>24]<<24^xe[le>>16&255]<<16^xe[k>>8&255]<<8^xe[j&255]^X[q++],Z=R,R=le,le=k,k=j,j=Z}}class l extends n{constructor(){super(n),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(B){this.jobs.push(B),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const u=function(E){return E<<24|(E&65280)<<8|(E&16711680)>>8|E>>>24},h=function(E,B,H){const Y=new Int32Array(E.buffer,E.byteOffset,E.byteLength>>2),U=new a(Array.prototype.slice.call(B)),re=new Uint8Array(E.byteLength),W=new Int32Array(re.buffer);let X,R,le,k,j,Z,V,ne,me;for(X=H[0],R=H[1],le=H[2],k=H[3],me=0;me<Y.length;me+=4)j=u(Y[me]),Z=u(Y[me+1]),V=u(Y[me+2]),ne=u(Y[me+3]),U.decrypt(j,Z,V,ne,W,me),W[me]=u(W[me]^X),W[me+1]=u(W[me+1]^R),W[me+2]=u(W[me+2]^le),W[me+3]=u(W[me+3]^k),X=j,R=Z,le=V,k=ne;return re};class f{constructor(B,H,Y,U){const re=f.STEP,W=new Int32Array(B.buffer),X=new Uint8Array(B.byteLength);let R=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(W.subarray(R,R+re),H,Y,X)),R=re;R<W.length;R+=re)Y=new Uint32Array([u(W[R-4]),u(W[R-3]),u(W[R-2]),u(W[R-1])]),this.asyncStream_.push(this.decryptChunk_(W.subarray(R,R+re),H,Y,X));this.asyncStream_.push(function(){U(null,e(X))})}static get STEP(){return 32e3}decryptChunk_(B,H,Y,U){return function(){const re=h(B,H,Y);U.set(re,B.byteOffset)}}}var g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_;typeof window<"u"?_=window:typeof g<"u"?_=g:typeof self<"u"?_=self:_={};var S=_,C=function(B){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(B):B&&B.buffer instanceof ArrayBuffer},N=S.BigInt||Number;N("0x1"),N("0x100"),N("0x10000"),N("0x1000000"),N("0x100000000"),N("0x10000000000"),N("0x1000000000000"),N("0x100000000000000"),N("0x10000000000000000"),(function(){var E=new Uint16Array([65484]),B=new Uint8Array(E.buffer,E.byteOffset,E.byteLength);return B[0]===255?"big":B[0]===204?"little":"unknown"})();const O=function(E){const B={};return Object.keys(E).forEach(H=>{const Y=E[H];C(Y)?B[H]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:B[H]=Y}),B};self.onmessage=function(E){const B=E.data,H=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),Y=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),U=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(H,Y,U,function(re,W){self.postMessage(O({source:B.source,decrypted:W}),[W.buffer])})}}));var n8=XS(t8);const i8=n=>{let e=n.default?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},hk=(n,e)=>{n.abort(),n.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},hy=(n,e)=>{e.activePlaylistLoader=n,n.load()},r8=(n,e)=>()=>{const{segmentLoaders:{[n]:t,main:i},mediaTypes:{[n]:a}}=e,l=a.activeTrack(),u=a.getActiveGroup(),h=a.activePlaylistLoader,f=a.lastGroup_;if(!(u&&f&&u.id===f.id)&&(a.lastGroup_=u,a.lastTrack_=l,hk(t,a),!(!u||u.isMainPlaylist))){if(!u.playlistLoader){h&&i.resetEverything();return}t.resyncLoader(),hy(u.playlistLoader,a)}},s8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},a8=(n,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[n]:i,main:a},mediaTypes:{[n]:l}}=e,u=l.activeTrack(),h=l.getActiveGroup(),f=l.activePlaylistLoader,g=l.lastTrack_;if(!(g&&u&&g.id===u.id)&&(l.lastGroup_=h,l.lastTrack_=u,hk(i,l),!!h)){if(h.isMainPlaylist){if(!u||!g||u.id===g.id)return;const _=e.vhs.playlistController_,S=_.selectPlaylist();if(_.media()===S)return;l.logger_(`track change. Switching main audio from ${g.id} to ${u.id}`),t.pause(),a.resetEverything(),_.fastQualityChange_(S);return}if(n==="AUDIO"){if(!h.playlistLoader){a.setAudio(!0),a.resetEverything();return}i.setAudio(!0),a.setAudio(!1)}if(f===h.playlistLoader){hy(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),hy(h.playlistLoader,l)}},qf={AUDIO:(n,e)=>()=>{const{mediaTypes:{[n]:t},excludePlaylist:i}=e,a=t.activeTrack(),l=t.activeGroup(),u=(l.filter(f=>f.default)[0]||l[0]).id,h=t.tracks[u];if(a===h){i({error:{message:"Problem encountered loading the default audio track."}});return}Fe.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const f in t.tracks)t.tracks[f].enabled=t.tracks[f]===h;t.onTrackChanged()},SUBTITLES:(n,e)=>()=>{const{mediaTypes:{[n]:t}}=e;Fe.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},E_={AUDIO:(n,e,t)=>{if(!e)return;const{tech:i,requestOptions:a,segmentLoaders:{[n]:l}}=t;e.on("loadedmetadata",()=>{const u=e.media();l.playlist(u,a),(!i.paused()||u.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))},SUBTITLES:(n,e,t)=>{const{tech:i,requestOptions:a,segmentLoaders:{[n]:l},mediaTypes:{[n]:u}}=t;e.on("loadedmetadata",()=>{const h=e.media();l.playlist(h,a),l.track(u.activeTrack()),(!i.paused()||h.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))}},o8={AUDIO:(n,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[n]:a},requestOptions:l,main:{mediaGroups:u},mediaTypes:{[n]:{groups:h,tracks:f,logger_:g}},mainPlaylistLoader:_}=e,S=Cd(_.main);(!u[n]||Object.keys(u[n]).length===0)&&(u[n]={main:{default:{default:!0}}},S&&(u[n].main.default.playlists=_.main.playlists));for(const C in u[n]){h[C]||(h[C]=[]);for(const N in u[n][C]){let O=u[n][C][N],E;if(S?(g(`AUDIO group '${C}' label '${N}' is a main playlist`),O.isMainPlaylist=!0,E=null):i==="vhs-json"&&O.playlists?E=new su(O.playlists[0],t,l):O.resolvedUri?E=new su(O.resolvedUri,t,l):O.playlists&&i==="dash"?E=new oy(O.playlists[0],t,l,_):E=null,O=ri({id:N,playlistLoader:E},O),E_[n](n,O.playlistLoader,e),h[C].push(O),typeof f[N]>"u"){const B=new Fe.AudioTrack({id:N,kind:i8(O),enabled:!1,language:O.language,default:O.default,label:N});f[N]=B}}}a.on("error",qf[n](n,e))},SUBTITLES:(n,e)=>{const{tech:t,vhs:i,sourceType:a,segmentLoaders:{[n]:l},requestOptions:u,main:{mediaGroups:h},mediaTypes:{[n]:{groups:f,tracks:g}},mainPlaylistLoader:_}=e;for(const S in h[n]){f[S]||(f[S]=[]);for(const C in h[n][S]){if(!i.options_.useForcedSubtitles&&h[n][S][C].forced)continue;let N=h[n][S][C],O;if(a==="hls")O=new su(N.resolvedUri,i,u);else if(a==="dash"){if(!N.playlists.filter(B=>B.excludeUntil!==1/0).length)return;O=new oy(N.playlists[0],i,u,_)}else a==="vhs-json"&&(O=new su(N.playlists?N.playlists[0]:N.resolvedUri,i,u));if(N=ri({id:C,playlistLoader:O},N),E_[n](n,N.playlistLoader,e),f[S].push(N),typeof g[C]>"u"){const E=t.addRemoteTextTrack({id:C,kind:"subtitles",default:N.default&&N.autoselect,language:N.language,label:C},!1).track;g[C]=E}}}l.on("error",qf[n](n,e))},"CLOSED-CAPTIONS":(n,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[n]:{groups:a,tracks:l}}}=e;for(const u in i[n]){a[u]||(a[u]=[]);for(const h in i[n][u]){const f=i[n][u][h];if(!/^(?:CC|SERVICE)/.test(f.instreamId))continue;const g=t.options_.vhs&&t.options_.vhs.captionServices||{};let _={label:h,language:f.language,instreamId:f.instreamId,default:f.default&&f.autoselect};if(g[_.instreamId]&&(_=ri(_,g[_.instreamId])),_.default===void 0&&delete _.default,a[u].push(ri({id:h},f)),typeof l[h]>"u"){const S=t.addRemoteTextTrack({id:_.instreamId,kind:"captions",default:_.default,language:_.language,label:_.label},!1).track;l[h]=S}}}}},fk=(n,e)=>{for(let t=0;t<n.length;t++)if(rb(e,n[t])||n[t].playlists&&fk(n[t].playlists,e))return!0;return!1},l8=(n,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[n]:{groups:a}}}=e,l=i.media();if(!l)return null;let u=null;l.attributes[n]&&(u=a[l.attributes[n]]);const h=Object.keys(a);if(!u)if(n==="AUDIO"&&h.length>1&&Cd(e.main))for(let f=0;f<h.length;f++){const g=a[h[f]];if(fk(g,l)){u=g;break}}else a.main?u=a.main:h.length===1&&(u=a[h[0]]);return typeof t>"u"?u:t===null||!u?null:u.filter(f=>f.id===t.id)[0]||null},u8={AUDIO:(n,e)=>()=>{const{mediaTypes:{[n]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(n,e)=>()=>{const{mediaTypes:{[n]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},c8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},d8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{o8[g](g,n)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:a,segmentLoaders:{["AUDIO"]:l,main:u}}=n;["AUDIO","SUBTITLES"].forEach(g=>{e[g].activeGroup=l8(g,n),e[g].activeTrack=u8[g](g,n),e[g].onGroupChanged=r8(g,n),e[g].onGroupChanging=s8(g,n),e[g].onTrackChanged=a8(g,n),e[g].getActiveGroup=c8(g,n)});const h=e.AUDIO.activeGroup();if(h){const g=(h.filter(S=>S.default)[0]||h[0]).id;e.AUDIO.tracks[g].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(u.setAudio(!1),l.setAudio(!0)):u.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(g=>e[g].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(g=>e[g].onGroupChanging())});const f=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",f),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),a.on("dispose",()=>{i.audioTracks().removeEventListener("change",f),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const g in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[g])},h8=()=>{const n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{n[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ea,activeTrack:Ea,getActiveGroup:Ea,onGroupChanged:Ea,onTrackChanged:Ea,lastTrack_:null,logger_:xs(`MediaGroups[${e}]`)}}),n};class C_{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=zr(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class f8 extends Fe.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new C_,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=xs("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=zr(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const a={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:a}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(l,u)=>{if(l){if(u.status===410){this.logger_(`manifest request 410 ${l}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(u.status===429){const g=u.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${l}.`),this.logger_(`content steering will retry in ${g} seconds.`),this.startTTLTimeout_(parseInt(g,10));return}this.logger_(`manifest failed to load ${l}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:a});let h;try{h=JSON.parse(this.request_.responseText)}catch(g){const _={errorType:Fe.Error.StreamingContentSteeringParserError,error:g};this.trigger({type:"error",metadata:_})}this.assignSteeringProperties_(h);const f={contentSteeringInfo:a.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:f}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new de.URL(e),i=new de.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(de.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new de.URL(e),i=this.getPathway(),a=this.getBandwidth_();if(i){const l=`_${this.manifestType_}_pathway`;t.searchParams.set(l,i)}if(a){const l=`_${this.manifestType_}_throughput`;t.searchParams.set(l,a)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(a=>{for(const l of a)if(this.availablePathways_.has(l))return l;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=a=>this.excludedSteeringManifestURLs.has(a);if(this.proxyServerUrl_){const a=this.setProxyServerUrl_(e);if(!t(a))return a}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=de.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){de.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new C_}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(zr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const m8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},p8=10;let go;const g8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],y8=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},b8=function({currentPlaylist:n,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:u,bufferBasedABR:h,log:f}){if(!i)return Fe.log.warn("We received no playlist to switch to. Please check your stream."),!1;const g=`allowing switch ${n&&n.id||"null"} -> ${i.id}`;if(!n)return f(`${g} as current playlist is not set`),!0;if(i.id===n.id)return!1;const _=!!ru(e,t).length;if(!n.endList)return!_&&typeof n.partTargetDuration=="number"?(f(`not ${g} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(f(`${g} as current playlist is live`),!0);const S=tb(e,t),C=h?lr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:lr.MAX_BUFFER_LOW_WATER_LINE;if(u<C)return f(`${g} as duration < max low water line (${u} < ${C})`),!0;const N=i.attributes.BANDWIDTH,O=n.attributes.BANDWIDTH;if(N<O&&(!h||S<l)){let E=`${g} as next bandwidth < current bandwidth (${N} < ${O})`;return h&&(E+=` and forwardBuffer < bufferHighWaterLine (${S} < ${l})`),f(E),!0}if((!h||N>O)&&S>=a){let E=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(E+=` and next bandwidth > current bandwidth (${N} > ${O})`),f(E),!0}return f(`not ${g} as no switching criteria met`),!1};class v8 extends Fe.EventTarget{constructor(e){super(),this.fastQualityChange_=m8(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:a,bandwidth:l,externVhs:u,useCueTags:h,playlistExclusionDuration:f,enableLowInitialPlaylist:g,sourceType:_,cacheEncryptionKeys:S,bufferBasedABR:C,leastPixelDiffSelector:N,captionServices:O,experimentalUseMMS:E}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:B}=e;(B===null||typeof B>"u")&&(B=1/0),go=u,this.bufferBasedABR=!!C,this.leastPixelDiffSelector=!!N,this.withCredentials=i,this.tech_=a,this.vhs_=a.vhs,this.player_=e.player_,this.sourceType_=_,this.useCueTags_=h,this.playlistExclusionDuration=f,this.maxPlaylistRetries=B,this.enableLowInitialPlaylist=g,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:B,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=h8(),E&&de.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new de.ManagedMediaSource,this.usingManagedMediaSource_=!0,Fe.log("Using ManagedMediaSource")):de.MediaSource&&(this.mediaSource=new de.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=cr(),this.hasPlayed_=!1,this.syncController_=new JR(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new n8,this.sourceUpdater_=new ck(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new e8,this.keyStatusMap_=new Map;const H={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:O,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:l,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:S,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new oy(t,this.vhs_,ri(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new su(t,this.vhs_,ri(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new cy(ri(H,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new cy(ri(H,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new WR(ri(H,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((re,W)=>{function X(){a.off("vttjserror",R),re()}function R(){a.off("vttjsloaded",X),W()}a.one("vttjsloaded",X),a.one("vttjserror",R),a.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new f8(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),g8.forEach(re=>{this[re+"_"]=y8.bind(this,re)}),this.logger_=xs("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const re=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-re,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const a=this.media(),l=a&&(a.id||a.uri),u=e&&(e.id||e.uri);if(l&&l!==u){this.logger_(`switch media ${l} -> ${u} from ${t}`);const h={renditionInfo:{id:u,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:h}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,a=this.contentSteeringController_.getPathway();if(i&&a){const u=(i.length?i[0].playlists:i.playlists).filter(h=>h.attributes.serviceLocation===a);u.length&&this.mediaTypes_[e].activePlaylistLoader.media(u[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=de.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(de.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,a=Object.keys(i);let l;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)l=this.mediaTypes_.AUDIO.activeTrack();else{const h=i.main||a.length&&i[a[0]];for(const f in h)if(h[f].default){l={label:f};break}}if(!l)return t;const u=[];for(const h in i)if(i[h][l.label]){const f=i[h][l.label];if(f.playlists&&f.playlists.length)u.push.apply(u,f.playlists);else if(f.uri)u.push(f);else if(e.playlists.length)for(let g=0;g<e.playlists.length;g++){const _=e.playlists[g];_.attributes&&_.attributes.AUDIO&&_.attributes.AUDIO===h&&u.push(_)}}return u.length?u:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;ny(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),d8({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;ny(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(Xi({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let a=!0;const l=Object.keys(i.AUDIO);for(const u in i.AUDIO)for(const h in i.AUDIO[u])i.AUDIO[u][h].uri||(a=!1);a&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),go.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),l.length&&Object.keys(i.AUDIO[l[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),a=this.bufferLowWaterLine(),l=this.bufferHighWaterLine(),u=this.tech_.buffered();return b8({buffered:u,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const a=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(a)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:p8}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.audioSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.subtitleSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let a=i;if(e.start){const l=e.start.timeOffset;l<0?a=Math.max(i+l,t.start(0)):a=Math.min(i,l)}this.trigger("firstplay"),this.tech_.setCurrentTime(a)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const a=go.Playlist.playlistEnd(e,i),l=this.tech_.currentTime(),u=this.tech_.buffered();if(!u.length)return a-l<=Qs;const h=u.end(u.length-1);return h-l<=Qs&&a-h<=Qs}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const a=this.mainPlaylistLoader_.main.playlists,l=a.filter(S0),u=l.length===1&&l[0]===e;if(a.length===1&&i!==1/0)return Fe.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(u);if(u){if(this.main().contentSteering){const O=this.pathwayAttribute_(e),E=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(O),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(O)},E);return}let N=!1;a.forEach(O=>{if(O===e)return;const E=O.excludeUntil;typeof E<"u"&&E!==1/0&&(N=!0,delete O.excludeUntil)}),N&&(Fe.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let h;e.playlistErrors_>this.maxPlaylistRetries?h=1/0:h=Date.now()+i*1e3,e.excludeUntil=h,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const f=this.selectPlaylist();if(!f){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const g=t.internal?this.logger_:Fe.log.warn,_=t.message?" "+t.message:"";g(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${_} Switching to playlist ${f.id}.`),f.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),f.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const S=f.targetDuration/2*1e3||5*1e3,C=typeof f.lastRequest=="number"&&Date.now()-f.lastRequest<=S;return this.switchMedia_(f,"exclude",u||C)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],a=e==="all";(a||e==="main")&&i.push(this.mainPlaylistLoader_);const l=[];(a||e==="audio")&&l.push("AUDIO"),(a||e==="subtitle")&&(l.push("CLOSED-CAPTIONS"),l.push("SUBTITLES")),l.forEach(u=>{const h=this.mediaTypes_[u]&&this.mediaTypes_[u].activePlaylistLoader;h&&i.push(h)}),["main","audio","subtitle"].forEach(u=>{const h=this[`${u}SegmentLoader_`];h&&(e===u||e==="all")&&i.push(h)}),i.forEach(u=>t.forEach(h=>{typeof u[h]=="function"&&u[h]()}))}setCurrentTime(e){const t=ru(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:go.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const a=this.syncController_.getMediaSequenceSync(t);if(a&&a.isReliable){const h=a.start,f=a.end;if(!isFinite(h)||!isFinite(f))return null;const g=go.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),_=Math.max(h,f-g);return cr([[h,_]])}const l=this.syncController_.getExpiredTime(i,this.duration());if(l===null)return null;const u=go.Playlist.seekable(i,l,go.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return u.length?u:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),a=e.end(0),l=t.start(0),u=t.end(0);return l>a||i>u?e:cr([[Math.max(i,l),Math.min(a,u)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${TS(this.seekable_)}]`);const a={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:a}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const a=this.seekable();if(!a.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<a.end(a.length-1))&&this.sourceUpdater_.setDuration(a.end(a.length-1));return}const t=this.tech_.buffered();let i=go.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(a=>{a.playlistLoader&&a.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=od(this.main(),t),a={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(a.video=i.video||e.main.videoCodec||oD),e.main.isMuxed&&(a.video+=`,${i.audio||e.main.audioCodec||g2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||l)&&(a.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||g2,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!a.audio&&!a.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const u=(g,_)=>g?nd(_,this.usingManagedMediaSource_):Xp(_),h={};let f;if(["video","audio"].forEach(function(g){if(a.hasOwnProperty(g)&&!u(e[g].isFmp4,a[g])){const _=e[g].isFmp4?"browser":"muxer";h[_]=h[_]||[],h[_].push(a[g]),g==="audio"&&(f=_)}}),l&&f&&t.attributes.AUDIO){const g=t.attributes.AUDIO;this.main().playlists.forEach(_=>{(_.attributes&&_.attributes.AUDIO)===g&&_!==t&&(_.excludeUntil=1/0)}),this.logger_(`excluding audio group ${g} as ${f} does not support codec(s): "${a.audio}"`)}if(Object.keys(h).length){const g=Object.keys(h).reduce((_,S)=>(_&&(_+=", "),_+=`${S} does not support codec(s): "${h[S].join(",")}"`,_),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:g},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const g=[];if(["video","audio"].forEach(_=>{const S=(Ks(this.sourceUpdater_.codecs[_]||"")[0]||{}).type,C=(Ks(a[_]||"")[0]||{}).type;S&&C&&S.toLowerCase()!==C.toLowerCase()&&g.push(`"${this.sourceUpdater_.codecs[_]}" -> "${a[_]}"`)}),g.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${g.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return a}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const a=e[i];if(t.indexOf(a.id)!==-1)return;t.push(a.id);const l=od(this.main,a),u=[];l.audio&&!Xp(l.audio)&&!nd(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!Xp(l.video)&&!nd(l.video,this.usingManagedMediaSource_)&&u.push(`video codec ${l.video}`),l.text&&l.text==="stpp.ttml.im1t"&&u.push(`text codec ${l.text}`),u.length&&(a.excludeUntil=1/0,this.logger_(`excluding ${a.id} for unsupported: ${u.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,a=yd(Ks(e)),l=u_(a),u=a.video&&Ks(a.video)[0]||null,h=a.audio&&Ks(a.audio)[0]||null;Object.keys(i).forEach(f=>{const g=i[f];if(t.indexOf(g.id)!==-1||g.excludeUntil===1/0)return;t.push(g.id);const _=[],S=od(this.mainPlaylistLoader_.main,g),C=u_(S);if(!(!S.audio&&!S.video)){if(C!==l&&_.push(`codec count "${C}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const N=S.video&&Ks(S.video)[0]||null,O=S.audio&&Ks(S.audio)[0]||null;N&&u&&N.type.toLowerCase()!==u.type.toLowerCase()&&_.push(`video codec "${N.type}" !== "${u.type}"`),O&&h&&O.type.toLowerCase()!==h.type.toLowerCase()&&_.push(`audio codec "${O.type}" !== "${h.type}"`)}_.length&&(g.excludeUntil=1/0,this.logger_(`excluding ${g.id}: ${_.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),YR(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=lr.GOAL_BUFFER_LENGTH,i=lr.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,lr.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=lr.BUFFER_LOW_WATER_LINE,i=lr.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,lr.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,lr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return lr.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){y_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),NR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();y_(this.inbandTextTracks_,e,this.tech_),ER({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:a,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(Xi({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const l=this.contentSteeringController_.getAvailablePathways(),u=[];for(const h of t.playlists){const f=h.attributes.serviceLocation;if(f&&(u.push(f),!l.has(f)))return!0}return!!(!u.length&&l.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,a=new Set;let l=!1;Object.keys(i).forEach(u=>{const h=i[u],f=this.pathwayAttribute_(h),g=f&&e!==f;h.excludeUntil===1/0&&h.lastExcludeReason_==="content-steering"&&!g&&(delete h.excludeUntil,delete h.lastExcludeReason_,l=!0);const S=!h.excludeUntil&&h.excludeUntil!==1/0;!a.has(h.id)&&g&&S&&(a.add(h.id),h.excludeUntil=1/0,h.lastExcludeReason_="content-steering",this.logger_(`excluding ${h.id} for ${h.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(u=>{const h=this.mediaTypes_[u];if(h.activePlaylistLoader){const f=h.activePlaylistLoader.media_;f&&f.attributes.serviceLocation!==e&&(l=!0)}}),l&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,a=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||a&&a.size){for(const[u,h]of i.entries())a.get(u)||(this.mainPlaylistLoader_.updateOrDeleteClone(h),this.contentSteeringController_.excludePathway(u));for(const[u,h]of a.entries()){const f=i.get(u);if(!f){t.filter(_=>_.attributes["PATHWAY-ID"]===h["BASE-ID"]).forEach(_=>{this.mainPlaylistLoader_.addClonePathway(h,_)}),this.contentSteeringController_.addAvailablePathway(u);continue}this.equalPathwayClones_(f,h)||(this.mainPlaylistLoader_.updateOrDeleteClone(h,!0),this.contentSteeringController_.addAvailablePathway(u))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...a])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,a=t["URI-REPLACEMENT"].PARAMS;for(const l in i)if(i[l]!==a[l])return!1;for(const l in a)if(i[l]!==a[l])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=this.mainPlaylistLoader_.getKeyIdSet(i);!a||!a.size||a.forEach(l=>{const u="usable",h=this.keyStatusMap_.has(l)&&this.keyStatusMap_.get(l)===u,f=i.lastExcludeReason_===t&&i.excludeUntil===1/0;h?h&&f&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${l} is ${u}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${l} doesn't exist in the keyStatusMap or is not ${u}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,l=i.excludeUntil===1/0&&i.lastExcludeReason_===t;a&&l&&(delete i.excludeUntil,Fe.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const l=(typeof e=="string"?e:GR(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${l} added to the keyStatusMap`),this.keyStatusMap_.set(l,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const x8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=ib(a),u=S0(a);if(typeof i>"u")return u;i?delete a.disabled:a.disabled=!0;const h={renditionInfo:{id:e,bandwidth:a.attributes.BANDWIDTH,resolution:a.attributes.RESOLUTION,codecs:a.attributes.CODECS},cause:"fast-quality"};return i!==u&&!l&&(i?(t(a),n.trigger({type:"renditionenabled",metadata:h})):n.trigger({type:"renditiondisabled",metadata:h})),i};class _8{constructor(e,t,i){const{playlistController_:a}=e,l=a.fastQualityChange_.bind(a);if(t.attributes){const u=t.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=od(a.main(),t),this.playlist=t,this.id=i,this.enabled=x8(e.playlists,t.id,l)}}const w8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=Cd(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!ib(i)).map((i,a)=>new _8(n,i,i.id)):[]}},A_=["seeking","seeked","pause","playing","error"];class T8 extends Fe.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=xs("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),a=()=>this.techWaiting_(),l=()=>this.resetTimeUpdate_(),u=this.playlistController_,h=["main","subtitle","audio"],f={};h.forEach(_=>{f[_]={reset:()=>this.resetSegmentDownloads_(_),updateend:()=>this.checkSegmentDownloads_(_)},u[`${_}SegmentLoader_`].on("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].on("playlistupdate",f[_].reset),this.tech_.on(["seeked","seeking"],f[_].reset)});const g=_=>{["main","audio"].forEach(S=>{u[`${S}SegmentLoader_`][_]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),g("off"))},this.clearSeekingAppendCheck_=()=>g("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),g("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",a),this.tech_.on(A_,l),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",a),this.tech_.off(A_,l),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),h.forEach(_=>{u[`${_}SegmentLoader_`].off("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].off("playlistupdate",f[_].reset),this.tech_.off(["seeked","seeking"],f[_].reset)}),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=de.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],a=i.buffered_(),l=lj(this[`${e}Buffered_`],a);if(this[`${e}Buffered_`]=a,l){const u={bufferedRanges:a};t.trigger({type:"bufferedrangeschanged",metadata:u}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:ul(a)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Qs>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(cr([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),a=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let l;if(a&&(l=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const O=t.start(0);l=O+(O===t.end(0)?0:Qs)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${TS(t)}. Seeking to ${l}.`),this.tech_.setCurrentTime(l),!0;const u=this.playlistController_.sourceUpdater_,h=this.tech_.buffered(),f=u.audioBuffer?u.audioBuffered():null,g=u.videoBuffer?u.videoBuffered():null,_=this.media(),S=_.partTargetDuration?_.partTargetDuration:(_.targetDuration-Ys)*2,C=[f,g];for(let O=0;O<C.length;O++){if(!C[O])continue;if(tb(C[O],i)<S)return!1}const N=Zh(h,i);return N.length===0?!1:(l=N.start(0)+Qs,this.logger_(`Buffered region starts (${N.start(0)}) just beyond seek point (${i}). Seeking to ${l}.`),this.tech_.setCurrentTime(l),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ru(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const h=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${h}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(h),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,a=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const u=Zh(a,t);return u.length>0?(this.logger_(`Stopped at ${t} and seeking to ${u.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,a=!1){if(!e.length)return!1;let l=e.end(e.length-1)+Qs;const u=!i.endList,h=typeof i.partTargetDuration=="number";return u&&(h||a)&&(l=e.end(e.length-1)+i.targetDuration*3),t>l}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let a;if(e.length&&t.length){const l=ru(e,i-3),u=ru(e,i),h=ru(t,i);h.length&&!u.length&&l.length&&(a={start:l.end(0),end:h.end(0)})}else Zh(e,i).length||(a=this.gapFromVideoUnderflow_(e,i));return a?(this.logger_(`Encountered a gap in video from ${a.start} to ${a.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),a=Zh(t,i);if(this.resetTimeUpdate_(),a.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",a.start(0)),this.tech_.setCurrentTime(a.start(0)+Ys);const l={gapInfo:{from:i,to:a.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:l}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=sj(e);for(let a=0;a<i.length;a++){const l=i.start(a),u=i.end(a);if(t-l<4&&t-l>2)return{start:l,end:u}}return null}}const S8={errorInterval:30,getSource(n){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return n(t)}},mk=function(n,e){let t=0,i=0;const a=ri(S8,e);n.ready(()=>{n.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const l=function(){i&&n.currentTime(i)},u=function(_){_!=null&&(i=n.duration()!==1/0&&n.currentTime()||0,n.one("loadedmetadata",l),n.src(_),n.trigger({type:"usage",name:"vhs-error-reload"}),n.play())},h=function(){if(Date.now()-t<a.errorInterval*1e3){n.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!a.getSource||typeof a.getSource!="function"){Fe.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),a.getSource.call(n,u)},f=function(){n.off("loadedmetadata",l),n.off("error",h),n.off("dispose",f)},g=function(_){f(),mk(n,_)};n.on("error",h),n.on("dispose",f),n.reloadSourceOnError=g},k8=function(n){mk(this,n)};var pk="3.17.2",E8="7.1.0",C8="1.3.1",A8="7.2.0",N8="4.0.2";const Li={PlaylistLoader:su,Playlist:Hr,utils:Oj,STANDARD_PLAYLIST_SELECTOR:g_,INITIAL_PLAYLIST_SELECTOR:_R,lastBandwidthSelector:g_,movingAverageBandwidthSelector:vR,comparePlaylistBandwidth:ab,comparePlaylistResolution:bR,xhr:$S()};Object.keys(lr).forEach(n=>{Object.defineProperty(Li,n,{get(){return Fe.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),lr[n]},set(e){if(Fe.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Fe.log.warn(`value of Vhs.${n} must be greater than or equal to 0`);return}lr[n]=e}})});const gk="videojs-vhs",yk=function(n,e){const t=e.media();let i=-1;for(let a=0;a<n.length;a++)if(n[a].id===t.id){i=a;break}n.selectedIndex_=i,n.trigger({selectedIndex:i,type:"change"})},D8=function(n,e){e.representations().forEach(t=>{n.addQualityLevel(t)}),yk(n,e.playlists)};Li.canPlaySource=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const M8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=yd(Ks(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const a=_u(i.video),l=_u(i.audio),u={};for(const h in n)u[h]={},l&&(u[h].audioContentType=l),a&&(u[h].videoContentType=a),e.contentProtection&&e.contentProtection[h]&&e.contentProtection[h].pssh&&(u[h].pssh=e.contentProtection[h].pssh),typeof n[h]=="string"&&(u[h].url=n[h]);return ri(n,u)},j8=(n,e)=>n.reduce((t,i)=>{if(!i.contentProtection)return t;const a=e.reduce((l,u)=>{const h=i.contentProtection[u];return h&&h.pssh&&(l[u]={pssh:h.pssh}),l},{});return Object.keys(a).length&&t.push(a),t},[]),R8=({player:n,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!n.eme.initializeMediaKeys)return Promise.resolve();const a=t?i.concat([t]):i,l=j8(a,Object.keys(e)),u=[],h=[];return l.forEach(f=>{h.push(new Promise((g,_)=>{n.tech_.one("keysessioncreated",g)})),u.push(new Promise((g,_)=>{n.eme.initializeMediaKeys({keySystems:f},S=>{if(S){_(S);return}g()})}))}),Promise.race([Promise.all(u),Promise.race(h)])},O8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=M8(e,t,i);return a?(n.currentSource().keySystems=a,a&&!n.eme?(Fe.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},bk=()=>{if(!de.localStorage)return null;const n=de.localStorage.getItem(gk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},L8=n=>{if(!de.localStorage)return!1;let e=bk();e=e?ri(e,n):n;try{de.localStorage.setItem(gk,JSON.stringify(e))}catch{return!1}return e},I8=n=>n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n,vk=(n,e)=>{n._requestCallbackSet||(n._requestCallbackSet=new Set),n._requestCallbackSet.add(e)},xk=(n,e)=>{n._responseCallbackSet||(n._responseCallbackSet=new Set),n._responseCallbackSet.add(e)},_k=(n,e)=>{n._requestCallbackSet&&(n._requestCallbackSet.delete(e),n._requestCallbackSet.size||delete n._requestCallbackSet)},wk=(n,e)=>{n._responseCallbackSet&&(n._responseCallbackSet.delete(e),n._responseCallbackSet.size||delete n._responseCallbackSet)};Li.supportsNativeHls=(function(){if(!xt||!xt.createElement)return!1;const n=xt.createElement("video");return Fe.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(n.canPlayType(t))}):!1})();Li.supportsNativeDash=(function(){return!xt||!xt.createElement||!Fe.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(xt.createElement("video").canPlayType("application/dash+xml"))})();Li.supportsTypeNatively=n=>n==="hls"?Li.supportsNativeHls:n==="dash"?Li.supportsNativeDash:!1;Li.isSupported=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Li.xhr.onRequest=function(n){vk(Li.xhr,n)};Li.xhr.onResponse=function(n){xk(Li.xhr,n)};Li.xhr.offRequest=function(n){_k(Li.xhr,n)};Li.xhr.offResponse=function(n){wk(Li.xhr,n)};const B8=Fe.getComponent("Component");class Tk extends B8{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=xs("VhsHandler"),t.options_&&t.options_.playerId){const a=Fe.getPlayer(t.options_.playerId);this.player_=a}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(xt,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],a=>{const l=xt.fullscreenElement||xt.webkitFullscreenElement||xt.mozFullScreenElement||xt.msFullscreenElement;l&&l.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=ri(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=bk();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=lr.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===lr.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=I8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Li,this.options_.sourceType=qw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new v8(this.options_);const i=ri({liveRangeSafeTimeDelta:Qs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new T8(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const l=Fe.players[this.tech_.options_.playerId];let u=this.playlistController_.error;typeof u=="object"&&!u.code?u.code=3:typeof u=="string"&&(u={message:u,code:3}),l.error(u)});const a=this.options_.bufferBasedABR?Li.movingAverageBandwidthSelector(.55):Li.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Li.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(l){this.playlistController_.selectPlaylist=l.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(l){this.playlistController_.mainSegmentLoader_.throughput.rate=l,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let l=this.playlistController_.mainSegmentLoader_.bandwidth;const u=de.navigator.connection||de.navigator.mozConnection||de.navigator.webkitConnection,h=1e7;if(this.options_.useNetworkInformationApi&&u){const f=u.downlink*1e3*1e3;f>=h&&l>=h?l=Math.max(l,f):l=f}return l},set(l){this.playlistController_.mainSegmentLoader_.bandwidth=l,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const l=1/(this.bandwidth||1);let u;return this.throughput>0?u=1/this.throughput:u=0,Math.floor(1/(l+u))},set(){Fe.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>ul(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ul(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&L8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{w8(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=de.URL.createObjectURL(this.playlistController_.mediaSource),(Fe.browser.IS_ANY_SAFARI||Fe.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),R8({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=O8({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Fe.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{D8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{yk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":pk,"mux.js":E8,"mpd-parser":C8,"m3u8-parser":A8,"aes-decrypter":N8}}version(){return this.constructor.version()}canChangeType(){return ck.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&de.URL.revokeObjectURL&&(de.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return zj({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return KS({programTime:e,playlist:this.playlistController_.media(),retryCount:a,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{vk(this.xhr,e)},this.xhr.onResponse=e=>{xk(this.xhr,e)},this.xhr.offRequest=e=>{_k(this.xhr,e)},this.xhr.offResponse=e=>{wk(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,a=>{this.player_.trigger(Xi({},a))})}),t.forEach(i=>{this.playbackWatcher_.on(i,a=>{this.player_.trigger(Xi({},a))})})}}const Vf={name:"videojs-http-streaming",VERSION:pk,canHandleSource(n,e={}){const t=ri(Fe.options,e);return!t.vhs.experimentalUseMMS&&!nd("avc1.4d400d,mp4a.40.2",!1)?!1:Vf.canPlayType(n.type,t)},handleSource(n,e,t={}){const i=ri(Fe.options,t);return e.vhs=new Tk(n,e,i),e.vhs.xhr=$S(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=qw(n);if(!t)return"";const i=Vf.getOverrideNative(e);return!Li.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(n={}){const{vhs:e={}}=n,t=!(Fe.browser.IS_ANY_SAFARI||Fe.browser.IS_IOS),{overrideNative:i=t}=e;return i}},P8=()=>nd("avc1.4d400d,mp4a.40.2",!0);P8()&&Fe.getTech("Html5").registerSourceHandler(Vf,0);Fe.VhsHandler=Tk;Fe.VhsSourceHandler=Vf;Fe.Vhs=Li;Fe.use||Fe.registerComponent("Vhs",Li);Fe.options.vhs=Fe.options.vhs||{};(!Fe.getPlugin||!Fe.getPlugin("reloadSourceOnError"))&&Fe.registerPlugin("reloadSourceOnError",k8);const F8="",rl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${F8}${e}`};async function gg(n,e){const t=await fetch(rl(n),{...e,credentials:"include",headers:{...e?.headers??{},"Content-Type":e?.headers?.["Content-Type"]??"application/json"}});return t.status===401&&(location.pathname.startsWith("/login")||(location.href="/login")),t}function ob({src:n,muted:e=Sf,className:t}){const i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null);return p.useEffect(()=>{let f=!1,g=null;const _=i.current;if(!_)return;l(!1),h(null),cd(_,{muted:e});const S=()=>{try{_.pause(),_.removeAttribute("src"),_.load()}catch{}};S(),_.src=n,_.load(),_.play().catch(()=>{});let C=Date.now();const N=()=>{C=Date.now()};_.addEventListener("timeupdate",N),g=window.setInterval(()=>{f||!_.paused&&Date.now()-C>12e3&&(S(),_.src=n,_.load(),_.play().catch(()=>{}),C=Date.now())},4e3);const O=()=>{l(!0)};return _.addEventListener("error",O),()=>{f=!0,g&&window.clearInterval(g),g=null,_.removeEventListener("timeupdate",N),_.removeEventListener("error",O),S()}},[n,e]),a?c.jsx("div",{className:"text-xs text-gray-400 italic",children:u==="private"?"Private":u==="offline"?"Offline":""}):c.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const f=i.current;f&&(f.muted=!1,f.play().catch(()=>{}))}})}const ms=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",lb=n=>n.startsWith("HOT ")?n.slice(4):n,U8=n=>(n||"").trim().toLowerCase(),z8=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a.sort((l,u)=>l.localeCompare(u,void 0,{sensitivity:"base"})),a};function $8(n){if(!Number.isFinite(n)||n<=0)return"—";const e=Math.floor(n/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function H8(n){if(typeof n!="number"||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0||t>=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function N_(n){if(!n)return"—";const e=n instanceof Date?n:new Date(n),t=e.getTime();return Number.isFinite(t)?e.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}const tf=(...n)=>{for(const e of n){const t=typeof e=="string"?Number(e):e;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}return null};function q8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function V8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function G8(n){const e=ms(n||""),t=lb(e);if(!t)return null;const a=t.replace(/\.[^.]+$/,"").match(/_(\d{1,2})_(\d{1,2})_(\d{4})__(\d{1,2})-(\d{2})-(\d{2})$/);if(!a)return null;const l=Number(a[1]),u=Number(a[2]),h=Number(a[3]),f=Number(a[4]),g=Number(a[5]),_=Number(a[6]);return[l,u,h,f,g,_].every(S=>Number.isFinite(S))?new Date(h,l-1,u,f,g,_):null}const K8=n=>{const e=ms(n||""),t=lb(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i},W8=n=>{const e=n,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function _a(...n){return n.filter(Boolean).join(" ")}function X8(n){const[e,t]=p.useState(!1);return p.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}function Y8(n){!n||n.__absTimelineShimInstalled||(n.__absTimelineShimInstalled=!0,n.__origCurrentTime=n.currentTime.bind(n),n.__origDuration=n.duration.bind(n),n.__setRelativeTime=e=>{try{n.__origCurrentTime(Math.max(0,e||0))}catch{}},n.currentTime=function(e){const t=Number(this.__timeOffsetSec??0)||0;if(typeof e=="number"&&Number.isFinite(e)){const a=Math.max(0,e);return typeof this.__serverSeekAbs=="function"?(this.__serverSeekAbs(a),a):this.__origCurrentTime(Math.max(0,a-t))}const i=Number(this.__origCurrentTime()??0)||0;return Math.max(0,t+i)},n.duration=function(){const e=Number(this.__fullDurationSec??0)||0;if(e>0)return e;const t=Number(this.__timeOffsetSec??0)||0,i=Number(this.__origDuration()??0)||0;return Math.max(0,t+i)})}function Q8({job:n,expanded:e,onClose:t,onToggleExpand:i,modelKey:a,modelsByKey:l,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onKeep:_,onDelete:S,onToggleHot:C,onToggleFavorite:N,onToggleLike:O,onToggleWatch:E,onStopJob:B,startMuted:H=KN,startAtSec:Y=0}){const U=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),re=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),W=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),X=p.useMemo(()=>H8(W8(n)),[n]),R=n,[le,k]=p.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[j,Z]=p.useState(()=>n.status==="running"),[V,ne]=p.useState(()=>({h:0,fps:null})),me=n.status==="running",[ue,q]=p.useState(!1),P=me&&ue,Q=p.useMemo(()=>(W||"").replace(/\.[^.]+$/,""),[W]),te=p.useMemo(()=>me?n.id:Q||n.id,[me,n.id,Q]);p.useEffect(()=>{if(me||le>0)return;const se=ms(n.output?.trim()||"");if(!se)return;let I=!0;const ce=new AbortController;return(async()=>{try{const pe=rl(`/api/record/done/meta?file=${encodeURIComponent(se)}`),Ce=await gg(pe,{signal:ce.signal,cache:"no-store"});if(!Ce.ok)return;const Ae=await Ce.json(),z=Number(Ae?.durationSeconds||Ae?.meta?.durationSeconds||0)||0;if(!I||z<=0)return;k(z);const G=$e.current;if(G&&!G.isDisposed?.())try{G.__fullDurationSec=z,G.trigger?.("durationchange"),G.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{I=!1,ce.abort()}},[me,le,n.output]);const ge=re.startsWith("HOT "),L=p.useMemo(()=>{const se=(a||"").trim();return se||K8(n.output)},[a,n.output]),xe=p.useMemo(()=>lb(re),[re]),Te=p.useMemo(()=>{const se=Number(le||0)||0;return se>0?$8(se*1e3):"—"},[le]),ye=p.useMemo(()=>{const se=G8(n.output);if(se)return N_(se);const I=R.startedAt??R.endedAt??R.createdAt??R.fileCreatedAt??R.ctime??null,ce=I?new Date(I):null;return N_(ce&&Number.isFinite(ce.getTime())?ce:null)},[n.output,R.startedAt,R.endedAt,R.createdAt,R.fileCreatedAt,R.ctime]),be=p.useMemo(()=>U8((a||L||"").trim()),[a,L]),mt=p.useMemo(()=>{const se=l?.[be];return z8(se?.tags)},[l,be]),Ke=p.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(te)}&file=preview.webp`),[te]),we=p.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(te)}&play=1&file=index_hq.m3u8`),[te]),[Re,ct]=p.useState(Ke);p.useEffect(()=>{ct(Ke)},[Ke]);const Oe=p.useMemo(()=>tf(V.h,R.videoHeight,R.height,R.meta?.height),[V.h,R.videoHeight,R.height,R.meta?.height]),je=p.useMemo(()=>tf(V.fps,R.fps,R.frameRate,R.meta?.fps,R.meta?.frameRate),[V.fps,R.fps,R.frameRate,R.meta?.fps,R.meta?.frameRate]),[Ue,ze]=p.useState(null),gt=p.useMemo(()=>V8(Ue??Oe),[Ue,Oe]),st=p.useMemo(()=>q8(je),[je]);p.useEffect(()=>{const se=I=>I.key==="Escape"&&t();return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[t]);const bt=p.useMemo(()=>{const se=`/api/preview?id=${encodeURIComponent(te)}&file=index_hq.m3u8&play=1`;return rl(me?`${se}&t=${Date.now()}`:se)},[te,me]);p.useEffect(()=>{if(!me){q(!1);return}let se=!0;const I=new AbortController;return q(!1),(async()=>{for(let pe=0;pe<120&&se&&!I.signal.aborted;pe++){try{const Ce=await gg(bt,{method:"GET",cache:"no-store",signal:I.signal,headers:{"cache-control":"no-cache"}});if(Ce.ok){const Ae=await Ce.text(),z=Ae.includes("#EXTM3U"),G=/#EXTINF:/i.test(Ae)||/\.ts(\?|$)/i.test(Ae)||/\.m4s(\?|$)/i.test(Ae);if(z&&G){se&&q(!0);return}}}catch{}await new Promise(Ce=>setTimeout(Ce,500))}})(),()=>{se=!1,I.abort()}},[me,bt]);const Qe=p.useCallback(se=>{const I=new URLSearchParams;return se.file&&I.set("file",se.file),se.id&&I.set("id",se.id),rl(`/api/record/video?${I.toString()}`)},[]),Ye=p.useMemo(()=>{if(me)return{src:"",type:""};if(!j)return{src:"",type:""};const se=ms(n.output?.trim()||"");if(se){const I=se.toLowerCase().split(".").pop(),ce=I==="mp4"?"video/mp4":I==="ts"?"video/mp2t":"application/octet-stream";return{src:Qe({file:se}),type:ce}}return{src:Qe({id:n.id}),type:"video/mp4"}},[me,j,n.output,n.id,Qe]),tt=p.useRef(null),$e=p.useRef(null),ht=p.useRef(null),[At,he]=p.useState(!1),Ie=p.useCallback(()=>{const se=$e.current;if(!se||se.isDisposed?.())return;const I=typeof se.videoHeight=="function"?se.videoHeight():0;typeof I=="number"&&I>0&&Number.isFinite(I)&&ze(I)},[]),Le=p.useCallback(()=>{try{const se=$e.current?.tech?.(!0)?.el?.()||$e.current?.el?.()?.querySelector?.("video.vjs-tech")||ht.current;if(!se||!(se instanceof HTMLVideoElement))return null;const I=Number(se.videoWidth||0),ce=Number(se.videoHeight||0);if(!Number.isFinite(I)||!Number.isFinite(ce)||I<=0||ce<=0)return null;let pe=Mn.current;pe||(pe=document.createElement("canvas"),Mn.current=pe);const Ae=Math.min(1,640/I),z=Math.max(1,Math.round(I*Ae)),G=Math.max(1,Math.round(ce*Ae));pe.width!==z&&(pe.width=z),pe.height!==G&&(pe.height=G);const ee=pe.getContext("2d",{alpha:!1});return ee?(ee.drawImage(se,0,0,z,G),pe.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),ke=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),Pe=p.useMemo(()=>{const se=Number(Y);return Number.isFinite(se)&&se>=0?se:0},[Y]),et=p.useRef("");p.useEffect(()=>{if(me){Z(!0);return}const se=ms(n.output?.trim()||"");if(!se){Z(!0);return}let I=!0;const ce=new AbortController;return Z(!1),(async()=>{for(let pe=0;pe<80&&I&&!ce.signal.aborted;pe++){try{const Ce=rl(`/api/record/done/meta?file=${encodeURIComponent(se)}`),Ae=await gg(Ce,{signal:ce.signal,cache:"no-store"});if(Ae.ok){const z=await Ae.json(),G=!!z?.metaExists,ee=Number(z?.durationSeconds||0)||0,ae=Number(z?.height||0)||0,Be=Number(z?.fps||0)||0;if(ee>0){k(ee);const Je=$e.current;if(Je&&!Je.isDisposed?.())try{Je.__fullDurationSec=ee,Je.trigger?.("durationchange"),Je.trigger?.("timeupdate")}catch{}}if(ae>0&&ne({h:ae,fps:Be>0?Be:null}),G){Z(!0);return}}}catch{}await new Promise(Ce=>setTimeout(Ce,250))}I&&Z(!0)})(),()=>{I=!1,ce.abort()}},[me,ke,n.output]);const[,kt]=p.useState(0);p.useEffect(()=>{if(typeof window>"u")return;const se=window.visualViewport;if(!se)return;const I=()=>kt(ce=>ce+1);return I(),se.addEventListener("resize",I),se.addEventListener("scroll",I),window.addEventListener("resize",I),window.addEventListener("orientationchange",I),()=>{se.removeEventListener("resize",I),se.removeEventListener("scroll",I),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I)}},[]);const[Lt,pt]=p.useState(30),[Zt,qt]=p.useState(null),Gt=!e,wt=X8("(min-width: 640px)"),lt=Gt&&wt,Yt=e||lt,kn="player_window_v1",pn=420,xn=280,rt=12,M=320,F=200;p.useEffect(()=>{if(!At)return;const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.el();if(!I)return;const ce=I.querySelector(".vjs-control-bar");if(!ce)return;const pe=()=>{const Ae=Math.round(ce.getBoundingClientRect().height||0);Ae>0&&pt(Ae)};pe();let Ce=null;return typeof ResizeObserver<"u"&&(Ce=new ResizeObserver(pe),Ce.observe(ce)),window.addEventListener("resize",pe),()=>{window.removeEventListener("resize",pe),Ce?.disconnect()}},[At,e]),p.useEffect(()=>he(!0),[]),p.useEffect(()=>{if(!Yt){qt(null);return}let se=document.getElementById("player-root");se||(se=document.createElement("div"),se.id="player-root");let I=null;if(wt){const ce=Array.from(document.querySelectorAll("dialog[open]"));I=ce.length?ce[ce.length-1]:null}I=I??document.body,I.appendChild(se),se.style.position="relative",se.style.zIndex="2147483647",qt(se)},[wt,Yt]),p.useEffect(()=>{const se=$e.current;if(!se||se.isDisposed?.()||me||(Y8(se),!ms(n.output?.trim()||"")))return;const ce=Number(le||0)||0;return ce>0&&(se.__fullDurationSec=ce),se.__serverSeekAbs=pe=>{const Ce=Math.max(0,Number(pe)||0);try{se.__origCurrentTime?.(Ce);try{se.trigger?.("timeupdate")}catch{}}catch{try{se.currentTime?.(Ce)}catch{}}},()=>{try{delete se.__serverSeekAbs}catch{}}},[n.output,me]),p.useLayoutEffect(()=>{if(!At||!tt.current||$e.current||me||!j)return;const se=document.createElement("video");se.className="video-js vjs-big-play-centered w-full h-full",se.setAttribute("playsinline","true"),tt.current.appendChild(se),ht.current=se;const I=Fe(se,{autoplay:!0,muted:H,controls:!0,preload:"metadata",playsinline:!0,responsive:!0,fluid:!1,fill:!0,liveui:!1,html5:{vhs:{lowLatencyMode:!0}},inactivityTimeout:0,controlBar:{skipButtons:{backward:10,forward:10},volumePanel:{inline:!1},children:["skipBackward","playToggle","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","spacer","playbackRateMenuButton","fullscreenToggle"]},playbackRates:[.5,1,1.25,1.5,2]});return $e.current=I,I.one("loadedmetadata",()=>{Ie()}),I.userActive(!0),I.on("userinactive",()=>I.userActive(!0)),()=>{try{$e.current&&($e.current.dispose(),$e.current=null)}finally{ht.current&&(ht.current.remove(),ht.current=null)}}},[At,H,me,j,Oe,Ie]),p.useEffect(()=>{const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.el();I&&I.classList.toggle("is-live-download",!!P)},[P]);const ie=p.useCallback(()=>{const se=$e.current;if(!(!se||se.isDisposed?.())){try{se.pause(),se.reset?.()}catch{}try{se.src({src:"",type:"video/mp4"}),se.load?.()}catch{}}},[]),De=p.useCallback(se=>{const I=$e.current;if(!I||I.isDisposed?.())return;const ce=Math.max(0,Number(se)||0);try{const pe=Number(I.duration?.()??0),Ce=Number.isFinite(pe)&&pe>0?Math.max(0,pe-.05):ce;I.currentTime(Math.min(ce,Ce)),I.trigger?.("timeupdate")}catch{try{I.currentTime(ce)}catch{}}},[]);p.useEffect(()=>{if(!At)return;if(!me&&!j){ie();return}const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.currentTime()||0;if(se.muted(H),!Ye.src){try{se.pause(),se.reset?.(),se.error(null)}catch{}return}se.__timeOffsetSec=0;const ce=Number(le||0)||0;se.__fullDurationSec=ce;const pe=String(se.currentSrc?.()||"");if(et.current="",pe&&pe===Ye.src){const Ae=se.play?.();Ae&&typeof Ae.catch=="function"&&Ae.catch(()=>{});return}se.src({src:Ye.src,type:Ye.type});const Ce=()=>{const Ae=se.play?.();Ae&&typeof Ae.catch=="function"&&Ae.catch(()=>{})};se.one("loadedmetadata",()=>{if(se.isDisposed?.())return;Ie();try{const z=Number(le||0)||0;z>0&&(se.__fullDurationSec=z)}catch{}try{se.playbackRate(1)}catch{}const Ae=/mpegurl/i.test(Ye.type);if(I>0&&!Ae)try{const z=Number(se.__timeOffsetSec??0)||0,G=Math.max(0,I-z);se.__setRelativeTime?.(G)}catch{}try{se.trigger?.("timeupdate")}catch{}Ce()}),Ce()},[At,me,j,Ye.src,Ye.type,H,Ie,le,ie]),p.useEffect(()=>{if(!At||me||!j||!Ye.src)return;const se=$e.current;if(!se||se.isDisposed?.())return;if(!(Pe>0)){et.current="";return}const I=`${ke}|${Ye.src}|${Pe.toFixed(3)}`;if(et.current===I)return;let ce=!1;const pe=()=>{if(ce)return;const G=$e.current;if(!G||G.isDisposed?.())return;const ee=String(G.currentSrc?.()||"");if(!ee||ee!==Ye.src)return;const ae=G.tech?.(!0)?.el?.()||G.el?.()?.querySelector?.("video.vjs-tech");if(!((ae instanceof HTMLVideoElement?Number(ae.readyState||0):0)<1)){De(Pe),et.current=I;try{const Je=G.play?.();Je&&typeof Je.catch=="function"&&Je.catch(()=>{})}catch{}}};if(pe(),et.current===I)return;const Ce=()=>pe();se.one?.("loadedmetadata",Ce),se.one?.("canplay",Ce),se.one?.("durationchange",Ce);const Ae=window.setTimeout(pe,0),z=window.setTimeout(pe,120);return()=>{ce=!0,window.clearTimeout(Ae),window.clearTimeout(z);try{se.off?.("loadedmetadata",Ce)}catch{}try{se.off?.("canplay",Ce)}catch{}try{se.off?.("durationchange",Ce)}catch{}}},[At,me,j,Ye.src,ke,Pe,De]),p.useEffect(()=>{if(!At)return;const se=$e.current;if(!se||se.isDisposed?.())return;const I=()=>{n.status==="running"&&q(!1)};return se.on("error",I),()=>{try{se.off("error",I)}catch{}}},[At,n.status]),p.useEffect(()=>{const se=$e.current;!se||se.isDisposed?.()||queueMicrotask(()=>se.trigger("resize"))},[e]),p.useEffect(()=>{const se=I=>{const pe=(I.detail?.file??"").trim();if(!pe)return;const Ce=ms(n.output?.trim()||"");Ce&&Ce===pe&&ie()};return window.addEventListener("player:release",se),()=>window.removeEventListener("player:release",se)},[n.output,ie]),p.useEffect(()=>{const se=I=>{const pe=(I.detail?.file??"").trim();if(!pe)return;const Ce=ms(n.output?.trim()||"");Ce&&Ce===pe&&(ie(),t())};return window.addEventListener("player:close",se),()=>window.removeEventListener("player:close",se)},[n.output,ie,t]);const Ve=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const se=window.visualViewport;if(se&&Number.isFinite(se.width)&&Number.isFinite(se.height)){const Ce=Math.floor(se.width),Ae=Math.floor(se.height),z=Math.floor(se.offsetLeft||0),G=Math.floor(se.offsetTop||0),ee=Math.max(0,Math.floor(window.innerHeight-(se.height+se.offsetTop)));return{w:Ce,h:Ae,ox:z,oy:G,bottomInset:ee}}const I=document.documentElement,ce=I?.clientWidth||window.innerWidth,pe=I?.clientHeight||window.innerHeight;return{w:ce,h:pe,ox:0,oy:0,bottomInset:0}},yt=p.useRef(null);p.useEffect(()=>{if(typeof window>"u")return;const{w:se,h:I}=Ve();yt.current={w:se,h:I}},[]);const Vt=p.useCallback(()=>{const se=n,I=tf($e.current?.videoWidth?.(),se.videoWidth,se.width,se.meta?.width)??0,ce=tf(Ue,$e.current?.videoHeight?.(),se.videoHeight,se.height,se.meta?.height)??0;return I>0&&ce>0?I/ce:16/9},[n,Ue]),Jt=p.useCallback(se=>{if(typeof window>"u")return se;const I=Vt(),ce=30,{w:pe,h:Ce}=Ve(),Ae=pe-rt*2,z=Math.max(1,Ce-rt*2-ce),G=Math.max(1,F-ce);let ee=Math.max(M,Math.min(se.w,Ae)),ae=ee/I;ae<G&&(ae=G,ee=ae*I),ae>z&&(ae=z,ee=ae*I),ee>Ae&&(ee=Ae,ae=ee/I);const Be=Math.round(ae+ce),Je=Math.max(rt,Math.min(se.x,pe-ee-rt)),We=Math.max(rt,Math.min(se.y,Ce-Be-rt));return{x:Je,y:We,w:Math.round(ee),h:Be}},[Vt]),gn=p.useCallback(()=>{if(typeof window>"u")return{x:rt,y:rt,w:pn,h:xn};try{const z=window.localStorage.getItem(kn);if(z){const G=JSON.parse(z);if(typeof G.x=="number"&&typeof G.y=="number"&&typeof G.w=="number"&&typeof G.h=="number")return Jt({x:G.x,y:G.y,w:G.w,h:G.h})}}catch{}const{w:se,h:I}=Ve(),ce=pn,pe=xn,Ce=Math.max(rt,se-ce-rt),Ae=Math.max(rt,I-pe-rt);return Jt({x:Ce,y:Ae,w:ce,h:pe})},[Jt]),[ln,_n]=p.useState(()=>gn()),En=lt&&ln.w<380,Ut=p.useCallback(se=>{if(!(typeof window>"u"))try{window.localStorage.setItem(kn,JSON.stringify(se))}catch{}},[]),hn=p.useRef(ln);p.useEffect(()=>{hn.current=ln},[ln]),p.useEffect(()=>{lt&&_n(gn())},[lt,gn]),p.useEffect(()=>{if(!lt)return;const se=()=>{const I=yt.current,{w:ce,h:pe}=Ve();_n(Ce=>{if(!I)return Jt(Ce);const Ae=24,z=Ce.x-rt,G=I.w-rt-(Ce.x+Ce.w),ee=I.h-rt-(Ce.y+Ce.h),ae=Math.abs(z)<=Ae,Be=Math.abs(G)<=Ae,Je=Math.abs(ee)<=Ae;let We=Jt(Ce);return Je&&(We={...We,y:Math.max(rt,pe-We.h-rt)}),Be?We={...We,x:Math.max(rt,ce-We.w-rt)}:ae&&(We={...We,x:rt}),Jt(We)}),yt.current={w:ce,h:pe}};return yt.current=(()=>{const{w:I,h:ce}=Ve();return{w:I,h:ce}})(),window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[lt,Jt]);const cn=p.useRef(null);p.useEffect(()=>{const se=$e.current;if(!(!se||se.isDisposed?.()))return cn.current!=null&&cancelAnimationFrame(cn.current),cn.current=requestAnimationFrame(()=>{cn.current=null;try{se.trigger("resize")}catch{}}),()=>{cn.current!=null&&(cancelAnimationFrame(cn.current),cn.current=null)}},[lt,ln.w,ln.h]);const[en,zt]=p.useState(!1),[Dt,Ot]=p.useState(!1),[Hn,Rt]=p.useState(null),[qn,_i]=p.useState(null),Mn=p.useRef(null),Wt=p.useRef(null),zn=p.useRef(null),Kn=p.useRef(null),jn=p.useCallback(se=>{const{w:I,h:ce}=Ve(),pe=rt,Ce=I-se.w-rt,Ae=ce-se.h-rt,G=se.x+se.w/2<I/2;return{...se,x:G?pe:Ce,y:Ae}},[]),Wn=p.useCallback(se=>{const I=Kn.current;if(!I)return;const ce=se.clientX-I.sx,pe=se.clientY-I.sy,Ce=I.start,Ae=Jt({x:Ce.x+ce,y:Ce.y+pe,w:Ce.w,h:Ce.h});zn.current={x:Ae.x,y:Ae.y},Rt(jn(Ae)),Wt.current==null&&(Wt.current=requestAnimationFrame(()=>{Wt.current=null;const z=zn.current;z&&_n(G=>({...G,x:z.x,y:z.y}))}))},[Jt,jn]),Cn=p.useCallback(()=>{Kn.current&&(Ot(!1),Rt(null),Wt.current!=null&&(cancelAnimationFrame(Wt.current),Wt.current=null),Kn.current=null,window.removeEventListener("pointermove",Wn),window.removeEventListener("pointerup",Cn),_n(se=>{const I=jn(Jt(se));return queueMicrotask(()=>Ut(I)),I}))},[Wn,jn,Jt,Ut]),fi=p.useCallback(se=>{if(!lt||en||se.button!==0)return;se.preventDefault(),se.stopPropagation();const I=hn.current;Kn.current={sx:se.clientX,sy:se.clientY,start:I},Ot(!0);const ce=Le();_i(ce),Rt(jn(I)),window.addEventListener("pointermove",Wn),window.addEventListener("pointerup",Cn)},[lt,en,Wn,Cn,jn,Le]),Xn=p.useRef(null),li=p.useRef(null),_e=p.useRef(null),at=p.useCallback(se=>{const I=_e.current;if(!I)return;const ce=se.clientX-I.sx,pe=se.clientY-I.sy,Ce=I.ratio,Ae=I.dir.includes("w"),z=I.dir.includes("e"),G=I.dir.includes("n"),ee=I.dir.includes("s");let ae=I.start.w,Be=I.start.h,Je=I.start.x,We=I.start.y;const{w:ut,h:Mt}=Ve(),Nt=24,jt=I.start.x+I.start.w,Qt=I.start.y+I.start.h,Gn=Math.abs(ut-rt-jt)<=Nt,rr=Math.abs(Mt-rt-Qt)<=Nt,dr=wi=>{wi=Math.max(M,wi);let Fi=wi/Ce;return Fi<F&&(Fi=F,wi=Fi*Ce),{newW:wi,newH:Fi}},ja=wi=>{wi=Math.max(F,wi);let Fi=wi*Ce;return Fi<M&&(Fi=M,wi=Fi/Ce),{newW:Fi,newH:wi}};if((z||Ae)&&(G||ee)){if(Math.abs(ce)>=Math.abs(pe)){const Fi=z?I.start.w+ce:I.start.w-ce,{newW:_s,newH:Do}=dr(Fi);ae=_s,Be=Do}else{const Fi=ee?I.start.h+pe:I.start.h-pe,{newW:_s,newH:Do}=ja(Fi);ae=_s,Be=Do}Ae&&(Je=I.start.x+(I.start.w-ae)),G&&(We=I.start.y+(I.start.h-Be))}else if(z||Ae){const wi=z?I.start.w+ce:I.start.w-ce,{newW:Fi,newH:_s}=dr(wi);ae=Fi,Be=_s,Ae&&(Je=I.start.x+(I.start.w-ae)),We=rr?I.start.y+(I.start.h-Be):I.start.y}else if(G||ee){const wi=ee?I.start.h+pe:I.start.h-pe,{newW:Fi,newH:_s}=ja(wi);ae=Fi,Be=_s,G&&(We=I.start.y+(I.start.h-Be)),Gn?Je=I.start.x+(I.start.w-ae):Je=I.start.x}const os=Jt({x:Je,y:We,w:ae,h:Be});li.current=os,Xn.current==null&&(Xn.current=requestAnimationFrame(()=>{Xn.current=null;const wi=li.current;wi&&_n(wi)}))},[Jt]),Ct=p.useCallback(()=>{_e.current&&(zt(!1),Rt(null),_i(null),Xn.current!=null&&(cancelAnimationFrame(Xn.current),Xn.current=null),_e.current=null,window.removeEventListener("pointermove",at),window.removeEventListener("pointerup",Ct),Ut(hn.current))},[at,Ut]),St=p.useCallback(se=>I=>{if(!lt||I.button!==0)return;I.preventDefault(),I.stopPropagation();const ce=hn.current;_e.current={dir:se,sx:I.clientX,sy:I.clientY,start:ce,ratio:ce.w/ce.h},zt(!0),window.addEventListener("pointermove",at),window.addEventListener("pointerup",Ct)},[lt,at,Ct]),[Pt,tn]=p.useState(!1),[wn,vt]=p.useState(!1);p.useEffect(()=>{const se=window.matchMedia?.("(hover: hover) and (pointer: fine)"),I=()=>tn(!!se?.matches);return I(),se?.addEventListener?.("change",I),()=>se?.removeEventListener?.("change",I)},[]);const fn=lt&&(wn||Dt||en),[Ne,Tt]=p.useState(!1);if(p.useEffect(()=>{n.status!=="running"&&Tt(!1)},[n.id,n.status]),!At||Yt&&!Zt)return null;const _t="inline-flex items-center justify-center rounded-md p-2 transition bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 active:scale-[0.98] dark:bg-black/45 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500",Ht=String(n.phase??"").toLowerCase(),yn=Ht==="stopping"||Ht==="remuxing"||Ht==="moving",Xt=!B||!me||yn||Ne,On=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:me?c.jsxs(c.Fragment,{children:[c.jsx(sn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Xt,title:yn||Ne?"Stoppe…":"Stop","aria-label":yn||Ne?"Stoppe…":"Stop",onClick:async se=>{if(se.preventDefault(),se.stopPropagation(),!Xt)try{Tt(!0),await B?.(n.id)}finally{Tt(!1)}},className:_a("shadow-none shrink-0",lt&&En&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:yn||Ne?"Stoppe…":lt&&En?"Stop":"Stoppen"})}),c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,busy:yn||Ne,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,isHot:u||ge,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,onToggleHot:C?async se=>{ie(),await new Promise(ce=>setTimeout(ce,150)),await C(se),await new Promise(ce=>setTimeout(ce,0));const I=$e.current;if(I&&!I.isDisposed?.()){const ce=I.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{})}}:void 0,onKeep:_?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await _(se)}:void 0,onDelete:S?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await S(se)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),Vn=e||lt,mi=me?"calc(4px + env(safe-area-inset-bottom))":`calc(${Lt+2}px + env(safe-area-inset-bottom))`,$n="top-2",ji=e&&wt,Bi=c.jsx("div",{className:_a("relative overflow-visible",e||lt?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!lt||!Pt||vt(!0)},onMouseLeave:()=>{!lt||!Pt||vt(!1)},children:c.jsxs("div",{className:_a("relative w-full h-full",lt&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Lt}px`},children:[me?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(ob,{src:we,muted:H,className:"w-full h-full object-contain object-bottom"}),c.jsxs("div",{className:"absolute right-2 bottom-2 z-[60] pointer-events-none inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[c.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]})]}):c.jsx("div",{ref:tt,className:"absolute inset-0"}),c.jsxs("div",{className:_a("absolute inset-x-0 z-30 pointer-events-none","top-0"),children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-black/35 to-transparent"}),c.jsx("div",{className:_a("absolute inset-x-2",$n),children:c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2",children:[c.jsx("div",{className:"min-w-0 pointer-events-auto overflow-visible",children:ji?null:On}),lt?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:fi,onClick:se=>{se.preventDefault(),se.stopPropagation()},className:_a(_t,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",fn?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",Dt&&"scale-[0.98] opacity-90"),children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"})]}):null,c.jsxs("div",{className:"shrink-0 flex items-center gap-1 pointer-events-auto",children:[c.jsx("button",{type:"button",className:_t,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(IA,{className:"h-5 w-5"}):c.jsx(PA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:_t,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"h-5 w-5"})})]})]})})]}),c.jsxs("div",{className:_a("player-ui pointer-events-none absolute inset-x-2 z-50","flex items-end justify-between gap-2","transition-all duration-200 ease-out"),style:{bottom:mi},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white",children:L}),c.jsx("div",{className:"truncate text-[11px] text-white/80",children:c.jsxs("span",{className:"inline-flex items-center gap-1 min-w-0 align-middle",children:[c.jsx("span",{className:"truncate",children:xe||U}),u||ge?c.jsx("span",{className:"shrink-0 rounded bg-amber-500/25 px-1.5 py-0.5 font-semibold text-white",children:"HOT"}):null]})})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 text-[11px] text-white",children:[gt!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:gt}):null,me?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Te}),X!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:X}):null]})]})]})}),Yn=c.jsx("div",{className:"w-[360px] shrink-0 border-r border-white/10 bg-black/40 text-white",children:c.jsxs("div",{className:"h-full p-4 flex flex-col gap-3 overflow-y-auto",children:[c.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-white/10 bg-black/30",children:c.jsx("div",{className:"relative aspect-video",children:c.jsx("img",{src:Re,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}})})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"text-lg font-semibold truncate",children:L}),c.jsx("div",{className:"text-xs text-white/70 break-all",children:xe||U})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[me?c.jsx(sn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Xt,title:yn||Ne?"Stoppe…":"Stop","aria-label":yn||Ne?"Stoppe…":"Stop",onClick:async se=>{if(se.preventDefault(),se.stopPropagation(),!Xt)try{Tt(!0),await B?.(n.id)}finally{Tt(!1)}},className:"shadow-none",children:yn||Ne?"Stoppe…":"Stoppen"}):null,c.jsx(Ds,{job:n,variant:"table",collapseToMenu:!1,busy:yn||Ne,isHot:u||ge,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,onToggleHot:C?async se=>{ie(),await new Promise(ce=>setTimeout(ce,150)),await C(se),await new Promise(ce=>setTimeout(ce,0));const I=$e.current;if(I&&!I.isDisposed?.()){const ce=I.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{})}}:void 0,onKeep:_?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await _(se)}:void 0,onDelete:S?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await S(se)}:void 0,order:me?["watch","favorite","like","details"]:["watch","favorite","like","hot","details","keep","delete"],className:"flex items-center justify-start gap-1"})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-sm",children:[c.jsx("div",{className:"text-white/60",children:"Status"}),c.jsx("div",{className:"font-medium",children:n.status}),c.jsx("div",{className:"text-white/60",children:"Auflösung"}),c.jsx("div",{className:"font-medium",children:gt}),c.jsx("div",{className:"text-white/60",children:"FPS"}),c.jsx("div",{className:"font-medium",children:st}),c.jsx("div",{className:"text-white/60",children:"Laufzeit"}),c.jsx("div",{className:"font-medium",children:Te}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:X}),c.jsx("div",{className:"text-white/60",children:"Datum"}),c.jsx("div",{className:"font-medium",children:ye}),c.jsx("div",{className:"col-span-2",children:mt.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:mt.map(se=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:se},se))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),pi=lt&&Dt&&Hn?c.jsx("div",{className:"pointer-events-none absolute z-0 player-snap-ghost overflow-hidden rounded-lg border-2 border-dashed border-white/70 bg-black/55 shadow-2xl dark:border-white/60",style:{left:Hn.x-ln.x,top:Hn.y-ln.y,width:Hn.w,height:Hn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:qn||Re,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}}),c.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-black/55 to-transparent"}),c.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 opacity-80",children:[c.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"}),c.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"})]}),c.jsxs("div",{className:"absolute top-2 left-2 h-8 rounded-md bg-white/12 px-2 flex items-center gap-1 ring-1 ring-white/15",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"})]}),c.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex items-end justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white/95",children:L}),c.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[xe||U,u||ge?c.jsx("span",{className:"ml-1.5 rounded bg-amber-500/30 px-1.5 py-0.5 text-white",children:"HOT"}):null]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-[10px] text-white/90",children:[gt!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:gt}):null,!me&&Te!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Te}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,gi=c.jsx(Ns,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:_a("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",Vn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":lt?"rounded-lg":"rounded-none"),bodyClassName:"flex flex-col flex-1 min-h-0 p-0",children:c.jsxs("div",{className:"flex flex-1 min-h-0",children:[ji?Yn:null,Bi]})}),{w:Pn,h:Ri,ox:ei,oy:ti,bottomInset:An}=Ve(),ii={left:ei+16,top:ti+16,width:Math.max(0,Pn-32),height:Math.max(0,Ri-32)},Pi=e?ii:lt?{left:ln.x,top:ln.y,width:ln.w,height:ln.h}:void 0,Oi=c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
/* Live-Download: Progress/Seek-Bar ausblenden */
.is-live-download .vjs-progress-control {
display: none !important;
}
/* ---------- Video.js Layout-Fix (Finished Player) ----------
Ziel:
- Video endet immer direkt über der Controlbar
- Aspect Ratio bleibt erhalten
- Resize stabil (kein "Wandern")
*/
/* Container schwarz, falls Letterboxing sichtbar wird */
.vjs-mini .video-js,
.vjs-mini .video-js .vjs-tech,
.vjs-mini .video-js .vjs-poster {
background-color: transparent !important;
}
/* ECHTES Video (<video class="vjs-tech">) */
.vjs-mini .video-js .vjs-tech {
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
/* Seitenverhältnis beibehalten + unten an die Controlbar "anlehnen" */
object-fit: contain !important;
object-position: center top !important;
}
/* Poster genauso behandeln (falls sichtbar) */
.vjs-mini .video-js .vjs-poster {
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
background-position: center bottom !important;
background-size: contain !important;
background-repeat: no-repeat !important;
}
/* Untertitel-/Texttrack-Layer darf ebenfalls nicht in die Controlbar laufen */
.vjs-mini .video-js .vjs-text-track-display {
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: var(--vjs-controlbar-h, 30px) !important;
inset: 0 0 var(--vjs-controlbar-h, 30px) 0 !important;
}
/* Sicherheitsnetz: Controlbar immer wirklich unten */
.vjs-mini .video-js .vjs-control-bar {
bottom: 0 !important;
}
.player-snap-ghost {
backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);
}
.player-snap-ghost::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
pointer-events: none;
}
`}),e||lt?c.jsxs("div",{className:_a("fixed z-[2147483647]",!en&&!Dt&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...Pi,willChange:en?"left, top, width, height":void 0},children:[pi,gi,lt?c.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[c.jsx("div",{className:"pointer-events-auto absolute -left-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:St("w")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:St("e")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:St("n")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:St("s")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:St("nw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:St("ne")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:St("sw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:St("se")})]}):null]}):c.jsx("div",{className:`\r
fixed z-[2147483647] inset-x-0 w-full\r
shadow-2xl\r
md:bottom-4 md:left-1/2 md:right-auto md:inset-x-auto md:w-[min(760px,calc(100vw-32px))] md:-translate-x-1/2\r
`,style:{bottom:`calc(${An}px + env(safe-area-inset-bottom))`},children:gi})]});return Yt?yu.createPortal(Oi,Zt):Oi}function Sk({jobId:n,thumbTick:e,autoTickMs:t=1e4,blur:i=!1,className:a,alignStartAt:l,alignEndAt:u=null,alignEveryMs:h,fastRetryMs:f,fastRetryMax:g,fastRetryWindowMs:_,thumbsWebpUrl:S,thumbsCandidates:C}){const N=i?"blur-md":"",O=0,E=p.useRef(null),B=p.useRef(!0),[H,Y]=p.useState(!1),U=p.useRef(!1),[re,W]=p.useState(0),[X,R]=p.useState(!1),[le,k]=p.useState(!1),j=p.useRef(null),Z=p.useRef(0),V=p.useRef(!1),ne=p.useRef(!1),[me,ue]=p.useState(!0),q=Re=>{if(typeof Re=="number"&&Number.isFinite(Re))return Re;if(Re instanceof Date)return Re.getTime();const ct=Date.parse(String(Re??""));return Number.isFinite(ct)?ct:NaN},P=Re=>{const ct=String(Re??"").trim();return ct?/^https?:\/\//i.test(ct)||ct.startsWith("/")?ct:`/${ct}`:""},Q=p.useMemo(()=>{const Re=[S,...Array.isArray(C)?C:[]].map(P).filter(Boolean);return Array.from(new Set(Re)).join("|")},[S,C]);p.useEffect(()=>{const Re=()=>{const Oe=!document.hidden;B.current=Oe,ue(Oe)},ct=!document.hidden;return B.current=ct,ue(ct),document.addEventListener("visibilitychange",Re),()=>document.removeEventListener("visibilitychange",Re)},[]),p.useEffect(()=>()=>{j.current&&window.clearTimeout(j.current)},[]),p.useEffect(()=>{const Re=E.current;if(!Re)return;const ct=new IntersectionObserver(Oe=>{const je=Oe[0],Ue=!!(je&&(je.isIntersecting||je.intersectionRatio>0));Ue!==U.current&&(U.current=Ue,Y(Ue))},{root:null,threshold:0,rootMargin:"300px 0px"});return ct.observe(Re),()=>ct.disconnect()},[]),p.useEffect(()=>{typeof e!="number"&&H&&B.current&&(ne.current||(ne.current=!0,W(Re=>Re+1)))},[H,e]),p.useEffect(()=>{if(typeof e=="number"||!H||!B.current)return;const Re=Number(h??t??1e4);if(!Number.isFinite(Re)||Re<=0)return;const ct=l?q(l):NaN,Oe=u?q(u):NaN;if(Number.isFinite(ct)){let Ue;const ze=()=>{if(!B.current)return;const gt=Date.now();if(Number.isFinite(Oe)&&gt>=Oe)return;const bt=Math.max(0,gt-ct)%Re,Qe=bt===0?Re:Re-bt;Ue=window.setTimeout(()=>{U.current&&B.current&&(W(Ye=>Ye+1),ze())},Qe)};return ze(),()=>{Ue&&window.clearTimeout(Ue)}}const je=window.setInterval(()=>{U.current&&B.current&&W(Ue=>Ue+1)},Re);return()=>window.clearInterval(je)},[e,t,H,me,l,u,h]);const te=typeof e=="number"?e:re,ge=p.useRef(0),[L,xe]=p.useState(0);p.useEffect(()=>{H&&B.current&&(ge.current=te,xe(te))},[te,H]),p.useEffect(()=>{R(!1),k(!1)},[L]),p.useEffect(()=>{V.current=!1,Z.current=0,ne.current=!1,R(!1),k(!1),U.current&&B.current&&W(Re=>Re+1)},[n,Q]);const Te=p.useMemo(()=>`/api/preview?id=${encodeURIComponent(n)}&v=${L}`,[n,L]),ye=p.useMemo(()=>`/api/preview/live?id=${encodeURIComponent(n)}&hover=1`,[n]),mt=p.useMemo(()=>Q?Q.split("|"):[],[Q])[0]||"",Ke=!!mt&&!X,we=p.useMemo(()=>{if(Ke){const Re=mt.includes("?")?"&":"?";return`${mt}${Re}v=${encodeURIComponent(String(L))}`}return Te},[Ke,mt,L,Te]);return c.jsx(Ow,{content:(Re,{close:ct})=>Re&&c.jsx("div",{className:"w-[420px] max-w-[calc(100vw-1.5rem)]",children:c.jsx("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{paddingBottom:`calc(56.25% + ${O}px)`},children:c.jsxs("div",{className:"absolute inset-0",children:[c.jsx(ob,{src:ye,muted:!0,className:"w-full h-full object-contain object-bottom relative z-0"}),c.jsxs("div",{className:"absolute left-2 top-2 inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[c.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]}),c.jsx("button",{type:"button",className:"absolute right-2 top-2 z-20 inline-flex items-center justify-center rounded-md p-1.5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70 bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/55","aria-label":"Live-Vorschau schließen",title:"Vorschau schließen",onClick:Oe=>{Oe.preventDefault(),Oe.stopPropagation(),ct()},children:c.jsx(wf,{className:"h-4 w-4"})})]})})}),children:c.jsx("div",{ref:E,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",a||"w-full h-full"].join(" "),children:le?c.jsx("div",{className:"absolute inset-0 grid place-items-center px-1 text-center text-[10px] text-gray-500 dark:text-gray-400",children:"keine Vorschau"}):c.jsx("img",{src:we,loading:H?"eager":"lazy",fetchPriority:H?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",N].filter(Boolean).join(" "),onLoad:()=>{V.current=!0,Z.current=0,j.current&&window.clearTimeout(j.current),Ke?R(!1):k(!1)},onError:()=>{if(Ke){R(!0);return}if(k(!0),!f||!U.current||!B.current||V.current)return;const Re=l?q(l):NaN,ct=Number(_??6e4);if(!(!Number.isFinite(Re)||Date.now()-Re<ct))return;const je=Number(g??25);Z.current>=je||(j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{Z.current+=1,k(!1),W(Ue=>Ue+1)},f))}})})})}function bd({label:n,value:e=0,indeterminate:t=!1,showPercent:i=!1,rightLabel:a,steps:l,currentStep:u,size:h="md",className:f}){const g=Math.max(0,Math.min(100,Number(e)||0)),_=h==="sm"?"h-1.5":"h-2",S=Array.isArray(l)&&l.length>0,C=S?l.length:0,N=B=>B===0?"text-left":B===C-1?"text-right":"text-center",O=B=>typeof u!="number"||!Number.isFinite(u)?!1:B<=u,E=i&&!t;return c.jsxs("div",{className:f,children:[n||E?c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n?c.jsx("p",{className:"flex-1 min-w-0 truncate text-xs font-medium text-gray-900 dark:text-white",children:n}):c.jsx("span",{className:"flex-1"}),E?c.jsxs("span",{className:"shrink-0 text-xs font-medium text-gray-700 dark:text-gray-300",children:[Math.round(g),"%"]}):null]}):null,c.jsxs("div",{"aria-hidden":"true",className:n||E?"mt-2":"",children:[c.jsx("div",{className:"overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:t?c.jsx("div",{className:`${_} w-full rounded-full bg-indigo-600/70 dark:bg-indigo-500/70 animate-pulse`}):c.jsx("div",{className:`${_} rounded-full bg-indigo-600 dark:bg-indigo-500 transition-[width] duration-200`,style:{width:`${g}%`}})}),a?c.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:a}):null,S?c.jsx("div",{className:"mt-3 hidden text-sm font-medium text-gray-600 sm:grid dark:text-gray-400",style:{gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},children:l.map((B,H)=>c.jsx("div",{className:[N(H),O(H)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:B},`${H}-${B}`))}):null]})]})}function Z8(n,e=!1){const[t,i]=p.useState(e);return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(n),l=()=>{i(a.matches)};return l(),typeof a.addEventListener=="function"?(a.addEventListener("change",l),()=>a.removeEventListener("change",l)):(a.addListener(l),()=>a.removeListener(l))},[n]),t}const Gf=n=>{const e=n;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},kk=n=>{const e=n;return e.sourceUrl??e.url??e.roomUrl??""},Ek=n=>{const e=n;return String(e.imageUrl??e.image_url??"").trim()},Zl=n=>{const e=n;return String(e.key??e.id??Gf(n))},Hi=n=>{if(typeof n=="number"&&Number.isFinite(n))return n<1e12?n*1e3:n;if(typeof n=="string"){const e=Date.parse(n);return Number.isFinite(e)?e:0}return n instanceof Date?n.getTime():0},J8=n=>{const e=String(n??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},Ck=n=>{const e=n,t=[e.thumbsWebpUrl,e.thumbsUrl,e.previewThumbsUrl,e.thumbnailSheetUrl],i=[e.previewBaseUrl?`${String(e.previewBaseUrl).replace(/\/+$/,"")}/preview.webp`:"",e.assetBaseUrl?`${String(e.assetBaseUrl).replace(/\/+$/,"")}/preview.webp`:"",e.thumbsBaseUrl?`${String(e.thumbsBaseUrl).replace(/\/+$/,"")}/preview.webp`:""];return[...t,...i].map(a=>J8(String(a??""))).filter(Boolean)},Jl=n=>{if(n.kind==="job"){const t=n.job;return Hi(t.addedAt)||Hi(t.createdAt)||Hi(t.enqueuedAt)||Hi(t.queuedAt)||Hi(t.requestedAt)||Hi(t.startedAt)||0}const e=n.pending;return Hi(e.addedAt)||Hi(e.createdAt)||Hi(e.enqueuedAt)||Hi(e.queuedAt)||Hi(e.requestedAt)||0},Ak=n=>{switch((n??"").toLowerCase()){case"stopping":return"Stop wird angefordert…";case"probe":return"Analysiere Datei (Dauer/Streams)…";case"remuxing":return"Konvertiere Container zu MP4…";case"moving":return"Verschiebe nach Done…";case"assets":return"Erstelle Vorschau/Thumbnails…";case"postwork":return"Nacharbeiten laufen…";default:return""}};async function e6(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function Nk(n,e){const t=n.postWork;if(!t)return"Warte auf Nacharbeiten…";if(t.state==="running"){const i=typeof t.running=="number"?t.running:0,a=typeof t.maxParallel=="number"?t.maxParallel:0;return a>0?`Nacharbeiten laufen… (${i}/${a} parallel)`:"Nacharbeiten laufen…"}if(t.state==="queued"){const i=typeof t.position=="number"?t.position:0,a=typeof t.waiting=="number"?t.waiting:0,l=typeof t.running=="number"?t.running:0,u=Math.max(a+l,i),h=typeof e?.pos=="number"&&Number.isFinite(e.pos)&&e.pos>0?e.pos:i,f=typeof e?.total=="number"&&Number.isFinite(e.total)&&e.total>0?e.total:u;return h>0&&f>0?`Warte auf Nacharbeiten… ${h} / ${f}`:"Warte auf Nacharbeiten…"}return"Warte auf Nacharbeiten…"}function t6({job:n,postworkInfo:e}){const t=String(n?.phase??"").trim(),i=Number(n?.progress??0),a=t.toLowerCase(),l=a==="recording";let u=t?Ak(t)||t:"";a==="postwork"&&(u=Nk(n,e)),l&&(u="Recording läuft…");const h=u||String(n?.status??"").trim().toLowerCase(),f=!l&&Number.isFinite(i)&&i>0&&i<100,g=!l&&!f&&!!t&&(!Number.isFinite(i)||i<=0||i>=100);return c.jsx("div",{className:"min-w-0",children:f?c.jsx(bd,{label:h,value:Math.max(0,Math.min(100,i)),showPercent:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):g?c.jsx(bd,{label:h,indeterminate:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:h})})})}function yg({r:n,nowMs:e,blurPreviews:t,modelsByKey:i,stopRequestedIds:a,postworkInfoOf:l,markStopRequested:u,onOpenPlayer:h,onStopJob:f,onToggleFavorite:g,onToggleLike:_,onToggleWatch:S}){if(n.kind==="pending"){const P=n.pending,Q=Gf(P),te=kk(P),ge=(P.currentShow||"unknown").toLowerCase();return c.jsxs("div",{className:`\r
relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm\r
backdrop-blur-xl supports-[backdrop-filter]:bg-white/25\r
ring-1 ring-black/5\r
transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0\r
dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25\r
`,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),c.jsxs("div",{className:"relative p-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",title:Q,children:Q}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[c.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-900/5 px-2 py-0.5 font-medium dark:bg-white/10",children:"Wartend"}),c.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:bg-white/10 dark:text-gray-200",children:ge})]})]}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-900/5 px-2.5 py-1 text-xs font-medium text-gray-800 dark:bg-white/10 dark:text-gray-200",children:"⏳"})]}),c.jsx("div",{className:"mt-3",children:(()=>{const L=Ek(P);return c.jsx("div",{className:"relative aspect-[16/9] w-full overflow-hidden rounded-xl bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:L?c.jsx("img",{src:L,alt:Q,className:["h-full w-full object-cover",t?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:xe=>{xe.currentTarget.style.display="none"}}):c.jsx("div",{className:"grid h-full w-full place-items-center",children:c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-300",children:"Waiting…"})})})})()}),te?c.jsx("a",{href:te,target:"_blank",rel:"noreferrer",className:"mt-3 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:L=>L.stopPropagation(),title:te,children:te}):null]})]})}const C=n.job,N=fy(C.output),O=ub(C.output||""),E=String(C.phase??"").trim(),B=E.toLowerCase(),H=B==="recording",Y=!!a[C.id],U=String(C.status??"").toLowerCase(),W=B!==""&&B!=="recording"||U!=="running"||Y;let X=E?Ak(E)||E:"";B==="recording"?X="Recording läuft…":B==="postwork"&&(X=Nk(C,l(C)));const R=U||"unknown",le=X||R,k=Number(C.progress??0),j=!H&&Number.isFinite(k)&&k>0&&k<100,Z=!H&&!j&&!!E&&(!Number.isFinite(k)||k<=0||k>=100),V=N&&N!=="—"?N.toLowerCase():"",ne=V?i[V]:void 0,me=!!ne?.favorite,ue=ne?.liked===!0,q=!!ne?.watching;return c.jsxs("div",{className:`\r
group relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm\r
backdrop-blur-xl supports-[backdrop-filter]:bg-white/25\r
ring-1 ring-black/5\r
transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0\r
dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25\r
`,onClick:()=>h(C),role:"button",tabIndex:0,onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&h(C)},children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),c.jsx("div",{className:"pointer-events-none absolute -inset-10 opacity-0 blur-2xl transition-opacity duration-300 group-hover:opacity-100 bg-white/40 dark:bg-white/10"}),c.jsxs("div",{className:"relative p-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:`\r
relative\r
shrink-0 overflow-hidden rounded-lg\r
w-[112px] h-[64px]\r
bg-gray-100 ring-1 ring-black/5\r
dark:bg-white/10 dark:ring-white/10\r
`,children:c.jsx(Sk,{jobId:C.id,blur:t,alignStartAt:C.startedAt,alignEndAt:C.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ck(C),className:"w-full h-full"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"truncate text-base font-semibold text-gray-900 dark:text-white",title:N,children:N}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold","bg-gray-900/5 text-gray-800 dark:bg-white/10 dark:text-gray-200",W?"ring-1 ring-amber-500/30":"ring-1 ring-emerald-500/25"].join(" "),title:R,children:R})]}),c.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-600 dark:text-gray-300",title:C.output,children:O||"—"})]}),c.jsxs("div",{className:"shrink-0 flex flex-col items-end gap-1",children:[c.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Dk(C,e)}),c.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:jk(Mk(C))})]})]}),C.sourceUrl?c.jsx("a",{href:C.sourceUrl,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:P=>P.stopPropagation(),title:C.sourceUrl,children:C.sourceUrl}):null]})]}),j||Z?c.jsx("div",{className:"mt-3",children:j?c.jsx(bd,{label:le,value:Math.max(0,Math.min(100,k)),showPercent:!0,size:"sm",className:"w-full"}):c.jsx(bd,{label:le,indeterminate:!0,size:"sm",className:"w-full"})}):null,c.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/30 pt-3 dark:border-white/10",children:[c.jsx("div",{className:"flex items-center gap-1",onClick:P=>P.stopPropagation(),onMouseDown:P=>P.stopPropagation(),children:c.jsx(Ds,{job:C,variant:"table",busy:W,isFavorite:me,isLiked:ue,isWatching:q,onToggleFavorite:g,onToggleLike:_,onToggleWatch:S,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),c.jsx(sn,{size:"sm",variant:"primary",disabled:W,className:"shrink-0",onClick:P=>{P.stopPropagation(),!W&&(u(C.id),f(C.id))},children:W?"Stoppe…":"Stop"})]})]})]})}const ub=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",fy=n=>{const e=ub(n||"");if(!e)return"—";const t=e.replace(/\.[^.]+$/,""),i=t.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(i?.[1])return i[1];const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t},n6=n=>{if(!Number.isFinite(n)||n<=0)return"—";const e=Math.floor(n/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`},Dk=(n,e)=>{const t=n,i=Hi(t.startedAtMs)||Hi(n.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const a=n.endedAt?Hi(t.endedAtMs)||Hi(n.endedAt):e;return!Number.isFinite(a)||a<=0?"—":n6(a-i)},Mk=n=>{const e=n,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null},jk=n=>{if(!n||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0?0:t>=10?1:2;return`${t.toFixed(a).replace(/\.0+$/,"")} ${e[i]}`},bg=n=>{const e=n,t=String(e.phase??"").trim(),i=e.postWork;return!!(String(e.postWorkKey??"").trim()||i&&(i.state==="queued"||i.state==="running")||n.endedAt&&t||t==="postwork")},D_=n=>{const e=String(n??"").trim().toLowerCase();return e==="stopped"||e==="finished"||e==="failed"||e==="done"||e==="completed"||e==="canceled"||e==="cancelled"};function M_(){return c.jsx("span",{className:`\r
inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold\r
bg-red-100 text-red-800 ring-1 ring-red-200\r
dark:bg-red-500/15 dark:text-red-200 dark:ring-red-400/25\r
`,title:"Speicherplatz-Notbremse aktiv: Autostart gesperrt und Downloads wurden gestoppt",children:"Speicherplatz-Notbremse aktiv"})}function i6({jobs:n,pending:e=[],onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,modelsByKey:f={},blurPreviews:g}){const _=n,S=Z8("(min-width: 640px)",!0),[C,N]=p.useState(!1),[O,E]=p.useState(!1),[,B]=p.useState(!1),[H,Y]=p.useState(!1),U=p.useRef(null),re=p.useRef(null),W=p.useRef(null),[X,R]=p.useState(!1),le=p.useCallback(async()=>{try{const we=await e6("/api/autostart/state",{cache:"no-store"}),Re=!!we?.paused,ct=!!we?.pausedByUser,Oe=!!we?.pausedByDisk;U.current=Re,re.current=ct,W.current=Oe,E(Re),B(ct),Y(Oe)}catch{}},[]);p.useEffect(()=>{le();const we=ud("/api/stream","autostart",Re=>{const ct=!!Re?.paused,Oe=!!Re?.pausedByUser,je=!!Re?.pausedByDisk;U.current===ct&&re.current===Oe&&W.current===je||(U.current=ct,re.current=Oe,W.current=je,E(ct),B(Oe),Y(je))});return()=>{we()}},[le]);const k=p.useCallback(async()=>{if(!(X||O)){R(!0);try{const we=await fetch("/api/autostart/pause",{method:"POST"});if(!we.ok)throw new Error(`HTTP ${we.status}`);await le()}catch{}finally{R(!1)}}},[X,O,le]),j=p.useCallback(async()=>{if(!(X||!O||H)){R(!0);try{const we=await fetch("/api/autostart/resume",{method:"POST"});if(!we.ok)throw new Error(`HTTP ${we.status}`);await le()}catch{}finally{R(!1)}}},[X,O,H,le]),[Z,V]=p.useState({}),[ne,me]=p.useState({}),ue=p.useCallback(we=>{const Re=Array.isArray(we)?we:[we];V(ct=>{const Oe={...ct};for(const je of Re)je&&(Oe[je]=!0);return Oe}),me(ct=>{const Oe={...ct};for(const je of Re)je&&(Oe[je]=!0);return Oe})},[]);p.useEffect(()=>{V(we=>{const Re=Object.keys(we);if(Re.length===0)return we;const ct={};for(const Oe of Re){const je=_.find(st=>st.id===Oe);if(!je)continue;const Ue=String(je.phase??"").trim().toLowerCase();Ue!==""&&Ue!=="recording"||je.status!=="running"||(ct[Oe]=!0)}return ct})},[_]);const[q,P]=p.useState(()=>Date.now()),Q=p.useMemo(()=>_.some(we=>!we.endedAt&&we.status==="running"),[_]),te=p.useMemo(()=>{const we=new Map,Re=ze=>{const gt=ze,st=gt.postWork;return Hi(st?.enqueuedAt)||Hi(gt.enqueuedAt)||Hi(gt.queuedAt)||Hi(gt.createdAt)||Hi(gt.addedAt)||Hi(ze.endedAt)||Hi(ze.startedAt)||0},ct=[],Oe=[];for(const ze of _){const gt=ze?.postWork;if(!gt)continue;const st=String(gt.state??"").toLowerCase();st==="running"?ct.push(ze):st==="queued"&&Oe.push(ze)}ct.sort((ze,gt)=>Re(ze)-Re(gt)),Oe.sort((ze,gt)=>Re(ze)-Re(gt));const je=ct.length,Ue=je+Oe.length;for(let ze=0;ze<Oe.length;ze++){const gt=String(Oe[ze]?.id??"");gt&&we.set(gt,{pos:je+ze+1,total:Ue})}return we},[_]),ge=p.useCallback(we=>{const Re=String(we?.id??"");return Re?te.get(Re):void 0},[te]);p.useEffect(()=>{if(!Q)return;const we=window.setInterval(()=>P(Date.now()),1e3);return()=>window.clearInterval(we)},[Q]);const L=p.useMemo(()=>_.filter(we=>{if(bg(we)||we.endedAt)return!1;const Re=String(we.phase??"").trim(),ct=!!Z[we.id],Oe=Re.trim().toLowerCase();return!(Oe!==""&&Oe!=="recording"||we.status!=="running"||ct)}).map(we=>we.id),[_,Z]),xe=p.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:we=>{if(we.kind==="job"){const je=we.job;return c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:c.jsx(Sk,{jobId:je.id,blur:g,alignStartAt:je.startedAt,alignEndAt:je.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ck(je),className:"w-full h-full"})})}const Re=we.pending,ct=Gf(Re),Oe=Ek(Re);return Oe?c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:c.jsx("img",{src:Oe,alt:ct,className:["h-full w-full object-cover",g?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:je=>{je.currentTarget.style.display="none"}})}):c.jsx("div",{className:"h-[60px] w-[96px] rounded-md bg-gray-100 dark:bg-white/10 grid place-items-center text-sm text-gray-500",children:"⏳"})}},{key:"model",header:"Modelname",widthClassName:"w-[170px]",cell:we=>{if(we.kind==="job"){const je=we.job,Ue=ub(je.output||""),ze=fy(je.output),gt=String(je.status??"").toLowerCase(),st=!!Z[je.id],bt=!!ne[je.id],Qe=gt==="stopped"||bt&&!!je.endedAt,Ye=Qe?"stopped":gt||"unknown",tt=!Qe&&st,$e=tt?"stopping":Ye;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"min-w-0 block max-w-[170px] truncate font-medium",title:ze,children:ze}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",gt==="running"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":Qe?"bg-slate-500/15 text-slate-900 ring-slate-500/30 dark:bg-slate-400/10 dark:text-slate-200 dark:ring-slate-400/25":gt==="failed"?"bg-red-500/15 text-red-900 ring-red-500/30 dark:bg-red-400/10 dark:text-red-200 dark:ring-red-400/25":gt==="finished"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":tt?"bg-amber-500/15 text-amber-900 ring-amber-500/30 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25":"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"].join(" "),title:$e,children:$e})]}),c.jsx("span",{className:"block max-w-[220px] truncate",title:je.output,children:Ue}),je.sourceUrl?c.jsx("a",{href:je.sourceUrl,target:"_blank",rel:"noreferrer",title:je.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:ht=>ht.stopPropagation(),children:je.sourceUrl}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const Re=we.pending,ct=Gf(Re),Oe=kk(Re);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:ct,children:ct}),Oe?c.jsx("a",{href:Oe,target:"_blank",rel:"noreferrer",title:Oe,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:je=>je.stopPropagation(),children:Oe}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}},{key:"status",header:"Status",widthClassName:"w-[260px] min-w-[240px]",cell:we=>{if(we.kind==="job"){const Oe=we.job;return c.jsx(t6,{job:Oe,postworkInfo:ge(Oe)})}const ct=(we.pending.currentShow||"unknown").toLowerCase();return c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:ct})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:we=>we.kind==="job"?Dk(we.job,q):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:we=>we.kind==="job"?c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:jk(Mk(we.job))}):c.jsx("span",{className:"tabular-nums text-sm text-gray-500 dark:text-gray-400",children:"—"})},{key:"actions",header:"Aktion",srOnlyHeader:!0,align:"right",widthClassName:"w-[320px] min-w-[300px]",cell:we=>{if(we.kind!=="job")return c.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const Re=we.job,ct=String(Re.phase??"").trim(),Oe=!!Z[Re.id],je=ct.trim().toLowerCase(),ze=je!==""&&je!=="recording"||Re.status!=="running"||Oe,gt=fy(Re.output||""),st=gt&&gt!=="—"?f[gt.toLowerCase()]:void 0,bt=!!st?.favorite,Qe=st?.liked===!0,Ye=!!st?.watching;return c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[c.jsx(Ds,{job:Re,variant:"table",busy:ze,isFavorite:bt,isLiked:Qe,isWatching:Ye,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const tt=String(Re.phase??"").trim(),$e=!!Z[Re.id],ht=tt.trim().toLowerCase(),he=ht!==""&&ht!=="recording"||Re.status!=="running"||$e;return c.jsx(sn,{size:"sm",variant:"primary",disabled:he,className:"shrink-0",onClick:Ie=>{Ie.stopPropagation(),!he&&(ue(Re.id),i(Re.id))},children:he?"Stoppe…":"Stop"})})()]})}}],[g,ue,f,q,i,a,l,u,Z,ne,ge]),Te=p.useMemo(()=>{const we=_.filter(Re=>!(bg(Re)||D_(Re?.status)||Re?.endedAt)).map(Re=>({kind:"job",job:Re}));return we.sort((Re,ct)=>Jl(ct)-Jl(Re)),we},[_]),ye=p.useMemo(()=>{const we=_.filter(Oe=>!(!bg(Oe)||D_(Oe?.status))).map(Oe=>({kind:"job",job:Oe})),Re=Oe=>{const je=Oe?.postWork,Ue=String(je?.state??"").toLowerCase();return Ue==="running"?0:Ue==="queued"?1:2},ct=Oe=>{const je=String(Oe?.id??""),Ue=je?te.get(je):void 0;return typeof Ue?.pos=="number"&&Number.isFinite(Ue.pos)?Ue.pos:Number.MAX_SAFE_INTEGER};return we.sort((Oe,je)=>{const Ue=Oe.job,ze=je.job,gt=Re(Ue)-Re(ze);if(gt!==0)return gt;const st=ct(Ue),bt=ct(ze);return st!==bt?st-bt:Jl(Oe)-Jl(je)}),we},[_,te]),be=p.useMemo(()=>{const we=e.map(Re=>({kind:"pending",pending:Re}));return we.sort((Re,ct)=>Jl(ct)-Jl(Re)),we},[e]),mt=Te.length+ye.length+be.length,Ke=p.useCallback(async()=>{if(!C&&L.length!==0){N(!0);try{ue(L),await Promise.allSettled(L.map(we=>Promise.resolve(i(we))))}finally{N(!1)}}},[C,L,ue,i]);return c.jsxs("div",{className:"grid gap-3",children:[c.jsx("div",{className:"sticky top-[56px] z-20",children:c.jsx("div",{className:`\r
rounded-xl border border-gray-200/70 bg-white/80 shadow-sm\r
backdrop-blur supports-[backdrop-filter]:bg-white/60\r
dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40\r
`,children:c.jsxs("div",{className:"flex items-center justify-between gap-2 p-3",children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:mt})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[c.jsx(sn,{size:"sm",variant:O?"secondary":"primary",disabled:X||H,onClick:we=>{we.preventDefault(),we.stopPropagation(),!H&&(O?j():k())},className:"hidden sm:inline-flex",title:H?"Autostart durch Speicherplatz-Notbremse gesperrt":O?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:O?c.jsx(RN,{className:"size-4 shrink-0"}):c.jsx(LN,{className:"size-4 shrink-0"}),children:"Autostart"}),c.jsx(sn,{size:"sm",variant:"primary",disabled:C||L.length===0,onClick:we=>{we.preventDefault(),we.stopPropagation(),Ke()},className:"hidden sm:inline-flex",title:L.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:C?"Stoppe alle…":`Alle stoppen (${L.length})`})]})]})})}),Te.length>0||ye.length>0||be.length>0?c.jsx(c.Fragment,{children:S?c.jsxs("div",{className:"mt-3 space-y-4",children:[Te.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white",children:[c.jsxs("span",{children:["Downloads (",Te.length,")"]}),H?c.jsx(M_,{}):null]}),c.jsx(td,{rows:Te,columns:xe,getRowKey:we=>we.kind==="job"?`dl:job:${we.job.id}`:`dl:pending:${Zl(we.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:we=>{we.kind==="job"&&t(we.job)}})]}):null,ye.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Nacharbeiten (",ye.length,")"]}),c.jsx(td,{rows:ye,columns:xe,getRowKey:we=>we.kind==="job"?`pw:job:${we.job.id}`:`pw:pending:${Zl(we.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:we=>{we.kind==="job"&&t(we.job)}})]}):null,be.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Wartend (",be.length,")"]}),c.jsx(td,{rows:be,columns:xe,getRowKey:we=>we.kind==="job"?`wa:job:${we.job.id}`:`wa:pending:${Zl(we.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):c.jsxs("div",{className:"mt-3 grid gap-4",children:[Te.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:[c.jsxs("span",{children:["Downloads (",Te.length,")"]}),H?c.jsx(M_,{}):null]}),Te.map(we=>c.jsx(yg,{r:we,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:ge,stopRequestedIds:Z,markStopRequested:ue,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`dl:${we.kind==="job"?we.job.id:Zl(we.pending)}`))]}):null,ye.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Nacharbeiten (",ye.length,")"]}),ye.map(we=>c.jsx(yg,{r:we,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:ge,stopRequestedIds:Z,markStopRequested:ue,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`pw:${we.kind==="job"?we.job.id:Zl(we.pending)}`))]}):null,be.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Wartend (",be.length,")"]}),be.map(we=>c.jsx(yg,{r:we,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:ge,stopRequestedIds:Z,markStopRequested:ue,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`wa:${we.kind==="job"?we.job.id:Zl(we.pending)}`))]}):null]})}):c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:c.jsx("span",{className:"text-lg",children:"⏸️"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine laufenden Downloads"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Starte oben eine URL hier siehst du Live-Status und kannst Jobs stoppen."})]})]})})]})}async function vg(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const j_=(n,e)=>c.jsx("span",{className:on("inline-flex items-center rounded-md px-2 py-0.5 text-xs","bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-200"),children:e});function r6(n){let e=(n??"").trim();if(!e)return null;/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function nf(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(i=>i.trim()).filter(Boolean),t=Array.from(new Set(e));return t.sort((i,a)=>i.localeCompare(a,void 0,{sensitivity:"base"})),t}function s6(n){return String(n??"").trim().toLowerCase().replace(/^www\./,"")}function a6(n){const t=String(n||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function o6(n){const e=String(n||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function l6(n){const e=a6(n||""),t=o6(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i}function rf(n){if(n.isUrl&&/^https?:\/\//i.test(String(n.input??"")))return String(n.input);const e=s6(n.host),t=String(n.modelKey??"").trim();return!e||!t?null:e.includes("chaturbate.com")||e.includes("chaturbate")?`https://chaturbate.com/${encodeURIComponent(t)}/`:e.includes("myfreecams.com")||e.includes("myfreecams")?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:null}function R_(n){const e=String(n.profileImageCached??"").trim();if(e)return e;const t=String(n.profileImageUrl??"").trim();return/^https?:\/\//i.test(t)?t:null}function O_({title:n,active:e,hiddenUntilHover:t,onClick:i,icon:a}){return c.jsx("span",{className:on(t&&!e?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(sn,{variant:e?"soft":"secondary",size:"xs",className:on("px-2 py-1 leading-none",e?"":"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:n,onClick:i,children:c.jsx("span",{className:"text-base leading-none",children:a})})})}function L_(n){return n==null?{isNull:!0,kind:"string",value:""}:n instanceof Date?{isNull:!1,kind:"number",value:n.getTime()}:typeof n=="number"?{isNull:!1,kind:"number",value:n}:typeof n=="boolean"?{isNull:!1,kind:"number",value:n?1:0}:typeof n=="bigint"?{isNull:!1,kind:"number",value:Number(n)}:{isNull:!1,kind:"string",value:String(n).toLocaleLowerCase()}}function I_(n){return n?n.key==="createdAt"?n.direction==="asc"?"created_asc":"created_desc":n.key==="model"?n.direction==="asc"?"model_asc":"model_desc":n.key==="videos"?n.direction==="asc"?"videos_asc":"videos_desc":n.key==="tags"?n.direction==="asc"?"tags_asc":"tags_desc":"created_desc":"created_desc"}function B_(n){switch(n){case"created_asc":return{key:"createdAt",direction:"asc"};case"created_desc":return{key:"createdAt",direction:"desc"};case"model_asc":return{key:"model",direction:"asc"};case"model_desc":return{key:"model",direction:"desc"};case"videos_asc":return{key:"videos",direction:"asc"};case"videos_desc":return{key:"videos",direction:"desc"};case"tags_asc":return{key:"tags",direction:"asc"};case"tags_desc":return{key:"tags",direction:"desc"};default:return{key:"createdAt",direction:"desc"}}}function P_(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]})}function F_(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),c.jsx("path",{d:"M3 10h18"}),c.jsx("path",{d:"M9 10v10"}),c.jsx("path",{d:"M15 10v10"})]})}function u6(){const[n,e]=p.useState([]),t=p.useRef({}),[i,a]=p.useState(!1),[l,u]=p.useState(null),[h,f]=p.useState(""),[g,_]=p.useState(1),S=10,[C,N]=p.useState("gallery"),[O,E]=p.useState([]),[B,H]=p.useState({}),[Y,U]=p.useState(!1),[re,W]=p.useState({key:"createdAt",direction:"desc"}),X=p.useCallback(async()=>{U(!0);try{const he=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!he.ok)return;const Ie=await he.json().catch(()=>null),Le=Array.isArray(Ie?.items)?Ie.items:Array.isArray(Ie)?Ie:[],ke={};for(const Pe of Le){const et=l6(Pe.output);if(!et||et==="—")continue;const kt=et.trim().toLowerCase();kt&&(ke[kt]=(ke[kt]??0)+1)}H(ke)}finally{U(!1)}},[]),R=p.useMemo(()=>new Set(O.map(he=>he.toLowerCase())),[O]),le=p.useCallback(he=>{const Ie=he.toLowerCase();E(Le=>Le.some(Pe=>Pe.toLowerCase()===Ie)?Le.filter(Pe=>Pe.toLowerCase()!==Ie):[...Le,he])},[]),k=p.useCallback(()=>E([]),[]);p.useEffect(()=>{const he=Ie=>{const Le=Ie,ke=Array.isArray(Le.detail?.tags)?Le.detail.tags:[];E(ke)};return window.addEventListener("models:set-tag-filter",he),()=>window.removeEventListener("models:set-tag-filter",he)},[]),p.useEffect(()=>{try{const he=localStorage.getItem("models_pendingTags");if(!he)return;const Ie=JSON.parse(he);Array.isArray(Ie)&&E(Ie),localStorage.removeItem("models_pendingTags")}catch{}},[]),p.useEffect(()=>{try{const he=localStorage.getItem("models_viewMode");(he==="table"||he==="gallery")&&N(he)}catch{}},[]),p.useEffect(()=>{try{localStorage.setItem("models_viewMode",C)}catch{}},[C]);const[j,Z]=p.useState(""),[V,ne]=p.useState(null),[me,ue]=p.useState(null),[q,P]=p.useState(!1),[Q,te]=p.useState(!1),[ge,L]=p.useState(null),[xe,Te]=p.useState(null),[ye,be]=p.useState("favorite"),[mt,Ke]=p.useState(!1),[we,Re]=p.useState(null);async function ct(){if(ge){Ke(!0),Te(null),u(null);try{const he=new FormData;he.append("file",ge),he.append("kind",ye);const Ie=await fetch("/api/models/import",{method:"POST",body:he});if(!Ie.ok)throw new Error(await Ie.text());const Le=await Ie.json();Te(`✅ Import: ${Le.inserted} neu, ${Le.updated} aktualisiert, ${Le.skipped} übersprungen`),te(!1),L(null),await Ue(),window.dispatchEvent(new Event("models-changed"))}catch(he){Re(he?.message??String(he))}finally{Ke(!1)}}}function Oe(he){const Ie=rf(he)??void 0;return{output:`${he.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:Ie}}const je=()=>{Re(null),Te(null),L(null),be("favorite"),te(!0)},Ue=p.useCallback(async()=>{a(!0),u(null);try{const he=await vg("/api/models",{cache:"no-store"});e(Array.isArray(he)?he:[]),X()}catch(he){u(he?.message??String(he))}finally{a(!1)}},[X]);p.useEffect(()=>{X()},[X]),p.useEffect(()=>{Ue()},[Ue]),p.useEffect(()=>{const he=Ie=>{const ke=Ie?.detail??{};if(ke?.model){const Pe=ke.model;e(et=>{const kt=et.findIndex(pt=>pt.id===Pe.id);if(kt===-1)return[Pe,...et];const Lt=et.slice();return Lt[kt]=Pe,Lt});return}if(ke?.removed&&ke?.id){const Pe=String(ke.id);e(et=>et.filter(kt=>kt.id!==Pe));return}Ue()};return window.addEventListener("models-changed",he),()=>window.removeEventListener("models-changed",he)},[Ue]),p.useEffect(()=>{const he=j.trim();if(!he){ne(null),ue(null);return}const Ie=r6(he);if(!Ie){ne(null),ue("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const Le=window.setTimeout(async()=>{try{const ke=await vg("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Ie})});if(!ke?.isUrl){ne(null),ue("Bitte nur URLs einfügen (keine Modelnamen).");return}ne(ke),ue(null)}catch(ke){ne(null),ue(ke?.message??String(ke))}},300);return()=>window.clearTimeout(Le)},[j]);const ze=p.useMemo(()=>n.map(he=>({m:he,hay:`${he.modelKey} ${he.host??""} ${he.input??""} ${he.tags??""}`.toLowerCase()})),[n]),gt=p.useDeferredValue(h);async function st(he,Ie){if(u(null),t.current[he])return;t.current[he]=!0;const Le=n.find(ke=>ke.id===he)??null;if(Le){const ke={...Le,...Ie};typeof Ie?.watched=="boolean"&&(ke.watching=Ie.watched),Ie?.favorite===!0&&(ke.liked=!1),Ie?.liked===!0&&(ke.favorite=!1),e(Pe=>Pe.map(et=>et.id===he?ke:et)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ke}}))}try{const ke=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:he,...Ie})});if(ke.status===204){e(et=>et.filter(kt=>kt.id!==he)),Le?window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Le.id,modelKey:Le.modelKey}})):window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:he}}));return}if(!ke.ok){const et=await ke.text().catch(()=>"");throw new Error(et||`HTTP ${ke.status}`)}const Pe=await ke.json();e(et=>{const kt=et.findIndex(pt=>pt.id===Pe.id);if(kt===-1)return et;const Lt=et.slice();return Lt[kt]=Pe,Lt}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Pe}}))}catch(ke){Le&&(e(Pe=>Pe.map(et=>et.id===he?Le:et)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Le}}))),u(ke?.message??String(ke))}finally{delete t.current[he]}}const bt=p.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:he=>{const Ie=he.liked===!0,Le=he.favorite===!0,ke=he.watching===!0,Pe=!ke&&!Le&&!Ie;return c.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[c.jsx("span",{className:on(Pe&&!ke?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(sn,{variant:ke?"soft":"secondary",size:"xs",className:on("px-2 py-1 leading-none",!ke&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:ke?"Nicht mehr beobachten":"Beobachten",onClick:et=>{et.stopPropagation(),st(he.id,{watched:!ke})},children:c.jsx("span",{className:on("text-base leading-none",ke?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),c.jsx(O_,{title:Le?"Favorit entfernen":"Als Favorit markieren",active:Le,hiddenUntilHover:Pe,onClick:et=>{et.stopPropagation(),Le?st(he.id,{favorite:!1}):st(he.id,{favorite:!0,liked:!1})},icon:c.jsx("span",{className:Le?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),c.jsx(O_,{title:Ie?"Gefällt mir entfernen":"Gefällt mir",active:Ie,hiddenUntilHover:Pe,onClick:et=>{et.stopPropagation(),Ie?st(he.id,{liked:!1}):st(he.id,{liked:!0,favorite:!1})},icon:c.jsx("span",{className:Ie?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:he=>(he.modelKey||"").toLowerCase(),cell:he=>{const Ie=rf(he),Le=R_(he);return c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[c.jsx("div",{className:"shrink-0 mt-0.5",children:Le?c.jsx("img",{src:Le,alt:he.modelKey,loading:"lazy",className:"w-10 h-10 rounded-full object-cover bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10",onClick:ke=>{ke.stopPropagation(),Ie&&window.open(Ie,"_blank","noreferrer")},onError:ke=>{ke.currentTarget.style.display="none"}}):c.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10 flex items-center justify-center text-xs text-gray-500 dark:text-gray-400",children:String(he.modelKey||"?").slice(0,1).toUpperCase()})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:he.modelKey}),Ie?c.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:Ie,onClick:ke=>{ke.stopPropagation(),window.open(Ie,"_blank","noreferrer")},children:"↗"}):null]}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:he.host??"—"}),Ie?c.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:Ie}):null]})]})})}},{key:"videos",header:"Videos",sortable:!0,sortValue:he=>{const Ie=String(he.modelKey||"").trim().toLowerCase(),Le=B[Ie];return typeof Le=="number"?Le:0},align:"right",cell:he=>{const Ie=String(he.modelKey||"").trim().toLowerCase(),Le=B[Ie];return c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white w-[64px] inline-block text-right",children:typeof Le=="number"?Le:Y?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:he=>nf(he.tags).length,cell:he=>{const Ie=nf(he.tags),Le=Ie.slice(0,6),ke=Ie.length-Le.length,Pe=Ie.join(", ");return c.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:Pe||void 0,children:[he.hot?j_(!0,"🔥 HOT"):null,he.keep?j_(!0,"📌 Behalten"):null,Le.map(et=>c.jsx(ps,{tag:et,title:et,active:R.has(et.toLowerCase()),onClick:le},et)),ke>0?c.jsxs(ps,{title:Pe,children:["+",ke]}):null,!he.hot&&!he.keep&&Ie.length===0?c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"}):null]})}},{key:"createdAt",header:"Hinzugefügt",sortable:!0,sortValue:he=>{const Ie=Date.parse(String(he.createdAt??""));return Number.isFinite(Ie)?Ie:0},widthClassName:"w-[160px]",cell:he=>{const Ie=Date.parse(String(he.createdAt??""));if(!Number.isFinite(Ie)||Ie<=0)return c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"});const Le=new Date(Ie);return c.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300 leading-tight",children:[c.jsx("div",{className:"tabular-nums",children:Le.toLocaleDateString("de-DE")}),c.jsx("div",{className:"tabular-nums text-gray-500 dark:text-gray-400",children:Le.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})})]})}},{key:"actions",header:"",align:"right",cell:he=>c.jsx("div",{className:"flex justify-end w-[92px]",children:c.jsx(Ds,{job:Oe(he),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[R,le,B,Y]),Qe=p.useMemo(()=>{const he=gt.trim().toLowerCase(),Ie=he?ze.filter(Le=>Le.hay.includes(he)).map(Le=>Le.m):n;return R.size===0?Ie:Ie.filter(Le=>{const ke=nf(Le.tags);if(ke.length===0)return!1;const Pe=new Set(ke.map(et=>et.toLowerCase()));for(const et of R)if(!Pe.has(et))return!1;return!0})},[n,ze,gt,R]),Ye=p.useMemo(()=>{if(!re)return Qe;const he=bt.find(ke=>ke.key===re.key);if(!he)return Qe;const Ie=re.direction==="asc"?1:-1,Le=Qe.map((ke,Pe)=>({r:ke,i:Pe}));return Le.sort((ke,Pe)=>{let et=0;if(he.sortFn)et=he.sortFn(ke.r,Pe.r);else{const kt=he.sortValue?he.sortValue(ke.r):ke.r?.[he.key],Lt=he.sortValue?he.sortValue(Pe.r):Pe.r?.[he.key],pt=L_(kt),Zt=L_(Lt);pt.isNull&&!Zt.isNull?et=1:!pt.isNull&&Zt.isNull?et=-1:pt.kind==="number"&&Zt.kind==="number"?et=pt.value<Zt.value?-1:pt.value>Zt.value?1:0:et=String(pt.value).localeCompare(String(Zt.value),void 0,{numeric:!0})}return et===0?ke.i-Pe.i:et*Ie}),Le.map(ke=>ke.r)},[Qe,re,bt]);p.useEffect(()=>{_(1)},[h,O,C,re]);const tt=Ye.length,$e=p.useMemo(()=>Math.max(1,Math.ceil(tt/S)),[tt,S]);p.useEffect(()=>{g>$e&&_($e)},[g,$e]);const ht=p.useMemo(()=>{const he=(g-1)*S;return Ye.slice(he,he+S)},[Ye,g,S]),At=async()=>{if(V){if(!V.isUrl){ue("Bitte nur URLs einfügen (keine Modelnamen).");return}P(!0),u(null);try{const he=await vg("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});e(Ie=>{const Le=Ie.filter(ke=>ke.id!==he.id);return[he,...Le]}),Z(""),ne(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:he}}))}catch(he){u(he?.message??String(he))}finally{P(!1)}}};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(Ns,{header:c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Model hinzufügen"}),grayBody:!0,children:c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[c.jsx("input",{value:j,onChange:he=>Z(he.target.value),placeholder:"https://…",className:"flex-1 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),c.jsx(sn,{className:"px-3 py-2 text-sm",onClick:At,disabled:!V||q,title:V?"In Models speichern":"Bitte gültige URL einfügen",children:"Hinzufügen"}),c.jsx(sn,{className:"px-3 py-2 text-sm",onClick:Ue,disabled:i,children:"Aktualisieren"})]}),me?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:me}):V?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Gefunden: ",c.jsx("span",{className:"font-medium",children:V.modelKey}),V.host?c.jsxs("span",{className:"opacity-70",children:[" • ",V.host]}):null]}):null,l?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:l}):null]})}),c.jsx(Ns,{header:c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid gap-2 sm:flex sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white whitespace-nowrap",children:["Models ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",Qe.length,")"]})]}),c.jsx("div",{className:"sm:hidden shrink-0",children:c.jsx(sn,{variant:"secondary",size:"md",onClick:je,children:"Import"})}),c.jsx("div",{className:"hidden sm:block shrink-0",children:c.jsx(sn,{variant:"secondary",size:"md",onClick:je,children:"Importieren"})})]}),c.jsxs("div",{className:"w-full sm:w-auto min-w-0",children:[c.jsxs("div",{className:"sm:hidden grid gap-2",children:[c.jsxs("div",{className:"grid grid-cols-[auto,minmax(0,1fr)] gap-2 items-center min-w-0",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Fg,{ariaLabel:"Ansicht umschalten",size:"lg",className:"flex w-full [&>button]:flex-1 [&>button]:min-w-0",value:C,onChange:he=>{(he==="table"||he==="gallery")&&N(he)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(P_,{})},{id:"table",label:"Tabelle",icon:c.jsx(F_,{})}]})}),c.jsx("div",{className:"min-w-0",children:C==="gallery"?c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"sr-only",htmlFor:"models-gallery-sort-mobile",children:"Sortierung"}),c.jsxs("select",{id:"models-gallery-sort-mobile",value:I_(re),onChange:he=>{const Ie=B_(he.target.value);W(Ie)},className:`\r
h-9 w-full min-w-0\r
rounded-md px-2 text-sm\r
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10 dark:[color-scheme:dark]\r
`,children:[c.jsx("option",{value:"created_desc",children:"Hinzugefügt ↓"}),c.jsx("option",{value:"created_asc",children:"Hinzugefügt ↑"}),c.jsx("option",{value:"model_asc",children:"Model A→Z"}),c.jsx("option",{value:"model_desc",children:"Model Z→A"}),c.jsx("option",{value:"videos_desc",children:"Videos ↓"}),c.jsx("option",{value:"videos_asc",children:"Videos ↑"}),c.jsx("option",{value:"tags_desc",children:"Tags ↓"}),c.jsx("option",{value:"tags_asc",children:"Tags ↑"})]})]}):c.jsx("div",{"aria-hidden":"true",className:`\r
h-9 w-full min-w-0\r
rounded-md px-3 text-sm\r
inline-flex items-center\r
bg-gray-50 text-gray-400 ring-1 ring-gray-200\r
dark:bg-white/5 dark:text-white/30 dark:ring-white/10\r
select-none\r
`,title:"Sortierung in der Tabellenansicht über Spaltenkopf",children:"Sortierung"})})]}),c.jsx("input",{value:h,onChange:he=>f(he.target.value),placeholder:"Suchen…",className:`\r
w-full min-w-0\r
rounded-md px-3 py-2 text-sm\r
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10\r
`})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 sm:justify-end",children:[C==="gallery"?c.jsxs("div",{className:"shrink-0",children:[c.jsx("label",{className:"sr-only",htmlFor:"models-gallery-sort",children:"Sortierung"}),c.jsxs("select",{id:"models-gallery-sort",value:I_(re),onChange:he=>{const Ie=B_(he.target.value);W(Ie)},className:`\r
h-9 w-auto\r
rounded-md px-3 text-sm\r
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10 dark:[color-scheme:dark]\r
`,children:[c.jsx("option",{value:"created_desc",children:"Hinzugefügt ↓"}),c.jsx("option",{value:"created_asc",children:"Hinzugefügt ↑"}),c.jsx("option",{value:"model_asc",children:"Model A→Z"}),c.jsx("option",{value:"model_desc",children:"Model Z→A"}),c.jsx("option",{value:"videos_desc",children:"Videos ↓"}),c.jsx("option",{value:"videos_asc",children:"Videos ↑"}),c.jsx("option",{value:"tags_desc",children:"Tags ↓"}),c.jsx("option",{value:"tags_asc",children:"Tags ↑"})]})]}):null,c.jsx("div",{className:"shrink-0",children:c.jsx(Fg,{ariaLabel:"Ansicht umschalten",size:"lg",value:C,onChange:he=>{(he==="table"||he==="gallery")&&N(he)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(P_,{})},{id:"table",label:"Tabelle",icon:c.jsx(F_,{})}]})}),c.jsx("input",{value:h,onChange:he=>f(he.target.value),placeholder:"Suchen…",className:`\r
w-full sm:w-[260px]\r
rounded-md px-3 py-2 text-sm\r
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10\r
`})]})]})]}),O.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Tag-Filter:"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[O.map(he=>c.jsx(ps,{tag:he,active:!0,onClick:le,title:he},he)),c.jsx(sn,{size:"sm",variant:"soft",className:"text-xs font-medium text-gray-600 hover:underline dark:text-gray-300",onClick:k,children:"Zurücksetzen"})]})]}):null]}),noBodyPadding:!0,children:C==="table"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:"min-w-[980px]",children:c.jsx(td,{rows:ht,columns:bt,getRowKey:he=>he.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:re,onSortChange:he=>W(he),onRowClick:he=>{const Ie=rf(he);Ie&&window.open(Ie,"_blank","noreferrer")}})})}),c.jsx(kf,{page:g,pageSize:S,totalItems:tt,onPageChange:_})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"p-2 sm:p-3",children:ht.length===0?c.jsx("div",{className:"rounded-lg border border-dashed border-gray-200 p-8 text-center text-sm text-gray-500 dark:border-white/10 dark:text-gray-400",children:"Keine Models gefunden."}):c.jsx("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-5",children:ht.map(he=>{const Ie=rf(he),Le=R_(he),ke=nf(he.tags),Pe=ke.slice(0,3),et=he.liked===!0,kt=he.favorite===!0,Lt=he.watching===!0,pt=!Lt&&!kt&&!et,Zt=B[String(he.modelKey||"").trim().toLowerCase()]??0,qt=String(he.modelKey||"?"),Gt=qt.length;return c.jsxs("div",{className:"group h-full overflow-hidden rounded-md border border-gray-200 bg-slate-900/80 shadow-sm transition hover:shadow-md dark:border-white/10 flex flex-col",children:[c.jsx("div",{className:"relative cursor-pointer bg-slate-950",onClick:()=>{Ie&&window.open(Ie,"_blank","noreferrer")},children:c.jsxs("div",{className:"relative aspect-[3/4] w-full overflow-hidden bg-[#12202c]",children:[Le?c.jsx("img",{src:Le,alt:he.modelKey,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]",onError:wt=>{wt.currentTarget.style.display="none";const lt=wt.currentTarget.nextElementSibling;lt&&(lt.style.display="flex")}}):null,c.jsx("div",{className:on("absolute inset-0 items-center justify-center px-3 text-center font-semibold text-slate-500 leading-tight",Le?"hidden":"flex"),style:{display:Le?"none":"flex",fontSize:Gt<=10?"clamp(1rem, 1.4vw + 0.4rem, 2.1rem)":Gt<=18?"clamp(0.95rem, 1.15vw + 0.3rem, 1.7rem)":"clamp(0.8rem, 0.9vw + 0.25rem, 1.25rem)",lineHeight:1.1,overflowWrap:"anywhere",wordBreak:"break-word"},title:qt,children:qt}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-black/70 via-black/20 to-transparent"}),c.jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 p-2.5 pr-18 sm:pr-2.5",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:he.modelKey,children:he.modelKey}),he.host?c.jsx("div",{className:"truncate text-[11px] text-white/70 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:he.host}):null]}),c.jsxs("div",{className:"pointer-events-none absolute bottom-2 right-2 z-10 flex flex-col items-end gap-1",children:[c.jsxs("span",{className:"inline-flex items-center gap-1 px-0.5 py-0 text-[10px] font-semibold text-white/95 tabular-nums",title:"Videos","aria-hidden":"true",children:[c.jsx("span",{className:"text-[11px] leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"🎬"}),c.jsx("span",{className:"drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:Y?"…":Zt})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 px-0.5 py-0 text-[10px] font-semibold text-white/95 tabular-nums",title:"Tags","aria-hidden":"true",children:[c.jsx("span",{className:"text-[11px] leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"🏷️"}),c.jsx("span",{className:"drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:ke.length})]})]}),c.jsx("div",{className:on("absolute left-2 z-10 flex items-center gap-1",he.hot||he.keep?"top-12":"top-2"),onClick:wt=>wt.stopPropagation(),children:c.jsx(Ds,{job:Oe(he),variant:"table",order:["add","details"],className:`\r
flex items-center gap-1\r
[&_button]:h-7 [&_button]:w-7 [&_button]:min-w-0 [&_button]:p-0\r
[&_button]:bg-transparent [&_button]:shadow-none\r
[&_button:hover]:bg-white/10\r
[&_button]:border-0\r
[&_button_svg]:drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]\r
`})}),c.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5 pointer-events-none select-none",children:[Lt?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-indigo-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Beobachtet","aria-hidden":"true",children:"👁"}):null,kt?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-amber-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Favorit","aria-hidden":"true",children:"★"}):null,et?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-rose-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Gefällt mir","aria-hidden":"true",children:"♥"}):null]}),(he.hot||he.keep)&&c.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-1",children:[he.hot?c.jsx("span",{className:"rounded bg-amber-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"HOT"}):null,he.keep?c.jsx("span",{className:"rounded bg-indigo-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"KEEP"}):null]})]})}),c.jsxs("div",{className:"border-t border-white/5 bg-slate-800/70 px-2.5 py-2 rounded-b-md flex-1",children:[c.jsxs("div",{className:"sm:hidden",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-1.5",onClick:wt=>wt.stopPropagation(),children:[c.jsx(sn,{variant:Lt?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",Lt?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Lt?"Nicht mehr beobachten":"Beobachten",onClick:wt=>{wt.stopPropagation(),st(he.id,{watched:!Lt})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",Lt?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(sn,{variant:kt?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",kt?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:kt?"Favorit entfernen":"Als Favorit markieren",onClick:wt=>{wt.stopPropagation(),kt?st(he.id,{favorite:!1}):st(he.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",kt?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(sn,{variant:et?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",et?"bg-rose-500/20 text-rose-200 hover:bg-rose-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:et?"Gefällt mir entfernen":"Gefällt mir",onClick:wt=>{wt.stopPropagation(),et?st(he.id,{liked:!1}):st(he.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",et?"text-rose-300":"text-slate-300"),children:"♥"})})})]}),c.jsx("div",{className:"mt-2 min-h-[24px] flex flex-wrap items-start gap-1.5",children:Pe.length>0?Pe.map(wt=>c.jsx(ps,{tag:wt,title:wt,active:R.has(wt.toLowerCase()),onClick:le},`${he.id}:${wt}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]}),c.jsxs("div",{className:"hidden sm:block",children:[c.jsx("div",{onClick:wt=>wt.stopPropagation(),children:c.jsxs("div",{className:"grid grid-cols-3 gap-1.5 w-full",children:[c.jsx(sn,{variant:Lt?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",pt&&!Lt?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",Lt?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Lt?"Nicht mehr beobachten":"Beobachten",onClick:wt=>{wt.stopPropagation(),st(he.id,{watched:!Lt})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",Lt?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(sn,{variant:kt?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",pt&&!kt?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",kt?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:kt?"Favorit entfernen":"Als Favorit markieren",onClick:wt=>{wt.stopPropagation(),kt?st(he.id,{favorite:!1}):st(he.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",kt?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(sn,{variant:et?"soft":"secondary",size:"xs",className:on("h-8 min-w-0 px-0 shadow-none",pt&&!et?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",et?"bg-rose-500/20 text-rose-200 hover:bg-rose-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:et?"Gefällt mir entfernen":"Gefällt mir",onClick:wt=>{wt.stopPropagation(),et?st(he.id,{liked:!1}):st(he.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:on("text-xl leading-none",et?"text-rose-300":"text-slate-300"),children:"♥"})})})]})}),c.jsx("div",{className:"mt-2 min-h-[24px] flex flex-wrap items-start gap-1.5",children:Pe.length>0?Pe.map(wt=>c.jsx(ps,{tag:wt,title:wt,active:R.has(wt.toLowerCase()),onClick:le},`${he.id}:${wt}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]})]})]},he.id)})})}),c.jsx(kf,{page:g,pageSize:S,totalItems:tt,onPageChange:_})]})}),c.jsx(Tf,{open:Q,onClose:()=>!mt&&te(!1),title:"Models importieren",footer:c.jsxs(c.Fragment,{children:[c.jsx(sn,{variant:"secondary",onClick:()=>te(!1),disabled:mt,children:"Abbrechen"}),c.jsx(sn,{variant:"primary",onClick:ct,isLoading:mt,disabled:!ge||mt,children:"Import starten"})]}),children:c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Wähle eine CSV-Datei zum Import aus."}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Import-Typ"}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[c.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[c.jsx("input",{type:"radio",name:"import-kind",value:"favorite",checked:ye==="favorite",onChange:()=>be("favorite"),disabled:mt}),"Favoriten (★)"]}),c.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[c.jsx("input",{type:"radio",name:"import-kind",value:"liked",checked:ye==="liked",onChange:()=>be("liked"),disabled:mt}),"Gefällt mir (♥)"]})]})]}),c.jsx("input",{type:"file",accept:".csv,text/csv",onChange:he=>{const Ie=he.target.files?.[0]??null;Re(null),L(Ie)},className:"block w-full text-sm text-gray-700 file:mr-4 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-gray-900 hover:file:bg-gray-200 dark:text-gray-200 dark:file:bg-white/10 dark:file:text-white dark:hover:file:bg-white/20"}),ge?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",c.jsx("span",{className:"font-medium",children:ge.name})]}):null,we?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:we}):null,xe?c.jsx("div",{className:"rounded-md bg-green-50 px-3 py-2 text-xs text-green-700 dark:bg-green-500/10 dark:text-green-200",children:xe}):null]})})]})}function Jn(...n){return n.filter(Boolean).join(" ")}function xg(n){const e=String(n?.status??"").toLowerCase();return!!!(n?.endedAt??n?.completedAt)&&(e==="running"||e==="postwork")}const c6=600*1e3,_g=new Map,U_=new Map;function eu(n){return Number.isFinite(n)&&Date.now()-n<=c6}function wg(n){try{if(typeof window>"u")return null;const e=window.sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}function z_(n,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function Tg(n){return`md:cb:online:${n}`}function $_(n){return`md:cb:bio:${n}`}const d6=new Intl.NumberFormat("de-DE");function el(n){return n==null||!Number.isFinite(n)?"—":d6.format(n)}function h6(n){if(n==null||!Number.isFinite(n))return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0||i===1?0:1;return`${t.toFixed(a)} ${e[i]}`}function Sg(n){if(n==null||!Number.isFinite(n)||n<0)return"—";const e=Math.floor(n),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${i}:${String(a).padStart(2,"0")}`}function zc(n){if(!n)return"—";const e=typeof n=="string"?new Date(n):n;return Number.isNaN(e.getTime())?String(n):e.toLocaleString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function f6(n){return n?n.split(",").map(e=>e.trim()).filter(Boolean):[]}function bo(n){return(n||"").split(/[\\/]/).pop()||""}function m6(n){if(!n)return"—";const e=typeof n=="string"?new Date(n):n;return Number.isNaN(e.getTime())?String(n):e.toLocaleDateString("de-DE",{year:"2-digit",month:"2-digit",day:"2-digit"})}function _o(n){return n.startsWith("HOT ")?n.slice(4):n}function my(n){return String(n||"").startsWith("HOT ")}function p6(n,e){const t=String(n||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function g6(n){return my(n)?_o(n):`HOT ${n}`}function y6(n){const e=bo(n||""),t=_o(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i}function pf(n){return n?String(n).replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?>[\s\S]*?<\/style>/gi,"").replace(/<\/?[^>]+>/g," ").replace(/\s+/g," ").trim():""}function H_(n){const e=String(n??"").trim();if(!e)return"";const t=e.match(/HTTP\s+(\d{3})/i);if(t?.[1])return`HTTP ${t[1]}`;const i=e.toLowerCase();if(i.includes("<!doctype")||i.includes("<html")||i.includes("text/html"))return"HTTP Error (HTML response)";const a=e.replace(/\s+/g," ");return a.length>80?a.slice(0,77)+"…":a}function q_(n){const e=String(n??"").trim();if(!e)return"";const t=pf(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function b6(n){if(!n)return"";const e=String(n).trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/")?`https://chaturbate.com${e}`:`https://chaturbate.com/${e}`:""}function rs(n){return Jn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",n)}const sf=n=>n?"blur-md scale-[1.03] brightness-90":"";function af(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function V_(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function tu(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function of(n,e,t){return Math.max(e,Math.min(t,n))}const G_=5;function K_(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function v6(n){let e=String(n??"").trim();if(!e)return"";if(e=e.replace(/^https?:\/\//i,""),e.includes("/")){const t=e.split("/").filter(Boolean);e=t[t.length-1]||e}return e.includes(":")&&(e=e.split(":").pop()||e),e.trim().toLowerCase()}function W_(n){const e=n??{},t=e.cf_clearance||e["cf-clearance"]||e.cfclearance||"",i=e.sessionId||e.sessionid||e.session_id||e["session-id"]||"",a=[];return t&&a.push(`cf_clearance=${t}`),i&&a.push(`sessionid=${i}`),a.join("; ")}function x6({open:n,modelKey:e,onClose:t,onOpenPlayer:i,cookies:a,runningJobs:l,blurPreviews:u,teaserPlayback:h="hover",teaserAudio:f=!1,onToggleWatch:g,onToggleFavorite:_,onToggleLike:S,onToggleHot:C,onDelete:N,onKeep:O,onStopJob:E}){const[B,H]=p.useState([]),[,Y]=p.useState(!1),[U,re]=p.useState(null),[W,X]=p.useState(null),[R,le]=p.useState(null),[k,j]=p.useState(null),[Z,V]=p.useState(!1),[ne,me]=p.useState([]),[ue,q]=p.useState(!1),[P,Q]=p.useState([]),[te,ge]=p.useState(!1),L=p.useRef(0),[xe,Te]=p.useState(0),[ye,be]=p.useState(null),[,mt]=p.useState(!1),[Ke,we]=p.useState(!1),[Re,ct]=p.useState(0),[Oe,je]=p.useState(1),Ue=4,ze=v6(e),[gt,st]=p.useState({}),[bt,Qe]=p.useState(null),[Ye,tt]=p.useState(null),[$e,ht]=p.useState(null),[At,he]=p.useState({}),[Ie,Le]=p.useState(null),ke=p.useCallback(_e=>String(_e??"").toLowerCase(),[]),Pe=p.useMemo(()=>new Set,[]),et=p.useMemo(()=>new Set,[]),kt=p.useMemo(()=>new Set,[]),Lt=p.useMemo(()=>new Set,[]);p.useEffect(()=>{if(!n||!ze)return;const _e=_g.get(ze),at=wg(Tg(ze)),Ct=(_e&&eu(_e.at)?_e:null)||(at&&eu(at.at)?at:null);Ct&&(re(Ct.room??null),X(Ct.meta??null));const St=U_.get(ze),Pt=wg($_(ze)),tn=(St&&eu(St.at)?St:null)||(Pt&&eu(Pt.at)?Pt:null);tn&&(le(tn.bio??null),j(tn.meta??null))},[n,ze]),p.useEffect(()=>{n&&we(!1)},[n,ze]);const pt=p.useCallback(async()=>{try{const at=await(await fetch("/api/models",{cache:"no-store"})).json().catch(()=>null);H(Array.isArray(at)?at:[])}catch{}},[]),Zt=p.useCallback(async()=>{if(ze){q(!0);try{const _e=`/api/record/done?model=${encodeURIComponent(ze)}&page=${Oe}&pageSize=${Ue}&sort=completed_desc&includeKeep=1&withCount=1`,Ct=await(await fetch(_e,{cache:"no-store"})).json().catch(()=>null),St=Array.isArray(Ct?.items)?Ct.items:[],Pt=Number(Ct?.count??St.length);me(St),ct(Number.isFinite(Pt)?Pt:St.length)}catch{}finally{q(!1)}}},[ze,Oe]);function qt(_e){return{id:`model:${_e}`,output:`${_e}_01_01_2000__00-00-00.mp4`,status:"finished"}}const Gt=p.useCallback((_e,at)=>{const Ct=String(_e??"").trim();Ct&&be({src:Ct,alt:at})},[]);p.useEffect(()=>{n||Te(0)},[n]);const wt=p.useMemo(()=>Array.isArray(l)?l:P,[l,P]);p.useEffect(()=>{n&&je(1)},[n,e]),p.useEffect(()=>{if(!n)return;let _e=!0;return Y(!0),fetch("/api/models",{cache:"no-store"}).then(at=>at.json()).then(at=>{_e&&H(Array.isArray(at)?at:[])}).catch(()=>{_e&&H([])}).finally(()=>{_e&&Y(!1)}),()=>{_e=!1}},[n]),p.useEffect(()=>{if(!n||!ze)return;const _e=_g.get(ze),at=wg(Tg(ze));if((_e&&eu(_e.at)?_e:null)||(at&&eu(at.at)?at:null))return;let St=!0;const Pt=new AbortController;return(async()=>{try{const tn=W_(a),vt=await(await fetch("/api/chaturbate/online",{method:"POST",headers:{"Content-Type":"application/json",...tn?{"X-Chaturbate-Cookie":tn}:{}},cache:"no-store",signal:Pt.signal,body:JSON.stringify({q:[ze],show:[],refresh:!1})})).json().catch(()=>null);if(!St)return;const fn={enabled:vt?.enabled,fetchedAt:vt?.fetchedAt,lastError:vt?.lastError},Tt=(Array.isArray(vt?.rooms)?vt.rooms:[])[0]??null;X(fn),re(Tt);const _t={at:Date.now(),room:Tt,meta:fn};_g.set(ze,_t),z_(Tg(ze),_t)}catch(tn){if(tn?.name==="AbortError"||!St)return;X({enabled:void 0,fetchedAt:void 0,lastError:"Fetch fehlgeschlagen"})}})(),()=>{St=!1,Pt.abort()}},[n,ze,a]),p.useEffect(()=>{if(!n||!ze)return;let _e=!0;V(!0),le(null),j(null);const at=W_(a),Ct=`/api/chaturbate/biocontext?model=${encodeURIComponent(ze)}${xe>0?"&refresh=1":""}`;return fetch(Ct,{cache:"no-store",headers:at?{"X-Chaturbate-Cookie":at}:void 0}).then(async St=>{if(!St.ok){const Pt=await St.text().catch(()=>"");throw new Error(Pt||`HTTP ${St.status}`)}return St.json()}).then(St=>{if(!_e)return;j({enabled:St?.enabled,fetchedAt:St?.fetchedAt,lastError:St?.lastError}),le(St?.bio??null);const Pt={enabled:St?.enabled,fetchedAt:St?.fetchedAt,lastError:St?.lastError},tn=St?.bio??null;j(Pt),le(tn);const wn={at:Date.now(),bio:tn,meta:Pt};U_.set(ze,wn),z_($_(ze),wn)}).catch(St=>{_e&&j({enabled:void 0,fetchedAt:void 0,lastError:St?.message||"Fetch fehlgeschlagen"})}).finally(()=>{_e&&V(!1)}),()=>{_e=!1}},[n,ze,xe,a]),p.useEffect(()=>{!n||!ze||Zt()},[n,ze,Zt]),p.useEffect(()=>{if(!n||Array.isArray(l))return;const _e=new AbortController,at=++L.current;return ge(!0),fetch("/api/record/jobs",{cache:"no-store",signal:_e.signal}).then(Ct=>Ct.json()).then(Ct=>{_e.signal.aborted||L.current===at&&Q(Array.isArray(Ct)?Ct:[])}).catch(()=>{_e.signal.aborted||L.current===at&&Q([])}).finally(()=>{_e.signal.aborted||L.current===at&&ge(!1)}),()=>{_e.abort()}},[n,l]);const lt=p.useMemo(()=>ze?B.find(_e=>(_e.modelKey||"").toLowerCase()===ze)??null:null,[B,ze]),Yt=ne,kn=p.useMemo(()=>ze?wt.filter(_e=>{const at=y6(_e.output);return at!=="—"&&at.trim().toLowerCase()===ze}):[],[wt,ze]),pn=p.useMemo(()=>{const _e=f6(lt?.tags),at=Array.isArray(U?.tags)?U.tags:[],Ct=new Map;for(const St of[..._e,...at]){const Pt=String(St).trim().toLowerCase();Pt&&(Ct.has(Pt)||Ct.set(Pt,String(St).trim()))}return Array.from(Ct.values()).sort((St,Pt)=>St.localeCompare(Pt,"de"))},[lt?.tags,U?.tags]),xn=U?.display_name||lt?.modelKey||ze||"Model",rt=U?.image_url_360x270||U?.image_url||"",M=U?.image_url||rt,F=U?.chat_room_url_revshare||U?.chat_room_url||"",ie=(U?.current_show||"").trim().toLowerCase(),De=ie?ie==="public"?"Public":ie==="private"?"Private":ie:"",Ve=(R?.location||"").trim(),yt=R?.follower_count,Vt=R?.display_age,Jt=(R?.room_status||"").trim(),gn=R?.last_broadcast?zc(R.last_broadcast):"—",ln=pf(R?.about_me),_n=pf(R?.wish_list),En=lt?.lastSeenOnline==null?"":lt.lastSeenOnline?"online":"offline",Ut=(Jt||ie||En||"").trim(),hn=Array.isArray(R?.social_medias)?R.social_medias:[],cn=Array.isArray(R?.photo_sets)?R.photo_sets:[],en=Array.isArray(R?.interested_in)?R.interested_in:[],zt=({icon:_e,label:at,value:Ct})=>c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-2.5 py-2 sm:px-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] sm:text-xs text-gray-600 dark:text-gray-300",children:[_e,at]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:Ct})]}),Dt=p.useCallback(_e=>{const at=String(_e?.id??""),Ct=String(_e.output??"");return at?`${at}::${Ct}`:Ct},[]),Ot=p.useCallback(async _e=>{const at=_e.output||"",Ct=bo(at);if(!Ct){await C?.(_e);return}const St=g6(Ct);me(Pt=>Pt.map(tn=>tn.id&&_e.id&&tn.id===_e.id||tn.output&&_e.output&&tn.output===_e.output?{...tn,output:p6(tn.output||"",St)}:tn)),await C?.(_e),Zt()},[C,Zt]),Hn=p.useCallback((_e,at,Ct)=>{const St=_e?.meta,Pt=typeof St=="string"?(()=>{try{return JSON.parse(St)}catch{return null}})():St,tn=typeof Pt?.previewSprite?.stepSeconds=="number"&&Number.isFinite(Pt.previewSprite.stepSeconds)&&Pt.previewSprite.stepSeconds>0?Pt.previewSprite.stepSeconds:5,wn=Math.max(0,Math.floor(at)*tn);i?.(_e,wn)},[i]),Rt=p.useCallback(async()=>{ze&&(H(_e=>_e.map(at=>(at.modelKey||"").toLowerCase()===ze?{...at,favorite:!at.favorite}:at)),await _?.(qt(ze)),pt())},[ze,_,pt]),qn=p.useCallback(async()=>{ze&&(H(_e=>_e.map(at=>(at.modelKey||"").toLowerCase()===ze?{...at,liked:at.liked!==!0}:at)),await S?.(qt(ze)),pt())},[ze,S,pt]),_i=p.useCallback(async()=>{ze&&(H(_e=>_e.map(at=>(at.modelKey||"").toLowerCase()===ze?{...at,watching:!at.watching}:at)),await g?.(qt(ze)),pt())},[ze,g,pt]);p.useEffect(()=>{n||(Qe(null),tt(null),ht(null),Le(null),he({}),st({}))},[n,ze]);const Mn=p.useCallback((_e,at)=>{const Ct=Dt(_e);st(St=>St[Ct]===at?St:{...St,[Ct]:at})},[Dt]),Wt=p.useCallback(_e=>{Qe(_e),h==="hover"&&tt(_e)},[h]),zn=p.useCallback(_e=>{const at=Dt(_e),Ct=_e?.durationSeconds??_e?.meta?.durationSeconds??gt[at],St=typeof Ct=="number"&&Number.isFinite(Ct)?Ct>1440*60?Ct/1e3:Ct:null;return Sg(St)},[gt,Dt]),Kn=p.useCallback(_e=>{const at=_e?.sizeBytes??_e?.size??_e?.meta?.sizeBytes??_e?.meta?.size;return typeof at=="number"&&Number.isFinite(at)?at:null},[]),jn=p.useCallback(_e=>h6(_e??null),[]),Wn=p.useCallback((_e,at)=>{he(Ct=>{if(at===void 0){if(!(_e in Ct))return Ct;const St={...Ct};return delete St[_e],St}return Ct[_e]===at?Ct:{...Ct,[_e]:at}})},[]),Cn=p.useCallback(_e=>Wn(_e,void 0),[Wn]),[fi,Xn]=p.useState("info");p.useEffect(()=>{n&&Xn("info")},[n,ze]);const li=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:Re?el(Re):void 0,disabled:ue},{id:"running",label:"Running",count:kn.length?el(kn.length):void 0,disabled:te}];return c.jsxs(Tf,{open:n,onClose:t,title:xn,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:rt||void 0,mobileCollapsedImageAlt:xn,rightBodyClassName:"pt-0 sm:pt-2",left:c.jsx("div",{className:"space-y-3 sm:space-y-4",children:c.jsxs("div",{className:"hidden sm:block space-y-2",children:[c.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/70 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"relative",children:[rt?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Gt(M,xn),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:rt,alt:xn,className:Jn("h-24 sm:h-52 w-full object-cover transition",sf(u))})}):c.jsx("div",{className:"h-24 sm:h-52 w-full bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),c.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/40 via-black/0 to-black/0"}),c.jsxs("div",{className:"absolute left-3 top-3 flex flex-wrap items-center gap-2",children:[De?c.jsx("span",{className:rs("bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20"),children:De}):null,Ut?c.jsx("span",{className:rs(Ut.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 backdrop-blur dark:text-gray-200 dark:ring-white/15"),children:Ut}):null,U?.is_hd?c.jsx("span",{className:rs("bg-indigo-500/10 text-indigo-900 ring-indigo-200 backdrop-blur dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,U?.is_new?c.jsx("span",{className:rs("bg-amber-500/10 text-amber-900 ring-amber-200 backdrop-blur dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),c.jsxs("div",{className:"absolute bottom-3 left-3 right-3",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow",children:U?.display_name||U?.username||lt?.modelKey||ze||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:U?.username?`@${U.username}`:lt?.modelKey?`@${lt.modelKey}`:""})]}),c.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),_i()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",lt?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:lt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!lt?.watching,"aria-label":lt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(gl,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Rt()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",lt?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:lt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!lt?.favorite,"aria-label":lt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(_f,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(vu,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),qn()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",lt?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:lt?.liked?"Like entfernen":"Liken","aria-pressed":lt?.liked===!0,"aria-label":lt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(ed,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(yl,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-200")})]})})]})]}),c.jsxs("div",{className:"p-3 sm:p-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[c.jsx(zt,{icon:c.jsx(B1,{className:"size-4"}),label:"Viewer",value:el(U?.num_users)}),c.jsx(zt,{icon:c.jsx(Cp,{className:"size-4"}),label:"Follower",value:el(U?.num_followers??yt)})]}),c.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-xs",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(lN,{className:"size-4"}),"Location"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:U?.location||Ve||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(iN,{className:"size-4"}),"Sprache"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:U?.spoken_languages||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(Ep,{className:"size-4"}),"Online"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:Sg(U?.seconds_online)})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(ed,{className:"size-4"}),"Alter"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:Vt!=null?String(Vt):U?.age!=null?String(U.age):"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(Ep,{className:"size-4"}),"Last broadcast"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:gn})]})]}),W?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):W?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[c.jsxs("div",{className:"font-medium",children:["Online-Info: ",H_(W.lastError)]}),c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),c.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:q_(W.lastError)})]})]}):null,k?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):k?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["BioContext: ",k.lastError]}):null]})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Tags"}),pn.length?c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:pn.map(_e=>c.jsx(ps,{tag:_e},_e))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:c.jsxs("div",{className:Jn("border-b border-gray-200/70 dark:border-white/10","bg-white/95 backdrop-blur dark:bg-gray-800/95"),children:[c.jsxs("div",{className:"sm:hidden px-2 pb-2 space-y-1.5",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsxs("button",{type:"button",className:"relative shrink-0 overflow-hidden rounded-lg ring-1 ring-black/5 dark:ring-white/10",onClick:()=>M?Gt(M,xn):void 0,"aria-label":"Bild vergrößern",children:[rt?c.jsx("img",{src:rt,alt:xn,className:Jn("size-10 object-cover",sf(u))}):c.jsx("div",{className:"size-10 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),c.jsx("span",{"aria-hidden":!0,className:Jn("absolute bottom-1.5 right-1.5 size-2.5 rounded-full ring-2 ring-white/80 dark:ring-gray-900/60",(Ut||"").toLowerCase()==="online"?"bg-emerald-400":"bg-gray-400")})]}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:U?.display_name||U?.username||lt?.modelKey||ze||"—"}),c.jsx("div",{className:"truncate text-xs text-gray-600 dark:text-gray-300",children:U?.username?`@${U.username}`:lt?.modelKey?`@${lt.modelKey}`:""})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),_i()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",lt?.watching?"bg-sky-500/15 ring-sky-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:lt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!lt?.watching,"aria-label":lt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),c.jsx(gl,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-500")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Rt()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",lt?.favorite?"bg-amber-500/15 ring-amber-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:lt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!lt?.favorite,"aria-label":lt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(_f,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),c.jsx(vu,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-500")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),qn()},className:Jn("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",lt?.liked?"bg-rose-500/15 ring-rose-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:lt?.liked?"Like entfernen":"Liken","aria-pressed":lt?.liked===!0,"aria-label":lt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(ed,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),c.jsx(yl,{className:Jn("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",lt?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-500")})]})})]})]}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[De?c.jsx("span",{className:rs("bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20"),children:De}):null,Jt?c.jsx("span",{className:rs(Jt.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:Jt}):null,U?.is_hd?c.jsx("span",{className:rs("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,U?.is_new?c.jsx("span",{className:rs("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),F?c.jsx("div",{className:"mt-1.5 flex justify-end",children:c.jsxs("a",{href:F,target:"_blank",rel:"noreferrer",className:Jn("inline-flex h-8 items-center justify-center gap-1 rounded-lg px-3 text-sm font-medium","border border-gray-200/70 bg-white/70 text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white"),title:"Room öffnen",children:[c.jsx(Kh,{className:"size-4"}),c.jsx("span",{children:"Room"})]})}):null]})]}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[12px] text-gray-700 dark:text-gray-200",children:[c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(B1,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:el(U?.num_users)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Cp,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:el(U?.num_followers??yt)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(qA,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:Sg(U?.seconds_online)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Ep,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:R?.last_broadcast?m6(R.last_broadcast):"—"})]})]}),W?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):W?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["Online-Info: ",W.lastError]}):null,k?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):k?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[c.jsx("div",{className:"flex items-start justify-between gap-2",children:c.jsxs("div",{className:"font-medium",children:["BioContext: ",H_(k.lastError)]})}),c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),c.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:q_(k.lastError)})]})]}):null]}),pn.length?c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-2 py-1.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"shrink-0 text-xs font-semibold text-gray-900 dark:text-white",children:["Tags ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",pn.length,")"]})]}),c.jsx("div",{className:"-mx-1 flex-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:c.jsxs("div",{className:"flex min-w-max items-center gap-1.5",children:[pn.slice(0,20).map(_e=>c.jsx(ps,{tag:_e},_e)),pn.length>20?c.jsxs("span",{className:rs("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:["+",pn.length-20]}):null]})})]})}):null]}),c.jsxs("div",{className:"flex items-start justify-between gap-2 px-2 py-2 sm:px-4",children:[c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"text-[11px] leading-snug text-gray-600 dark:text-gray-300",children:ze?c.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[W?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",zc(W.fetchedAt)]}):null,k?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",zc(k.fetchedAt)]}):null,lt?.lastSeenOnlineAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",c.jsx("span",{className:"font-medium",children:lt.lastSeenOnline==null?"—":lt.lastSeenOnline?"online":"offline"})," ","(",zc(lt.lastSeenOnlineAt),")"]}):null]}):"—"})}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[fi==="info"?c.jsx(sn,{variant:"secondary",className:Jn("h-9 px-3 text-sm","whitespace-nowrap"),disabled:Z||!e,onClick:()=>Te(_e=>_e+1),title:"BioContext neu abrufen",children:c.jsxs("span",{className:"inline-flex items-center gap-2",children:[c.jsx(RA,{className:Jn("size-4",Z?"animate-spin":"")}),c.jsx("span",{className:"hidden sm:inline",children:"Bio aktualisieren"})]})}):null,F?c.jsxs("a",{href:F,target:"_blank",rel:"noreferrer",className:Jn("inline-flex h-8 items-center justify-center gap-1 rounded-lg","border border-gray-200/70 bg-white/70 px-3 text-sm font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white","whitespace-nowrap"),title:"Room öffnen",children:[c.jsx(Kh,{className:"size-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Room öffnen"})]}):null]})]}),c.jsx("div",{className:"px-2 pb-2",children:c.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:c.jsx("div",{className:"min-w-max",children:c.jsx(Ig,{tabs:li,value:fi,onChange:_e=>Xn(_e),variant:"pillsBrand",ariaLabel:"Bereich auswählen"})})})})]}),footer:c.jsx("div",{className:"w-full",children:c.jsx(sn,{variant:"secondary",className:"w-full sm:w-auto",onClick:t,children:"Schließen"})}),children:[c.jsxs("div",{className:"min-h-0",children:[fi==="info"?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-3 sm:p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"flex items-center justify-between gap-3",children:c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Room Subject"})}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:U?.room_subject?c.jsx("p",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:U.room_subject}):c.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Keine Subject-Info vorhanden."})})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Bio"}),Z?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsxs("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[c.jsx(JA,{className:"size-4"}),"Über mich"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:ln?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:ln}):c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[c.jsx(Cp,{className:"size-4"}),"Wishlist"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:_n?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:_n}):c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]})]}),c.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Real name:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.real_name?pf(R.real_name):"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Body type:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.body_type||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Smoke/Drink:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.smoke_drink||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Sex:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.sex||"—"})]})]}),en.length?c.jsxs("div",{className:"mt-2",children:[c.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Interested in"}),c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:en.map(_e=>c.jsx("span",{className:rs("bg-sky-500/10 text-sky-900 ring-sky-200 dark:text-sky-200 dark:ring-sky-400/20"),children:_e},_e))})]}):null]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Socials"}),hn.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[hn.length," Links"]}):null]}),hn.length?c.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:hn.map(_e=>{const at=b6(_e.link);return c.jsxs("a",{href:at,target:"_blank",rel:"noreferrer",className:Jn("group flex min-w-0 w-full items-center gap-3 overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-gray-900","transition hover:border-indigo-200 hover:bg-gray-50/80 hover:text-gray-900 dark:border-white/10 dark:bg-white/5 dark:text-white dark:hover:border-indigo-400/30 dark:hover:bg-white/10 dark:hover:text-white"),title:_e.title_name,children:[c.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:_e.image_url?c.jsx("img",{src:_e.image_url,alt:"",className:"size-5"}):c.jsx(sN,{className:"size-5"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:_e.title_name}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:_e.label_text?_e.label_text:_e.tokens!=null?`${_e.tokens} token(s)`:"Link"})]}),c.jsx(Kh,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},_e.id)})}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Social-Medias vorhanden."})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Photo sets"}),cn.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[cn.length," Sets"]}):null]}),cn.length?c.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:cn.slice(0,6).map(_e=>c.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"relative",children:[_e.cover_url?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Gt(_e.cover_url,_e.name),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:_e.cover_url,alt:_e.name,className:Jn("h-28 w-full object-cover transition",sf(u))})}):c.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:c.jsx(cN,{className:"size-6 text-gray-500"})}),c.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[_e.is_video?c.jsx("span",{className:rs("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"Video"}):c.jsx("span",{className:rs("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:"Photos"}),_e.fan_club_only?c.jsx("span",{className:rs("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"FanClub"}):null]})]}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:_e.name}),c.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Tokens: ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:el(_e.tokens)}),_e.user_can_access===!0?c.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},_e.id))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,fi==="downloads"?c.jsx("div",{className:"min-h-0",children:c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"shrink-0 flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Inkl. Dateien aus ",c.jsx("span",{className:"font-medium",children:"/done/keep/"})]})]}),c.jsx("div",{className:"w-full sm:w-auto",children:c.jsx(kf,{page:Oe,pageSize:Ue,totalItems:Re,onPageChange:_e=>je(_e),siblingCount:1,boundaryCount:1,showSummary:!0,prevLabel:"Zurück",nextLabel:"Weiter",ariaLabel:"Downloads Seiten",className:"border-0 bg-transparent px-0 py-0 dark:bg-transparent"})})]}),c.jsx("div",{className:"mt-2",children:ue?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):Yt.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine abgeschlossenen Downloads für dieses Model gefunden."}):c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:Yt.map(_e=>{const at=Dt(_e),St=!(!!f&&bt===at),Pt=bo(_e.output||""),tn=my(Pt),wn=_o(Pt),vt=zn(_e),fn=jn(Kn(_e)),Ne=V_(_e?.meta),Tt=typeof Ne?.videoWidth=="number"&&typeof Ne?.videoHeight=="number"&&Ne.videoWidth>0&&Ne.videoHeight>0?{w:Ne.videoWidth,h:Ne.videoHeight}:typeof _e?.videoWidth=="number"&&typeof _e?.videoHeight=="number"&&_e.videoWidth>0&&_e.videoHeight>0?{w:_e.videoWidth,h:_e.videoHeight}:null,_t=hd(Tt),$t=Pe.has(at)||et.has(at)||kt.has(at),Ht=Lt.has(at),yn=!!lt?.favorite,Xt=lt?.liked===!0,On=!!lt?.watching,Vn=pn,mi=af(M,rt),ji=_o(bo(_e.output||"")).replace(/\.[^.]+$/,"").trim(),Bi=af(Ne?.previewSprite?.path,Ne?.previewSpritePath,ji?`/api/preview-sprite/${encodeURIComponent(ji)}`:void 0),Yn=Bi?Bi.replace(/\/+$/,""):void 0,pi=Ne?.previewSprite?.stepSeconds??Ne?.previewSpriteStepSeconds,gi=typeof pi=="number"&&Number.isFinite(pi)&&pi>0?pi:G_,Pn=tu(Ne?.durationSeconds)??tu(_e?.durationSeconds)??tu(gt[at]),Ri=typeof Pn=="number"&&Pn>0?Math.max(1,Math.min(200,Math.floor(Pn/gi)+1)):void 0,ei=Ne?.previewSprite?.count??Ne?.previewSpriteCount??Ri,ti=Ne?.previewSprite?.cols??Ne?.previewSpriteCols,An=Ne?.previewSprite?.rows??Ne?.previewSpriteRows,ii=typeof ei=="number"&&Number.isFinite(ei)?Math.max(0,Math.floor(ei)):0,[Pi,Oi]=ii>1?K_(ii):[0,0],se=typeof ti=="number"&&Number.isFinite(ti)?Math.max(0,Math.floor(ti)):Pi,I=typeof An=="number"&&Number.isFinite(An)?Math.max(0,Math.floor(An)):Oi,ce=(typeof Ne?.updatedAtUnix=="number"&&Number.isFinite(Ne.updatedAtUnix)?Ne.updatedAtUnix:void 0)??(typeof Ne?.fileModUnix=="number"&&Number.isFinite(Ne.fileModUnix)?Ne.fileModUnix:void 0)??0,pe=Yn&&ce?`${Yn}?v=${encodeURIComponent(String(ce))}`:Yn||void 0,Ce=!!pe&&ii>1,Ae=Ce&&se>0&&I>0,z=Ce?ii:0,G=Ce?gi:0,ee=Ce,ae=At[at],Be=typeof ae=="number"&&z>1?of(ae/(z-1),0,1):void 0,Je=Ae&&typeof ae=="number"?(()=>{const Nt=of(ae,0,Math.max(0,ii-1)),jt=Nt%se,Qt=Math.floor(Nt/se),Gn=se<=1?0:jt/(se-1)*100,rr=I<=1?0:Qt/(I-1)*100;return{backgroundImage:`url("${pe}")`,backgroundRepeat:"no-repeat",backgroundSize:`${se*100}% ${I*100}%`,backgroundPosition:`${Gn}% ${rr}%`}})():void 0,We=$e===at&&!!mi,ut=!We&&!!Je,Mt=We||ut;return Ht?null:c.jsxs("div",{role:"button",tabIndex:0,className:["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",$t&&"pointer-events-none opacity-70",kt.has(at)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),onClick:()=>i?.(_e),onKeyDown:Nt=>{(Nt.key==="Enter"||Nt.key===" ")&&i?.(_e)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:()=>{Le(at),Wt(at)},onMouseLeave:()=>{Le(null),Wt(null),Cn(at),ht(Nt=>Nt===at?null:Nt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:_e,getFileName:Nt=>_o(bo(Nt)),durationSeconds:gt[at]??_e?.durationSeconds,onDuration:Mn,variant:"fill",showPopover:!1,blur:u,animated:Mt?!1:h==="all"?!0:h==="hover"?Ye===at:!1,animatedMode:"teaser",animatedTrigger:"always",muted:St,popoverMuted:St,scrubProgressRatio:Be,preferScrubProgress:typeof ae=="number"})}),Ae&&pe?c.jsx("img",{src:pe,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,ut&&Je?c.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:c.jsx("div",{className:"h-full w-full",style:Je})}):null,We&&mi?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:mi,alt:"Model preview",className:"h-full w-full object-cover",draggable:!1}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/65 to-transparent px-2 py-1.5",children:c.jsx("div",{className:"text-[10px] font-semibold tracking-wide text-white/95",children:"MODEL PREVIEW"})})]}):null,ee&&Ie===at?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Nt=>Nt.stopPropagation(),onMouseDown:Nt=>Nt.stopPropagation(),children:c.jsx(_y,{className:"pointer-events-auto px-1",imageCount:z,activeIndex:ae,onActiveIndexChange:Nt=>Wn(at,Nt),onIndexClick:Nt=>{Wn(at,Nt),Hn(_e,Nt,z)},stepSeconds:G})}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",children:c.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[vt,Tt?`${Tt.w}×${Tt.h}`:_t||"",fn].filter(Boolean).join(" • "),children:[c.jsx("span",{children:vt}),_t?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,_t?c.jsx("span",{children:_t}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:fn})]})})]})}),c.jsxs("div",{className:"relative min-h-[118px] px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[tn?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:wn||"—",children:wn||"—"})]})}),c.jsx("div",{className:"mt-2",onClick:Nt=>Nt.stopPropagation(),onMouseDown:Nt=>Nt.stopPropagation(),children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:_e,variant:"table",busy:$t,collapseToMenu:!0,compact:!0,isHot:tn,isFavorite:yn,isLiked:Xt,isWatching:On,onToggleWatch:g,onToggleFavorite:_,onToggleLike:S,onToggleHot:async Nt=>(await Ot(Nt),!0),onKeep:async Nt=>{try{return await O?.(Nt),!0}catch{return!1}},onDelete:async Nt=>{try{return await N?.(Nt),!0}catch{return!1}},order:["hot","keep","delete"],className:"w-full gap-1.5"})})}),c.jsx("div",{className:"mt-2",onClick:Nt=>Nt.stopPropagation(),onMouseDown:Nt=>Nt.stopPropagation(),children:c.jsx(dd,{rowKey:at,tags:Vn,activeTagSet:new Set,lower:ke,onToggleTagFilter:()=>{}})})]})]},at)})})})]})}):null,fi==="running"?c.jsx("div",{className:"min-h-0",children:c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Laufender Download"}),te?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsx("div",{className:"mt-3",children:te?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):kn.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Kein laufender Job."}):(()=>{const _e=kn[0],at=Dt(_e),St=!(!!f&&bt===at),Pt=bo(_e.output||""),tn=my(Pt),wn=_o(Pt)||"—",vt=V_(_e?.meta),fn=typeof vt?.videoWidth=="number"&&typeof vt?.videoHeight=="number"&&vt.videoWidth>0&&vt.videoHeight>0?{w:vt.videoWidth,h:vt.videoHeight}:typeof _e?.videoWidth=="number"&&typeof _e?.videoHeight=="number"&&_e.videoWidth>0&&_e.videoHeight>0?{w:_e.videoWidth,h:_e.videoHeight}:null,Ne=hd(fn),Tt=zn(_e),_t=jn(Kn(_e)),$t=pn,Ht=af(M,rt),Xt=_o(bo(_e.output||"")).replace(/\.[^.]+$/,"").trim(),On=af(vt?.previewSprite?.path,vt?.previewSpritePath,Xt?`/api/preview-sprite/${encodeURIComponent(Xt)}`:void 0),Vn=On?On.replace(/\/+$/,""):void 0,mi=vt?.previewSprite?.stepSeconds??vt?.previewSpriteStepSeconds,$n=typeof mi=="number"&&Number.isFinite(mi)&&mi>0?mi:G_,ji=tu(vt?.durationSeconds)??tu(_e?.durationSeconds)??tu(gt[at]),Bi=typeof ji=="number"&&ji>0?Math.max(1,Math.min(200,Math.floor(ji/$n)+1)):void 0,Yn=vt?.previewSprite?.count??vt?.previewSpriteCount??Bi,pi=vt?.previewSprite?.cols??vt?.previewSpriteCols,gi=vt?.previewSprite?.rows??vt?.previewSpriteRows,Pn=typeof Yn=="number"&&Number.isFinite(Yn)?Math.max(0,Math.floor(Yn)):0,[Ri,ei]=Pn>1?K_(Pn):[0,0],ti=typeof pi=="number"&&Number.isFinite(pi)?Math.max(0,Math.floor(pi)):Ri,An=typeof gi=="number"&&Number.isFinite(gi)?Math.max(0,Math.floor(gi)):ei,ii=(typeof vt?.updatedAtUnix=="number"&&Number.isFinite(vt.updatedAtUnix)?vt.updatedAtUnix:void 0)??(typeof vt?.fileModUnix=="number"&&Number.isFinite(vt.fileModUnix)?vt.fileModUnix:void 0)??0,Pi=Vn&&ii?`${Vn}?v=${encodeURIComponent(String(ii))}`:Vn||void 0,Oi=!!Pi&&Pn>1,se=Oi&&ti>0&&An>0,I=Oi?Pn:0,ce=At[at],pe=typeof ce=="number"&&I>1?of(ce/(I-1),0,1):void 0,Ce=se&&typeof ce=="number"?(()=>{const ae=of(ce,0,Math.max(0,Pn-1)),Be=ae%ti,Je=Math.floor(ae/ti),We=ti<=1?0:Be/(ti-1)*100,ut=An<=1?0:Je/(An-1)*100;return{backgroundImage:`url("${Pi}")`,backgroundRepeat:"no-repeat",backgroundSize:`${ti*100}% ${An*100}%`,backgroundPosition:`${We}% ${ut}%`}})():void 0,Ae=$e===at&&!!Ht,G=Ae||!Ae&&!!Ce,ee=xg(_e);return c.jsx("div",{className:"w-full",children:c.jsxs("div",{className:Jn("group relative overflow-hidden rounded-lg outline-1 outline-black/5","bg-white shadow-sm backdrop-blur","dark:-outline-offset-1 dark:outline-white/10 dark:bg-gray-900/40"),children:[c.jsx("div",{role:i?"button":void 0,tabIndex:i?0:void 0,className:Jn("group/thumb relative w-full bg-black/5 dark:bg-white/5","aspect-video sm:aspect-[21/9]",i?"cursor-pointer":""),onClick:()=>i?.(_e),onKeyDown:ae=>{i&&(ae.key==="Enter"||ae.key===" ")&&i(_e)},onMouseEnter:()=>{mt(!0),Le(at),Wt(at)},onMouseLeave:()=>{mt(!1),Le(null),Wt(null),Cn(at),ht(ae=>ae===at?null:ae)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[ee?null:c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:_e,getFileName:ae=>_o(bo(ae)),durationSeconds:gt[at]??_e?.durationSeconds,onDuration:Mn,variant:"fill",showPopover:!1,blur:u,animated:G?!1:h==="all"?!0:h==="hover"?Ye===at:!1,animatedMode:"teaser",animatedTrigger:"always",muted:St,popoverMuted:St,scrubProgressRatio:pe,preferScrubProgress:typeof ce=="number"})}),ee?c.jsxs("div",{className:"absolute inset-0 z-10",children:[c.jsx(ob,{src:`/api/preview/live?id=${encodeURIComponent(String(_e?.id??""))}&hover=1`,className:"absolute inset-0 w-full h-full",muted:!0}),c.jsxs("div",{className:"absolute left-2 top-2 z-20 pointer-events-none inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[c.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]})]}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-20 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",children:c.jsx("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Tt,fn?`${fn.w}×${fn.h}`:Ne||"",_t].filter(Boolean).join(" • "),children:c.jsx("span",{children:_t})})})]})}),c.jsxs("div",{className:"relative px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[tn?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:wn,children:wn})]}),c.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Start:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:zc(_e?.startedAt)})," · ","Status:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:String(_e?.status??"running")})]})]}),c.jsx("div",{className:"mt-2",onClick:ae=>ae.stopPropagation(),onMouseDown:ae=>ae.stopPropagation(),children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(sn,{variant:"primary",color:"red",size:"sm",rounded:"md",className:"w-full shadow-none",disabled:!E||!xg(_e)||Ke,title:Ke?"Stoppe…":"Stop","aria-label":Ke?"Stoppe…":"Stop",onClick:async ae=>{if(ae.preventDefault(),ae.stopPropagation(),!!E&&xg(_e)&&!Ke)try{we(!0),await E(String(_e?.id??""))}finally{we(!1)}},children:Ke?"Stoppe…":"Stoppen"})})}),c.jsx("div",{className:"mt-2",onClick:ae=>ae.stopPropagation(),onMouseDown:ae=>ae.stopPropagation(),children:c.jsx(dd,{rowKey:at,tags:$t,activeTagSet:new Set,lower:ke,onToggleTagFilter:()=>{}})})]})]})})})()})]})}):null]}),c.jsx(Tf,{open:!!ye,onClose:()=>be(null),title:ye?.alt||"Bild",width:"max-w-4xl",layout:"single",scroll:"body",footer:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[ye?.src?c.jsxs("a",{href:ye.src,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg border border-gray-200/70 bg-white/70 px-3 py-1.5 text-xs font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white dark:border-white/10 dark:bg-white/5 dark:text-white",children:[c.jsx(Kh,{className:"size-4"}),"In neuem Tab"]}):null,c.jsx(sn,{variant:"secondary",onClick:()=>be(null),children:"Schließen"})]}),children:c.jsx("div",{className:"grid place-items-center",children:ye?.src?c.jsx("img",{src:ye.src,alt:ye.alt||"",className:Jn("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",sf(u))}):null})})]})}const lf=n=>Math.max(0,Math.min(1,n));function uf(n){return n==="good"?"bg-emerald-500":n==="warn"?"bg-amber-500":"bg-red-500"}function _6(n){return n==null?"":`${Math.round(n)}ms`}function X_(n){return n==null?"":`${Math.round(n)}%`}function kg(n){if(n==null||!Number.isFinite(n)||n<=0)return"";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function w6(n=1e3){const[e,t]=rn.useState(null);return rn.useEffect(()=>{let i=0,a=performance.now(),l=0,u=!0,h=!1;const f=C=>{if(!u||!h)return;l+=1;const N=C-a;if(N>=n){const O=Math.round(l*1e3/N);t(O),l=0,a=C}i=requestAnimationFrame(f)},g=()=>{u&&(document.hidden||h||(h=!0,a=performance.now(),l=0,i=requestAnimationFrame(f)))},_=()=>{h=!1,cancelAnimationFrame(i)},S=()=>{document.hidden?_():g()};return g(),document.addEventListener("visibilitychange",S),()=>{u=!1,document.removeEventListener("visibilitychange",S),_()}},[n]),e}function Y_({mode:n="inline",className:e,pollMs:t=3e3}){const i=w6(1e3),[a,l]=rn.useState(null),[u,h]=rn.useState(null),[f,g]=rn.useState(null),[_,S]=rn.useState(null),[C,N]=rn.useState(null),O=5*1024*1024*1024,E=8*1024*1024*1024,B=rn.useRef(!1),H=rn.useRef(0);rn.useEffect(()=>{const me=ud("/api/stream","perf",ue=>{const q=Date.now();if(q-H.current<t)return;H.current=q;const P=typeof ue?.cpuPercent=="number"?ue.cpuPercent:null,Q=typeof ue?.diskFreeBytes=="number"?ue.diskFreeBytes:null,te=typeof ue?.diskTotalBytes=="number"?ue.diskTotalBytes:null,ge=typeof ue?.diskUsedPercent=="number"?ue.diskUsedPercent:null;h(P),g(Q),S(te),N(ge);const L=typeof ue?.serverMs=="number"?ue.serverMs:null;l(L!=null?Math.max(0,Date.now()-L):null)});return()=>me()},[t]);const Y=a==null?"bad":a<=120?"good":a<=300?"warn":"bad",U=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",re=u==null?"bad":u<=60?"good":u<=85?"warn":"bad",W=lf((a??999)/500),X=lf((i??0)/60),R=lf((u??0)/100),le=f!=null&&_!=null&&_>0?f/_:null,k=C??(le!=null?(1-le)*100:null),j=lf((k??0)/100);f==null?B.current=!1:B.current?f>=E&&(B.current=!1):f<=O&&(B.current=!0);const Z=f==null||B.current||le==null?"bad":le>=.15?"good":le>=.07?"warn":"bad",V=f==null?"Disk: ":`Free: ${kg(f)} / Total: ${kg(_)} · Used: ${X_(k)}`,ne=n==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return c.jsx("div",{className:`${ne} ${e??""}`,children:c.jsxs("div",{className:`\r
rounded-lg border border-gray-200/70 bg-white/70 px-2.5 py-1.5 shadow-sm backdrop-blur\r
dark:border-white/10 dark:bg-white/5\r
grid grid-cols-2 gap-x-3 gap-y-2\r
sm:flex sm:items-center sm:gap-3\r
`,children:[c.jsxs("div",{className:"flex items-center gap-2",title:V,children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Disk"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${uf(Z)}`,style:{width:`${Math.round(j*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:kg(f)})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Ping"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${uf(Y)}`,style:{width:`${Math.round(W*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:_6(a)})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"FPS"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${uf(U)}`,style:{width:`${Math.round(X*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-8 tabular-nums text-gray-900 dark:text-gray-100",children:i??""})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"CPU"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${uf(re)}`,style:{width:`${Math.round(R*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:X_(u)})]})]})})}async function Eg(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function T6(n,e,t,i){const a=`/api/generated/cover?category=${encodeURIComponent(n)}`,l=e?`&v=${e}`:"",u="",h=i&&i.trim()?`&model=${encodeURIComponent(i.trim())}`:"";return`${a}${l}${u}${h}`}function Q_(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function Rk(n){return String(n||"").replaceAll("\\","/").split("/").pop()||""}function Ok(n){return n.toUpperCase().startsWith("HOT ")?n.slice(4).trim():n}function S6(n){const e=Ok(Rk(n||""));return e?e.replace(/\.[^.]+$/,""):""}const k6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Cg(n){const t=Ok(Rk(n)).replace(/\.[^.]+$/,""),i=t.match(k6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a).trim():t?t.trim():null}function E6(n){const e=S6(n);return e?`/generated/meta/${encodeURIComponent(e)}/preview.webp`:null}async function C6(n,e,t,i){const a=(t||"").trim(),l=`/api/generated/cover?category=${encodeURIComponent(n)}&src=${encodeURIComponent(e)}`+(a?`&model=${encodeURIComponent(a)}`:"")+"&refresh=1",u=await fetch(l,{method:"GET",cache:"no-store"});if(!u.ok){const h=await u.text().catch(()=>"");throw new Error(h||`ensureCover failed: HTTP ${u.status}`)}}function A6(){const[n,e]=p.useState([]),[t,i]=p.useState(!1),[a,l]=p.useState(null),[u,h]=p.useState(()=>Date.now()),[f,g]=p.useState({}),[_,S]=p.useState({}),[C,N]=p.useState(!1),[O,E]=p.useState(null),[B,H]=p.useState({}),Y=p.useRef(null),U=p.useRef({}),re=p.useCallback((k,j)=>{const Z={};for(const ne of Array.isArray(k)?k:[]){const me=String(ne?.modelKey??"").trim().toLowerCase();if(!me)continue;const ue=Q_(ne?.tags).map(q=>q.toLowerCase());ue.length&&(Z[me]=ue)}const V={};for(const ne of Array.isArray(j)?j:[]){const me=String(ne?.output??"");if(!me)continue;const ue=(Cg(me)||"").trim().toLowerCase();if(!ue)continue;const q=Z[ue];if(!(!q||q.length===0))for(const P of q)P&&(V[P]||(V[P]=[]),V[P].push(me))}for(const[ne,me]of Object.entries(V))V[ne]=Array.from(new Set(me));U.current=V},[]),W=p.useCallback(k=>{const j=String(k||"").trim();if(j){try{localStorage.setItem("finishedDownloads_pendingTags",JSON.stringify([j]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"finished"}})),window.dispatchEvent(new CustomEvent("finished-downloads:tag-filter",{detail:{tags:[j],mode:"replace"}}))}},[]),X=p.useCallback(k=>{const j=String(k||"").trim();if(j){try{localStorage.setItem("models_pendingTags",JSON.stringify([j]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"models"}})),window.dispatchEvent(new CustomEvent("models:set-tag-filter",{detail:{tags:[j]}}))}},[]),R=p.useCallback(async()=>{Y.current?.abort();const k=new AbortController;Y.current=k,i(!0),l(null);try{const[j,Z]=await Promise.all([Eg("/api/models",{cache:"no-store",signal:k.signal}),Eg("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:k.signal})]),V=Array.isArray(Z?.items)?Z.items:Array.isArray(Z)?Z:[];re(Array.isArray(j)?j:[],V);const ne=new Map;for(const te of Array.isArray(j)?j:[])for(const ge of Q_(te?.tags)){const L=ge.toLowerCase();ne.set(L,(ne.get(L)??0)+1)}const me=U.current||{},ue=Array.from(ne.entries()).map(([te,ge])=>({tag:te,modelsCount:ge,downloadsCount:(me[te]||[]).length})).sort((te,ge)=>te.tag.localeCompare(ge.tag,void 0,{sensitivity:"base"})),q=new Map;try{const te=await Eg("/api/generated/coverinfo/list",{cache:"no-store",signal:k.signal});for(const ge of Array.isArray(te)?te:[]){const L=String(ge?.category??"").trim().toLowerCase();L&&q.set(L,ge)}}catch{}const P={};for(const te of ue){const ge=q.get(te.tag);P[te.tag]=!!ge?.hasCover}S(P);const Q={};for(const te of ue){const L=(me[te.tag]||[])[0]||"";let xe=L?Cg(L):null;if(!xe){const Te=q.get(te.tag);Te?.hasCover&&Te.model?.trim()&&(xe=Te.model.trim())}xe&&(Q[te.tag]=xe)}H(Q),g(te=>{const ge={};for(const L of ue){const xe=te[L.tag];xe&&P[L.tag]===!0&&(ge[L.tag]=xe)}return ge}),e(ue)}catch(j){if(j?.name==="AbortError")return;l(j?.message??String(j)),e([]),U.current={},H({}),S({}),g({})}finally{Y.current===k&&(Y.current=null,i(!1))}},[re]);p.useEffect(()=>(R(),()=>{Y.current?.abort()}),[R]);const le=p.useCallback(async()=>{if(!C){N(!0),l(null),E({done:0,total:n.length});try{const k=U.current||{},j=await Promise.all(n.map(async V=>{try{const ne=k[V.tag]||[];if(ne.length===0)return{tag:V.tag,ok:!0,status:0,text:"skipped (no candidates)"};const me=ne[Math.floor(Math.random()*ne.length)],ue=E6(me);if(!ue)return{tag:V.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const q=Cg(me);return await C6(V.tag,ue,q,!0),S(P=>({...P,[V.tag]:!0})),H(P=>{const Q={...P};return q?.trim()?Q[V.tag]=q.trim():delete Q[V.tag],Q}),g(P=>{const Q={...P};return delete Q[V.tag],Q}),{tag:V.tag,ok:!0,status:200,text:""}}catch(ne){return{tag:V.tag,ok:!1,status:0,text:ne?.message??String(ne)}}finally{E(ne=>ne&&{...ne,done:Math.min(ne.total,ne.done+1)})}})),Z=j.filter(V=>!V.ok);if(Z.length){console.warn("Cover renew failed:",Z.slice(0,20));const V=Z.slice(0,8).map(ne=>`${ne.tag} (ERR)`).join(", ");l(`Covers fehlgeschlagen: ${Z.length}/${j.length} — z.B.: ${V}`)}else l(null)}finally{h(Date.now()),N(!1),setTimeout(()=>E(null),400)}}},[n,C]);return c.jsxs(Ns,{header:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Kategorien ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",n.length,")"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[O?c.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 tabular-nums",children:["Covers: ",O.done,"/",O.total]}),c.jsx("div",{className:"h-2 w-28 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:"h-full bg-indigo-500",style:{width:O.total>0?`${Math.round(O.done/O.total*100)}%`:"0%"}})})]}):null,c.jsx(sn,{variant:"secondary",size:"md",onClick:le,disabled:t||C,children:"Cover erneuern"}),c.jsx(sn,{variant:"secondary",size:"md",onClick:R,disabled:t||C,children:"Aktualisieren"})]})]}),grayBody:!0,children:[a?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:a}):null,n.length===0&&!t?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Kategorien/Tags gefunden."}):null,c.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n.map(k=>{const j=B[k.tag]??null,Z=_[k.tag]===!0,V=Object.prototype.hasOwnProperty.call(_,k.tag),ne=Z?T6(k.tag,u,!1,j):"",me=f[k.tag]==="ok",ue=f[k.tag]==="error";return c.jsxs("button",{type:"button",onClick:()=>W(k.tag),className:on("group text-left rounded-2xl overflow-hidden transition","bg-white/70 dark:bg-white/[0.06]","border border-gray-200/70 dark:border-white/10","shadow-sm hover:shadow-md","hover:-translate-y-[1px]","hover:bg-white dark:hover:bg-white/[0.09]","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-950"),title:"In FinishedDownloads öffnen (Tag-Filter setzen)",children:[c.jsx("div",{className:"relative w-full overflow-hidden aspect-[16/9] bg-gray-100/70 dark:bg-white/5",children:V?Z?ue?c.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),c.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[c.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Cover konnte nicht geladen werden"}),c.jsx("div",{className:"mt-1 flex justify-center",children:c.jsx("span",{className:`text-[11px] inline-flex items-center rounded-full bg-indigo-50 px-2 py-1 font-semibold text-indigo-700 ring-1 ring-indigo-100 hover:bg-indigo-100\r
dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20 dark:hover:bg-indigo-500/20`,onClick:q=>{q.preventDefault(),q.stopPropagation(),g(P=>{const Q={...P};return delete Q[k.tag],Q}),h(Date.now())},children:"Retry"})})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 z-[1] pointer-events-none",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0) 35%),linear-gradient(to top, rgba(0,0,0,0.35), rgba(0,0,0,0) 45%)"}}),c.jsx("img",{src:ne,alt:"","aria-hidden":"true",className:"absolute inset-0 z-0 h-full w-full object-cover blur-xl scale-110 opacity-60",loading:"lazy"}),c.jsx("img",{src:ne,alt:k.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>g(q=>({...q,[k.tag]:"ok"})),onError:()=>{g(q=>({...q,[k.tag]:"error"})),S(q=>({...q,[k.tag]:!1}))}}),me&&j?c.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:c.jsx("div",{className:on("truncate rounded-full px-2.5 py-1 text-[11px] font-semibold","bg-black/40 text-white backdrop-blur-md","ring-1 ring-white/15"),children:j})}):null]}):c.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),c.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[c.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Kein Cover vorhanden"}),j?c.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-700 dark:text-gray-300",children:["Model: ",c.jsx("span",{className:"font-semibold",children:j})]}):null,c.jsx("div",{className:"mt-1 text-[11px] text-gray-600 dark:text-gray-400 text-center",children:"(Kein Request / keine 404)"})]})]}):c.jsxs("div",{className:"absolute inset-0",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.20), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.14), transparent 55%)"}}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"}),c.jsx("div",{className:"absolute left-3 bottom-3 text-[11px] font-semibold text-white/80 bg-black/30 px-2.5 py-1 rounded-full ring-1 ring-white/10",children:"Cover wird geprüft…"})]})}),c.jsx("div",{className:"px-4 py-3.5",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-semibold text-gray-900 dark:text-white truncate tracking-tight",children:k.tag}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{role:"button",tabIndex:0,className:on("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap","overflow-hidden","bg-indigo-50 text-indigo-700 ring-1 ring-indigo-100","dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20","cursor-pointer"),title:"FinishedDownloads nach diesem Tag filtern",onClick:q=>{q.preventDefault(),q.stopPropagation(),W(k.tag)},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),q.stopPropagation(),W(k.tag))},children:[c.jsx("span",{className:"shrink-0",children:k.downloadsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Downloads"})]}),c.jsxs("span",{role:"button",tabIndex:0,className:on("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap overflow-hidden","bg-gray-50 text-gray-700 ring-1 ring-gray-200","dark:bg-white/5 dark:text-gray-200 dark:ring-white/10","cursor-pointer"),title:"Models nach diesem Tag filtern",onClick:q=>{q.preventDefault(),q.stopPropagation(),X(k.tag)},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),q.stopPropagation(),X(k.tag))},children:[c.jsx("span",{className:"shrink-0",children:k.modelsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Models"})]})]})]}),c.jsx("span",{"aria-hidden":"true",className:on("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},k.tag)})})]})}async function $c(n,e){const t=await fetch(n,{credentials:"include",...e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function N6(){try{const e=new URL(window.location.href).searchParams.get("next")||"/";return!e.startsWith("/")||e.startsWith("/login")?"/":e}catch{return"/"}}const cb="recorder_login_state_v1";function D6(){try{const n=sessionStorage.getItem(cb);if(!n)return null;const e=JSON.parse(n);return!e?.ts||Date.now()-e.ts>900*1e3?null:e}catch{return null}}function M6(n){try{sessionStorage.setItem(cb,JSON.stringify(n))}catch{}}function cf(){try{sessionStorage.removeItem(cb)}catch{}}function j6(n){const t=(n??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function R6(n){return(n??[]).join("")}function O6({onLoggedIn:n}){const e=p.useMemo(()=>N6(),[]),[t,i]=p.useState(""),[a,l]=p.useState(""),[u,h]=p.useState(["","","","","",""]),f=p.useRef([]),[g,_]=p.useState(!1),[S,C]=p.useState(null),[N,O]=p.useState("login"),[E,B]=p.useState(null),[H,Y]=p.useState(null),[U,re]=p.useState(null),W=p.useRef(!1),X=p.useMemo(()=>R6(u),[u]);function R(P){const Q=f.current[P];Q&&Q.focus()}function le(){h(["","","","","",""]),W.current=!1,window.setTimeout(()=>R(0),0)}function k(P,Q){const te=(Q??"").replace(/\D/g,"").slice(-1);h(ge=>{const L=[...ge];return L[P]=te,L})}function j(P,Q){const te=(Q??"").replace(/\D/g,"");if(!te){k(P,""),W.current=!1;return}if(te.length>1){h(ge=>{const L=[...ge];let xe=P;for(const Te of te){if(xe>5)break;L[xe]=Te,xe++}return L}),W.current=!1,window.setTimeout(()=>R(Math.min(5,P+te.length)),0);return}k(P,te),W.current=!1,P<5&&window.setTimeout(()=>R(P+1),0)}function Z(P,Q){if(Q.key==="Backspace"){if(u[P]){Q.preventDefault(),k(P,""),W.current=!1;return}P>0&&(Q.preventDefault(),R(P-1),k(P-1,""),W.current=!1);return}if(Q.key==="ArrowLeft"){Q.preventDefault(),P>0&&R(P-1);return}if(Q.key==="ArrowRight"){Q.preventDefault(),P<5&&R(P+1);return}}function V(P,Q){const ge=(Q.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);ge&&(Q.preventDefault(),h(L=>{const xe=[...L];let Te=P;for(const ye of ge){if(Te>5)break;xe[Te]=ye,Te++}return xe}),W.current=!1,window.setTimeout(()=>R(Math.min(5,P+ge.length)),0))}p.useEffect(()=>{const P=D6();P&&(O(P.stage??"login"),i(P.username??""),h(j6(P.code??"")),B(P.setupAuthUrl??null),Y(P.setupSecret??null),re(P.setupInfo??null))},[]),p.useEffect(()=>{M6({stage:N,username:t,code:X,setupAuthUrl:E,setupSecret:H,setupInfo:U,ts:Date.now()})},[N,t,X,E,H,U]),p.useEffect(()=>{W.current=!1,(N==="verify"||N==="setup")&&window.setTimeout(()=>R(0),0)},[N]),p.useEffect(()=>{let P=!1;return(async()=>{try{const te=await $c("/api/auth/me",{cache:"no-store"});if(P)return;if(te?.authenticated){te?.totpConfigured?(cf(),window.location.assign(e||"/")):(O("setup"),ue());return}if(te?.pending2fa){O("verify");return}O("login")}catch{}})(),()=>{P=!0}},[e]);const ne=async()=>{_(!0),C(null);try{if((await $c("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:a})}))?.totpRequired){O("verify"),le();return}const Q=await $c("/api/auth/me",{cache:"no-store"});if(Q?.authenticated&&!Q?.totpConfigured){O("setup"),le(),await ue();return}n&&await n(),cf(),window.location.assign(e||"/")}catch(P){C(P?.message??String(P))}finally{_(!1)}},me=async()=>{const P=X.trim();if(/^\d{6}$/.test(P)){_(!0),C(null);try{await $c("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:P})}),n&&await n(),cf(),window.location.assign(e||"/")}catch(Q){W.current=!1,C(Q?.message??String(Q))}finally{_(!1)}}},ue=async()=>{C(null),re(null);try{const P=await $c("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Q=(P?.otpauth??"").trim();if(!Q)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");B(Q),Y((P?.secret??"").trim()||null),re("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(P){C(P?.message??String(P))}};p.useEffect(()=>{g||N!=="verify"&&N!=="setup"||/^\d{6}$/.test(X)&&(W.current||(W.current=!0,me()))},[X,N,g]);const q=c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"2FA Code"}),c.jsx("div",{className:"flex items-center justify-between gap-2",children:u.map((P,Q)=>c.jsx("input",{ref:te=>{f.current[Q]=te},value:P,onChange:te=>j(Q,te.target.value),onKeyDown:te=>Z(Q,te),onPaste:te=>V(Q,te),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:Q===0?"one-time-code":"off",enterKeyHint:Q===5?"done":"next",autoCapitalize:"none",autoCorrect:"off",disabled:g,className:`h-12 w-12 rounded-lg text-center text-lg tabular-nums bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
dark:bg-white/10 dark:text-white dark:ring-white/10`,"aria-label":`2FA Ziffer ${Q+1}`},Q))})]});return c.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[c.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),c.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),c.jsx("div",{className:"relative grid min-h-[100dvh] place-items-center px-4",children:c.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-gray-200/70 bg-white/80 p-6 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Recorder Login"}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Bitte melde dich an, um fortzufahren."})]}),c.jsxs("div",{className:"mt-5 space-y-3",children:[N==="login"?c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&ne()},className:"space-y-3",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Username"}),c.jsx("input",{value:t,onChange:P=>i(P.target.value),autoComplete:"username",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"admin",disabled:g})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Passwort"}),c.jsx("input",{type:"password",value:a,onChange:P=>l(P.target.value),autoComplete:"current-password",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"••••••••••",disabled:g})]}),c.jsx(sn,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:g||!t.trim()||!a,children:g?"Login…":"Login"})]}):N==="verify"?c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&me()},className:"space-y-3",children:[c.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:"2FA ist aktiv bitte gib den Code aus deiner Authenticator-App ein."}),q,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(sn,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{O("login"),le()},children:"Zurück"}),c.jsx(sn,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(X),children:g?"Prüfe…":"Bestätigen"})]})]}):c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&me()},className:"space-y-3",children:[c.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-2 text-sm text-indigo-900 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-200",children:"2FA ist noch nicht eingerichtet bitte richte es jetzt ein (empfohlen)."}),c.jsxs("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[c.jsx("div",{children:"1) Öffne deine Authenticator-App und füge einen neuen Account hinzu."}),c.jsx("div",{children:"2) Scanne den QR-Code oder verwende den Secret-Key."})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white/70 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"QR / Setup"}),E?c.jsx("div",{className:"mt-2 flex items-center justify-center",children:c.jsx("img",{alt:"2FA QR Code",className:"h-44 w-44 rounded bg-white p-2",src:`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(E)}`})}):c.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-300",children:"QR wird geladen…"}),H?c.jsxs("div",{className:"mt-3",children:[c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Secret (manuell):"}),c.jsx("div",{className:"mt-1 select-all break-all rounded bg-gray-100 px-2 py-1 text-xs font-mono text-gray-900 dark:bg-white/10 dark:text-gray-100",children:H})]}):null,U?c.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:U}):null,c.jsx("div",{className:"mt-3",children:c.jsx(sn,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:g,onClick:()=>{ue()},title:"Setup-Infos neu laden",children:E?"QR/Setup erneut laden":"QR/Setup laden"})})]}),q,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(sn,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{n&&n(),cf(),window.location.assign(e||"/")},title:"Ohne 2FA fortfahren (nicht empfohlen)",children:"Später"}),c.jsx(sn,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(X),children:g?"Aktiviere…":"2FA aktivieren"})]})]}),S?c.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx("div",{className:"min-w-0 break-words",children:S}),c.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>C(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null]})]})})]})}const Ag="record_cookies";function df(n){return Object.fromEntries(Object.entries(n??{}).map(([t,i])=>[t.trim().toLowerCase(),String(i??"").trim()]).filter(([t,i])=>t.length>0&&i.length>0))}async function or(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const Z_={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!1,autoStartAddedDownloads:!1,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!1,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:3e3};function Ta(n){let e=(n??"").trim();if(!e)return null;e=e.replace(/^[("'[{<]+/,"").replace(/[)"'\]}>.,;:]+$/,""),/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function tl(n){const e=(n??"").trim();if(!e)return null;for(const t of e.split(/\s+/g)){const i=Ta(t);if(i)return i}return null}function ld(n){try{const e=new URL(n).hostname.replace(/^www\./i,"").toLowerCase();return e==="chaturbate.com"||e.endsWith(".chaturbate.com")?"chaturbate":e==="myfreecams.com"||e.endsWith(".myfreecams.com")?"mfc":null}catch{return null}}function Lk(n){try{const e=new URL(n),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="chaturbate.com"&&!t.endsWith(".chaturbate.com"))return"";const i=e.pathname.split("/").filter(Boolean);return i[0]?decodeURIComponent(i[0]).trim():""}catch{return""}}function yo(n){const e=ld(n);if(!e)return n;if(e==="chaturbate"){const i=Lk(n);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:n}const t=Ik(n);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:n}function L6(n){const e=ld(n);return e?((e==="chaturbate"?Lk(n):Ik(n))||"").trim().toLowerCase():""}function Ik(n){try{const e=new URL(n),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="myfreecams.com"&&!t.endsWith(".myfreecams.com"))return"";const i=(e.hash||"").replace(/^#\/?/,"");if(i){const u=i.split("/").filter(Boolean),h=u[u.length-1]||"";if(h)return decodeURIComponent(h).trim()}const a=e.pathname.split("/").filter(Boolean),l=a[a.length-1]||"";return l?decodeURIComponent(l).trim():""}catch{return""}}const Ei=n=>(n||"").replaceAll("\\","/").split("/").pop()||"";function I6(n,e){const i=(n||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function B6(n){return n.startsWith("HOT ")?n.slice(4):n}const P6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Hc(n){const t=B6(Ei(n)).replace(/\.[^.]+$/,""),i=t.match(P6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function F6(){const[n,e]=p.useState(!1),[t,i]=p.useState(!1),a=p.useRef(null),l=p.useCallback(()=>{const I=a.current;I&&(I.focus(),requestAnimationFrame(()=>I.select()))},[]),u=p.useCallback(async()=>{try{const I=await or("/api/auth/me",{cache:"no-store"});i(!!I?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),h=p.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),ke(null),et(!1),lt("running"),kn(null),xn(!1),he(null),Q([]),ge([]),ye(0),xe(1),bt({}),mt(0),li({}),_e.current={},Ot.current={},Hn.current=!1,_n([]),Ut({}),we(0),q("")}},[]);p.useEffect(()=>{u()},[u]);const f=Pw(),g=p.useRef(f),_=p.useRef(0),S=I=>{const ce=(I||"").toLowerCase();return ce.includes("altersverifikationsseite erhalten")||ce.includes("verify your age")||ce.includes("schutzseite von cloudflare erhalten")||ce.includes("just a moment")||ce.includes("kein room-html")},C=I=>{const ce=!!I?.silent,pe="Cookies fehlen oder sind abgelaufen",Ce="Der Recorder hat statt des Room-HTML eine Schutz-/Altersverifikationsseite erhalten. Bitte Cookies aktualisieren (bei Chaturbate z.B. cf_clearance + sessionId) und erneut starten.";if(!ce){ke(`⚠️ ${pe}. ${Ce}`),Lt(!0);return}const Ae=Date.now();Ae-_.current>15e3&&(_.current=Ae,g.current?.error(pe,Ce))};p.useEffect(()=>{g.current=f},[f]);const[N,O]=p.useState(!1);p.useEffect(()=>{const I=window,ce=typeof I.requestIdleCallback=="function"?I.requestIdleCallback(()=>O(!0),{timeout:1500}):window.setTimeout(()=>O(!0),800);return()=>{typeof I.cancelIdleCallback=="function"?I.cancelIdleCallback(ce):window.clearTimeout(ce)}},[]);const E=8,B="finishedDownloads_sort",[H,Y]=p.useState(()=>{try{return window.localStorage.getItem(B)||"completed_desc"}catch{return"completed_desc"}}),U=p.useRef(null),re=p.useRef(!1),W=(I,ce)=>`${ce}::${I}`,X=p.useCallback(async I=>{if(I<1||re.current)return;const ce=W(I,H),pe=U.current;if(!(pe?.key===ce&&Date.now()-pe.ts<15e3)){re.current=!0;try{const Ce=await fetch(`/api/record/done?page=${I}&pageSize=${E}&sort=${encodeURIComponent(H)}`,{cache:"no-store"});if(!Ce.ok)return;const Ae=await Ce.json().catch(()=>null),z=Array.isArray(Ae?.items)?Ae.items:Array.isArray(Ae)?Ae:[];U.current={key:ce,items:z,ts:Date.now()}}finally{re.current=!1}}},[H]),R=p.useCallback(async()=>{const I=Date.now();if(!le.current&&!(I-k.current<500)){le.current=!0,k.current=I;try{const ce=await fetch("/api/record/done/meta",{cache:"no-store"});if(!ce.ok)return;const pe=await ce.json().catch(()=>null),Ce=Number(pe?.count??0),Ae=Number.isFinite(Ce)&&Ce>=0?Ce:0;ye(Ae),ct(Date.now())}catch{}finally{le.current=!1}}},[]),le=p.useRef(!1),k=p.useRef(0),j=p.useRef(null),Z=p.useRef(0),V=p.useCallback((I="unknown")=>{const ce=Date.now(),pe=700;if(wn.current!=="finished"||j.current!=null)return;const Ce=ce-Z.current;if(Ce<pe){j.current=window.setTimeout(()=>{j.current=null,Z.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload(cooldown-tail)",reason:I}}))},pe-Ce);return}j.current=window.setTimeout(()=>{j.current=null,Z.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload",reason:I}}))},150)},[]);p.useEffect(()=>()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),p.useEffect(()=>{try{window.localStorage.setItem(B,H)}catch{}},[H]),p.useEffect(()=>{t&&R()},[t,R]);const[ne,me]=p.useState(null),[ue,q]=p.useState(""),[P,Q]=p.useState([]),[te,ge]=p.useState([]),[L,xe]=p.useState(1),[Te,ye]=p.useState(0),[be,mt]=p.useState(0),[Ke,we]=p.useState(0),[Re,ct]=p.useState(()=>Date.now()),[Oe,je]=p.useState(()=>Date.now());p.useEffect(()=>{const I=window.setInterval(()=>je(Date.now()),1e3);return()=>window.clearInterval(I)},[]);const Ue=I=>(I||"").toLowerCase().trim(),ze=I=>{const ce=Math.max(0,Math.floor(I/1e3));if(ce<2)return"gerade eben";if(ce<60)return`vor ${ce} Sekunden`;const pe=Math.floor(ce/60);if(pe===1)return"vor 1 Minute";if(pe<60)return`vor ${pe} Minuten`;const Ce=Math.floor(pe/60);return Ce===1?"vor 1 Stunde":`vor ${Ce} Stunden`},gt=p.useMemo(()=>{const I=Oe-Re;return`(zuletzt aktualisiert: ${ze(I)})`},[Oe,Re]),[st,bt]=p.useState({}),Qe=p.useCallback(I=>{const ce={};for(const pe of Array.isArray(I)?I:[]){const Ce=(pe?.modelKey||"").trim().toLowerCase();if(!Ce)continue;const Ae=G=>(G.favorite?4:0)+(G.liked===!0?2:0)+(G.watching?1:0),z=ce[Ce];(!z||Ae(pe)>=Ae(z))&&(ce[Ce]=pe)}return ce},[]),Ye=p.useCallback(async()=>{try{const I=await or("/api/models",{cache:"no-store"});bt(Qe(Array.isArray(I)?I:[])),ct(Date.now())}catch{}},[Qe]),[tt,$e]=p.useState(null),ht=p.useRef(null),[At,he]=p.useState(null);p.useEffect(()=>{const I=ce=>{const Ce=(ce.detail?.modelKey??"").trim();if(!Ce)return;if(!Ce.includes(" ")&&!Ce.includes("/")&&!Ce.includes("\\")){const ae=Ce.replace(/^@/,"").trim().toLowerCase();ae&&he(ae);return}const z=Ta(Ce);if(!z){let ae=Ce.replace(/^https?:\/\//i,"");ae.includes("/")&&(ae=ae.split("/").filter(Boolean).pop()||ae),ae.includes(":")&&(ae=ae.split(":").pop()||ae),ae=ae.trim().toLowerCase(),ae&&he(ae);return}const G=yo(z),ee=L6(G);ee&&he(ee)};return window.addEventListener("open-model-details",I),()=>window.removeEventListener("open-model-details",I)},[]);const Ie=p.useCallback(I=>{const ce=Date.now(),pe=ht.current;if(!pe){ht.current={ts:ce,list:[I]};return}pe.ts=ce;const Ce=pe.list.findIndex(Ae=>Ae.id===I.id);Ce>=0?pe.list[Ce]=I:pe.list.unshift(I)},[]);p.useEffect(()=>{Ye();const I=ce=>{const Ce=ce?.detail??{},Ae=Ce?.model;if(Ae&&typeof Ae=="object"){const z=String(Ae.modelKey??"").toLowerCase().trim();z&&bt(G=>({...G,[z]:Ae}));try{Ie(Ae)}catch{}$e(G=>G?.id===Ae.id?Ae:G),ct(Date.now());return}if(Ce?.removed){const z=String(Ce?.id??"").trim(),G=String(Ce?.modelKey??"").toLowerCase().trim();G&&bt(ee=>{const{[G]:ae,...Be}=ee;return Be}),z&&$e(ee=>ee?.id===z?null:ee),ct(Date.now());return}Ye()};return window.addEventListener("models-changed",I),()=>window.removeEventListener("models-changed",I)},[Ye,Ie]);const[Le,ke]=p.useState(null),[Pe,et]=p.useState(!1),[kt,Lt]=p.useState(!1),[pt,Zt]=p.useState({}),[qt,Gt]=p.useState(!1),[wt,lt]=p.useState("running"),[Yt,kn]=p.useState(null),[pn,xn]=p.useState(!1),[rt,M]=p.useState(null),[F,ie]=p.useState(0),De=p.useCallback(()=>ie(I=>I+1),[]),[Ve,yt]=p.useState(Z_),Vt=p.useRef(Ve);p.useEffect(()=>{Vt.current=Ve},[Ve]);const Jt=!!Ve.autoAddToDownloadList,gn=!!Ve.autoStartAddedDownloads,[ln,_n]=p.useState([]),[En,Ut]=p.useState({}),hn=p.useRef(!1),cn=p.useRef({}),en=p.useRef([]),zt=p.useRef(0),Dt=p.useRef(0),Ot=p.useRef({}),Hn=p.useRef(!1);p.useEffect(()=>{hn.current=Pe},[Pe]),p.useEffect(()=>{cn.current=pt},[pt]),p.useEffect(()=>{en.current=P},[P]);const Rt=p.useRef(null),qn=p.useRef(""),_i=4,Mn=p.useRef([]),Wt=p.useRef(0),zn=p.useRef(new Set),Kn=p.useRef(!1),jn=p.useCallback(()=>{const I=Wt.current>0;et(I),hn.current=I},[]),Wn=p.useCallback(I=>{const ce=Ta(I.url);if(!ce)return!1;const pe=yo(ce);return zn.current.has(pe)||(zn.current.add(pe),Mn.current.push({...I,url:pe}),Kn.current||(Kn.current=!0,queueMicrotask(()=>{Kn.current=!1,fi()}))),!0},[]);async function Cn(I,ce){if(I=yo(I),en.current.some(Ce=>{if(String(Ce.status||"").toLowerCase()!=="running"||Ce.endedAt)return!1;const Ae=Ta(String(Ce.sourceUrl||""));return(Ae?yo(Ae):"")===I}))return!0;try{const Ce=cn.current,Ae=ld(I);if(!Ae)return ce||ke("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(Ae==="chaturbate"&&!mi(Ce))return ce||ke('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const z=Object.entries(Ce).map(([ee,ae])=>`${ee}=${ae}`).join("; "),G=await or("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:I,cookie:z})});return G?.id&&(Ot.current[String(G.id)]=!0),Q(ee=>[G,...ee]),en.current=[G,...en.current],!0}catch(Ce){const Ae=Ce?.message??String(Ce);return S(Ae)?(C({silent:ce}),!1):(ce||ke(Ae),!1)}}async function fi(){for(;Wt.current<_i&&Mn.current.length>0;){const I=Mn.current.shift();Wt.current++,jn(),(async()=>{try{if(await Cn(I.url,I.silent)&&I.pendingKeyLower){const pe=I.pendingKeyLower;Ut(Ce=>{const Ae={...Ce||{}};return delete Ae[pe],Pt.current=Ae,Ae})}}finally{zn.current.delete(I.url),Wt.current=Math.max(0,Wt.current-1),jn(),Mn.current.length>0&&fi()}})()}}const[Xn,li]=p.useState({}),_e=p.useRef({});p.useEffect(()=>{_e.current=Xn},[Xn]);const at=p.useCallback(I=>{const ce=String(I?.host??"").toLowerCase(),pe=String(I?.input??"").toLowerCase();return ce.includes("chaturbate")||pe.includes("chaturbate.com")},[]),Ct=p.useMemo(()=>{const I=new Set;for(const ce of Object.values(st)){if(!at(ce))continue;const pe=Ue(String(ce?.modelKey??""));pe&&I.add(pe)}return Array.from(I)},[st,at]),St=p.useRef(st);p.useEffect(()=>{St.current=st},[st]);const Pt=p.useRef(En);p.useEffect(()=>{Pt.current=En},[En]);const tn=p.useRef(Ct);p.useEffect(()=>{tn.current=Ct},[Ct]);const wn=p.useRef(wt);p.useEffect(()=>{wn.current=wt},[wt]);const vt=p.useCallback(async(I,ce)=>{const pe=Ta(I);if(!pe)return!1;const Ce=yo(pe),Ae=!!ce?.silent;Ae||ke(null);const z=ld(Ce);if(!z)return Ae||ke("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const G=cn.current;if(z==="chaturbate"&&!mi(G))return Ae||ke('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if(en.current.some(ae=>{if(String(ae.status||"").toLowerCase()!=="running"||ae.endedAt)return!1;const Be=Ta(String(ae.sourceUrl||""));return(Be?yo(Be):"")===Ce}))return!0;if(z==="chaturbate"&&Vt.current.useChaturbateApi)try{const ae=await or("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Ce})}),Be=String(ae?.modelKey??"").trim().toLowerCase();if(Be){if(hn.current)return Ut(ut=>({...ut||{},[Be]:Ce})),!0;const Je=_e.current[Be],We=String(Je?.current_show??"");if(Je&&We&&We!=="public")return Ut(ut=>({...ut||{},[Be]:Ce})),!0}}catch{}else if(hn.current)return Rt.current=Ce,!0;if(hn.current)return!1;et(!0),hn.current=!0;try{const ae=Object.entries(G).map(([Je,We])=>`${Je}=${We}`).join("; "),Be=await or("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Ce,cookie:ae})});return Be?.id&&(Ot.current[String(Be.id)]=!0),Q(Je=>[Be,...Je]),en.current=[Be,...en.current],!0}catch(ae){const Be=ae?.message??String(ae);return S(Be)?(C({silent:Ae}),!1):(Ae||ke(Be),!1)}finally{et(!1),hn.current=!1}},[]);p.useEffect(()=>{let I=!1;const ce=async()=>{try{const Ae=await or("/api/settings",{cache:"no-store"});!I&&Ae&&yt({...Z_,...Ae})}catch{}},pe=()=>{ce()},Ce=()=>{ce()};return window.addEventListener("recorder-settings-updated",pe),window.addEventListener("focus",Ce),document.addEventListener("visibilitychange",Ce),ce(),()=>{I=!0,window.removeEventListener("recorder-settings-updated",pe),window.removeEventListener("focus",Ce),document.removeEventListener("visibilitychange",Ce)}},[]),p.useEffect(()=>{let I=!1;const ce=async()=>{try{const Ce=await or("/api/models/meta",{cache:"no-store"}),Ae=Number(Ce?.count??0);!I&&Number.isFinite(Ae)&&(mt(Ae),ct(Date.now()))}catch{}};ce();const pe=window.setInterval(ce,document.hidden?6e4:3e4);return()=>{I=!0,window.clearInterval(pe)}},[]);const fn=p.useMemo(()=>Object.entries(pt).map(([I,ce])=>({name:I,value:ce})),[pt]),Ne=p.useCallback((I,ce)=>{ht.current=null,$e(null),kn(I),xn(!1),M(typeof ce=="number"&&Number.isFinite(ce)&&ce>=0?ce:null)},[]),Tt=P.filter(I=>{const ce=String(I?.status??"").toLowerCase();return ce==="running"||ce==="postwork"}),_t=p.useMemo(()=>{let I=0;for(const ce of Object.values(st)){if(!ce?.watching||!at(ce))continue;const pe=Ue(String(ce?.modelKey??""));pe&&Xn[pe]&&I++}return I},[st,Xn,at]),{onlineFavCount:$t,onlineLikedCount:Ht}=p.useMemo(()=>{let I=0,ce=0;for(const pe of Object.values(st)){const Ce=Ue(String(pe?.modelKey??""));Ce&&Xn[Ce]&&(pe?.favorite&&I++,pe?.liked===!0&&ce++)}return{onlineFavCount:I,onlineLikedCount:ce}},[st,Xn]),yn=[{id:"running",label:"Laufende Downloads",count:Tt.length},{id:"finished",label:"Abgeschlossene Downloads",count:Te},{id:"models",label:"Models",count:be},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],Xt=p.useMemo(()=>ue.trim().length>0&&!Pe,[ue,Pe]);p.useEffect(()=>{let I=!1;return(async()=>{try{const pe=await or("/api/cookies",{cache:"no-store"}),Ce=df(pe?.cookies);if(I||Zt(Ce),Object.keys(Ce).length===0){const Ae=localStorage.getItem(Ag);if(Ae)try{const z=JSON.parse(Ae),G=df(z);Object.keys(G).length>0&&(I||Zt(G),await or("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:G})}))}catch{}}}catch{const pe=localStorage.getItem(Ag);if(pe)try{const Ce=JSON.parse(pe);I||Zt(df(Ce))}catch{}}finally{I||Gt(!0)}})(),()=>{I=!0}},[]),p.useEffect(()=>{qt&&localStorage.setItem(Ag,JSON.stringify(pt))},[pt,qt]),p.useEffect(()=>{R();const I=()=>{document.hidden||R()};return document.addEventListener("visibilitychange",I),()=>{document.removeEventListener("visibilitychange",I)}},[R]),p.useEffect(()=>{if(wt!=="finished")return;R(),V("selectedTab effect");const I=()=>{document.hidden||(R(),V("selectedTab visibilitychange"))};return document.addEventListener("visibilitychange",I),()=>{document.removeEventListener("visibilitychange",I)}},[wt,R,V]),p.useEffect(()=>{const I=Math.max(1,Math.ceil(Te/E));L>I&&xe(I)},[Te,L]),p.useEffect(()=>{if(!t)return;const I=ud("/api/stream","jobs",ce=>{Dt.current=Date.now();const pe=Array.isArray(ce)?ce:[];Q(pe),en.current=pe,ct(Date.now())});return()=>I()},[t]),p.useEffect(()=>{if(!t)return;let I=null;const ce={t:0};let pe=null;const Ce=()=>{I!=null&&(window.clearInterval(I),I=null)},Ae=()=>{I==null&&(I=window.setInterval(()=>{document.hidden||Date.now()-(zt.current||0)<12e3||(wn.current==="finished"?(R(),V("done-stream poll fallback tick")):R())},document.hidden?6e4:15e3))},z=ae=>{const Be=Date.now();if(Be-ce.t<800){if(pe!=null)return;pe=window.setTimeout(()=>{pe=null,ce.t=Date.now(),wn.current==="finished"?(R(),V(`done-stream coalesced (${ae})`)):R()},900);return}ce.t=Be,wn.current==="finished"?(R(),V(`done-stream (${ae})`)):R()};R(),Ae();const G=ud("/api/stream","doneChanged",ae=>{zt.current=Date.now(),z("sse event")}),ee=()=>{document.hidden||z("visibilitychange")};return document.addEventListener("visibilitychange",ee),()=>{document.removeEventListener("visibilitychange",ee),pe!=null&&window.clearTimeout(pe),Ce(),G()}},[t,R,V]);function On(I){const ce=Ta(I);if(!ce)return!1;try{return new URL(ce).hostname.includes("chaturbate.com")}catch{return!1}}function Vn(I,ce){const pe=Object.fromEntries(Object.entries(I).map(([Ce,Ae])=>[Ce.trim().toLowerCase(),Ae]));for(const Ce of ce){const Ae=pe[Ce.toLowerCase()];if(Ae)return Ae}}function mi(I){const ce=Vn(I,["cf_clearance"]),pe=Vn(I,["sessionid","session_id","sessionId"]);return!!(ce&&pe)}async function $n(I){try{await or(`/api/record/stop?id=${encodeURIComponent(I)}`,{method:"POST"})}catch(ce){f.error("Stop fehlgeschlagen",ce?.message??String(ce))}}p.useEffect(()=>{const I=ce=>{const Ce=Number(ce.detail?.delta??0);Number.isFinite(Ce)&&Ce!==0&&ye(Ae=>Math.max(0,Ae+Ce)),R()};return window.addEventListener("finished-downloads:count-hint",I),()=>window.removeEventListener("finished-downloads:count-hint",I)},[R]),p.useEffect(()=>{const I=ce=>{const pe=ce.detail||{};pe.tab==="finished"&&lt("finished"),pe.tab==="categories"&&lt("categories"),pe.tab==="models"&&lt("models"),pe.tab==="running"&&lt("running"),pe.tab==="settings"&&lt("settings")};return window.addEventListener("app:navigate-tab",I),()=>window.removeEventListener("app:navigate-tab",I)},[]),p.useEffect(()=>{if(!Yt){$e(null),me(null);return}const I=(Hc(Yt.output||"")||"").trim().toLowerCase();me(I||null);const ce=I?st[I]:void 0;$e(ce??null)},[Yt,st]);async function ji(){return vt(ue)}const Bi=p.useCallback(async I=>{const ce=String(I?.sourceUrl??""),pe=tl(ce);if(!pe)return!1;const Ce=Ta(pe);if(!Ce)return!1;const Ae=yo(Ce),z=await vt(Ae,{silent:!0});return z||f.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),z},[vt,f]);async function Yn(I){const{kind:ce,file:pe,run:Ce,onSuccess:Ae,onError:z}=I;(ce==="delete"||ce==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:pe,phase:"start"}}));try{const G=await Ce();return(ce==="delete"||ce==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:pe,phase:"success"}})),await Ae?.(G),G}catch(G){throw(ce==="delete"||ce==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:pe,phase:"error"}})),await z?.(G),G}}const pi=p.useCallback(async I=>{const ce=Ei(I.output||"");if(ce)try{const pe=await Yn({kind:"delete",file:ce,run:()=>or(`/api/record/delete?file=${encodeURIComponent(ce)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{ge(Ae=>{const z=Ae.filter(We=>Ei(We.output||"")!==ce);if(E-z.length<=0)return z;const ee=W(L+1,H),ae=U.current;if(!ae||ae.key!==ee||!Array.isArray(ae.items)||ae.items.length===0)return z;const Be=[...z],Je=new Set(Be.map(We=>String(We.id||Ei(We.output||"")).trim()));for(;Be.length<E&&ae.items.length>0;){const We=ae.items.shift(),ut=String(We.id||Ei(We.output||"")).trim();!ut||Je.has(ut)||(Je.add(ut),Be.push(We))}return U.current={...ae,items:ae.items,ts:ae.ts},Be}),ye(Ae=>Math.max(0,Ae-1)),Q(Ae=>Ae.filter(z=>Ei(z.output||"")!==ce)),kn(Ae=>Ae&&Ei(Ae.output||"")===ce?null:Ae),X(L+1)},320)},onError:async()=>{f.error("Löschen fehlgeschlagen",ce)}}),Ce=typeof pe?.undoToken=="string"?pe.undoToken:"";return Ce?{undoToken:Ce}:{}}catch{return}},[Yn,f,L,H,X]),gi=p.useCallback(async I=>{const ce=Ei(I.output||"");if(ce)try{await Yn({kind:"keep",file:ce,run:()=>or(`/api/record/keep?file=${encodeURIComponent(ce)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{ge(pe=>pe.filter(Ce=>Ei(Ce.output||"")!==ce)),Q(pe=>pe.filter(Ce=>Ei(Ce.output||"")!==ce)),kn(pe=>pe&&Ei(pe.output||"")===ce?null:pe),ye(pe=>Math.max(0,pe-1)),X(L+1)},320)},onError:async()=>{f.error("Keep fehlgeschlagen",ce)}})}catch{return}},[Yn,f,L,X]),Pn=p.useCallback(async I=>{const ce=Ei(I.output||"");if(ce)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:ce}})),await new Promise(G=>window.setTimeout(G,60));const pe=await or(`/api/record/toggle-hot?file=${encodeURIComponent(ce)}`,{method:"POST"}),Ce=Ei(pe.oldFile||ce)||ce,Ae=Ei(pe.newFile||"")||"";if(!Ae)throw new Error("Backend lieferte keinen neuen Dateinamen zurück");window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:Ce,newFile:Ae}}));const z=G=>I6(G||"",Ae);return kn(G=>G&&(G.id===I.id||Ei(G.output||"")===Ce?{...G,output:z(G.output||"")}:G)),ge(G=>G.map(ee=>ee.id===I.id||Ei(ee.output||"")===Ce?{...ee,output:z(ee.output||"")}:ee)),Q(G=>G.map(ee=>ee.id===I.id||Ei(ee.output||"")===Ce?{...ee,output:z(ee.output||"")}:ee)),pe}catch(pe){f.error("Umbenennen fehlgeschlagen",pe?.message??String(pe));return}},[f]),Ri=p.useCallback(async I=>{await pi(I)},[pi]);async function ei(I){const ce=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)});if(ce.status===204)return null;if(!ce.ok){const pe=await ce.text().catch(()=>"");throw new Error(pe||`HTTP ${ce.status}`)}return ce.json()}const ti=p.useCallback(I=>{const ce=ht.current;!ce||!I||(ce.ts=Date.now(),ce.list=ce.list.filter(pe=>pe.id!==I))},[]),An=p.useRef({}),ii=p.useCallback(async I=>{const ce=Ei(I.output||""),pe=!!(Yt&&Ei(Yt.output||"")===ce),Ce=We=>{try{const ut=String(We.sourceUrl??We.SourceURL??""),Mt=tl(ut);return Mt?new URL(Mt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ae=(Hc(I.output||"")||"").trim().toLowerCase();if(Ae){const We=Ae;if(An.current[We])return;An.current[We]=!0;const ut=st[Ae]??{id:"",input:"",host:Ce(I)||void 0,modelKey:Ae,watching:!1,favorite:!1,liked:null,isUrl:!1},Mt=!ut.favorite,Nt={...ut,modelKey:ut.modelKey||Ae,favorite:Mt,liked:Mt?!1:ut.liked};bt(jt=>({...jt,[Ae]:Nt})),Ie(Nt),pe&&$e(Nt);try{const jt=await ei({...Nt.id?{id:Nt.id}:{},host:Nt.host||Ce(I)||"",modelKey:Ae,favorite:Mt,...Mt?{liked:!1}:{}});if(!jt){bt(Gn=>{const{[Ae]:rr,...dr}=Gn;return dr}),ut.id&&ti(ut.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:Ae}}));return}const Qt=Ue(jt.modelKey||Ae);Qt&&bt(Gn=>({...Gn,[Qt]:jt})),Ie(jt),pe&&$e(jt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:jt}}))}catch(jt){bt(Qt=>({...Qt,[Ae]:ut})),Ie(ut),pe&&$e(ut),f.error("Favorit umschalten fehlgeschlagen",jt?.message??String(jt))}finally{delete An.current[We]}return}let z=pe?tt:null;if(z||(z=await se(I,{ensure:!0})),!z)return;const G=Ue(z.modelKey||z.id||"");if(!G||An.current[G])return;An.current[G]=!0;const ee=z,ae=!ee.favorite,Be={...ee,favorite:ae,liked:ae?!1:ee.liked},Je=Ue(ee.modelKey||"");Je&&bt(We=>({...We,[Je]:Be})),Ie(Be),pe&&$e(Be);try{const We=await ei({id:ee.id,favorite:ae,...ae?{liked:!1}:{}});if(!We){bt(Mt=>{const Nt=Ue(ee.modelKey||"");if(!Nt)return Mt;const{[Nt]:jt,...Qt}=Mt;return Qt}),ti(ee.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ee.id,modelKey:ee.modelKey}}));return}const ut=Ue(We.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:We})),Ie(We),pe&&$e(We),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:We}}))}catch(We){const ut=Ue(ee.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:ee})),Ie(ee),pe&&$e(ee),f.error("Favorit umschalten fehlgeschlagen",We?.message??String(We))}finally{delete An.current[G]}},[f,Yt,tt,se,ei,Ie,ti,st]),Pi=p.useCallback(async I=>{const ce=Ei(I.output||""),pe=!!(Yt&&Ei(Yt.output||"")===ce),Ce=We=>{try{const ut=String(We.sourceUrl??We.SourceURL??""),Mt=tl(ut);return Mt?new URL(Mt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ae=(Hc(I.output||"")||"").trim().toLowerCase();if(Ae){const We=Ae;if(An.current[We])return;An.current[We]=!0;const ut=st[Ae]??{id:"",input:"",host:Ce(I)||void 0,modelKey:Ae,watching:!1,favorite:!1,liked:null,isUrl:!1},Mt=ut.liked!==!0,Nt={...ut,modelKey:ut.modelKey||Ae,liked:Mt,favorite:Mt?!1:ut.favorite};bt(jt=>({...jt,[Ae]:Nt})),Ie(Nt),pe&&$e(Nt);try{const jt=await ei({...Nt.id?{id:Nt.id}:{},host:Nt.host||Ce(I)||"",modelKey:Ae,liked:Mt,...Mt?{favorite:!1}:{}});if(!jt){bt(Gn=>{const{[Ae]:rr,...dr}=Gn;return dr}),ut.id&&ti(ut.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:Ae}}));return}const Qt=Ue(jt.modelKey||Ae);Qt&&bt(Gn=>({...Gn,[Qt]:jt})),Ie(jt),pe&&$e(jt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:jt}}))}catch(jt){bt(Qt=>({...Qt,[Ae]:ut})),Ie(ut),pe&&$e(ut),f.error("Like umschalten fehlgeschlagen",jt?.message??String(jt))}finally{delete An.current[We]}return}let z=pe?tt:null;if(z||(z=await se(I,{ensure:!0})),!z)return;const G=Ue(z.modelKey||z.id||"");if(!G||An.current[G])return;An.current[G]=!0;const ee=z,ae=ee.liked!==!0,Be={...ee,liked:ae,favorite:ae?!1:ee.favorite},Je=Ue(ee.modelKey||"");Je&&bt(We=>({...We,[Je]:Be})),Ie(Be),pe&&$e(Be);try{const We=ae?await ei({id:ee.id,liked:!0,favorite:!1}):await ei({id:ee.id,liked:!1});if(!We){bt(Mt=>{const Nt=Ue(ee.modelKey||"");if(!Nt)return Mt;const{[Nt]:jt,...Qt}=Mt;return Qt}),ti(ee.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ee.id,modelKey:ee.modelKey}}));return}const ut=Ue(We.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:We})),Ie(We),pe&&$e(We),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:We}}))}catch(We){const ut=Ue(ee.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:ee})),Ie(ee),pe&&$e(ee),f.error("Like umschalten fehlgeschlagen",We?.message??String(We))}finally{delete An.current[G]}},[f,Yt,tt,se,ei,Ie,ti,st]),Oi=p.useCallback(async I=>{const ce=Ei(I.output||""),pe=!!(Yt&&Ei(Yt.output||"")===ce),Ce=We=>{try{const ut=String(We.sourceUrl??We.SourceURL??""),Mt=tl(ut);return Mt?new URL(Mt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ae=(Hc(I.output||"")||"").trim().toLowerCase();if(Ae){const We=Ae;if(An.current[We])return;An.current[We]=!0;const ut=st[Ae]??{id:"",input:"",host:Ce(I)||void 0,modelKey:Ae,watching:!1,favorite:!1,liked:null,isUrl:!1},Mt=!ut.watching,Nt={...ut,modelKey:ut.modelKey||Ae,watching:Mt};bt(jt=>({...jt,[Ae]:Nt})),Ie(Nt),pe&&$e(Nt);try{const jt=await ei({...Nt.id?{id:Nt.id}:{},host:Nt.host||Ce(I)||"",modelKey:Ae,watched:Mt});if(!jt){bt(Gn=>{const{[Ae]:rr,...dr}=Gn;return dr}),ut.id&&ti(ut.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:Ae}}));return}const Qt=Ue(jt.modelKey||Ae);Qt&&bt(Gn=>({...Gn,[Qt]:jt})),Ie(jt),pe&&$e(jt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:jt}}))}catch(jt){bt(Qt=>({...Qt,[Ae]:ut})),Ie(ut),pe&&$e(ut),f.error("Watched umschalten fehlgeschlagen",jt?.message??String(jt))}finally{delete An.current[We]}return}let z=pe?tt:null;if(z||(z=await se(I,{ensure:!0})),!z)return;const G=Ue(z.modelKey||z.id||"");if(!G||An.current[G])return;An.current[G]=!0;const ee=z,ae=!ee.watching,Be={...ee,watching:ae},Je=Ue(ee.modelKey||"");Je&&bt(We=>({...We,[Je]:Be})),Ie(Be),pe&&$e(Be);try{const We=await ei({id:ee.id,watched:ae});if(!We){bt(Mt=>{const Nt=Ue(ee.modelKey||"");if(!Nt)return Mt;const{[Nt]:jt,...Qt}=Mt;return Qt}),ti(ee.id),pe&&$e(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ee.id,modelKey:ee.modelKey}}));return}const ut=Ue(We.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:We})),Ie(We),pe&&$e(We),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:We}}))}catch(We){const ut=Ue(ee.modelKey||"");ut&&bt(Mt=>({...Mt,[ut]:ee})),Ie(ee),pe&&$e(ee),f.error("Watched umschalten fehlgeschlagen",We?.message??String(We))}finally{delete An.current[G]}},[f,Yt,tt,se,ei,Ie,ti,st]);async function se(I,ce){const pe=!!ce?.ensure,Ce=Be=>{const Je=Date.now(),We=ht.current;if(!We){ht.current={ts:Je,list:[Be]};return}We.ts=Je;const ut=We.list.findIndex(Mt=>Mt.id===Be.id);ut>=0?We.list[ut]=Be:We.list.unshift(Be)},Ae=async Be=>{if(!Be)return null;const Je=Be.trim().toLowerCase();if(!Je)return null;const We=st[Je];if(We)return Ce(We),We;if(pe){let Qt;try{const rr=I.sourceUrl??I.SourceURL??"",dr=tl(rr);dr&&(Qt=new URL(dr).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const Gn=await or("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:Be,...Qt?{host:Qt}:{}})});return Ie(Gn),Gn}const ut=Date.now(),Mt=ht.current;if(!Mt||ut-Mt.ts>3e4){const Qt=Object.values(st);if(Qt.length)ht.current={ts:ut,list:Qt};else{const Gn=await or("/api/models",{cache:"no-store"});ht.current={ts:ut,list:Array.isArray(Gn)?Gn:[]}}}const jt=(ht.current?.list??[]).find(Qt=>(Qt.modelKey||"").trim().toLowerCase()===Je);return jt||null},z=Hc(I.output||"");if(z)return Ae(z);const G=I.status==="running",ee=I.sourceUrl??I.SourceURL??"",ae=tl(ee);if(G&&ae){const Be=await or("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:ae})}),Je=await or("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Be)});return Ie(Je),Je}return null}return p.useEffect(()=>{if(!Jt&&!gn||!navigator.clipboard?.readText)return;let I=!1,ce=!1,pe=null;const Ce=async()=>{if(!(I||ce)){ce=!0;try{const G=await navigator.clipboard.readText(),ee=tl(G);if(!ee)return;const ae=Ta(ee);if(!ae||!ld(ae))return;const Je=yo(ae);if(Je===qn.current)return;qn.current=Je,Jt&&q(Je),gn&&Wn({url:Je,silent:!1})}catch{}finally{ce=!1}}},Ae=G=>{I||(pe=window.setTimeout(async()=>{await Ce(),Ae(document.hidden?5e3:1500)},G))},z=()=>{Ce()};return window.addEventListener("hover",z),document.addEventListener("visibilitychange",z),Ae(0),()=>{I=!0,pe&&window.clearTimeout(pe),window.removeEventListener("hover",z),document.removeEventListener("visibilitychange",z)}},[Jt,gn,Wn]),n?t?c.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[c.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),c.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),c.jsxs("div",{className:"relative",children:[c.jsx("header",{className:"z-30 bg-white/70 backdrop-blur dark:bg-gray-950/60 sm:sticky sm:top-0 sm:border-b sm:border-gray-200/70 sm:dark:border-white/10",children:c.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 pt-3 sm:py-4 space-y-2 sm:space-y-3",children:[c.jsxs("div",{className:"flex items-center sm:items-start justify-between gap-3 sm:gap-4",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c.jsx("h1",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:"Recorder"}),c.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"online",children:[c.jsx(BN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:Ke})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Watched online",children:[c.jsx(gl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:_t})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Fav online",children:[c.jsx(yl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:$t})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Like online",children:[c.jsx(DN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:Ht})]})]}),c.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:gt})]}),c.jsxs("div",{className:"sm:hidden mt-1 w-full",children:[c.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:gt}),c.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[N?c.jsx(Y_,{mode:"inline",className:"flex-1"}):c.jsx("div",{className:"flex-1"}),c.jsx(sn,{variant:"secondary",onClick:()=>Lt(!0),className:"px-3 shrink-0",children:"Cookies"}),c.jsx(sn,{variant:"secondary",onClick:h,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[N?c.jsx(Y_,{mode:"inline"}):null,c.jsx(sn,{variant:"secondary",onClick:()=>Lt(!0),className:"h-9 px-3",children:"Cookies"}),c.jsx(sn,{variant:"secondary",onClick:h,className:"h-9 px-3",children:"Abmelden"})]})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto] sm:items-stretch",children:[c.jsxs("div",{className:"relative",children:[c.jsx("label",{className:"sr-only",children:"Source URL"}),c.jsx("input",{ref:a,value:ue,onChange:I=>q(I.target.value),onMouseDown:I=>{I.button===0&&(I.preventDefault(),l())},onFocus:()=>{l()},placeholder:"https://…",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10"})]}),c.jsx(sn,{variant:"primary",onClick:ji,disabled:!Xt,className:"w-full sm:w-auto rounded-lg",children:"Start"})]}),Le?c.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx("div",{className:"min-w-0 break-words",children:Le}),c.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>ke(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,On(ue)&&!mi(pt)?c.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["⚠️ Für Chaturbate werden die Cookies ",c.jsx("code",{children:"cf_clearance"})," und ",c.jsx("code",{children:"sessionId"})," benötigt."]}):null,Pe?c.jsx("div",{className:"pt-1",children:c.jsx(bd,{label:"Starte Download…",indeterminate:!0})}):null,c.jsx("div",{className:"hidden sm:block pt-2",children:c.jsx(Ig,{tabs:yn,value:wt,onChange:lt,ariaLabel:"Tabs",variant:"barUnderline"})})]})}),c.jsx("div",{className:"sm:hidden sticky top-0 z-20 border-b border-gray-200/70 bg-white/70 backdrop-blur dark:border-white/10 dark:bg-gray-950/60",children:c.jsx("div",{className:"mx-auto max-w-7xl px-4 pt-0 pb-2",children:c.jsx(Ig,{tabs:yn,value:wt,onChange:lt,ariaLabel:"Tabs",variant:"barUnderline"})})}),c.jsxs("main",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-2 space-y-2",children:[wt==="running"?c.jsx(i6,{jobs:Tt,modelsByKey:st,pending:ln,onOpenPlayer:Ne,onStopJob:$n,onToggleFavorite:ii,onToggleLike:Pi,onToggleWatch:Oi,onAddToDownloads:Bi,blurPreviews:!!Ve.blurPreviews}):null,wt==="finished"?c.jsx(R3,{jobs:P,modelsByKey:st,doneJobs:te,doneTotal:Te,page:L,pageSize:E,onPageChange:xe,onOpenPlayer:Ne,onDeleteJob:pi,onToggleHot:Pn,onToggleFavorite:ii,onToggleLike:Pi,onToggleWatch:Oi,onKeepJob:gi,blurPreviews:!!Ve.blurPreviews,teaserPlayback:Ve.teaserPlayback??"hover",teaserAudio:!!Ve.teaserAudio,assetNonce:F,sortMode:H,onSortModeChange:I=>{Y(I),xe(1)},loadMode:"paged"}):null,wt==="models"?c.jsx(u6,{}):null,wt==="categories"?c.jsx(A6,{}):null,wt==="settings"?c.jsx($N,{onAssetsGenerated:De}):null]}),c.jsx(bA,{open:kt,onClose:()=>Lt(!1),initialCookies:fn,onApply:I=>{const ce=df(Object.fromEntries(I.map(pe=>[pe.name,pe.value])));Zt(ce),or("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:ce})}).catch(()=>{})}}),c.jsx(x6,{open:!!At,modelKey:At,onClose:()=>he(null),onOpenPlayer:Ne,runningJobs:Tt,cookies:pt,blurPreviews:Ve.blurPreviews,teaserPlayback:Ve.teaserPlayback??"hover",teaserAudio:!!Ve.teaserAudio,onToggleHot:Pn,onDelete:Ri,onKeep:gi,onToggleFavorite:ii,onToggleLike:Pi,onToggleWatch:Oi,onStopJob:$n}),Yt?c.jsx(Q8,{job:Yt,modelKey:ne??void 0,modelsByKey:st,expanded:pn,onToggleExpand:()=>xn(I=>!I),onClose:()=>{kn(null),M(null)},startAtSec:rt??void 0,isHot:Ei(Yt.output||"").startsWith("HOT "),isFavorite:!!tt?.favorite,isLiked:tt?.liked===!0,isWatching:!!tt?.watching,onKeep:gi,onDelete:Ri,onToggleHot:Pn,onToggleFavorite:ii,onToggleLike:Pi,onStopJob:$n,onToggleWatch:Oi},[String(Yt?.id??""),Ei(Yt.output||""),String(F)].join("::")):null]})]}):c.jsx(O6,{onLoggedIn:u}):c.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}ew.createRoot(document.getElementById("root")).render(c.jsx(p.StrictMode,{children:c.jsx(E3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:c.jsx(F6,{})})}));