function GE(n,e){for(var t=0;ti[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 KE(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 pm={exports:{}},Rc={};var t1;function WE(){if(t1)return Rc;t1=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 n1;function XE(){return n1||(n1=1,pm.exports=WE()),pm.exports}var c=XE(),mm={exports:{}},gn={};var i1;function YE(){if(i1)return gn;i1=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 D(I){return I===null||typeof I!="object"?null:(I=C&&I[C]||I["@@iterator"],typeof I=="function"?I:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function G(I,pe,ke){this.props=I,this.context=pe,this.refs=B,this.updater=ke||R}G.prototype.isReactComponent={},G.prototype.setState=function(I,pe){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,pe,"setState")},G.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function Y(){}Y.prototype=G.prototype;function q(I,pe,ke){this.props=I,this.context=pe,this.refs=B,this.updater=ke||R}var se=q.prototype=new Y;se.constructor=q,E(se,G.prototype),se.isPureReactComponent=!0;var Q=Array.isArray;function K(){}var O={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function k(I,pe,ke){var ye=ke.ref;return{$$typeof:n,type:I,key:pe,ref:ye!==void 0?ye:null,props:ke}}function j(I,pe){return k(I.type,pe,I.props)}function te(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function V(I){var pe={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ke){return pe[ke]})}var ne=/\/+/g;function he(I,pe){return typeof I=="object"&&I!==null&&I.key!=null?V(""+I.key):pe.toString(36)}function ae(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(K,K):(I.status="pending",I.then(function(pe){I.status==="pending"&&(I.status="fulfilled",I.value=pe)},function(pe){I.status==="pending"&&(I.status="rejected",I.reason=pe)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function z(I,pe,ke,ye,me){var pt=typeof I;(pt==="undefined"||pt==="boolean")&&(I=null);var We=!1;if(I===null)We=!0;else switch(pt){case"bigint":case"string":case"number":We=!0;break;case"object":switch(I.$$typeof){case n:case e:We=!0;break;case _:return We=I._init,z(We(I._payload),pe,ke,ye,me)}}if(We)return me=me(I),We=ye===""?"."+he(I,0):ye,Q(me)?(ke="",We!=null&&(ke=We.replace(ne,"$&/")+"/"),z(me,pe,ke,"",function(wt){return wt})):me!=null&&(te(me)&&(me=j(me,ke+(me.key==null||I&&I.key===me.key?"":(""+me.key).replace(ne,"$&/")+"/")+We)),pe.push(me)),1;We=0;var _e=ye===""?".":ye+":";if(Q(I))for(var Ye=0;Ye>>1,fe=z[ee];if(0>>1;eea(ke,Z))yea(me,ke)?(z[ee]=me,z[ye]=Z,ee=ye):(z[ee]=ke,z[pe]=Z,ee=pe);else if(yea(me,Z))z[ee]=me,z[ye]=Z,ee=ye;else break e}}return P}function a(z,P){var Z=z.sortIndex-P.sortIndex;return Z!==0?Z:z.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,D=!1,R=!1,E=!1,B=!1,G=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function se(z){for(var P=t(g);P!==null;){if(P.callback===null)i(g);else if(P.startTime<=z)i(g),P.sortIndex=P.expirationTime,e(f,P);else break;P=t(g)}}function Q(z){if(E=!1,se(z),!R)if(t(f)!==null)R=!0,K||(K=!0,V());else{var P=t(g);P!==null&&ae(Q,P.startTime-z)}}var K=!1,O=-1,re=5,k=-1;function j(){return B?!0:!(n.unstable_now()-kz&&j());){var ee=S.callback;if(typeof ee=="function"){S.callback=null,C=S.priorityLevel;var fe=ee(S.expirationTime<=z);if(z=n.unstable_now(),typeof fe=="function"){S.callback=fe,se(z),P=!0;break t}S===t(f)&&i(f),se(z)}else i(f);S=t(f)}if(S!==null)P=!0;else{var I=t(g);I!==null&&ae(Q,I.startTime-z),P=!1}}break e}finally{S=null,C=Z,D=!1}P=void 0}}finally{P?V():K=!1}}}var V;if(typeof q=="function")V=function(){q(te)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,he=ne.port2;ne.port1.onmessage=te,V=function(){he.postMessage(null)}}else V=function(){G(te,0)};function ae(z,P){O=G(function(){z(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(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125ee?(z.sortIndex=Z,e(g,z),t(f)===null&&z===t(g)&&(E?(Y(O),O=-1):E=!0,ae(Q,Z-ee))):(z.sortIndex=fe,e(f,z),R||D||(R=!0,K||(K=!0,V()))),z},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(z){var P=C;return function(){var Z=C;C=P;try{return z.apply(this,arguments)}finally{C=Z}}}})(bm)),bm}var o1;function ZE(){return o1||(o1=1,ym.exports=QE()),ym.exports}var vm={exports:{}},br={};var l1;function JE(){if(l1)return br;l1=1;var n=Kf();function e(f){var g="https://react.dev/errors/"+f;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),vm.exports=JE(),vm.exports}var c1;function eC(){if(c1)return Oc;c1=1;var n=ZE(),e=Kf(),t=X_();function i(r){var s="https://react.dev/errors/"+r;if(1fe||(r.current=ee[fe],ee[fe]=null,fe--)}function ke(r,s){fe++,ee[fe]=r.current,r.current=s}var ye=I(null),me=I(null),pt=I(null),We=I(null);function _e(r,s){switch(ke(pt,s),ke(me,r),ke(ye,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Sx(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Sx(s),r=kx(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}pe(ye),ke(ye,r)}function Ye(){pe(ye),pe(me),pe(pt)}function wt(r){r.memoizedState!==null&&ke(We,r);var s=ye.current,o=kx(s,r.type);s!==o&&(ke(me,r),ke(ye,o))}function je(r){me.current===r&&(pe(ye),pe(me)),We.current===r&&(pe(We),Nc._currentValue=Z)}var Se,Je;function tt(r){if(Se===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Se=s&&s[1]||"",Je=-1)":-1y||ge[d]!==Ue[y]){var st=` `+ge[d].replace(" at new "," at ");return r.displayName&&st.includes("")&&(st=st.replace("",r.displayName)),st}while(1<=d&&0<=y);break}}}finally{ot=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?tt(o):""}function Ut(r,s){switch(r.tag){case 26:case 27:case 5:return tt(r.type);case 16:return tt("Lazy");case 13:return r.child!==s&&s!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return dt(r.type,!1);case 11:return dt(r.type.render,!1);case 1:return dt(r.type,!0);case 31:return tt("Activity");default:return""}}function Ge(r){try{var s="",o=null;do s+=Ut(r,o),o=r,r=r.return;while(r);return s}catch(d){return` Error generating stack: `+d.message+` `+d.stack}}var Ie=Object.prototype.hasOwnProperty,Ze=n.unstable_scheduleCallback,et=n.unstable_cancelCallback,ft=n.unstable_shouldYield,mt=n.unstable_requestPaint,de=n.unstable_now,ze=n.unstable_getCurrentPriorityLevel,Le=n.unstable_ImmediatePriority,Ae=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,Qe=n.unstable_LowPriority,St=n.unstable_IdlePriority,Ot=n.log,Tt=n.unstable_setDisableYieldValue,an=null,Nt=null;function Lt(r){if(typeof Ot=="function"&&Tt(r),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(an,r)}catch{}}var vt=Math.clz32?Math.clz32:$n,It=Math.log,yn=Math.LN2;function $n(r){return r>>>=0,r===0?32:31-(It(r)/yn|0)|0}var kt=256,Bn=262144,at=4194304;function N(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,M=r.pingedLanes;r=r.warmLanes;var H=d&134217727;return H!==0?(d=H&~b,d!==0?y=N(d):(M&=H,M!==0?y=N(M):o||(o=H&~r,o!==0&&(y=N(o))))):(H=d&~b,H!==0?y=N(H):M!==0?y=N(M):o||(o=d&~r,o!==0&&(y=N(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 Me(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 He(){var r=at;return at<<=1,(at&62914560)===0&&(at=4194304),r}function gt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function zt(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 M=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 H=r.entanglements,ge=r.expirationTimes,Ue=r.hiddenUpdates;for(o=M&~o;0"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var $t=/[\n"\\]/g;function Vt(r){return r.replace($t,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function vn(r,s,o,d,y,b,M,H){r.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.type=M:r.removeAttribute("type"),s!=null?M==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+jt(s)):r.value!==""+jt(s)&&(r.value=""+jt(s)):M!=="submit"&&M!=="reset"||r.removeAttribute("value"),s!=null?Yi(r,M,jt(s)):o!=null?Yi(r,M,jt(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?r.name=""+jt(H):r.removeAttribute("name")}function qn(r,s,o,d,y,b,M,H){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)){xt(r);return}o=o!=null?""+jt(o):"",s=s!=null?""+jt(s):o,H||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=H?r.checked:!!d,r.defaultChecked=!!d,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(r.name=M),xt(r)}function Yi(r,s,o){s==="number"&&Ft(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Gn(r,s,o,d){if(r=r.options,s){s={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),W=!1;if(U)try{var le={};Object.defineProperty(le,"passive",{get:function(){W=!0}}),window.addEventListener("test",le,le),window.removeEventListener("test",le,le)}catch{W=!1}var be=null,Ce=null,Oe=null;function ht(){if(Oe)return Oe;var r,s=Ce,o=s.length,d,y="value"in be?be.value:be.textContent,b=y.length;for(r=0;r=Oo),Ld=" ",Fu=!1;function kl(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 Id(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ba=!1;function R0(r,s){switch(r){case"compositionend":return Id(s);case"keypress":return s.which!==32?null:(Fu=!0,Ld);case"textInput":return r=s.data,r===Ld&&Fu?null:r;default:return null}}function Uu(r,s){if(Ba)return r==="compositionend"||!Ia&&kl(r,s)?(r=ht(),Oe=Ce=be=null,Ba=!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)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=Fa(o)}}function oa(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?oa(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function El(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Ft(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=Ft(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=U&&"documentMode"in document&&11>=document.documentMode,Ua=null,Ku=null,za=null,Cl=!1;function Wu(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Cl||Ua==null||Ua!==Ft(d)||(d=Ua,"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}),za&&Ls(za,d)||(za=d,d=Nh(Ku,"onSelect"),0>=M,y-=M,Yr=1<<32-vt(s)+y|o<Tn?(zn=Gt,Gt=null):zn=Gt.sibling;var Xn=$e(Re,Gt,Fe[Tn],lt);if(Xn===null){Gt===null&&(Gt=zn);break}r&&Gt&&Xn.alternate===null&&s(Re,Gt),Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn,Gt=zn}if(Tn===Fe.length)return o(Re,Gt),On&&kn(Re,Tn),Qt;if(Gt===null){for(;TnTn?(zn=Gt,Gt=null):zn=Gt.sibling;var fo=$e(Re,Gt,Xn.value,lt);if(fo===null){Gt===null&&(Gt=zn);break}r&&Gt&&fo.alternate===null&&s(Re,Gt),Ee=b(fo,Ee,Tn),Wn===null?Qt=fo:Wn.sibling=fo,Wn=fo,Gt=zn}if(Xn.done)return o(Re,Gt),On&&kn(Re,Tn),Qt;if(Gt===null){for(;!Xn.done;Tn++,Xn=Fe.next())Xn=ut(Re,Xn.value,lt),Xn!==null&&(Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn);return On&&kn(Re,Tn),Qt}for(Gt=d(Gt);!Xn.done;Tn++,Xn=Fe.next())Xn=Xe(Gt,Re,Tn,Xn.value,lt),Xn!==null&&(r&&Xn.alternate!==null&&Gt.delete(Xn.key===null?Tn:Xn.key),Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn);return r&&Gt.forEach(function(VE){return s(Re,VE)}),On&&kn(Re,Tn),Qt}function fi(Re,Ee,Fe,lt){if(typeof Fe=="object"&&Fe!==null&&Fe.type===E&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case D:e:{for(var Qt=Fe.key;Ee!==null;){if(Ee.key===Qt){if(Qt=Fe.type,Qt===E){if(Ee.tag===7){o(Re,Ee.sibling),lt=y(Ee,Fe.props.children),lt.return=Re,Re=lt;break e}}else if(Ee.elementType===Qt||typeof Qt=="object"&&Qt!==null&&Qt.$$typeof===re&&Vo(Qt)===Ee.type){o(Re,Ee.sibling),lt=y(Ee,Fe.props),ac(lt,Fe),lt.return=Re,Re=lt;break e}o(Re,Ee);break}else s(Re,Ee);Ee=Ee.sibling}Fe.type===E?(lt=Bs(Fe.props.children,Re.mode,lt,Fe.key),lt.return=Re,Re=lt):(lt=tc(Fe.type,Fe.key,Fe.props,null,Re.mode,lt),ac(lt,Fe),lt.return=Re,Re=lt)}return M(Re);case R:e:{for(Qt=Fe.key;Ee!==null;){if(Ee.key===Qt)if(Ee.tag===4&&Ee.stateNode.containerInfo===Fe.containerInfo&&Ee.stateNode.implementation===Fe.implementation){o(Re,Ee.sibling),lt=y(Ee,Fe.children||[]),lt.return=Re,Re=lt;break e}else{o(Re,Ee);break}else s(Re,Ee);Ee=Ee.sibling}lt=Ga(Fe,Re.mode,lt),lt.return=Re,Re=lt}return M(Re);case re:return Fe=Vo(Fe),fi(Re,Ee,Fe,lt)}if(ae(Fe))return Ht(Re,Ee,Fe,lt);if(V(Fe)){if(Qt=V(Fe),typeof Qt!="function")throw Error(i(150));return Fe=Qt.call(Fe),sn(Re,Ee,Fe,lt)}if(typeof Fe.then=="function")return fi(Re,Ee,Jd(Fe),lt);if(Fe.$$typeof===q)return fi(Re,Ee,hn(Re,Fe),lt);eh(Re,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Ee!==null&&Ee.tag===6?(o(Re,Ee.sibling),lt=y(Ee,Fe),lt.return=Re,Re=lt):(o(Re,Ee),lt=Uo(Fe,Re.mode,lt),lt.return=Re,Re=lt),M(Re)):o(Re,Ee)}return function(Re,Ee,Fe,lt){try{sc=0;var Qt=fi(Re,Ee,Fe,lt);return Rl=null,Qt}catch(Gt){if(Gt===jl||Gt===Qd)throw Gt;var Wn=Ui(29,Gt,null,Re.mode);return Wn.lanes=lt,Wn.return=Re,Wn}}}var Ko=mb(!0),gb=mb(!1),Xa=!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 Ya(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Qa(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ti&2)!==0){var y=d.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),d.pending=s,s=Dl(r),Gd(r,null,o),s}return Nl(r,d,s,o),Dl(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,Xt(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 M={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?y=b=M:b=b.next=M,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;Xa=!1;var b=y.firstBaseUpdate,M=y.lastBaseUpdate,H=y.shared.pending;if(H!==null){y.shared.pending=null;var ge=H,Ue=ge.next;ge.next=null,M===null?b=Ue:M.next=Ue,M=ge;var st=r.alternate;st!==null&&(st=st.updateQueue,H=st.lastBaseUpdate,H!==M&&(H===null?st.firstBaseUpdate=Ue:H.next=Ue,st.lastBaseUpdate=ge))}if(b!==null){var ut=y.baseState;M=0,st=Ue=ge=null,H=b;do{var $e=H.lane&-536870913,Xe=$e!==H.lane;if(Xe?(Un&$e)===$e:(d&$e)===$e){$e!==0&&$e===ls&&(K0=!0),st!==null&&(st=st.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ht=r,sn=H;$e=s;var fi=o;switch(sn.tag){case 1:if(Ht=sn.payload,typeof Ht=="function"){ut=Ht.call(fi,ut,$e);break e}ut=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=sn.payload,$e=typeof Ht=="function"?Ht.call(fi,ut,$e):Ht,$e==null)break e;ut=S({},ut,$e);break e;case 2:Xa=!0}}$e=H.callback,$e!==null&&(r.flags|=64,Xe&&(r.flags|=8192),Xe=y.callbacks,Xe===null?y.callbacks=[$e]:Xe.push($e))}else Xe={lane:$e,tag:H.tag,payload:H.payload,callback:H.callback,next:null},st===null?(Ue=st=Xe,ge=ut):st=st.next=Xe,M|=$e;if(H=H.next,H===null){if(H=y.shared.pending,H===null)break;Xe=H,H=Xe.next,Xe.next=null,y.lastBaseUpdate=Xe,y.shared.pending=null}}while(!0);st===null&&(ge=ut),y.baseState=ge,y.firstBaseUpdate=Ue,y.lastBaseUpdate=st,b===null&&(y.shared.lanes=0),no|=M,r.lanes=M,r.memoizedState=ut}}function yb(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function bb(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;rb?b:8;var M=z.T,H={};z.T=H,hp(r,!1,s,o);try{var ge=y(),Ue=z.S;if(Ue!==null&&Ue(H,ge),ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var st=Ok(ge,d);hc(r,s,st,ts(r))}else hc(r,s,d,ts(r))}catch(ut){hc(r,s,{then:function(){},status:"rejected",reason:ut},ts())}finally{P.p=b,M!==null&&H.types!==null&&(M.types=H.types),z.T=M}}function Uk(){}function cp(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Yb(r).queue;Xb(r,y,s,Z,o===null?Uk:function(){return Qb(r),o(d)})}function Yb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:Z},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Qb(r){var s=Yb(r);s.next===null&&(s=r.alternate.memoizedState),hc(r,s.next.queue,{},ts())}function dp(){return Bt(Nc)}function Zb(){return Ki().memoizedState}function Jb(){return Ki().memoizedState}function zk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=ts();r=Ya(o);var d=Qa(s,r,o);d!==null&&(Pr(d,s,o),oc(d,s,o)),s={cache:ca()},r.payload=s;return}s=s.return}}function $k(r,s,o){var d=ts();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ch(r)?tv(s,o):(o=Ju(r,s,o,d),o!==null&&(Pr(o,r,d),nv(o,s,d)))}function ev(r,s,o){var d=ts();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(ch(r))tv(s,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=s.lastRenderedReducer,b!==null))try{var M=s.lastRenderedState,H=b(M,o);if(y.hasEagerState=!0,y.eagerState=H,gr(H,M))return Nl(r,s,y,0),yi===null&&Al(),!1}catch{}if(o=Ju(r,s,y,d),o!==null)return Pr(o,r,d),nv(o,s,d),!0}return!1}function hp(r,s,o,d){if(d={lane:2,revertLane:qp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},ch(r)){if(s)throw Error(i(479))}else s=Ju(r,o,d,2),s!==null&&Pr(s,r,2)}function ch(r){var s=r.alternate;return r===_n||s!==null&&s===_n}function tv(r,s){Ll=ih=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function nv(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Xt(r,o)}}var fc={readContext:Bt,use:ah,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 iv={readContext:Bt,use:ah,useCallback:function(r,s){return Tr().memoizedState=[r,s===void 0?null:s],r},useContext:Bt,useEffect:Ub,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,lh(4194308,4,qb.bind(null,s,r),o)},useLayoutEffect:function(r,s){return lh(4194308,4,r,s)},useInsertionEffect:function(r,s){lh(4,2,r,s)},useMemo:function(r,s){var o=Tr();s=s===void 0?null:s;var d=r();if(Wo){Lt(!0);try{r()}finally{Lt(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Tr();if(o!==void 0){var y=o(s);if(Wo){Lt(!0);try{o(s)}finally{Lt(!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=$k.bind(null,_n,r),[d.memoizedState,r]},useRef:function(r){var s=Tr();return r={current:r},s.memoizedState=r},useState:function(r){r=sp(r);var s=r.queue,o=ev.bind(null,_n,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:lp,useDeferredValue:function(r,s){var o=Tr();return up(o,r,s)},useTransition:function(){var r=sp(!1);return r=Xb.bind(null,_n,r.queue,!0,!1),Tr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=_n,y=Tr();if(On){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),yi===null)throw Error(i(349));(Un&127)!==0||Sb(d,s,o)}y.memoizedState=o;var b={value:o,getSnapshot:s};return y.queue=b,Ub(Eb.bind(null,d,b,r),[r]),d.flags|=2048,Bl(9,{destroy:void 0},kb.bind(null,d,b,o,s),null),o},useId:function(){var r=Tr(),s=yi.identifierPrefix;if(On){var o=cr,d=Yr;o=(d&~(1<<32-vt(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=rh++,0<\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?M.createElement("select",{is:d.is}):M.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?M.createElement(y,{is:d.is}):M.createElement(y)}}b[qt]=s,b[Rt]=d;e:for(M=s.child;M!==null;){if(M.tag===5||M.tag===6)b.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===s)break e;for(;M.sibling===null;){if(M.return===null||M.return===s)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}s.stateNode=b;e:switch(hr(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&&pa(s)}}return wi(s),Ep(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&pa(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=pt.current,p(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=Qi,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[qt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||wx(r.nodeValue,o)),r||zs(s,!0)}else r=Dh(r).createTextNode(d),r[qt]=s,s.stateNode=r}return wi(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=p(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[qt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wi(s),r=!1}else o=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(Zr(s),s):(Zr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return wi(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=p(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[qt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wi(s),y=!1}else y=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(Zr(s),s):(Zr(s),null)}return Zr(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),mh(s,s.updateQueue),wi(s),null);case 4:return Ye(),r===null&&Wp(s.stateNode.containerInfo),wi(s),null;case 10:return oe(s.type),wi(s),null;case 19:if(pe(Gi),d=s.memoizedState,d===null)return wi(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)mc(d,!1);else{if($i!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=nh(r),b!==null){for(s.flags|=128,mc(d,!1),r=b.updateQueue,s.updateQueue=r,mh(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Kd(o,r),o=o.sibling;return ke(Gi,Gi.current&1|2),On&&kn(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&de()>xh&&(s.flags|=128,y=!0,mc(d,!1),s.lanes=4194304)}else{if(!y)if(r=nh(b),r!==null){if(s.flags|=128,y=!0,r=r.updateQueue,s.updateQueue=r,mh(s,r),mc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!On)return wi(s),null}else 2*de()-d.renderingStartTime>xh&&o!==536870912&&(s.flags|=128,y=!0,mc(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=de(),r.sibling=null,o=Gi.current,ke(Gi,y?o&1|2:o&1),On&&kn(s,d.treeForkCount),r):(wi(s),null);case 22:case 23:return Zr(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&&(wi(s),s.subtreeFlags&6&&(s.flags|=8192)):wi(s),o=s.updateQueue,o!==null&&mh(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&&pe(qo),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oe(xi),wi(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Kk(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(xi),Ye(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return je(s),null;case 31:if(s.memoizedState!==null){if(Zr(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(Zr(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 pe(Gi),null;case 4:return Ye(),null;case 10:return oe(s.type),null;case 22:case 23:return Zr(s),X0(),r!==null&&pe(qo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(xi),null;case 25:return null;default:return null}}function Cv(r,s){switch(jr(s),s.tag){case 3:oe(xi),Ye();break;case 26:case 27:case 5:je(s);break;case 4:Ye();break;case 31:s.memoizedState!==null&&Zr(s);break;case 13:Zr(s);break;case 19:pe(Gi);break;case 10:oe(s.type);break;case 22:case 23:Zr(s),X0(),r!==null&&pe(qo);break;case 24:oe(xi)}}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,M=o.inst;d=b(),M.destroy=d}o=o.next}while(o!==y)}}catch(H){li(s,s.return,H)}}function eo(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 M=d.inst,H=M.destroy;if(H!==void 0){M.destroy=void 0,y=s;var ge=o,Ue=H;try{Ue()}catch(st){li(y,ge,st)}}}d=d.next}while(d!==b)}}catch(st){li(s,s.return,st)}}function Av(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{bb(s,o)}catch(d){li(r,r.return,d)}}}function Nv(r,s,o){o.props=Xo(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){li(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){li(r,s,y)}}function qs(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(y){li(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){li(r,s,y)}else o.current=null}function Dv(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){li(r,r.return,y)}}function Cp(r,s,o){try{var d=r.stateNode;mE(d,r.type,o,s),d[Rt]=s}catch(y){li(r,r.return,y)}}function Mv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&oo(r.type)||r.tag===4}function Ap(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Mv(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&&oo(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 Np(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=ei));else if(d!==4&&(d===27&&oo(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Np(r,s,o),r=r.sibling;r!==null;)Np(r,s,o),r=r.sibling}function gh(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&&oo(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(gh(r,s,o),r=r.sibling;r!==null;)gh(r,s,o),r=r.sibling}function jv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);hr(s,d,o),s[qt]=r,s[Rt]=o}catch(b){li(r,r.return,b)}}var ma=!1,er=!1,Dp=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,ar=null;function Wk(r,s){if(r=r.containerInfo,Qp=Bh,r=El(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 M=0,H=-1,ge=-1,Ue=0,st=0,ut=r,$e=null;t:for(;;){for(var Xe;ut!==o||y!==0&&ut.nodeType!==3||(H=M+y),ut!==b||d!==0&&ut.nodeType!==3||(ge=M+d),ut.nodeType===3&&(M+=ut.nodeValue.length),(Xe=ut.firstChild)!==null;)$e=ut,ut=Xe;for(;;){if(ut===r)break t;if($e===o&&++Ue===y&&(H=M),$e===b&&++st===d&&(ge=M),(Xe=ut.nextSibling)!==null)break;ut=$e,$e=ut.parentNode}ut=Xe}o=H===-1||ge===-1?null:{start:H,end:ge}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zp={focusedElem:r,selectionRange:o},Bh=!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 title"))),hr(b,d,o),b[qt]=r,mn(b),d=b;break e;case"link":var M=Fx("link","href",y).get(d+(o.href||""));if(M){for(var H=0;Hfi&&(M=fi,fi=sn,sn=M);var Re=Ai(H,sn),Ee=Ai(H,fi);if(Re&&Ee&&(Xe.rangeCount!==1||Xe.anchorNode!==Re.node||Xe.anchorOffset!==Re.offset||Xe.focusNode!==Ee.node||Xe.focusOffset!==Ee.offset)){var Fe=ut.createRange();Fe.setStart(Re.node,Re.offset),Xe.removeAllRanges(),sn>fi?(Xe.addRange(Fe),Xe.extend(Ee.node,Ee.offset)):(Fe.setEnd(Ee.node,Ee.offset),Xe.addRange(Fe))}}}}for(ut=[],Xe=H;Xe=Xe.parentNode;)Xe.nodeType===1&&ut.push({element:Xe,left:Xe.scrollLeft,top:Xe.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;Ho?32:o,z.T=null,o=Bp,Bp=null;var b=ro,M=xa;if(ir=0,$l=ro=null,xa=0,(ti&6)!==0)throw Error(i(331));var H=ti;if(ti|=4,qv(b.current),zv(b,b.current,M,o),ti=H,Tc(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(an,b)}catch{}return!0}finally{P.p=y,z.T=d,lx(r,s)}}function cx(r,s,o){s=Dr(o,s),s=gp(r.stateNode,s,2),r=Qa(r,s,2),r!==null&&(zt(r,2),Vs(r))}function li(r,s,o){if(r.tag===3)cx(r,r,o);else for(;s!==null;){if(s.tag===3){cx(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(io===null||!io.has(d))){r=Dr(o,r),o=dv(2),d=Qa(s,o,2),d!==null&&(hv(o,d,s,r),zt(d,2),Vs(d));break}}s=s.return}}function zp(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new Qk;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)||(Rp=!0,y.add(o),r=nE.bind(null,r,s,o),s.then(r,r))}function nE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,yi===r&&(Un&o)===o&&($i===4||$i===3&&(Un&62914560)===Un&&300>de()-vh?(ti&2)===0&&Hl(r,0):Op|=o,zl===Un&&(zl=0)),Vs(r)}function dx(r,s){s===0&&(s=He()),r=ua(r,s),r!==null&&(zt(r,s),Vs(r))}function iE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),dx(r,o)}function rE(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),dx(r,o)}function sE(r,s){return Ze(r,s)}var Eh=null,Vl=null,$p=!1,Ch=!1,Hp=!1,ao=0;function Vs(r){r!==Vl&&r.next===null&&(Vl===null?Eh=Vl=r:Vl=Vl.next=r),Ch=!0,$p||($p=!0,oE())}function Tc(r,s){if(!Hp&&Ch){Hp=!0;do for(var o=!1,d=Eh;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var b=0;else{var M=d.suspendedLanes,H=d.pingedLanes;b=(1<<31-vt(42|r)+1)-1,b&=y&~(M&~H),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,mx(d,b))}else b=Un,b=F(d,d===yi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ie(d,b)||(o=!0,mx(d,b));d=d.next}while(o);Hp=!1}}function aE(){hx()}function hx(){Ch=$p=!1;var r=0;ao!==0&&yE()&&(r=ao);for(var s=de(),o=null,d=Eh;d!==null;){var y=d.next,b=fx(d,s);b===0?(d.next=null,o===null?Eh=y:o.next=y,y===null&&(Vl=o)):(o=d,(r!==0||(b&3)!==0)&&(Ch=!0)),d=y}ir!==0&&ir!==5||Tc(r),ao!==0&&(ao=0)}function fx(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0H)break;var st=ge.transferSize,ut=ge.initiatorType;st&&Tx(ut)&&(ge=ge.responseEnd,M+=st*(ge"u"?null:document;function Lx(r,s,o){var d=Gl;if(d&&typeof s=="string"&&s){var y=Vt(s);y='link[rel="'+r+'"][href="'+y+'"]',typeof o=="string"&&(y+='[crossorigin="'+o+'"]'),Ox.has(y)||(Ox.add(y),r={rel:r,crossOrigin:o,href:s},d.querySelector(y)===null&&(s=d.createElement("link"),hr(s,"link",r),mn(s),d.head.appendChild(s)))}}function EE(r){_a.D(r),Lx("dns-prefetch",r,null)}function CE(r,s){_a.C(r,s),Lx("preconnect",r,s)}function AE(r,s,o){_a.L(r,s,o);var d=Gl;if(d&&r&&s){var y='link[rel="preload"][as="'+Vt(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+Vt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+Vt(o.imageSizes)+'"]')):y+='[href="'+Vt(r)+'"]';var b=y;switch(s){case"style":b=Kl(r);break;case"script":b=Wl(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"),hr(s,"link",r),mn(s),d.head.appendChild(s)))}}function NE(r,s){_a.m(r,s);var o=Gl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+Vt(d)+'"][href="'+Vt(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Wl(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"),hr(d,"link",r),mn(d),o.head.appendChild(d)}}}function DE(r,s,o){_a.S(r,s,o);var d=Gl;if(d&&r){var y=Qn(d).hoistableStyles,b=Kl(r);s=s||"default";var M=y.get(b);if(!M){var H={loading:0,preload:null};if(M=d.querySelector(Cc(b)))H.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ds.get(b))&&sm(r,o);var ge=M=d.createElement("link");mn(ge),hr(ge,"link",r),ge._p=new Promise(function(Ue,st){ge.onload=Ue,ge.onerror=st}),ge.addEventListener("load",function(){H.loading|=1}),ge.addEventListener("error",function(){H.loading|=2}),H.loading|=4,jh(M,s,d)}M={type:"stylesheet",instance:M,count:1,state:H},y.set(b,M)}}}function ME(r,s){_a.X(r,s);var o=Gl;if(o&&r){var d=Qn(o).hoistableScripts,y=Wl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0},s),(s=ds.get(y))&&am(r,s),b=o.createElement("script"),mn(b),hr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function jE(r,s){_a.M(r,s);var o=Gl;if(o&&r){var d=Qn(o).hoistableScripts,y=Wl(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))&&am(r,s),b=o.createElement("script"),mn(b),hr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function Ix(r,s,o,d){var y=(y=pt.current)?Mh(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=Kl(o.href),o=Qn(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=Kl(o.href);var b=Qn(y).hoistableStyles,M=b.get(r);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,M),(b=y.querySelector(Cc(r)))&&!b._p&&(M.instance=b,M.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||RE(y,r,o,M.state))),s&&d===null)throw Error(i(528,""));return M}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=Wl(o),o=Qn(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 Kl(r){return'href="'+Vt(r)+'"'}function Cc(r){return'link[rel="stylesheet"]['+r+"]"}function Bx(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function RE(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}),hr(s,"link",o),mn(s),r.head.appendChild(s))}function Wl(r){return'[src="'+Vt(r)+'"]'}function Ac(r){return"script[async]"+r}function Px(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Vt(o.href)+'"]');if(d)return s.instance=d,mn(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"),mn(d),hr(d,"style",y),jh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Kl(o.href);var b=r.querySelector(Cc(y));if(b)return s.state.loading|=4,s.instance=b,mn(b),b;d=Bx(o),(y=ds.get(y))&&sm(d,y),b=(r.ownerDocument||r).createElement("link"),mn(b);var M=b;return M._p=new Promise(function(H,ge){M.onload=H,M.onerror=ge}),hr(b,"link",d),s.state.loading|=4,jh(b,o.precedence,r),s.instance=b;case"script":return b=Wl(o.src),(y=r.querySelector(Ac(b)))?(s.instance=y,mn(y),y):(d=o,(y=ds.get(b))&&(d=S({},o),am(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),mn(y),hr(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,jh(d,o.precedence,r));return s.instance}function jh(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,M=0;M title"):null)}function OE(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 zx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function LE(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=Kl(d.href),b=s.querySelector(Cc(y));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Oh.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=b,mn(b);return}b=s.ownerDocument||s,d=Bx(d),(y=ds.get(y))&&sm(d,y),b=b.createElement("link"),mn(b);var M=b;M._p=new Promise(function(H,ge){M.onload=H,M.onerror=ge}),hr(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=Oh.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var om=0;function IE(r,s){return r.stylesheets&&r.count===0&&Ih(r,r.stylesheets),0om?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Oh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ih(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Lh=null;function Ih(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Lh=new Map,s.forEach(BE,r),Lh=null,Oh.call(r))}function BE(r,s){if(!(s.state.loading&4)){var o=Lh.get(r);if(o)var d=o.get(null);else{o=new Map,Lh.set(r,o);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),gm.exports=eC(),gm.exports}var Y_=tC();function nC(...n){return n.filter(Boolean).join(" ")}const iC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",rC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},sC={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"},aC={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 oC(){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 en({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:nC(iC,rC[a],sC[i],aC[t][e],C,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(oC,{})}):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 Q_(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;ee in n?lC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xm=(n,e,t)=>(uC(n,typeof e!="symbol"?e+"":e,t),t);let cC=class{constructor(){xm(this,"current",this.detect()),xm(this,"handoffState","pending"),xm(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"}},ea=new cC;function bd(n){var e;return ea.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function Eg(n){var e,t;return ea.isServer?null:n==null?document:(t=(e=n?.getRootNode)==null?void 0:e.call(n))!=null?t:document}function Z_(n){var e,t;return(t=(e=Eg(n))==null?void 0:e.activeElement)!=null?t:null}function dC(n){return Z_(n)===n}function Wf(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function Ra(){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=Ra();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]=m.useState(Ra);return m.useEffect(()=>()=>n.dispose(),[n]),n}let qr=(n,e)=>{ea.isServer?m.useEffect(n,e):m.useLayoutEffect(n,e)};function _l(n){let e=m.useRef(n);return qr(()=>{e.current=n},[n]),e}let vi=function(n){let e=_l(n);return Zt.useCallback((...t)=>e.current(...t),[e])};function vd(n){return m.useMemo(()=>n,Object.values(n))}let hC=m.createContext(void 0);function fC(){return m.useContext(hC)}function Cg(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Ma(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,Ma),i}var yf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(yf||{}),So=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(So||{});function vs(){let n=mC();return m.useCallback(e=>pC({mergeRefs:n,...e}),[n])}function pC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??gC;let f=J_(e,n);if(l)return qh(f,t,i,u,h);let g=a??0;if(g&2){let{static:_=!1,...S}=f;if(_)return qh(S,t,i,u,h)}if(g&1){let{unmount:_=!0,...S}=f;return Ma(_?0:1,{0(){return null},1(){return qh({...S,hidden:!0,style:{display:"none"}},t,i,u,h)}})}return qh(f,t,i,u,h)}function qh(n,e={},t,i,a){let{as:l=t,children:u,refName:h="ref",...f}=_m(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,D=[];for(let[R,E]of Object.entries(e))typeof E=="boolean"&&(C=!0),E===!0&&D.push(R.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(C){S["data-headlessui-state"]=D.join(" ");for(let R of D)S[`data-${R}`]=""}}if(Yc(l)&&(Object.keys(nl(f)).length>0||Object.keys(nl(S)).length>0))if(!m.isValidElement(_)||Array.isArray(_)&&_.length>1||bC(_)){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,D=C?.className,R=typeof D=="function"?(...G)=>Cg(D(...G),f.className):Cg(D,f.className),E=R?{className:R}:{},B=J_(_.props,nl(_m(f,["ref"])));for(let G in S)G in B&&delete S[G];return m.cloneElement(_,Object.assign({},B,S,g,{ref:a(yC(_),g.ref)},E))}return m.createElement(l,Object.assign({},_m(f,["ref"]),!Yc(l)&&g,!Yc(l)&&S),_)}function mC(){let n=m.useRef([]),e=m.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 gC(...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 J_(...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(m.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 _m(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function yC(n){return Zt.version.split(".")[0]>="19"?n.props.ref:n.ref}function Yc(n){return n===m.Fragment||n===Symbol.for("react.fragment")}function bC(n){return Yc(n.type)}let vC="span";var bf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(bf||{});function xC(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:vC,name:"Hidden"})}let Ag=Gr(xC);function _C(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function Eo(n){return _C(n)&&"tagName"in n}function gl(n){return Eo(n)&&"accessKey"in n}function ko(n){return Eo(n)&&"tabIndex"in n}function wC(n){return Eo(n)&&"style"in n}function TC(n){return gl(n)&&n.nodeName==="IFRAME"}function SC(n){return gl(n)&&n.nodeName==="INPUT"}let ew=Symbol();function kC(n,e=!0){return Object.assign(n,{[ew]:e})}function ra(...n){let e=m.useRef(n);m.useEffect(()=>{e.current=n},[n]);let t=vi(i=>{for(let a of e.current)a!=null&&(typeof a=="function"?a(i):a.current=i)});return n.every(i=>i==null||i?.[ew])?void 0:t}let hy=m.createContext(null);hy.displayName="DescriptionContext";function tw(){let n=m.useContext(hy);if(n===null){let e=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,tw),e}return n}function EC(){let[n,e]=m.useState([]);return[n.length>0?n.join(" "):void 0,m.useMemo(()=>function(t){let i=vi(l=>(e(u=>[...u,l]),()=>e(u=>{let h=u.slice(),f=h.indexOf(l);return f!==-1&&h.splice(f,1),h}))),a=m.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 Zt.createElement(hy.Provider,{value:a},t.children)},[e])]}let CC="p";function AC(n,e){let t=m.useId(),i=fC(),{id:a=`headlessui-description-${t}`,...l}=n,u=tw(),h=ra(e);qr(()=>u.register(a),[a,u.register]);let f=vd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return vs()({ourProps:g,theirProps:l,slot:f,defaultTag:CC,name:u.name||"Description"})}let NC=Gr(AC),DC=Object.assign(NC,{});var nw=(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))(nw||{});let MC=m.createContext(()=>{});function jC({value:n,children:e}){return Zt.createElement(MC.Provider,{value:n},e)}let iw=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 RC=Object.defineProperty,OC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,LC=(n,e,t)=>(OC(n,e+"",t),t),rw=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},hs=(n,e,t)=>(rw(n,e,"read from private field"),t?t.call(n):e.get(n)),wm=(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)},h1=(n,e,t,i)=>(rw(n,e,"write to private field"),e.set(n,t),t),Ks,qc,Vc;let IC=class{constructor(e){wm(this,Ks,{}),wm(this,qc,new iw(()=>new Set)),wm(this,Vc,new Set),LC(this,"disposables",Ra()),h1(this,Ks,e),ea.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return hs(this,Ks)}subscribe(e,t){if(ea.isServer)return()=>{};let i={selector:e,callback:t,current:e(hs(this,Ks))};return hs(this,Vc).add(i),this.disposables.add(()=>{hs(this,Vc).delete(i)})}on(e,t){return ea.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,Ks),e);if(t!==hs(this,Ks)){h1(this,Ks,t);for(let i of hs(this,Vc)){let a=i.selector(hs(this,Ks));sw(i.current,a)||(i.current=a,i.callback(a))}for(let i of hs(this,qc).get(e.type))i(hs(this,Ks),e)}}};Ks=new WeakMap,qc=new WeakMap,Vc=new WeakMap;function sw(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:Tm(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:Tm(n.entries(),e.entries()):f1(n)&&f1(e)?Tm(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Tm(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 f1(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}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,p1=(n,e,t)=>(PC(n,typeof e!="symbol"?e+"":e,t),t),FC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(FC||{});let UC={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}}},zC=class aw extends IC{constructor(){super(...arguments),p1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),p1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new aw({stack:[]})}reduce(e,t){return Ma(t.type,UC,e,t)}};const ow=new iw(()=>zC.new());var Sm={exports:{}},km={};var m1;function $C(){if(m1)return km;m1=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 km.useSyncExternalStoreWithSelector=function(f,g,_,S,C){var D=a(null);if(D.current===null){var R={hasValue:!1,value:null};D.current=R}else R=D.current;D=u(function(){function B(Q){if(!G){if(G=!0,Y=Q,Q=S(Q),C!==void 0&&R.hasValue){var K=R.value;if(C(K,Q))return q=K}return q=Q}if(K=q,t(Y,Q))return K;var O=S(Q);return C!==void 0&&C(K,O)?(Y=Q,K):(Y=Q,q=O)}var G=!1,Y,q,se=_===void 0?null:_;return[function(){return B(g())},se===null?void 0:function(){return B(se())}]},[g,_,S,C]);var E=i(f,D[0],D[1]);return l(function(){R.hasValue=!0,R.value=E},[E]),h(E),E},km}var g1;function HC(){return g1||(g1=1,Sm.exports=$C()),Sm.exports}var qC=HC();function lw(n,e,t=sw){return qC.useSyncExternalStoreWithSelector(vi(i=>n.subscribe(VC,i)),vi(()=>n.state),vi(()=>n.state),vi(e),t)}function VC(n){return n}function xd(n,e){let t=m.useId(),i=ow.get(e),[a,l]=lw(i,m.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 Ng=new Map,Qc=new Map;function y1(n){var e;let t=(e=Qc.get(n))!=null?e:0;return Qc.set(n,t+1),t!==0?()=>b1(n):(Ng.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>b1(n))}function b1(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=Ng.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,Ng.delete(n))}function GC(n,{allowed:e,disallowed:t}={}){let i=xd(n,"inert-others");qr(()=>{var a,l;if(!i)return;let u=Ra();for(let f of(a=t?.())!=null?a:[])f&&u.add(y1(f));let h=(l=e?.())!=null?l:[];for(let f of h){if(!f)continue;let g=bd(f);if(!g)continue;let _=f.parentElement;for(;_&&_!==g.body;){for(let S of _.children)h.some(C=>S.contains(C))||u.add(y1(S));_=_.parentElement}}return u.dispose},[i,e,t])}function KC(n,e,t){let i=_l(a=>{let l=a.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&t()});m.useEffect(()=>{if(!n)return;let a=e===null?null:gl(e)?e:e.current;if(!a)return;let l=Ra();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(","),WC=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Ea=(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))(Ea||{}),Dg=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Dg||{}),XC=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(XC||{});function YC(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 QC(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(WC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var uw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(uw||{});function ZC(n,e=0){var t;return n===((t=bd(n))==null?void 0:t.body)?!1:Ma(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 JC=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(JC||{});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 Na(n){n?.focus({preventScroll:!0})}let e5=["textarea","input"].join(",");function t5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,e5))!=null?t:!1}function n5(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?Eg(n[0]):document:Eg(n),u=Array.isArray(n)?t?n5(n):n:e&64?QC(n):YC(n);a.length>0&&u.length>1&&(u=u.filter(D=>!a.some(R=>R!=null&&"current"in R?R?.current===D:R===D))),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 D=f+_;if(e&16)D=(D+S)%S;else{if(D<0)return 3;if(D>=S)return 1}C=u[D],C?.focus(g),_+=h}while(C!==Z_(C));return e&6&&t5(C)&&C.select(),2}function cw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function i5(){return/Android/gi.test(window.navigator.userAgent)}function v1(){return cw()||i5()}function Vh(n,e,t,i){let a=_l(t);m.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 dw(n,e,t,i){let a=_l(t);m.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 x1=30;function r5(n,e,t){let i=_l(t),a=m.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!ZC(g,uw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=m.useRef(null);Vh(n,"pointerdown",h=>{var f,g;v1()||(l.current=((g=(f=h.composedPath)==null?void 0:f.call(h))==null?void 0:g[0])||h.target)},!0),Vh(n,"pointerup",h=>{if(v1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=m.useRef({x:0,y:0});Vh(n,"touchstart",h=>{u.current.x=h.touches[0].clientX,u.current.y=h.touches[0].clientY},!0),Vh(n,"touchend",h=>{let f={x:h.changedTouches[0].clientX,y:h.changedTouches[0].clientY};if(!(Math.abs(f.x-u.current.x)>=x1||Math.abs(f.y-u.current.y)>=x1))return a(h,()=>ko(h.target)?h.target:null)},!0),dw(n,"blur",h=>a(h,()=>TC(window.document.activeElement)?window.document.activeElement:null),!0)}function fy(...n){return m.useMemo(()=>bd(...n),[...n])}function hw(n,e,t,i){let a=_l(t);m.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 s5(n){return m.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function a5(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 o5(){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 l5(){return cw()?{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=Ra();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(ko(h.target))try{let f=h.target.closest("a");if(!f)return;let{hash:g}=new URL(f.href),_=n.querySelector(g);ko(_)&&!i(_)&&(u=_)}catch{}},!0),e.group(h=>{e.addEventListener(n,"touchstart",f=>{if(h.dispose(),ko(f.target)&&wC(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(ko(h.target)){if(SC(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 u5(){return{before({doc:n,d:e}){e.style(n.documentElement,"overflow","hidden")}}}function _1(n){let e={};for(let t of n)Object.assign(e,t(e));return e}let ol=a5(()=>new Map,{PUSH(n,e){var t;let i=(t=this.get(n))!=null?t:{doc:n,count:0,d:Ra(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=_1(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=_1(t.meta)),this},SCROLL_PREVENT(n){let e={doc:n.doc,d:n.d,meta(){return n.computedMeta}},t=[l5(),o5(),u5()];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 c5(n,e,t=()=>({containers:[]})){let i=s5(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 d5(n,e,t=()=>[document.body]){let i=xd(n,"scroll-lock");c5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function h5(n=0){let[e,t]=m.useState(n),i=m.useCallback(f=>t(f),[]),a=m.useCallback(f=>t(g=>g|f),[]),l=m.useCallback(f=>(e&f)===f,[e]),u=m.useCallback(f=>t(g=>g&~f),[]),h=m.useCallback(f=>t(g=>g^f),[]);return{flags:e,setFlag:i,addFlag:a,hasFlag:l,removeFlag:u,toggleFlag:h}}var f5={},w1,T1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((w1=process==null?void 0:f5)==null?void 0:w1.NODE_ENV)==="test"&&typeof((T1=Element?.prototype)==null?void 0:T1.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 p5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(p5||{});function m5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function g5(n,e,t,i){let[a,l]=m.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=h5(n&&a?3:0),g=m.useRef(!1),_=m.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),y5(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 D;_.current&&x5(e)||(g.current=!1,f(7),t||l(!1),(D=i?.end)==null||D.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 y5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ra();return v5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(b5(n,i))})}),l.dispose}function b5(n,e){var t,i;let a=Ra();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 v5(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 x5(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 py(n,e){let t=m.useRef([]),i=vi(n);m.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=m.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 m.useContext(Yf)}function _5({value:n,children:e}){return Zt.createElement(Yf.Provider,{value:n},e)}function w5({children:n}){return Zt.createElement(Yf.Provider,{value:null},n)}function T5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let To=[];T5(()=>{function n(e){if(!ko(e.target)||e.target===document.body||To[0]===e.target)return;let t=e.target;t=t.closest(vf),To.unshift(t??e.target),To=To.filter(i=>i!=null&&i.isConnected),To.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 fw(n){let e=vi(n),t=m.useRef(!1);m.useEffect(()=>(t.current=!1,()=>{t.current=!0,Wf(()=>{t.current&&e()})}),[e])}let pw=m.createContext(!1);function S5(){return m.useContext(pw)}function S1(n){return Zt.createElement(pw.Provider,{value:n.force},n.children)}function k5(n){let e=S5(),t=m.useContext(gw),[i,a]=m.useState(()=>{var l;if(!e&&t!==null)return(l=t.current)!=null?l:null;if(ea.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 m.useEffect(()=>{i!==null&&(n!=null&&n.body.contains(i)||n==null||n.body.appendChild(i))},[i,n]),m.useEffect(()=>{e||t!==null&&a(t.current)},[t,a,e]),i}let mw=m.Fragment,E5=Gr(function(n,e){let{ownerDocument:t=null,...i}=n,a=m.useRef(null),l=ra(kC(C=>{a.current=C}),e),u=fy(a.current),h=t??u,f=k5(h),g=m.useContext(Mg),_=Xf(),S=vs();return fw(()=>{var C;f&&f.childNodes.length<=0&&((C=f.parentElement)==null||C.removeChild(f))}),f?yu.createPortal(Zt.createElement("div",{"data-headlessui-portal":"",ref:C=>{_.dispose(),g&&C&&_.add(g.register(C))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:mw,name:"Portal"})),f):null});function C5(n,e){let t=ra(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=vs();return i?Zt.createElement(E5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:mw,name:"Portal"})}let A5=m.Fragment,gw=m.createContext(null);function N5(n,e){let{target:t,...i}=n,a={ref:ra(e)},l=vs();return Zt.createElement(gw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:A5,name:"Popover.Group"}))}let Mg=m.createContext(null);function D5(){let n=m.useContext(Mg),e=m.useRef([]),t=vi(l=>(e.current.push(l),n&&n.register(l),()=>i(l))),i=vi(l=>{let u=e.current.indexOf(l);u!==-1&&e.current.splice(u,1),n&&n.unregister(l)}),a=m.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,m.useMemo(()=>function({children:l}){return Zt.createElement(Mg.Provider,{value:a},l)},[a])]}let M5=Gr(C5),yw=Gr(N5),j5=Object.assign(M5,{Group:yw});function R5(n,e=typeof document<"u"?document.defaultView:null,t){let i=xd(n,"escape");hw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===nw.Escape&&t(a))})}function O5(){var n;let[e]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=m.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 L5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=vi(()=>{var a,l;let u=bd(t),h=[];for(let f of n)f!==null&&(Eo(f)?h.push(f):"current"in f&&Eo(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&&Eo(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:vi(a=>i().some(l=>l.contains(a)))}}let bw=m.createContext(null);function k1({children:n,node:e}){let[t,i]=m.useState(null),a=vw(e??t);return Zt.createElement(bw.Provider,{value:a},n,a===null&&Zt.createElement(Ag,{features:bf.Hidden,ref:l=>{var u,h;if(l){for(let f of(h=(u=bd(l))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?h:[])if(f!==document.body&&f!==document.head&&Eo(f)&&f!=null&&f.contains(l)){i(f);break}}}}))}function vw(n=null){var e;return(e=m.useContext(bw))!=null?e:n}function I5(){let n=typeof document>"u";return"useSyncExternalStore"in s1?(e=>e.useSyncExternalStore)(s1)(()=>()=>{},()=>!1,()=>!n):!1}function Zf(){let n=I5(),[e,t]=m.useState(ea.isHandoffComplete);return e&&ea.isHandoffComplete===!1&&t(!1),m.useEffect(()=>{e!==!0&&t(!0)},[e]),m.useEffect(()=>ea.handoff(),[]),n?!1:e}function my(){let n=m.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 B5(){let n=m.useRef(0);return dw(!0,"keydown",e=>{e.key==="Tab"&&(n.current=e.shiftKey?1:0)},!0),n}function xw(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let e=new Set;for(let t of n.current)Eo(t.current)&&e.add(t.current);return e}let P5="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 F5(n,e){let t=m.useRef(null),i=ra(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;Zf()||(h=0);let g=fy(t.current);H5(h,{ownerDocument:g});let _=q5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});V5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:_});let S=B5(),C=vi(Y=>{if(!gl(t.current))return;let q=t.current;(se=>se())(()=>{Ma(S.current,{[Gc.Forwards]:()=>{Zc(q,Ea.First,{skipElements:[Y.relatedTarget,l]})},[Gc.Backwards]:()=>{Zc(q,Ea.Last,{skipElements:[Y.relatedTarget,l]})}})})}),D=xd(!!(h&2),"focus-trap#tab-lock"),R=Xf(),E=m.useRef(!1),B={ref:i,onKeyDown(Y){Y.key=="Tab"&&(E.current=!0,R.requestAnimationFrame(()=>{E.current=!1}))},onBlur(Y){if(!(h&4))return;let q=xw(u);gl(t.current)&&q.add(t.current);let se=Y.relatedTarget;ko(se)&&se.dataset.headlessuiFocusGuard!=="true"&&(_w(q,se)||(E.current?Zc(t.current,Ma(S.current,{[Gc.Forwards]:()=>Ea.Next,[Gc.Backwards]:()=>Ea.Previous})|Ea.WrapAround,{relativeTo:Y.target}):ko(Y.target)&&Na(Y.target)))}},G=vs();return Zt.createElement(Zt.Fragment,null,D&&Zt.createElement(Ag,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}),G({ourProps:B,theirProps:f,defaultTag:P5,name:"FocusTrap"}),D&&Zt.createElement(Ag,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}))}let U5=Gr(F5),z5=Object.assign(U5,{features:sl});function $5(n=!0){let e=m.useRef(To.slice());return py(([t],[i])=>{i===!0&&t===!1&&Wf(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=To.slice())},[n,To,e]),vi(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function H5(n,{ownerDocument:e}){let t=!!(n&8),i=$5(t);py(()=>{t||dC(e?.body)&&Na(i())},[t]),fw(()=>{t&&Na(i())})}function q5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=m.useRef(null),u=xd(!!(n&1),"focus-trap#initial-focus"),h=my();return py(()=>{if(n===0)return;if(!u){a!=null&&a.current&&Na(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)Na(i.current);else{if(n&16){if(Zc(f,Ea.First|Ea.AutoFocus)!==Dg.Error)return}else if(Zc(f,Ea.First)!==Dg.Error)return;if(a!=null&&a.current&&(Na(a.current),e?.activeElement===a.current))return;console.warn("There are no focusable elements inside the ")}l.current=e?.activeElement})},[a,u,n]),l}function V5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=my(),u=!!(n&4);hw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=xw(i);gl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let _=h.target;gl(_)?_w(f,_)?(a.current=_,Na(_)):(h.preventDefault(),h.stopPropagation(),Na(g)):Na(a.current)},!0)}function _w(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function ww(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Yc((e=n.as)!=null?e:Sw)||Zt.Children.count(n.children)===1}let Jf=m.createContext(null);Jf.displayName="TransitionContext";var G5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(G5||{});function K5(){let n=m.useContext(Jf);if(n===null)throw new Error("A is used but it is missing a parent or .");return n}function W5(){let n=m.useContext(e0);if(n===null)throw new Error("A is used but it is missing a parent or .");return n}let e0=m.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 Tw(n,e){let t=_l(n),i=m.useRef([]),a=my(),l=Xf(),u=vi((D,R=So.Hidden)=>{let E=i.current.findIndex(({el:B})=>B===D);E!==-1&&(Ma(R,{[So.Unmount](){i.current.splice(E,1)},[So.Hidden](){i.current[E].state="hidden"}}),l.microTask(()=>{var B;!t0(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=vi(D=>{let R=i.current.find(({el:E})=>E===D);return R?R.state!=="visible"&&(R.state="visible"):i.current.push({el:D,state:"visible"}),()=>u(D,So.Unmount)}),f=m.useRef([]),g=m.useRef(Promise.resolve()),_=m.useRef({enter:[],leave:[]}),S=vi((D,R,E)=>{f.current.splice(0),e&&(e.chains.current[R]=e.chains.current[R].filter(([B])=>B!==D)),e?.chains.current[R].push([D,new Promise(B=>{f.current.push(B)})]),e?.chains.current[R].push([D,new Promise(B=>{Promise.all(_.current[R].map(([G,Y])=>Y)).then(()=>B())})]),R==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>E(R)):E(R)}),C=vi((D,R,E)=>{Promise.all(_.current[R].splice(0).map(([B,G])=>G)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>E(R))});return m.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:C,wait:g,chains:_}),[h,u,i,S,C,_,g])}let Sw=m.Fragment,kw=yf.RenderStrategy;function X5(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:D,leaveFrom:R,leaveTo:E,...B}=n,[G,Y]=m.useState(null),q=m.useRef(null),se=ww(n),Q=ra(...se?[q,e,Y]:e===null?[]:[e]),K=(t=B.unmount)==null||t?So.Unmount:So.Hidden,{show:O,appear:re,initial:k}=K5(),[j,te]=m.useState(O?"visible":"hidden"),V=W5(),{register:ne,unregister:he}=V;qr(()=>ne(q),[ne,q]),qr(()=>{if(K===So.Hidden&&q.current){if(O&&j!=="visible"){te("visible");return}return Ma(j,{hidden:()=>he(q),visible:()=>ne(q)})}},[j,q,ne,he,O,K]);let ae=Zf();qr(()=>{if(se&&ae&&j==="visible"&&q.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[q,j,ae,se]);let z=k&&!re,P=re&&O&&k,Z=m.useRef(!1),ee=Tw(()=>{Z.current||(te("hidden"),he(q))},V),fe=vi(We=>{Z.current=!0;let _e=We?"enter":"leave";ee.onStart(q,_e,Ye=>{Ye==="enter"?l?.():Ye==="leave"&&h?.()})}),I=vi(We=>{let _e=We?"enter":"leave";Z.current=!1,ee.onStop(q,_e,Ye=>{Ye==="enter"?u?.():Ye==="leave"&&f?.()}),_e==="leave"&&!t0(ee)&&(te("hidden"),he(q))});m.useEffect(()=>{se&&a||(fe(O),I(O))},[O,se,a]);let pe=!(!a||!se||!ae||z),[,ke]=g5(pe,G,O,{start:fe,end:I}),ye=nl({ref:Q,className:((i=Cg(B.className,P&&g,P&&_,ke.enter&&g,ke.enter&&ke.closed&&_,ke.enter&&!ke.closed&&S,ke.leave&&D,ke.leave&&!ke.closed&&R,ke.leave&&ke.closed&&E,!ke.transition&&O&&C))==null?void 0:i.trim())||void 0,...m5(ke)}),me=0;j==="visible"&&(me|=As.Open),j==="hidden"&&(me|=As.Closed),O&&j==="hidden"&&(me|=As.Opening),!O&&j==="visible"&&(me|=As.Closing);let pt=vs();return Zt.createElement(e0.Provider,{value:ee},Zt.createElement(_5,{value:me},pt({ourProps:ye,theirProps:B,defaultTag:Sw,features:kw,visible:j==="visible",name:"Transition.Child"})))}function Y5(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=m.useRef(null),h=ww(n),f=ra(...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 is used but it is missing a `show={true | false}` prop.");let[_,S]=m.useState(t?"visible":"hidden"),C=Tw(()=>{t||S("hidden")}),[D,R]=m.useState(!0),E=m.useRef([t]);qr(()=>{D!==!1&&E.current[E.current.length-1]!==t&&(E.current.push(t),R(!1))},[E,t]);let B=m.useMemo(()=>({show:t,appear:i,initial:D}),[t,i,D]);qr(()=>{t?S("visible"):!t0(C)&&u.current!==null&&S("hidden")},[t,C]);let G={unmount:a},Y=vi(()=>{var Q;D&&R(!1),(Q=n.beforeEnter)==null||Q.call(n)}),q=vi(()=>{var Q;D&&R(!1),(Q=n.beforeLeave)==null||Q.call(n)}),se=vs();return Zt.createElement(e0.Provider,{value:C},Zt.createElement(Jf.Provider,{value:B},se({ourProps:{...G,as:m.Fragment,children:Zt.createElement(Ew,{ref:f,...G,...l,beforeEnter:Y,beforeLeave:q})},theirProps:{},defaultTag:m.Fragment,features:kw,visible:_==="visible",name:"Transition"})))}function Q5(n,e){let t=m.useContext(Jf)!==null,i=Qf()!==null;return Zt.createElement(Zt.Fragment,null,!t&&i?Zt.createElement(jg,{ref:e,...n}):Zt.createElement(Ew,{ref:e,...n}))}let jg=Gr(Y5),Ew=Gr(X5),gy=Gr(Q5),Jc=Object.assign(jg,{Child:gy,Root:jg});var Z5=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(Z5||{}),J5=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(J5||{});let eA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},yy=m.createContext(null);yy.displayName="DialogContext";function n0(n){let e=m.useContext(yy);if(e===null){let t=new Error(`<${n} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,n0),t}return e}function tA(n,e){return Ma(e.type,eA,n,e)}let E1=Gr(function(n,e){let t=m.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=m.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(C.current||(C.current=!0,console.warn(`Invalid role [${h}] passed to . Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let D=Qf();a===void 0&&D!==null&&(a=(D&As.Open)===As.Open);let R=m.useRef(null),E=ra(R,e),B=fy(R.current),G=a?0:1,[Y,q]=m.useReducer(tA,{titleId:null,descriptionId:null,panelRef:m.createRef()}),se=vi(()=>l(!1)),Q=vi(ke=>q({type:0,id:ke})),K=Zf()?G===0:!1,[O,re]=D5(),k={get current(){var ke;return(ke=Y.panelRef.current)!=null?ke:R.current}},j=vw(),{resolveContainers:te}=L5({mainTreeNode:j,portals:O,defaultContainers:[k]}),V=D!==null?(D&As.Closing)===As.Closing:!1;GC(g||V?!1:K,{allowed:vi(()=>{var ke,ye;return[(ye=(ke=R.current)==null?void 0:ke.closest("[data-headlessui-portal]"))!=null?ye:null]}),disallowed:vi(()=>{var ke;return[(ke=j?.closest("body > *:not(#headlessui-portal-root)"))!=null?ke:null]})});let ne=ow.get(null);qr(()=>{if(K)return ne.actions.push(i),()=>ne.actions.pop(i)},[ne,i,K]);let he=lw(ne,m.useCallback(ke=>ne.selectors.isTop(ke,i),[ne,i]));r5(he,te,ke=>{ke.preventDefault(),se()}),R5(he,B?.defaultView,ke=>{ke.preventDefault(),ke.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),se()}),d5(g||V?!1:K,B,te),KC(K,R,se);let[ae,z]=EC(),P=m.useMemo(()=>[{dialogState:G,close:se,setTitleId:Q,unmount:_},Y],[G,se,Q,_,Y]),Z=vd({open:G===0}),ee={ref:E,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:G===0?!0:void 0,"aria-labelledby":Y.titleId,"aria-describedby":ae,unmount:_},fe=!O5(),I=sl.None;K&&!g&&(I|=sl.RestoreFocus,I|=sl.TabLock,f&&(I|=sl.AutoFocus),fe&&(I|=sl.InitialFocus));let pe=vs();return Zt.createElement(w5,null,Zt.createElement(S1,{force:!0},Zt.createElement(j5,null,Zt.createElement(yy.Provider,{value:P},Zt.createElement(yw,{target:R},Zt.createElement(S1,{force:!1},Zt.createElement(z,{slot:Z},Zt.createElement(re,null,Zt.createElement(z5,{initialFocus:u,initialFocusFallback:R,containers:te,features:I},Zt.createElement(jC,{value:se},pe({ourProps:ee,theirProps:S,slot:Z,defaultTag:nA,features:iA,visible:G===0,name:"Dialog"})))))))))))}),nA="div",iA=yf.RenderStrategy|yf.Static;function rA(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?Zt.createElement(k1,null,Zt.createElement(Jc,{show:i,transition:t,unmount:a.unmount},Zt.createElement(E1,{ref:e,...a}))):Zt.createElement(k1,null,Zt.createElement(E1,{ref:e,open:i,...a}))}let sA="div";function aA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=n0("Dialog.Panel"),g=ra(e,f.panelRef),_=vd({open:u===0}),S=vi(B=>{B.stopPropagation()}),C={ref:g,id:i,onClick:S},D=a?gy:m.Fragment,R=a?{unmount:h}:{},E=vs();return Zt.createElement(D,{...R},E({ourProps:C,theirProps:l,slot:_,defaultTag:sA,name:"Dialog.Panel"}))}let oA="div";function lA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=n0("Dialog.Backdrop"),u=vd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?gy:m.Fragment,g=t?{unmount:l}:{},_=vs();return Zt.createElement(f,{...g},_({ourProps:h,theirProps:i,slot:u,defaultTag:oA,name:"Dialog.Backdrop"}))}let uA="h2";function cA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=n0("Dialog.Title"),h=ra(e);m.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=vd({open:l===0}),g={ref:h,id:i};return vs()({ourProps:g,theirProps:a,slot:f,defaultTag:uA,name:"Dialog.Title"})}let dA=Gr(rA),hA=Gr(aA);Gr(lA);let fA=Gr(cA),au=Object.assign(dA,{Panel:hA,Title:fA,Description:DC});function pA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=m.useState(""),[u,h]=m.useState(""),[f,g]=m.useState([]),_=m.useRef(!1);m.useEffect(()=>{n&&!_.current&&(l(""),h(""),g(i??[])),_.current=n},[n,i]);function S(){const R=a.trim(),E=u.trim();!R||!E||(g(B=>[...B.filter(Y=>Y.name!==R),{name:R,value:E}]),l(""),h(""))}function C(R){g(E=>E.filter(B=>B.name!==R))}function D(){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:R=>l(R.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:R=>h(R.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(en,{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(R=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:R.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:R.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>C(R.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},R.name))})]})}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx(en,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:D,children:"Übernehmen"})]})]})})]})}function mA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 gA=m.forwardRef(mA);function Rg({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=nn("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=>nn(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,D)=>D.count===void 0?null:c.jsx("span",{className:g(C),children:D.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 D=C.id===h.id,R=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"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",R&&"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:nn(D?"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}),_(D,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",D=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(R=>{const E=R.id===h.id,B=!!R.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(R.id),disabled:B,"aria-current":E?"page":void 0,className:nn(E?C:D,"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:R.label}),R.count!==void 0?c.jsx("span",{className:nn(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:R.count}):null]},R.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 D=C.id===h.id,R=!!C.disabled;return c.jsx("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"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",R&&"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,D)=>{const R=C.id===h.id,E=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!E&&t(C.id),disabled:E,"aria-current":R?"page":void 0,className:nn(R?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",D===0?"rounded-l-lg":"",D===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:nn(R?"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 D=C.id===h.id,R=!!C.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",R&&"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(gA,{"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:nn("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:nn("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:nn("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 Og({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=R=>{a||e(R.target.checked)},D=nn("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:nn("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:nn("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:nn("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:D})]}):c.jsxs("div",{className:nn("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:nn("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:nn("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:nn("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:nn("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:D})]})}function Sa({label:n,description:e,labelPosition:t="left",id:i,className:a,...l}){const u=m.useId(),h=i??`sw-${u}`,f=`${h}-label`,g=`${h}-desc`;return t==="right"?c.jsxs("div",{className:nn("flex items-center justify-between gap-3",a),children:[c.jsx(Og,{...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:nn("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(Og,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const bu=new Map;let C1=!1;function yA(){C1||(C1=!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&&Cw(n)}))}function Cw(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 bA(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function vA(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 ll(n,e,t){yA();const i=vA(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 Cw(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&&(bA(l),bu.delete(n))}}async function xA(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 _A="/api/stream",wA="state";function A1({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:D,onError:R}){const[E,B]=m.useState(null),[G,Y]=m.useState(!1),[q,se]=m.useState(null),Q=m.useRef(null),K=m.useRef(!1),O=m.useRef(!1),re=m.useRef(!1),k=m.useRef(!1),j=m.useRef(""),te=m.useRef(S),V=m.useRef(R);m.useEffect(()=>{te.current=S},[S]),m.useEffect(()=>{V.current=R},[R]);async function ne(){if(e&&!re.current){re.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{re.current=!1}}}function he(){if(Q.current)return Q.current;const Z=new AbortController;Q.current=Z;const ee=()=>{O.current=!0,ne()};return Z.signal.addEventListener("abort",ee,{once:!0}),Z}function ae(Z){K.current||(K.current=!0,_?.(Z))}m.useEffect(()=>{const Z=k.current,ee=!!E?.running;if(k.current=ee,Z&&!ee){const fe=String(E?.error??"").trim();Q.current=null,K.current=!1,O.current||fe==="abgebrochen"?(O.current=!1,D?.()):fe||C?.(),g?.()}},[E?.running,E?.error,g,C,D]),m.useEffect(()=>{if(t||!n)return;const Z=ll(_A,wA,ee=>{if(B(ee),!!ee?.running){const pe=he();ae(pe)}te.current?.({done:ee?.done??0,total:ee?.total??0,currentFile:ee?.currentFile??""});const I=String(ee?.error??"").trim();I&&I!=="abgebrochen"&&I!==j.current&&(j.current=I,V.current?.(I))});return()=>Z()},[n,t]);async function z(){if(f||E?.running)return;if(se(null),Y(!0),O.current=!1,j.current="",t){try{await t()}catch(ee){const fe=ee?.message??String(ee);se(fe),R?.(fe)}finally{Y(!1)}return}if(!n){const ee="Task ist nicht konfiguriert (startUrl fehlt).";se(ee),R?.(ee),Y(!1);return}const Z=he();try{const ee=await xA(n,{method:"POST"});B(ee),ae(Z),ee?.running&&S?.({done:ee?.done??0,total:ee?.total??0,currentFile:ee?.currentFile??""})}catch(ee){Q.current=null,K.current=!1;const fe=ee?.message??String(ee);se(fe),R?.(fe)}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}),q?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:q}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(en,{variant:"primary",onClick:z,disabled:h||f||G||P,children:G||f?u:l})})]})}function TA(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 SA({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=TA(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 kA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 EA=m.forwardRef(kA);function CA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 N1=m.forwardRef(CA);function AA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 NA=m.forwardRef(AA);function DA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Gh=m.forwardRef(DA);function MA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 jA=m.forwardRef(MA);function RA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 OA=m.forwardRef(RA);function LA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 D1=m.forwardRef(LA);function IA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Em=m.forwardRef(IA);function BA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 PA=m.forwardRef(BA);function FA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 UA=m.forwardRef(FA);function zA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 $A=m.forwardRef(zA);function HA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 qA=m.forwardRef(HA);function VA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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"}),m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const xf=m.forwardRef(VA);function GA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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"}),m.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 M1=m.forwardRef(GA);function KA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(KA);function WA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 XA=m.forwardRef(WA);function YA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 QA=m.forwardRef(YA);function ZA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 JA=m.forwardRef(ZA);function eN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 tN=m.forwardRef(eN);function nN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 j1=m.forwardRef(nN);function iN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),m.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 rN=m.forwardRef(iN);function sN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 aN=m.forwardRef(sN);function oN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 lN=m.forwardRef(oN);function uN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Cm=m.forwardRef(uN);function cN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 dN=m.forwardRef(cN);function hN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(hN);function fN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 pN=m.forwardRef(fN);function mN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 R1=m.forwardRef(mN);function gN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 O1=m.forwardRef(gN);function yN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 bN=m.forwardRef(yN);function vN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const wf=m.forwardRef(vN);function fr(...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:D,rightHeader:R,rightBodyClassName:E,mobileCollapsedImageSrc:B,mobileCollapsedImageAlt:G,titleRight:Y}){const q=_??(h==="split"?"right":"body"),se=m.useRef(null),[Q,K]=m.useState(!1);return m.useEffect(()=>{if(!n)return;const O=document.documentElement,re=document.body,k=O.style.overflow,j=re.style.overflow,te=re.style.paddingRight,V=window.innerWidth-O.clientWidth;return O.style.overflow="hidden",re.style.overflow="hidden",V>0&&(re.style.paddingRight=`${V}px`),()=>{O.style.overflow=k,re.style.overflow=j,re.style.paddingRight=te}},[n]),m.useEffect(()=>{n&&K(!1)},[n]),m.useEffect(()=>{if(!n)return;const O=se.current;if(!O)return;const re=72,k=()=>{const j=O.scrollTop||0;K(te=>{const V=j>re;return te===V?te:V})};return k(),O.addEventListener("scroll",k,{passive:!0}),()=>O.removeEventListener("scroll",k)},[n]),c.jsx(Jc,{show:n,as:m.Fragment,children:c.jsxs(au,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(Jc.Child,{as:m.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:m.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:fr("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:fr("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}),Y?c.jsx("div",{className:"shrink-0 flex items-center gap-2",children:Y}):null,c.jsx("button",{type:"button",onClick:e,className:fr("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:fr("flex-1 min-h-0 h-full",q==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",D),children:i}):c.jsxs("div",{className:fr("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:se,className:fr("lg:hidden flex-1 min-h-0 relative",q==="right"||q==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:fr("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:fr("flex items-center justify-between gap-3 px-3",Q?"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:G||t||"",className:fr("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",Q?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0",children:t?c.jsx("div",{className:fr("truncate font-semibold text-gray-900 dark:text-white",Q?"text-sm":"text-base"),children:t}):null})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[Y?c.jsx("div",{className:"flex items-center",children:Y}):null,c.jsx("button",{type:"button",onClick:e,className:fr("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"})})]})]}),R?c.jsx("div",{children:R}):null]}),f?c.jsx("div",{className:fr("lg:hidden px-2 pb-2",C),children:f}):null,c.jsx("div",{className:fr("px-2 pt-0 min-h-0",D),children:c.jsx("div",{className:fr("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:fr("min-h-0",g,"shrink-0","overflow-hidden",C),children:f}),c.jsxs("div",{className:fr("flex-1 min-h-0 flex flex-col",D),children:[R?c.jsx("div",{className:"shrink-0",children:R}):null,c.jsx("div",{className:fr("flex-1 min-h-0",q==="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 Aw(n,e){const t=Number(n);return Number.isFinite(t)&&t>0?Math.floor(t):e}function xN(n){const e=(n.user||"").trim()||"postgres",t=(n.host||"").trim()||"127.0.0.1",i=Aw(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 _N({open:n,onClose:e,initialUrl:t,initialHasPassword:i,onApply:a}){const[l,u]=m.useState("127.0.0.1"),[h,f]=m.useState(5432),[g,_]=m.useState("nsfwapp"),[S,C]=m.useState("postgres"),[D,R]=m.useState(""),[E,B]=m.useState("disable"),G=m.useMemo(()=>xN({user:S,host:l,port:h,db:g,sslmode:E}),[S,l,h,g,E]),Y=c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:()=>{a({databaseUrl:G,dbPassword:D}),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:q=>u(q.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:q=>f(Aw(q.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:q=>_(q.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:q=>C(q.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:D,onChange:q=>R(q.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:q=>B(q.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:G})]})]})})}function wN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Nw=m.forwardRef(wN);function TN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),m.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 yl=m.forwardRef(TN);function SN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Lg=m.forwardRef(SN);function kN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 EN=m.forwardRef(kN);function CN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 bl=m.forwardRef(CN);function AN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 NN=m.forwardRef(AN);function DN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 MN=m.forwardRef(DN);function jN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 RN=m.forwardRef(jN);function ON({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(ON);function LN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 IN=m.forwardRef(LN),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 BN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function PN({onAssetsGenerated:n}){const[e,t]=m.useState(Wi),[i,a]=m.useState(!1),[l,u]=m.useState(0),h=m.useRef(null),[f,g]=m.useState(!1),[_,S]=m.useState(null),[C,D]=m.useState(null),[R,E]=m.useState(null),[B,G]=m.useState(null),Y=m.useRef(null),[q,se]=m.useState(!1),[Q,K]=m.useState(""),O=Date.now(),re=l>O,j=i?"saving":re?"success":!!R&&!i&&!re?"error":"idle",te=j==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:j==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(Nw,{className:"size-4"}),isLoading:!1}:j==="error"?{text:"Fehler",color:"red",icon:c.jsx(IN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[V,ne]=m.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[he,ae]=m.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),z=Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB??5),P=B?.pauseGB??z,Z=B?.resumeGB??z+3;m.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),m.useEffect(()=>{let ye=!0;return fetch("/api/settings",{cache:"no-store"}).then(async me=>{if(!me.ok)throw new Error(await me.text());return me.json()}).then(me=>{ye&&t({databaseUrl:String(me.databaseUrl??""),hasDbPassword:!!(me.hasDbPassword??!1),recordDir:(me.recordDir||Wi.recordDir).toString(),doneDir:(me.doneDir||Wi.doneDir).toString(),ffmpegPath:String(me.ffmpegPath??Wi.ffmpegPath??""),autoAddToDownloadList:me.autoAddToDownloadList??Wi.autoAddToDownloadList,autoStartAddedDownloads:me.autoStartAddedDownloads??Wi.autoStartAddedDownloads,useChaturbateApi:me.useChaturbateApi??Wi.useChaturbateApi,useMyFreeCamsWatcher:me.useMyFreeCamsWatcher??Wi.useMyFreeCamsWatcher,autoDeleteSmallDownloads:me.autoDeleteSmallDownloads??Wi.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:me.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB,blurPreviews:me.blurPreviews??Wi.blurPreviews,teaserPlayback:me.teaserPlayback??Wi.teaserPlayback,teaserAudio:me.teaserAudio??Wi.teaserAudio,lowDiskPauseBelowGB:me.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB,enableNotifications:me.enableNotifications??Wi.enableNotifications})}).catch(()=>{}),()=>{ye=!1}},[]),m.useEffect(()=>{let ye=!0;const me=async()=>{try{const We=await fetch("/api/status/disk",{cache:"no-store"});if(!We.ok)return;const _e=await We.json();ye&&G(_e)}catch{}};me();const pt=window.setInterval(me,5e3);return()=>{ye=!1,window.clearInterval(pt)}},[]);async function ee(ye){E(null),D(null),S(ye);try{window.focus();const me=await fetch(`/api/settings/browse?target=${ye}`,{cache:"no-store"});if(me.status===204)return;if(!me.ok){const _e=await me.text().catch(()=>"");throw new Error(_e||`HTTP ${me.status}`)}const We=((await me.json()).path??"").trim();if(!We)return;t(_e=>ye==="record"?{..._e,recordDir:We}:ye==="done"?{..._e,doneDir:We}:{..._e,ffmpegPath:We})}catch(me){E(me?.message??String(me))}finally{S(null)}}async function fe(){E(null),D(null);const ye=e.recordDir.trim(),me=e.doneDir.trim(),pt=(e.ffmpegPath??"").trim(),We=String(e.databaseUrl??"").trim();if(!ye||!me){E("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const _e=!!e.autoAddToDownloadList,Ye=_e?!!e.autoStartAddedDownloads:!1,wt=!!e.useChaturbateApi,je=!!e.useMyFreeCamsWatcher,Se=!!e.autoDeleteSmallDownloads,Je=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB)))),tt=!!e.blurPreviews,ot=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:Wi.teaserPlayback,dt=!!e.teaserAudio,Ut=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB))),Ge=!!e.enableNotifications;a(!0);try{const Ie=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:We,dbPassword:Q||void 0,recordDir:ye,doneDir:me,ffmpegPath:pt,autoAddToDownloadList:_e,autoStartAddedDownloads:Ye,useChaturbateApi:wt,useMyFreeCamsWatcher:je,autoDeleteSmallDownloads:Se,autoDeleteSmallDownloadsBelowMB:Je,blurPreviews:tt,teaserPlayback:ot,teaserAudio:dt,lowDiskPauseBelowGB:Ut,enableNotifications:Ge})});if(!Ie.ok){const et=await Ie.text().catch(()=>"");throw new Error(et||`HTTP ${Ie.status}`)}D("✅ Gespeichert.");const Ze=Date.now()+2500;u(Ze),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(Ie){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),E(Ie?.message??String(Ie))}finally{a(!1)}}function I(ye,me=3500,pt=500){window.setTimeout(()=>{ye(We=>({...We,fading:!0})),window.setTimeout(()=>{ye(We=>({...We,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},pt)},me)}async function pe(){E(null),D(null);const ye=Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB??0),me=(e.doneDir||Wi.doneDir).trim();if(!me){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 "${me}" < ${ye} MB (Ordner "keep" wird übersprungen) • Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei Fortfahren?`)){g(!0),ae(We=>({...We,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const We=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!We.ok){const Je=await We.text().catch(()=>"");throw new Error(Je||`HTTP ${We.status}`)}const _e=await We.json(),Ye=Number(_e.scannedFiles??0),wt=Number(_e.orphanIdsRemoved??0),je=Number(_e.generatedOrphansRemoved??0),Se=wt+je;ae(Je=>({...Je,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Ye} · Orphans: ${Se}`})),I(ae)}catch(We){const _e=We?.message??String(We);E(_e),ae(Ye=>({...Ye,status:"error",text:"Fehler beim Aufräumen.",err:_e})),I(ae)}finally{g(!1)}}}async function ke(){const ye=Y.current;if(Y.current=null,ne(me=>({...me,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:R?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:R}):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(en,{variant:"primary",color:te.color,onClick:fe,disabled:i,className:"shrink-0",size:"md",isLoading:te.isLoading,leadingIcon:te.icon,children:te.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(SA,{tasks:[V,he],onCancel:ye=>{ye==="generate-assets"&&ke()}}),j!=="success"?c.jsxs("div",{className:"sm:hidden",children:[R&&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:R}),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(A1,{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(me=>({...me,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:ye=>{const me=BN(ye.currentFile);ne(pt=>({...pt,status:"running",title:"Assets generieren",text:me||"",done:ye.done,total:ye.total}))},onDone:()=>{Y.current=null,ne(ye=>({...ye,status:"done",title:"Assets generieren"})),I(ne)},onCancelled:()=>{Y.current=null,ne(ye=>({...ye,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),I(ne)},onError:ye=>{Y.current=null,ne(me=>({...me,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:ye})),I(ne)}}),c.jsx(A1,{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:pe,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(me=>({...me,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(en,{variant:"secondary",onClick:()=>se(!0),disabled:i,children:"URL erstellen…"})]})]})})]}),c.jsx(_N,{open:q,onClose:()=>se(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:ye,dbPassword:me})=>{t(pt=>({...pt,databaseUrl:ye})),K(me||"")}}),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(me=>({...me,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(en,{variant:"secondary",onClick:()=>ee("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(me=>({...me,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(en,{variant:"secondary",onClick:()=>ee("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(me=>({...me,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(en,{variant:"secondary",onClick:()=>ee("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(Sa,{checked:!!e.autoAddToDownloadList,onChange:ye=>t(me=>({...me,autoAddToDownloadList:ye,autoStartAddedDownloads:ye?me.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),c.jsx(Sa,{checked:!!e.autoStartAddedDownloads,onChange:ye=>t(me=>({...me,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(Sa,{checked:!!e.useChaturbateApi,onChange:ye=>t(me=>({...me,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(Sa,{checked:!!e.useMyFreeCamsWatcher,onChange:ye=>t(me=>({...me,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(Sa,{checked:!!e.autoDeleteSmallDownloads,onChange:ye=>t(me=>({...me,autoDeleteSmallDownloads:ye,autoDeleteSmallDownloadsBelowMB:me.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(me=>({...me,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(Sa,{checked:!!e.blurPreviews,onChange:ye=>t(me=>({...me,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(me=>({...me,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(Sa,{checked:!!e.teaserAudio,onChange:ye=>t(me=>({...me,teaserAudio:ye})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(Sa,{checked:!!e.enableNotifications,onChange:ye=>t(me=>({...me,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:Z})," ","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 Am(...n){return n.filter(Boolean).join(" ")}const FN={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 Ig({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=FN[i];return c.jsx("span",{className:Am("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:Am("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:Am("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 UN(...n){return n.filter(Boolean).join(" ")}function zN(){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 $N=m.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:D=180,tapIgnoreSelector:R="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:E,hotTargetSelector:B="[data-hot-target]",doubleTapMs:G=360,doubleTapMaxMovePx:Y=48},q){const se=m.useRef(null),Q=m.useRef(!1),K=m.useRef(0),O=m.useRef(null),re=m.useRef(0),k=m.useRef(null),j=m.useRef(null),te=m.useRef(null),V=m.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[ne,he]=m.useState(0),[ae,z]=m.useState(null),[P,Z]=m.useState(0),ee=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0,se.current&&(se.current.style.touchAction="pan-y"),Z(C),he(0),z(null),window.setTimeout(()=>Z(0),C)},[C]),fe=m.useCallback(async(je,Se)=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),se.current&&(se.current.style.touchAction="pan-y");const tt=se.current?.offsetWidth||360;Z(D),z(je==="right"?"right":"left");const ot=je==="right"?tt+40:-(tt+40);K.current=ot,he(ot);let dt;Se?dt=Promise.resolve(je==="right"?u():l()).catch(()=>!1):dt=Promise.resolve(!0);const Ut=new Promise(Ie=>{window.setTimeout(Ie,D)}),[,Ge]=await Promise.all([Ut,dt]);return Ge===!1?(Z(C),z(null),he(0),window.setTimeout(()=>Z(0),C),!1):!0},[D,l,u,C]),I=m.useCallback(()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),pe=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0,Z(0),he(0),z(null);try{const je=se.current;je&&(je.style.touchAction="pan-y")}catch{}},[]),ke=m.useCallback((je,Se)=>{const Je=k.current,tt=se.current;if(!Je||!tt)return;const ot=zN();if(!ot)return;let dt=typeof je=="number"?je:window.innerWidth/2,Ut=typeof Se=="number"?Se:window.innerHeight/2;const Ge=B?k.current?.querySelector(B)??tt.querySelector(B):null;let Ie=dt,Ze=Ut;if(Ge){const an=Ge.getBoundingClientRect();Ie=an.left+an.width/2,Ze=an.top+an.height/2}const et=Ie-dt,ft=Ze-Ut,mt=document.createElement("div");mt.style.position="absolute",mt.style.left=`${dt}px`,mt.style.top=`${Ut}px`,mt.style.transform="translate(-50%, -50%)",mt.style.pointerEvents="none",mt.style.willChange="transform, opacity",mt.style.zIndex="2147483647",mt.style.lineHeight="1",mt.style.userSelect="none",mt.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const de=document.createElement("div");de.style.width="30px",de.style.height="30px",de.style.color="#f59e0b",de.style.display="block",mt.appendChild(de),ot.appendChild(mt);const ze=Y_.createRoot(de);ze.render(c.jsx(Lg,{className:"w-full h-full","aria-hidden":"true"})),mt.getBoundingClientRect();const Le=200,Ae=500,Pe=400,Qe=Le+Ae+Pe,St=Le/Qe,Ot=(Le+Ae)/Qe,Tt=mt.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:St*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:St},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Ot},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${ft}px)) scale(0.85)`,opacity:.95,offset:Ot+(1-Ot)*.75},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${ft}px)) scale(0.55)`,opacity:0,offset:1}],{duration:Qe,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});Ge&&window.setTimeout(()=>{try{Ge.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+Ae+Math.round(Pe*.75)),Tt.onfinish=()=>{try{ze.unmount()}catch{}mt.remove()}},[B]);m.useEffect(()=>()=>{j.current!=null&&window.clearTimeout(j.current)},[]),m.useImperativeHandle(q,()=>({swipeLeft:je=>fe("left",je?.runAction??!0),swipeRight:je=>fe("right",je?.runAction??!0),reset:()=>ee()}),[fe,ee]);const ye=Math.abs(ne),me=ne===0?null:ne>0?"right":"left",pt=re.current||Math.min(f,(se.current?.offsetWidth||360)*g),We=Math.max(0,Math.min(1,ye/Math.max(1,pt))),_e=Math.max(0,Math.min(1,ye/Math.max(1,pt*1.35))),Ye=Math.max(-6,Math.min(6,ne/28)),wt=ne===0?1:.995;return c.jsx("div",{ref:k,className:UN("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:se,className:"relative",style:{transform:ne!==0?`translate3d(${ne}px,0,0) rotate(${Ye}deg) scale(${wt})`:void 0,transition:P?`transform ${P}ms ease`:void 0,touchAction:"pan-y",willChange:ne!==0?"transform":void 0,boxShadow:ne!==0?me==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+We*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+We*.12})`:void 0,borderRadius:ne!==0?"12px":void 0,filter:ne!==0?`saturate(${1+We*.08}) brightness(${1+We*.02})`:void 0},onPointerDown:je=>{if(!t||i)return;const Se=je.target;let Je=!!(R&&Se?.closest?.(R));if(S&&Se?.closest?.(S))return;let tt=!1;const ot=je.currentTarget,Ut=Array.from(ot.querySelectorAll("video")).find(ft=>ft.controls);if(Ut){const ft=Ut.getBoundingClientRect();if(je.clientX>=ft.left&&je.clientX<=ft.right&&je.clientY>=ft.top&&je.clientY<=ft.bottom)if(ft.bottom-je.clientY<=72)tt=!0,Je=!0;else{const Ae=je.clientX-ft.left,Pe=ft.right-je.clientX;Ae<=64||Pe<=64||(tt=!0,Je=!0)}}const Ie=je.currentTarget.getBoundingClientRect().bottom-je.clientY;_&&Ie<=_&&(tt=!0),V.current={id:je.pointerId,x:je.clientX,y:je.clientY,dragging:!1,captured:!1,tapIgnored:Je,noSwipe:tt};const et=se.current?.offsetWidth||360;re.current=Math.min(f,et*g),K.current=0},onPointerMove:je=>{if(!t||i||V.current.id!==je.pointerId||V.current.noSwipe)return;const Se=je.clientX-V.current.x,Je=je.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(Je)>Math.abs(Se)&&Math.abs(Je)>8){V.current.id=null;return}if(Math.abs(Se)<12)return;V.current.dragging=!0,je.currentTarget.style.touchAction="none",Z(0);try{je.currentTarget.setPointerCapture(je.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const tt=(Ge,Ie)=>{const Ze=Ie*.9,et=Math.abs(Ge);if(et<=Ze)return Ge;const ft=et-Ze,mt=Ze+ft*.25;return Math.sign(Ge)*mt},ot=se.current?.offsetWidth||360;K.current=tt(Se,ot),O.current==null&&(O.current=requestAnimationFrame(()=>{O.current=null,he(K.current)}));const dt=re.current,Ut=Se>dt?"right":Se<-dt?"left":null;z(Ge=>{if(Ge===Ut)return Ge;if(Ut)try{navigator.vibrate?.(10)}catch{}return Ut})},onPointerUp:je=>{if(!t||i||V.current.id!==je.pointerId)return;const Se=re.current||Math.min(f,(se.current?.offsetWidth||360)*g),Je=V.current.dragging,tt=V.current.captured,ot=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,tt)try{je.currentTarget.releasePointerCapture(je.pointerId)}catch{}if(je.currentTarget.style.touchAction="pan-y",!Je){const Ut=Date.now(),Ge=te.current,Ie=Ge&&Math.hypot(je.clientX-Ge.x,je.clientY-Ge.y)<=Y;if(!!E&&Ge&&Ut-Ge.t<=G&&Ie){if(te.current=null,I(),Q.current)return;Q.current=!0;try{ke(je.clientX,je.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await E?.()}finally{Q.current=!1}})()});return}if(ot){te.current={t:Ut,x:je.clientX,y:je.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,te.current=null},E?G:0);return}pe(),te.current={t:Ut,x:je.clientX,y:je.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,te.current=null,a?.()},E?G:0);return}const dt=K.current;O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),dt>Se?fe("right",!0):dt<-Se?fe("left",!0):ee(),K.current=0},onPointerCancel:je=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{je.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0;try{je.currentTarget.style.touchAction="pan-y"}catch{}ee()}},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+_e*.18,background:me==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":me==="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:ae?1:0,boxShadow:ae==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ae==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function Dw({children:n,content:e}){const t=m.useRef(null),i=m.useRef(null),[a,l]=m.useState(!1),[u,h]=m.useState(null),f=m.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=()=>{_()},D=()=>{g(),l(!1)},R=()=>{const B=t.current,G=i.current;if(!B||!G)return;const Y=8,q=8,se=B.getBoundingClientRect(),Q=G.getBoundingClientRect();let K=se.bottom+Y;if(K+Q.height>window.innerHeight-q){const k=se.top-Q.height-Y;k>=q?K=k:K=Math.max(q,window.innerHeight-Q.height-q)}let re=se.left;re+Q.width>window.innerWidth-q&&(re=window.innerWidth-Q.width-q),re=Math.max(q,re),h({left:re,top:K})};m.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>R());return()=>cancelAnimationFrame(B)},[a]),m.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>R());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),m.useEffect(()=>()=>g(),[]);const E=()=>typeof e=="function"?e(a,{close:D}):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,HN=!1;function ud(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 L1(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:D=12,variant:R="thumb",className:E,showPopover:B=!0,blur:G=!1,inlineVideo:Y=!1,inlineNonce:q=0,inlineControls:se=!1,inlineLoop:Q=!0,assetNonce:K=0,muted:O=Sf,popoverMuted:re=Sf,noGenerateTeaser:k,alwaysLoadStill:j=!1,teaserPreloadEnabled:te=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:ne,preferScrubProgress:he=!1}){const ae=L1(n.output||"")||e(n.output||""),z=G?"blur-md":"",P=m.useMemo(()=>{const De=n?.meta;if(!De)return null;if(typeof De=="string")try{return JSON.parse(De)}catch{return null}return De},[n]),[Z,ee]=m.useState(null),fe=m.useRef(new Set),I=m.useMemo(()=>!P&&!Z?null:P?Z?{...P,...Z}:P:Z,[P,Z]),pe=m.useMemo(()=>{let De=I?.previewClips;if(typeof De=="string"){const xt=De.trim();if(xt.length>0)try{const Et=JSON.parse(xt);return Array.isArray(Et)&&Et.length>0,!0}catch{return!0}}if(Array.isArray(De)&&De.length>0)return!0;const bt=I?.preview?.clips;return!!(Array.isArray(bt)&&bt.length>0)},[I]),[ke,ye]=m.useState(0),me=m.useMemo(()=>{let De=I?.previewClips;if(typeof De=="string")try{De=JSON.parse(De)}catch{De=null}!Array.isArray(De)&&Array.isArray(I?.preview?.clips)&&(De=I.preview.clips);const bt=De;if(!Array.isArray(bt)||bt.length===0)return null;let xt=0;const Et=[];for(const Ft of bt){const $t=Number(Ft?.startSeconds),Vt=Number(Ft?.durationSeconds);if(!Number.isFinite($t)||$t<0||!Number.isFinite(Vt)||Vt<=0)continue;const vn=xt,qn=xt+Vt;Et.push({start:$t,dur:Vt,cumStart:vn,cumEnd:qn}),xt=qn}return Et.length?Et:null},[I]),pt=m.useMemo(()=>me?me.map(De=>`${De.start.toFixed(3)}:${De.dur.toFixed(3)}`).join("|"):"",[me]),We=(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),_e=(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),Ye=(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),wt=(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),je=(typeof I?.durationSeconds=="number"&&Number.isFinite(I.durationSeconds)&&I.durationSeconds>0?I.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),Se=typeof je=="number"&&Number.isFinite(je)&&je>0?je>1440*60?je/1e3:je:void 0,Je=typeof Se=="number"&&Number.isFinite(Se)&&Se>0,tt=typeof We=="number"&&typeof _e=="number"&&Number.isFinite(We)&&Number.isFinite(_e)&&We>0&&_e>0,ot={muted:O,playsInline:!0,preload:"metadata"},[dt,Ut]=m.useState(!0),[Ge,Ie]=m.useState(!0),[Ze,et]=m.useState(!1),[ft,mt]=m.useState(!1),[de,ze]=m.useState(!0),Le=m.useRef(""),Ae=m.useRef(""),Pe=m.useRef(null),[Qe,St]=m.useState(!1),[Ot,Tt]=m.useState(!1),[an,Nt]=m.useState(!1),[Lt,vt]=m.useState(0),[It,yn]=m.useState(!1),$n=Y===!0||Y==="always"?"always":Y==="hover"?"hover":"never",kt=$n==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",Bn=De=>De.startsWith("HOT ")?De.slice(4):De,at=m.useMemo(()=>{const De=L1(n.output||"")||e(n.output||"");if(!De)return"";const bt=De.replace(/\.[^.]+$/,"");return Bn(bt).trim()},[n.output,e]),N=m.useMemo(()=>ae?`/api/record/video?file=${encodeURIComponent(ae)}`:"",[ae]),F=R==="fill"?"w-full h-full":"w-20 h-16",ie=m.useRef(null),Me=m.useRef(null),He=m.useRef(null),gt=m.useRef({inline:null,teaser:null,clips:null}),zt=(De,bt)=>{bt&>.current[De]!==bt&&(gt.current[De]=bt,ye(xt=>xt+1))},[Jt,un]=m.useState(0),[,Xt]=m.useState(0),pn=De=>De<0?0:De>1?1:De,fn=(De,bt,xt=C,Et=!1)=>{if(!De)return{ratio:0,globalSec:0,vvDur:0};const Ft=Number(De.duration);if(!(Number.isFinite(Ft)&&Ft>0))return{ratio:0,globalSec:0,vvDur:0};const Vt=Number(De.currentTime);if(!Number.isFinite(Vt)||Vt<0)return{ratio:0,globalSec:0,vvDur:Ft};const vn=me;let qn=0;if(Et&&Array.isArray(vn)&&vn.length>0){const Gn=vn[vn.length-1];if(Vt>=Gn.cumEnd)qn=typeof bt=="number"&&Number.isFinite(bt)&&bt>0?bt:Gn.start+Gn.dur;else{let ki=0,Ei=vn.length-1,si=0;for(;ki<=Ei;){const Sn=ki+Ei>>1,Jn=vn[Sn];if(Vt=Jn.cumEnd)ki=Sn+1;else{si=Sn;break}}return qn=vn[si].start,{ratio:vn.length>0?pn(si/vn.length):0,globalSec:Math.max(0,qn),vvDur:Ft}}}return Number.isFinite(xt)&&xt>0?qn=Math.floor(Vt/xt)*xt:qn=Vt,{ratio:pn(Math.min(qn,Ft)/Ft),globalSec:Math.max(0,qn),vvDur:Ft}},Kt=De=>{if(De){try{De.pause()}catch{}try{De.removeAttribute("src"),De.src="",De.load()}catch{}}};m.useEffect(()=>{mt(!1),ze(!0),ee(null),Le.current="",Ae.current="",et(!1)},[at,K,k]),m.useEffect(()=>{const De=bt=>{const xt=String(bt?.detail?.file??"");!xt||xt!==ae||(Kt(ie.current),Kt(Me.current),Kt(He.current))};return window.addEventListener("player:release",De),window.addEventListener("player:close",De),()=>{window.removeEventListener("player:release",De),window.removeEventListener("player:close",De)}},[ae]),m.useEffect(()=>{const De=Pe.current;if(!De)return;const bt=new IntersectionObserver(xt=>{const Et=!!xt[0]?.isIntersecting;St(Et),Et&&Nt(!0)},{threshold:.01,rootMargin:"0px"});return bt.observe(De),()=>bt.disconnect()},[]),m.useEffect(()=>{const De=Pe.current;if(!De)return;if(!te){Tt(Qe);return}let bt=!0;const xt=new IntersectionObserver(Et=>{Et[0]?.isIntersecting&&(Tt(!0),bt&&(bt=!1,xt.disconnect()))},{threshold:0,rootMargin:V});return xt.observe(De),()=>xt.disconnect()},[te,V,Qe]),m.useEffect(()=>{if(!l||u!=="frames"||!Qe||document.hidden)return;const De=window.setInterval(()=>vt(bt=>bt+1),f);return()=>window.clearInterval(De)},[l,u,Qe,f]);const cn=m.useMemo(()=>{if(!l||u!=="frames"||!Je)return null;const De=Se,bt=Math.max(.25,g??3);if(_){const Ft=Math.max(4,Math.min(S??16,Math.floor(De))),$t=Lt%Ft,Vt=Math.max(.1,De-bt),vn=Math.min(.25,Vt*.02),qn=$t/Ft*Vt+vn;return Math.min(De-.05,Math.max(.05,qn))}const xt=Math.max(De-.1,bt),Et=Lt*bt%xt;return Math.min(De-.05,Math.max(.05,Et))},[l,u,Je,Se,Lt,g,_,S]),dn=K??0,ln=m.useMemo(()=>at?cn==null?`/api/preview?id=${encodeURIComponent(at)}&v=${dn}`:`/api/preview?id=${encodeURIComponent(at)}&t=${cn}&v=${dn}`:"",[at,cn,dn]),qt=m.useMemo(()=>{if(!at)return"";const De=k?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(at)}${De}&v=${dn}`},[at,dn,k]),Rt=$n!=="never"&&Qe&&Ge&&($n==="always"||$n==="hover"&&It),Dt=l&&Qe&&!document.hidden&&Ge&&!Rt&&(h==="always"||It)&&(u==="teaser"&&de&&!!qt||u==="clips"&&Je),Cn=Je&&typeof Se=="number"?Se:void 0,Mt=j||Qe||an||kt&&It,Pn=Ot||Qe||an||kt&&It;m.useEffect(()=>{let De=!1;if(i&&Je){const bt=Number(Se),xt=`${ae}|dur|${bt}`;Le.current!==xt&&(Le.current=xt,i(n,bt),De=!0)}if(a&&tt){const bt=Number(We),xt=Number(_e),Et=`${ae}|res|${bt}x${xt}`;Ae.current!==Et&&(Ae.current=Et,a(n,bt,xt),De=!0)}De&&et(!0)},[ae,n,i,a,Je,tt,Se,We,_e]),m.useEffect(()=>{if(!at||!ae||!l||u!=="teaser"||!Pn||pe||fe.current.has(ae))return;let De=!1;const bt=new AbortController,xt=async Et=>{try{const Ft=await fetch(Et,{signal:bt.signal,cache:"no-store",credentials:"include"});return Ft.ok?await Ft.json():null}catch{return null}};return(async()=>{const Et=await xt(`/api/record/done/meta?file=${encodeURIComponent(ae)}`);De||(fe.current.add(ae),Et&&ee(Et))})(),()=>{De=!0,bt.abort()}},[at,ae,l,u,Pn,pe]);const Dn=De=>{et(!0);const bt=De.currentTarget;if(i&&!Je){const xt=Number(bt.duration);if(Number.isFinite(xt)&&xt>0){const Et=`${ae}|dur|${xt}`;Le.current!==Et&&(Le.current=Et,i(n,xt))}}if(a&&!tt){const xt=Number(bt.videoWidth),Et=Number(bt.videoHeight);if(Number.isFinite(xt)&&Number.isFinite(Et)&&xt>0&&Et>0){const Ft=`${ae}|res|${xt}x${Et}`;Ae.current!==Ft&&(Ae.current=Ft,a(n,xt,Et))}}};if(m.useEffect(()=>{Ut(!0),Ie(!0),gt.current.inline=null,gt.current.teaser=null,gt.current.clips=null},[at,K]),!N)return c.jsx("div",{className:[F,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Mn=Pn,Wt=l&&u==="teaser"&&de&&!!qt&&!Rt&&Pn,Vn=Rt?ie:!Rt&&Dt&&u==="teaser"?Me:!Rt&&Dt&&u==="clips"?He:null,Yn=!!Vn&&Qe,jn=Rt?"inline":Dt&&u==="teaser"?"teaser":"clips",Qn=l&&u==="frames"&&Je&&typeof cn=="number"&&Number.isFinite(cn)&&cn>=0,mn=Qn?pn(cn/Se):0,Ri=!Rt&&he&&typeof ne=="number"&&Number.isFinite(ne),Zn=Ri?pn(ne):Yn?Jt:Qn?mn:0,ni=!Rt&&(Ri||(Yn||Qn)),Si=m.useMemo(()=>{if(!Je)return null;const De=Se;if(!(De>0))return null;let xt=I?.previewClips;if(typeof xt=="string")try{xt=JSON.parse(xt)}catch{xt=null}if(!Array.isArray(xt)||xt.length===0)return null;const Et=xt.map(Ft=>({start:Number(Ft?.startSeconds),dur:Number(Ft?.durationSeconds)})).filter(Ft=>Number.isFinite(Ft.start)&&Ft.start>=0&&Number.isFinite(Ft.dur)&&Ft.dur>0);return Et.length?Et.map(Ft=>{const $t=pn(Ft.start/De),Vt=pn(Ft.dur/De);return{left:$t,width:Vt,start:Ft.start,dur:Ft.dur}}):null},[I,Je,Se]),An=m.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Je)return[];const De=Se,bt=Math.max(.25,C),xt=Math.max(8,Math.min(D??S??12,Math.floor(De))),Et=Math.max(.1,De-bt),Ft=Math.min(.25,Et*.02),$t=[];for(let Vt=0;VtAn.map(De=>De.toFixed(2)).join(","),[An]),Hn=m.useRef(0),ve=m.useRef(0);m.useEffect(()=>{const De=Me.current;if(!De)return;if(!(Dt&&u==="teaser")){try{De.pause()}catch{}return}ud(De,{muted:O});const xt=De.play?.();xt&&typeof xt.catch=="function"&&xt.catch(()=>{})},[Dt,u,qt,O]),m.useEffect(()=>{if(!Yn){un(0),Xt(0);return}const De=Vn?.current??null;if(!De){un(0),Xt(0);return}let bt=!1,xt=null;const Et=()=>{if(bt||!De.isConnected)return;const Vt=jn==="teaser"&&Array.isArray(me)&&me.length>0,vn=fn(De,Cn,C,Vt);un(vn.ratio),Xt(vn.globalSec)};Et(),xt=window.setInterval(Et,100);const Ft=()=>Et(),$t=()=>Et();return De.addEventListener("loadedmetadata",Ft),De.addEventListener("durationchange",Ft),De.addEventListener("timeupdate",$t),()=>{bt=!0,xt!=null&&window.clearInterval(xt),De.removeEventListener("loadedmetadata",Ft),De.removeEventListener("durationchange",Ft),De.removeEventListener("timeupdate",$t)}},[Yn,Vn,Cn,pt,jn,me,ke]),m.useEffect(()=>{Rt&&ud(ie.current,{muted:O})},[Rt,O]),m.useEffect(()=>{const De=He.current;if(!De)return;if(!(Dt&&u==="clips")){Dt||De.pause();return}if(!An.length)return;Hn.current=Hn.current%An.length,ve.current=An[Hn.current];const bt=()=>{try{De.currentTime=ve.current}catch{}const Ft=De.play();Ft&&typeof Ft.catch=="function"&&Ft.catch(()=>{})},xt=()=>bt(),Et=()=>{if(An.length&&De.currentTime-ve.current>=C){Hn.current=(Hn.current+1)%An.length,ve.current=An[Hn.current];try{De.currentTime=ve.current+.01}catch{}}};return De.addEventListener("loadedmetadata",xt),De.addEventListener("timeupdate",Et),De.readyState>=1&&bt(),()=>{De.removeEventListener("loadedmetadata",xt),De.removeEventListener("timeupdate",Et),De.pause()}},[Dt,u,Fn,C,An]);const rt=(Ot||Qe)&&(i||a)&&!Ze&&!Rt&&(i&&!Je||a&&!tt),ct=!!Si&&(jn==="teaser"||!Rt&&Ri&&u==="teaser"),jt=c.jsxs("div",{ref:Pe,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",F,E??""].join(" "),onMouseEnter:kt?()=>yn(!0):void 0,onMouseLeave:kt?()=>yn(!1):void 0,onFocus:kt?()=>yn(!0):void 0,onBlur:kt?()=>yn(!1):void 0,"data-duration":Je?String(Se):void 0,"data-res":tt?`${We}x${_e}`:void 0,"data-size":typeof Ye=="number"?String(Ye):void 0,"data-fps":typeof wt=="number"?String(wt):void 0,children:[Mt&&ln&&dt?c.jsx("img",{src:ln,loading:j?"eager":"lazy",decoding:"async",alt:ae,className:["absolute inset-0 w-full h-full object-cover",z].filter(Boolean).join(" "),onError:()=>Ut(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Rt?m.createElement("video",{...ot,ref:De=>{ie.current=De,zt("inline",De)},key:`inline-${at}-${q}`,src:N,className:["absolute inset-0 w-full h-full object-cover",z,se?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:O,controls:se,loop:Q,poster:Mn&&ln||void 0,onLoadedMetadata:Dn,onError:()=>Ie(!1)}):null,!Rt&&Wt&&!(Dt&&u==="teaser")?c.jsx("video",{src:qt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>mt(!0),onCanPlay:()=>mt(!0),onError:()=>{ze(!1),mt(!1)}},`teaser-prewarm-${at}`):null,!Rt&&Dt&&u==="teaser"?c.jsx("video",{ref:De=>{Me.current=De,zt("teaser",De)},src:qt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",z,ft?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:O,playsInline:!0,autoPlay:!0,loop:!0,preload:ft?"auto":"metadata",poster:Mn&&ln||void 0,onLoadedData:()=>mt(!0),onPlaying:()=>mt(!0),onError:()=>{ze(!1),mt(!1)}},`teaser-mp4-${at}`):null,!Rt&&Dt&&u==="clips"?c.jsx("video",{ref:De=>{He.current=De,zt("clips",De)},src:N,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",z].filter(Boolean).join(" "),muted:O,playsInline:!0,preload:"metadata",poster:Mn&&ln||void 0,onError:()=>Ie(!1)},`clips-${at}-${Fn}`):null,ni?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:[ct?c.jsx("div",{className:"absolute inset-0",children:Si.map((De,bt)=>c.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${De.left*100}%`,width:`${De.width*100}%`}},`seg-${bt}-${De.left.toFixed(6)}-${De.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(${pn(Zn)})`,background:"rgba(99,102,241,0.95)"}})]}):null,rt?c.jsx("video",{src:N,preload:"metadata",muted:O,playsInline:!0,className:"hidden",onLoadedMetadata:Dn}):null]});return B?c.jsx(Dw,{content:De=>De&&c.jsx("div",{className:"w-[420px]",children:c.jsx("div",{className:"aspect-video",children:c.jsx("video",{src:N,className:["w-full h-full bg-black",z].filter(Boolean).join(" "),muted:re,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:bt=>bt.stopPropagation(),onMouseDown:bt=>bt.stopPropagation()})})}),children:jt}):jt}function Nn(...n){return n.filter(Boolean).join(" ")}const qN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",VN=n=>n.startsWith("HOT ")?n.slice(4):n,GN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function KN(n){const t=VN(qN(n||"")).replace(/\.[^.]+$/,""),i=t.match(GN);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:D,onDelete:R,onToggleWatch:E,onAddToDownloads:B,order:G,className:Y}){const q=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",se=l?"size-4":"size-5",Q="h-full w-full",K=e==="table"?`inline-flex items-center justify-center rounded-md ${q} 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 ${q} 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`,O=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"},re=G??["watch","favorite","like","hot","keep","delete","details"],k=at=>re.includes(at),j=String(n?.sourceUrl??"").trim(),te=KN(n.output||""),V=te?`Mehr zu ${te} anzeigen`:"Mehr anzeigen",ne=k("favorite"),he=k("like"),ae=k("hot"),z=k("watch"),P=k("keep"),Z=k("delete"),ee=k("details")&&!!te,fe=k("add"),[I,pe]=m.useState("idle"),ke=m.useRef(null);m.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current)},[]);const ye=()=>{pe("ok"),ke.current&&window.clearTimeout(ke.current),ke.current=window.setTimeout(()=>pe("idle"),800)},me=async()=>{if(a||I==="busy"||!B&&!!!j)return!1;pe("busy");try{let N=!0;return B?N=await B(n)!==!1:j?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:j}})),N=!0):N=!1,N?ye():pe("idle"),N}catch{return pe("idle"),!1}},[pt,We]=m.useState(0),[_e,Ye]=m.useState(4),wt=at=>N=>{N.preventDefault(),N.stopPropagation(),!(a||!at)&&Promise.resolve(at(n)).catch(()=>{})},je=ee?c.jsxs("button",{type:"button",className:Nn(K),title:V,"aria-label":V,disabled:a,onClick:at=>{at.preventDefault(),at.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:te}}))},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(j1,{className:Nn(Q,O.off)})}),c.jsx("span",{className:"sr-only",children:V})]}):null,Se=fe?c.jsxs("button",{type:"button",className:Nn(K),title:j?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||I==="busy"||!B&&!j,onClick:async at=>{at.preventDefault(),at.stopPropagation(),await me()},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:I==="ok"?c.jsx(Nw,{className:Nn(Q,"text-emerald-600 dark:text-emerald-300")}):c.jsx(N1,{className:Nn(Q,O.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Je=ne?c.jsx("button",{type:"button",className:K,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!_,onClick:wt(_),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(_f,{className:Nn("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",Q,O.off)}),c.jsx(vu,{className:Nn("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",Q,O.favOn)})]})}):null,tt=he?c.jsx("button",{type:"button",className:K,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:wt(S),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(ed,{className:Nn("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",Q,O.off)}),c.jsx(bl,{className:Nn("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",Q,O.likeOn)})]})}):null,ot=ae?c.jsx("button",{type:"button","data-hot-target":!0,className:K,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!C,onClick:wt(C),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(M1,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Q,O.off)}),c.jsx(Lg,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Q,O.hotOn)})]})}):null,dt=z?c.jsx("button",{type:"button",className:K,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!E,onClick:wt(E),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(xf,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Q,O.off)}),c.jsx(yl,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Q,O.watchOn)})]})}):null,Ut=P?c.jsx("button",{type:"button",className:K,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!D,onClick:wt(D),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(D1,{className:Nn(Q,O.keep)})})}):null,Ge=Z?c.jsx("button",{type:"button",className:K,title:"Löschen","aria-label":"Löschen",disabled:a||!R,onClick:wt(R),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(R1,{className:Nn(Q,O.del)})})}):null,Ie={details:je,add:Se,favorite:Je,like:tt,watch:dt,hot:ot,keep:Ut,delete:Ge},Ze=t,et=re.filter(at=>!!Ie[at]),ft=Ze&&typeof i!="number",ze=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Le=l?2:3,Ae=m.useMemo(()=>{if(!ft)return i??Le;const at=pt||0;if(at<=0)return Math.min(et.length,Le);for(let N=et.length;N>=0;N--)if(N*ze+ze+(N>0?N*_e:0)<=at)return N;return 0},[ft,i,Le,pt,et.length,ze,_e]),Pe=Ze?et.slice(0,Ae):et,Qe=Ze?et.slice(Ae):[],[St,Ot]=m.useState(!1),Tt=m.useRef(null);m.useLayoutEffect(()=>{const at=Tt.current;if(!at||typeof window>"u")return;const N=()=>{const ie=Tt.current;if(!ie)return;const Me=Math.floor(ie.getBoundingClientRect().width||0);Me>0&&We(Me);const He=window.getComputedStyle(ie),gt=He.columnGap||He.gap||"0",zt=parseFloat(gt);Number.isFinite(zt)&&zt>=0&&Ye(zt)};N();const F=new ResizeObserver(()=>N());return F.observe(at),window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N),F.disconnect()}},[]);const an=m.useRef(null),Nt=m.useRef(null),Lt=208,vt=4,It=8,[yn,$n]=m.useState(null);m.useEffect(()=>{if(!St)return;const at=F=>{F.key==="Escape"&&Ot(!1)},N=F=>{const ie=Tt.current,Me=Nt.current,He=F.target;ie&&ie.contains(He)||Me&&Me.contains(He)||Ot(!1)};return window.addEventListener("keydown",at),window.addEventListener("mousedown",N),()=>{window.removeEventListener("keydown",at),window.removeEventListener("mousedown",N)}},[St]),m.useLayoutEffect(()=>{if(!St){$n(null);return}const at=()=>{const N=an.current;if(!N)return;const F=N.getBoundingClientRect(),ie=window.innerWidth,Me=window.innerHeight;let He=F.right-Lt;He=Math.max(It,Math.min(He,ie-Lt-It));let gt=F.bottom+vt;gt=Math.max(It,Math.min(gt,Me-It));const zt=Math.max(120,Me-gt-It);$n({top:gt,left:He,maxH:zt})};return at(),window.addEventListener("resize",at),window.addEventListener("scroll",at,!0),()=>{window.removeEventListener("resize",at),window.removeEventListener("scroll",at,!0)}},[St]);const kt=()=>{te&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:te}}))},Bn=at=>at==="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:N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),kt()},children:[c.jsx(j1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await me()},children:[c.jsx(N1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await _?.(n)},children:[h?c.jsx(vu,{className:Nn("size-4",O.favOn)}):c.jsx(_f,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await S?.(n)},children:[f?c.jsx(bl,{className:Nn("size-4",O.favOn)}):c.jsx(ed,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await E?.(n)},children:[g?c.jsx(yl,{className:Nn("size-4",O.favOn)}):c.jsx(xf,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await C?.(n)},children:[u?c.jsx(Lg,{className:Nn("size-4",O.favOn)}):c.jsx(M1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:u?"HOT entfernen":"Als HOT markieren"})]},"hot"):at==="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||!D,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await D?.(n)},children:[c.jsx(D1,{className:Nn("size-4",O.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):at==="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||!R,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await R?.(n)},children:[c.jsx(R1,{className:Nn("size-4",O.del)}),c.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return c.jsxs("div",{ref:Tt,className:Nn("relative flex items-center flex-nowrap",Y??"gap-2"),children:[Pe.map(at=>{const N=Ie[at];return N?c.jsx(m.Fragment,{children:N},at):null}),Ze&&Qe.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:an,type:"button",className:K,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":St,disabled:a,onClick:at=>{at.preventDefault(),at.stopPropagation(),!a&&Ot(N=>!N)},children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx($A,{className:Nn(Q,O.off)})})}),St&&yn&&typeof document<"u"?yu.createPortal(c.jsx("div",{ref:Nt,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:yn.top,left:yn.left,width:Lt,maxHeight:yn.maxH},onClick:at=>at.stopPropagation(),children:Qe.map(Bn)}),document.body):null]}):null]})}function ms({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=nn("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=nn(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),D=E=>E.stopPropagation(),R=h?{onPointerDown:D,onMouseDown:D}:{};return a?c.jsx("button",{type:"button",className:C,title:t??f,"aria-pressed":!!i,...R,onClick:E=>{h&&(E.preventDefault(),E.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:C,title:t??f,...R,onClick:h?D:void 0,children:e??n})}function cd({rowKey:n,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:a,maxVisible:l,maxWidthClassName:u,gapPx:h=6,className:f}){const[g,_]=m.useState(!1),S=m.useRef(null),C=m.useRef(null),D=m.useRef(null);m.useEffect(()=>_(!1),[n]),m.useEffect(()=>{if(!g)return;const O=re=>{re.key==="Escape"&&_(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[g]);const R=m.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),E=m.useMemo(()=>[...e].sort((O,re)=>O.localeCompare(re,void 0,{sensitivity:"base"})),[e]),[B,G]=m.useState(()=>{const O=Math.min(E.length,R);return Math.min(O,6)}),Y=m.useCallback(()=>{const O=S.current,re=C.current;if(!O||!re)return;const k=Math.floor(O.getBoundingClientRect().width);if(k<=0)return;const j=Math.min(E.length,R);if(j<=0){G(0);return}const V=Array.from(re.children).map(P=>P.offsetWidth).slice(0,j),ne=D.current?.offsetWidth??0,he=2,ae=P=>{let Z=0,ee=0;for(let fe=0;fe0?h:0);if(Z+I<=P-he)Z+=I,ee++;else break}return ee};let z=ae(k);if(z0?ne+h:0,Z=Math.max(0,k-P);z=ae(Z),z=Math.max(0,z)}G(Math.max(0,Math.min(z,j)))},[E,R,h]);m.useLayoutEffect(()=>{Y()},[Y,E.join("\0"),u,R]),m.useEffect(()=>{const O=S.current;if(!O)return;const re=new ResizeObserver(()=>Y());return re.observe(O),()=>re.disconnect()},[Y]);const q=Math.min(E.length,R),se=E.slice(0,Math.min(B,q)),Q=O=>O.stopPropagation(),K=E.length-se.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:Q,onMouseDown:Q,onPointerDown:Q,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:se.length>0?se.map(O=>c.jsx(ms,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O)):c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),K>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:O=>{O.preventDefault(),O.stopPropagation(),_(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",K]}):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:Q,onMouseDown:Q,onPointerDown:Q,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(O=>c.jsx(ms,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))})})]}):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,q).map(O=>c.jsx(ms,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))}),c.jsx("button",{ref:D,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 I1(n,e,t){return Math.max(e,Math.min(t,n))}function WN(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 by({imageCount:n,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:a,stepSeconds:l=0}){const u=m.useRef(null),h=m.useRef(null),f=m.useRef(void 0),g=m.useCallback(()=>{h.current=null,t(f.current)},[t]),_=m.useCallback(Q=>{f.current=Q,h.current==null&&(h.current=window.requestAnimationFrame(g))},[g]);m.useEffect(()=>()=>{h.current!=null&&(window.cancelAnimationFrame(h.current),h.current=null)},[]);const S=m.useCallback(Q=>{if(!u.current||n<1)return;const K=u.current.getBoundingClientRect();if(K.width<=0)return;const O=Q-K.left,re=I1(O/K.width,0,.999999);return I1(Math.floor(re*n),0,n-1)},[n]),C=m.useCallback(Q=>{const K=S(Q.clientX);_(K)},[S,_]),D=m.useCallback(Q=>{const K=S(Q.clientX);_(K)},[S,_]),R=m.useCallback(()=>{_(void 0)},[_]),E=m.useCallback(Q=>{Q.stopPropagation();const K=S(Q.clientX);_(K);try{Q.currentTarget.setPointerCapture?.(Q.pointerId)}catch{}},[S,_]),B=m.useCallback(Q=>{if(Q.stopPropagation(),!i)return;const K=S(Q.clientX);typeof K=="number"&&i(K)},[S,i]);if(!n||n<1)return null;const G=typeof e=="number"?(e+.5)/n*100:void 0,Y=typeof e=="number"?l>0?WN(e*l):`${e+1}/${n}`:"",q=typeof e=="number",se=typeof G=="number"?{left:`clamp(24px, ${G}%, 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:D,onPointerLeave:R,onPointerDown:E,onMouseDown:Q=>Q.stopPropagation(),onClick:B,title:q?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 G=="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:`${G}%`,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",q?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:se,children:Y})]})}const Mw=/^HOT[ \u00A0]+/i,jw=n=>String(n||"").replaceAll(" "," "),ou=n=>Mw.test(jw(n)),$r=n=>jw(n).replace(Mw,"");function dd(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 XN=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 YN(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function Nm(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function B1(n,e,t){return Math.max(e,Math.min(t,n))}const QN=5;function ZN(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{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 e3({animateOnMount:n,children:e}){const[t,i]=m.useState(!n);return m.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 t3({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:D,assetNonce:R,handleScrubberClickIndex:E,keyFor:B,baseName:G,modelNameFromOutput:Y,runtimeOf:q,sizeBytesOf:se,formatBytes:Q,lower:K,onHoverPreviewKeyChange:O,onOpenPlayer:re,openPlayer:k,startInlineAt:j,startInline:te,tryAutoplayInline:V,registerTeaserHost:ne,handleDuration:he,deleteVideo:ae,keepVideo:z,modelsByKey:P,activeTagSet:Z,onToggleTagFilter:ee,onToggleHot:fe,onToggleFavorite:I,onToggleLike:pe,onToggleWatch:ke,enqueueDeleteVideo:ye,enqueueKeepVideo:me,enqueueToggleHot:pt}){const We=m.useCallback(Le=>{const Ae=Le?.meta;if(!Ae)return null;if(typeof Ae=="string")try{return JSON.parse(Ae)}catch{return null}return Ae},[]),_e=m.useCallback(Le=>{const Ae=We(Le),Pe=(typeof Ae?.videoWidth=="number"&&Number.isFinite(Ae.videoWidth)?Ae.videoWidth:0)||(typeof Le.videoWidth=="number"&&Number.isFinite(Le.videoWidth)?Le.videoWidth:0),Qe=(typeof Ae?.videoHeight=="number"&&Number.isFinite(Ae.videoHeight)?Ae.videoHeight:0)||(typeof Le.videoHeight=="number"&&Number.isFinite(Le.videoHeight)?Le.videoHeight:0);return Pe>0&&Qe>0?{w:Pe,h:Qe}:null},[We]),Ye=m.useCallback(Le=>{const Ae=We(Le);let Pe=Ae?.previewSprite??Ae?.preview?.sprite??Ae?.sprite??Le?.previewSprite??Le?.preview?.sprite??null;if(typeof Pe=="string")try{Pe=JSON.parse(Pe)}catch{Pe=null}const Qe=Number(Pe?.count??Pe?.frames??Pe?.imageCount),St=Number(Pe?.stepSeconds??Pe?.step??Pe?.intervalSeconds);if(Number.isFinite(Qe)&&Qe>=2)return{count:Math.max(2,Math.floor(Qe)),stepSeconds:Number.isFinite(St)&&St>0?St:5};const Ot=B(Le),Tt=h[Ot]??(typeof Le?.durationSeconds=="number"?Le.durationSeconds:void 0);return typeof Tt=="number"&&Number.isFinite(Tt)&&Tt>1?{count:Math.max(2,Math.min(240,Math.floor(Tt/5)+1)),stepSeconds:5}:null},[We,B,h]),[wt,je]=m.useState({}),[Se,Je]=m.useState({}),[tt,ot]=m.useState(null),dt=m.useCallback((Le,Ae)=>{je(Pe=>{if(Ae===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ae?Pe:{...Pe,[Le]:Ae}})},[]),Ut=m.useCallback(Le=>{dt(Le,void 0)},[dt]),Ge=m.useCallback((Le,Ae)=>{Je(Pe=>{if(Ae===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ae?Pe:{...Pe,[Le]:Ae}})},[]),Ie=(Le,Ae)=>{const Pe=B(Le),Qe=g?.key===Pe,St=Ae?.disableInline?!1:Qe,Tt=!(!Ae?.forceStill&&!!a&&(St||l===Pe)),an=St?g?.nonce??0:0,Nt=!!Ae?.forceLoadStill,Lt=Ae?.forceStill?!1:Ae?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Pe:!1,vt=_.has(Pe)||S.has(Pe)||C.has(Pe),It=Y(Le.output),yn=G(Le.output||""),$n=$r(yn.replace(/\.[^.]+$/,"")).trim(),kt=K(It),Bn=P[kt],at=We(Le),N=Ye(Le),F=wt[Pe],ie=Se[Pe]===!0,Me=YN(at?.previewSprite?.path,at?.previewSpritePath,Bn?.previewScrubberPath,$n?`/api/preview-sprite/${encodeURIComponent($n)}`:void 0),He=Me?Me.replace(/\/+$/,""):void 0,gt=at?.previewSprite?.stepSeconds??at?.previewSpriteStepSeconds,zt=typeof gt=="number"&&Number.isFinite(gt)&>>0?gt:N?.stepSeconds&&N.stepSeconds>0?N.stepSeconds:QN,Jt=Nm(at?.durationSeconds)??Nm(Le?.durationSeconds)??Nm(h[Pe]),un=typeof Jt=="number"&&Jt>0?Math.max(1,Math.min(200,Math.floor(Jt/zt)+1)):void 0,Xt=at?.previewSprite?.count??at?.previewSpriteCount??Bn?.previewScrubberCount??un,pn=at?.previewSprite?.cols??at?.previewSpriteCols,fn=at?.previewSprite?.rows??at?.previewSpriteRows,Kt=typeof Xt=="number"&&Number.isFinite(Xt)?Math.max(0,Math.floor(Xt)):0,[cn,dn]=Kt>1?ZN(Kt):[0,0],ln=Number(pn),qt=Number(fn),Rt=Number.isFinite(ln)&&Number.isFinite(qt)&&ln>0&&qt>0&&!(Kt>1&&ln===1&&qt===1)&&(Kt<=1||ln*qt>=Kt),Dt=Rt?Math.floor(ln):cn,Cn=Rt?Math.floor(qt):dn,Mt=(typeof at?.updatedAtUnix=="number"&&Number.isFinite(at.updatedAtUnix)?at.updatedAtUnix:void 0)??(typeof at?.fileModUnix=="number"&&Number.isFinite(at.fileModUnix)?at.fileModUnix:void 0)??R??0,Pn=He&&Mt?`${He}?v=${encodeURIComponent(String(Mt))}`:He||void 0,Dn=!!Pn&&Kt>1,Mn=Dn&&Dt>0&&Cn>0,Wt=Dn?Kt:0,Vn=Dn?zt:0,Yn=typeof F=="number"&&Wt>1?B1(F/(Wt-1),0,1):void 0,jn=Mn&&typeof F=="number"?(()=>{const ct=B1(F,0,Math.max(0,Kt-1)),jt=ct%Dt,De=Math.floor(ct/Dt),bt=Dt<=1?0:jt/(Dt-1)*100,xt=Cn<=1?0:De/(Cn-1)*100;return{backgroundImage:`url("${Pn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Dt*100}% ${Cn*100}%`,backgroundPosition:`${bt}% ${xt}%`}})():void 0,Qn=ou(yn),mn=!!Bn?.favorite,Ri=Bn?.liked===!0,Zn=!!Bn?.watching,Kn=XN(Bn?.tags),ni=q(Le),Si=Q(se(Le)),An=_e(Le),Fn=dd(An),Hn=`inline-prev-${encodeURIComponent(Pe)}`,ve=["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",vt&&"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(" "),rt=c.jsx("div",{role:"button",tabIndex:0,className:ve,onClick:e?void 0:()=>k(Le),onKeyDown:ct=>{(ct.key==="Enter"||ct.key===" ")&&(ct.preventDefault(),re(Le))},children:c.jsx(JN,{blurred:Ae?.blur,animateUnblurOnMount:Ae?.animateUnblurOnMount,children:c.jsxs(Ns,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:Hn,ref:Ae?.disableInline||Ae?.isDecorative?void 0:ne(Pe),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||Ae?.disablePreviewHover?void 0:()=>{ot(Pe),O?.(Pe)},onMouseLeave:()=>{!e&&!Ae?.disablePreviewHover&&O?.(null),ot(ct=>ct===Pe?null:ct),Ut(Pe),Ge(Pe,!1)},onClick:ct=>{ct.preventDefault(),ct.stopPropagation(),!(e||Ae?.disableInline)&&te(Pe)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[St?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 "+(St?"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:[ni,An?`${An.w}×${An.h}`:Fn||"",Si].filter(Boolean).join(" • "),children:[c.jsx("span",{children:ni}),Fn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,Fn?c.jsx("span",{children:Fn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Si})]})}),c.jsx(xu,{job:Le,getFileName:ct=>$r(G(ct)),className:"h-full w-full",variant:"fill",durationSeconds:h[Pe]??Le?.durationSeconds,onDuration:he,showPopover:!1,blur:St?!1:!!u,animated:Lt,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!Ae?.disableInline&&St?"always":!1,inlineNonce:an,inlineControls:St,inlineLoop:!1,muted:Tt,popoverMuted:Tt,assetNonce:R??0,alwaysLoadStill:Nt,teaserPreloadEnabled:Ae?.mobileStackTopOnlyVideo||Ae?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:Ae?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:Yn,preferScrubProgress:ie&&typeof F=="number"}),Mn&&Pn?c.jsx("img",{src:Pn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Mn&&jn&&!St?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,!Ae?.isDecorative&&!Ae?.disableScrubber&&!St&&Wt>1&&tt===Pe?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.stopPropagation(),onMouseEnter:()=>Ge(Pe,!0),onMouseLeave:()=>{Ge(Pe,!1),dt(Pe,void 0)},children:c.jsx(by,{className:"pointer-events-auto px-1",imageCount:Wt,activeIndex:F,onActiveIndexChange:ct=>dt(Pe,ct),onIndexClick:ct=>{if(e||Ae?.disableInline){E(Le,ct,Wt);return}const jt=Vn>0?ct*Vn:0;if(j){j(Pe,jt,Hn),requestAnimationFrame(()=>{V(Hn)||requestAnimationFrame(()=>V(Hn))});return}te(Pe),requestAnimationFrame(()=>{V(Hn)||requestAnimationFrame(()=>V(Hn))})},stepSeconds:Vn})}):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:It}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Qn?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(yn)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[Zn?c.jsx(yl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Ri?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,mn?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.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:vt,collapseToMenu:!0,compact:!1,isHot:Qn,isFavorite:mn,isLiked:Ri,isWatching:Zn,onToggleWatch:ke,onToggleFavorite:I,onToggleLike:pe,onToggleHot:fe,onKeep:z,onDelete:ae,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.stopPropagation(),children:c.jsx(cd,{rowKey:Pe,tags:Kn,activeTagSet:Z,lower:K,onToggleTagFilter:ee})})]})]})})});return{k:Pe,j:Le,busy:vt,isHot:Qn,inlineDomId:Hn,cardInner:rt}},Ze=3,et=e?n.slice(0,Ze):[],mt=e?n.slice(Ze,Ze+4):[],de=15,ze=Math.min(et.length,Ze)-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:ze>0?`${ze}px`:void 0},children:(()=>{const Le=et,Ae=Le[0],Pe=Le.slice(1);return c.jsxs(c.Fragment,{children:[Pe.map((Qe,St)=>{const Ot=St+1,{k:Tt,cardInner:an}=Ie(Qe,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),Nt=Ot,Lt=-(Nt*de),vt=1-Nt*.03,It=1-Nt*.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-Nt,transform:`translateY(${Lt}px) scale(${vt}) translateZ(0)`,opacity:It,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[an,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},Tt)}).reverse(),Ae?(()=>{const Qe=Ae,{k:St,busy:Ot,isHot:Tt,cardInner:an,inlineDomId:Nt}=Ie(Qe,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(e3,{animateOnMount:!0,children:c.jsx($N,{ref:Lt=>{Lt?D.current.set(St,Lt):D.current.delete(St)},enabled:!0,disabled:Ot,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!Tt){if(pt){pt(Qe);return}await fe?.(Qe)}},onTap:()=>{te(St),requestAnimationFrame(()=>{V(Nt)||requestAnimationFrame(()=>V(Nt))})},onSwipeLeft:()=>ye?ye(Qe):ae(Qe),onSwipeRight:()=>me?me(Qe):z(Qe),children:an})})},St)})():null]})})()}),mt.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:mt.map(Le=>{const Ae=B(Le);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(xu,{job:Le,getFileName:G,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:R??0,alwaysLoadStill:!0})},`preload-still-${Ae}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Le=>{const{k:Ae,cardInner:Pe}=Ie(Le);return c.jsx(m.Fragment,{children:Pe},Ae)})}),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 n3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 i3=m.forwardRef(n3);function r3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 s3=m.forwardRef(r3);function a3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 o3=m.forwardRef(a3);function l3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 P1=m.forwardRef(l3);function Fr(...n){return n.filter(Boolean).join(" ")}function F1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function u3(n){return n==="center"?"justify-center":n==="right"?"justify-end":"justify-start"}function U1(n,e){const t=n===0,i=n===e-1;return t||i?"pl-2 pr-2":"px-2"}function z1(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:D,rowClassName:R,onRowClick:E,onRowContextMenu:B,sort:G,onSortChange:Y,defaultSort:q=null}){const se=_?"py-2":"py-4",Q=_?"py-3":"py-3.5",K=G!==void 0,[O,re]=m.useState(q),k=K?G:O,j=m.useCallback(V=>{K||re(V),Y?.(V)},[K,Y]),te=m.useMemo(()=>{if(!k)return e;const V=n.find(ae=>ae.key===k.key);if(!V)return e;const ne=k.direction==="asc"?1:-1,he=e.map((ae,z)=>({r:ae,i:z}));return he.sort((ae,z)=>{let P=0;if(V.sortFn)P=V.sortFn(ae.r,z.r);else{const Z=V.sortValue?V.sortValue(ae.r):ae.r?.[V.key],ee=V.sortValue?V.sortValue(z.r):z.r?.[V.key],fe=z1(Z),I=z1(ee);fe.isNull&&!I.isNull?P=1:!fe.isNull&&I.isNull?P=-1:fe.kind==="number"&&I.kind==="number"?P=fe.valueI.value?1:0:P=String(fe.value).localeCompare(String(I.value),void 0,{numeric:!0})}return P===0?ae.i-z.i:P*ne}),he.map(ae=>ae.r)},[e,n,k]);return c.jsxs("div",{className:Fr(u?"":"px-4 sm:px-6 lg:px-8",D),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 he=U1(ne,n.length),ae=!!k&&k.key===V.key,z=ae?k.direction:void 0,P=V.sortable&&!V.srOnlyHeader?ae?z==="asc"?"ascending":"descending":"none":void 0,Z=()=>{if(!(!V.sortable||V.srOnlyHeader))return j(ae?z==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":P,className:Fr(Q,he,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",F1(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:Z,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",u3(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",ae?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(i3,{"aria-hidden":"true",className:Fr("size-5 transition-transform",ae&&z==="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(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):te.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:C})}):te.map((V,ne)=>{const he=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",R?.(V,ne)),onClick:()=>E?.(V),onContextMenu:B?ae=>{ae.preventDefault(),B(V,ae)}:void 0,children:n.map((ae,z)=>{const P=U1(z,n.length),Z=ae.cell?.(V,ne)??ae.accessor?.(V)??V?.[ae.key];return c.jsx("td",{className:Fr(se,P,"text-sm whitespace-nowrap",F1(ae.align),ae.className,ae.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Z},ae.key)})},he)})})]})})})})})})]})}function c3({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:D,setHoverTeaserKey:R,teaserPlayback:E="hover",teaserKey:B,registerTeaserHost:G,handleDuration:Y,handleResolution:q,blurPreviews:se,assetNonce:Q,deletingKeys:K,keepingKeys:O,removingKeys:re,modelsByKey:k,activeTagSet:j,onToggleTagFilter:te,onOpenPlayer:V,onSortModeChange:ne,page:he,onPageChange:ae,onToggleHot:z,onToggleFavorite:P,onToggleLike:Z,onToggleWatch:ee,deleteVideo:fe,keepVideo:I,enqueueDeleteVideo:pe,enqueueKeepVideo:ke,enqueueToggleHot:ye}){const[me,pt]=m.useState(null),We=m.useCallback(Ge=>{const Ie=Ge?.durationSeconds;if(typeof Ie=="number"&&Number.isFinite(Ie)&&Ie>0)return Ie;const Ze=Date.parse(String(Ge?.startedAt||"")),et=Date.parse(String(Ge?.endedAt||""));if(Number.isFinite(Ze)&&Number.isFinite(et)&&et>Ze){const ft=(et-Ze)/1e3;if(ft>=1&&ft<=1440*60)return ft}return Number.POSITIVE_INFINITY},[]),_e=m.useCallback(Ge=>{const Ie=String(Ge??"").trim();if(!Ie)return[];const Ze=Ie.split(/[\n,;|]+/g).map(mt=>mt.trim()).filter(Boolean),et=new Set,ft=[];for(const mt of Ze){const de=mt.toLowerCase();et.has(de)||(et.add(de),ft.push(mt))}return ft.sort((mt,de)=>mt.localeCompare(de,void 0,{sensitivity:"base"})),ft},[]),Ye=m.useCallback(Ge=>{const Ie=Ge?.meta;if(!Ie)return null;if(typeof Ie=="string")try{return JSON.parse(Ie)}catch{return null}return Ie},[]),wt=m.useCallback(Ge=>{const Ie=Ye(Ge);let Ze=Ie?.previewSprite??Ie?.preview?.sprite??null;if(typeof Ze=="string")try{Ze=JSON.parse(Ze)}catch{Ze=null}const et=Number(Ze?.count),ft=Number(Ze?.stepSeconds);return!Number.isFinite(et)||et<2?null:{count:Math.max(2,Math.floor(et)),stepSeconds:Number.isFinite(ft)&&ft>0?ft:5}},[Ye]),[je,Se]=m.useState({}),Je=m.useCallback((Ge,Ie)=>{Se(Ze=>Ze[Ge]===Ie?Ze:{...Ze,[Ge]:Ie})},[]),tt=m.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Ge=>{const Ie=t(Ge),et=!(!!C&&D===Ie),ft=wt(Ge),mt=je[Ie],de=i(Ge.output||""),ze=$r(de.replace(/\.[^.]+$/,"")).trim(),Le=ft&&typeof mt=="number"?Math.max(0,mt*ft.stepSeconds):void 0,Ae=ze&&typeof Le=="number"?`/api/preview?id=${encodeURIComponent(ze)}&t=${Le.toFixed(3)}&v=${Q??0}`:"";return c.jsxs("div",{ref:G(Ie),className:"group relative py-1",onClick:Pe=>Pe.stopPropagation(),onMouseDown:Pe=>Pe.stopPropagation(),onMouseEnter:()=>{S&&R(Ie)},onMouseLeave:()=>{S&&R(null),Je(Ie,void 0)},children:[c.jsx(xu,{job:Ge,getFileName:i,durationSeconds:_[Ie],muted:et,popoverMuted:et,onDuration:Y,onResolution:q,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:se,animated:E==="all"?!0:E==="hover"?B===Ie:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:Q}),ft&&typeof mt=="number"&&Ae?c.jsx("img",{src:Ae,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:Ge=>{const Ie=i(Ge.output||""),Ze=ou(Ie),et=l(Ge.output),ft=$r(Ie);return`${et} ${Ze?"HOT":""} ${ft}`.trim()},cell:Ge=>{const Ie=i(Ge.output||""),Ze=ou(Ie),et=$r(Ie),ft=l(Ge.output),mt=a(l(Ge.output)),de=_e(k[mt]?.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:ft}),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:et,children:et||"—"}),(()=>{const ze=t(Ge),Le=g[ze]??null,Ae=dd(Le);return Ae?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:Ae}):null})(),Ze?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]}),de.length>0?c.jsx("div",{className:"mt-1",onClick:ze=>ze.stopPropagation(),onMouseDown:ze=>ze.stopPropagation(),children:c.jsx(cd,{rowKey:t(Ge),tags:de,activeTagSet:j,lower:a,onToggleTagFilter:te,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Ge=>{const Ie=Date.parse(String(Ge.endedAt||""));return Number.isFinite(Ie)?Ie:Number.NEGATIVE_INFINITY},cell:Ge=>{const Ie=Date.parse(String(Ge.endedAt||""));if(!Number.isFinite(Ie))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const Ze=new Date(Ie),et=Ze.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),ft=Ze.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:Ze.toISOString(),title:`${et} ${ft}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[c.jsx("span",{className:"font-medium",children:et}),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:ft})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Ge=>We(Ge),cell:Ge=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(Ge)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Ge=>{const Ie=h(Ge);return typeof Ie=="number"?Ie:Number.NEGATIVE_INFINITY},cell:Ge=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(Ge))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Ge=>{const Ie=t(Ge),Ze=K.has(Ie)||O.has(Ie)||re.has(Ie),et=i(Ge.output||""),ft=ou(et),mt=a(l(Ge.output)),de=k[mt],ze=!!de?.favorite,Le=de?.liked===!0,Ae=!!de?.watching;return c.jsx(Ds,{job:Ge,variant:"table",busy:Ze,isHot:ft,isFavorite:ze,isLiked:Le,isWatching:Ae,onToggleWatch:ee,onToggleFavorite:P,onToggleLike:Z,onToggleHot:z?async Pe=>{if(!(ye&&ye(Pe)))return z(Pe)}:void 0,onKeep:async Pe=>ke&&ke(Pe)?!0:I(Pe),onDelete:async Pe=>pe&&pe(Pe)?!0:fe(Pe),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,_,C,D,G,S,R,Y,q,se,E,B,Q,a,l,k,j,te,g,K,O,re,wt,je,Je,ee,P,Z,z,I,fe,h,f,u,_e,We]),ot=m.useCallback(Ge=>{if(!Ge)return"completed_desc";const Ie=Ge,Ze=String(Ie.key??Ie.columnKey??Ie.id??""),et=String(Ie.dir??Ie.direction??Ie.order??"").toLowerCase(),ft=et==="asc"||et==="1"||et==="true";return Ze==="completedAt"?ft?"completed_asc":"completed_desc":Ze==="runtime"?ft?"duration_asc":"duration_desc":Ze==="size"?ft?"size_asc":"size_desc":Ze==="Model"||Ze==="video"?ft?"file_asc":"file_desc":ft?"completed_asc":"completed_desc"},[]),dt=m.useCallback(Ge=>{pt(Ge),ne(ot(Ge)),he!==1&&ae(1)},[ne,ot,he,ae]),Ut=m.useCallback(Ge=>{const Ie=t(Ge);return["transition-all duration-300",(K.has(Ie)||re.has(Ie))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",K.has(Ie)&&"animate-pulse",(O.has(Ie)||re.has(Ie))&&"pointer-events-none",O.has(Ie)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",re.has(Ie)&&"opacity-0"].filter(Boolean).join(" ")},[t,K,O,re]);return c.jsxs("div",{className:"relative",children:[c.jsx(td,{rows:n,columns:tt,getRowKey:Ge=>t(Ge),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:me,onSortChange:dt,onRowClick:V,rowClassName:Ut}),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 $1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function d3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function Dm(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function H1(n,e,t){return Math.max(e,Math.min(t,n))}const h3=5;function f3(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);(fJe=>{if(!fe){se(Se)(null);return}se(Se)(Je)},[se,fe]),pe=Se=>{const Je=String(Se??"").trim();if(!Je)return[];const tt=Je.split(/[\n,;|]+/g).map(Ut=>Ut.trim()).filter(Boolean),ot=new Set,dt=[];for(const Ut of tt){const Ge=Ut.toLowerCase();ot.has(Ge)||(ot.add(Ge),dt.push(Ut))}return dt},ke=m.useCallback(Se=>{const Je=(typeof Se?.meta?.videoWidth=="number"&&Number.isFinite(Se.meta.videoWidth)?Se.meta.videoWidth:0)||(typeof Se?.videoWidth=="number"&&Number.isFinite(Se.videoWidth)?Se.videoWidth:0),tt=(typeof Se?.meta?.videoHeight=="number"&&Number.isFinite(Se.meta.videoHeight)?Se.meta.videoHeight:0)||(typeof Se?.videoHeight=="number"&&Number.isFinite(Se.videoHeight)?Se.videoHeight:0);return Je>0&&tt>0?{w:Je,h:tt}:null},[]),[ye,me]=m.useState(null),[pt,We]=m.useState({}),[_e,Ye]=m.useState(null),wt=m.useCallback((Se,Je)=>{We(tt=>{if(Je===void 0){if(!(Se in tt))return tt;const ot={...tt};return delete ot[Se],ot}return tt[Se]===Je?tt:{...tt,[Se]:Je}})},[]),je=m.useCallback(Se=>{wt(Se,void 0)},[wt]);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(Se=>{const Je=_(Se),ot=!(!!l&&u===Je),dt=C(Se.output),Ut=j(dt),Ge=te[Ut],Ie=!!Ge?.favorite,Ze=Ge?.liked===!0,et=!!Ge?.watching,ft=pe(Ge?.tags),mt=S(Se.output||""),de=ou(mt),ze=$r(mt),Le=D(Se),Ae=E(R(Se)),Pe=ke(Se),Qe=dd(Pe),St=B.has(Je)||G.has(Je)||Y.has(Je),Ot=q.has(Je),Tt=$1(Ge?.image,Ge?.imageUrl,Se?.meta?.modelImage,Se?.meta?.modelImageUrl),Nt=$r(S(Se.output||"")).replace(/\.[^.]+$/,"").trim(),Lt=d3(Se?.meta),vt=$1(Lt?.previewSprite?.path,Lt?.previewSpritePath,Ge?.previewScrubberPath,Nt?`/api/preview-sprite/${encodeURIComponent(Nt)}`:void 0),It=vt?vt.replace(/\/+$/,""):void 0,yn=Lt?.previewSprite?.stepSeconds??Lt?.previewSpriteStepSeconds,$n=typeof yn=="number"&&Number.isFinite(yn)&&yn>0?yn:h3,kt=Dm(Lt?.durationSeconds)??Dm(Se?.durationSeconds)??Dm(i[Je]),Bn=typeof kt=="number"&&kt>0?Math.max(1,Math.min(200,Math.floor(kt/$n)+1)):void 0,at=Lt?.previewSprite?.count??Lt?.previewSpriteCount??Ge?.previewScrubberCount??Bn,N=Lt?.previewSprite?.cols??Lt?.previewSpriteCols,F=Lt?.previewSprite?.rows??Lt?.previewSpriteRows,ie=typeof at=="number"&&Number.isFinite(at)?Math.max(0,Math.floor(at)):0,[Me,He]=ie>1?f3(ie):[0,0],gt=typeof N=="number"&&Number.isFinite(N)?Math.max(0,Math.floor(N)):Me,zt=typeof F=="number"&&Number.isFinite(F)?Math.max(0,Math.floor(F)):He,Jt=(typeof Lt?.updatedAtUnix=="number"&&Number.isFinite(Lt.updatedAtUnix)?Lt.updatedAtUnix:void 0)??(typeof Lt?.fileModUnix=="number"&&Number.isFinite(Lt.fileModUnix)?Lt.fileModUnix:void 0)??0,un=It&&Jt?`${It}?v=${encodeURIComponent(String(Jt))}`:It||void 0,Xt=!!un&&ie>1,pn=Xt&>>0&&zt>0,fn=Xt?ie:0,Kt=Xt?$n:0,cn=Xt,dn=pt[Je],ln=typeof dn=="number"&&fn>1?H1(dn/(fn-1),0,1):void 0,qt=pn&&typeof dn=="number"?(()=>{const Mt=H1(dn,0,Math.max(0,ie-1)),Pn=Mt%gt,Dn=Math.floor(Mt/gt),Mn=gt<=1?0:Pn/(gt-1)*100,Wt=zt<=1?0:Dn/(zt-1)*100;return{backgroundImage:`url("${un}")`,backgroundRepeat:"no-repeat",backgroundSize:`${gt*100}% ${zt*100}%`,backgroundPosition:`${Mn}% ${Wt}%`}})():void 0,Rt=ye===Je&&!!Tt,Dt=!Rt&&!!qt,Cn=Rt||Dt;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",St&&"pointer-events-none opacity-70",B.has(Je)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",Y.has(Je)&&"opacity-0 translate-y-2 scale-[0.98]",Ot&&"hidden"].filter(Boolean).join(" "),onClick:()=>K(Se),onKeyDown:Mt=>{(Mt.key==="Enter"||Mt.key===" ")&&K(Se)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:I(Je),onMouseEnter:()=>{Ye(Je),Q?.(Je)},onMouseLeave:()=>{Ye(Mt=>Mt===Je?null:Mt),Q?.(null),je(Je),me(Mt=>Mt===Je?null:Mt)},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:Se,getFileName:Mt=>$r(S(Mt)),durationSeconds:i[Je]??Se?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Cn?!1:a==="all"?!0:a==="hover"?h===Je:!1,animatedMode:"teaser",animatedTrigger:"always",muted:ot,popoverMuted:ot,scrubProgressRatio:ln,preferScrubProgress:typeof dn=="number"})}),pn&&un?c.jsx("img",{src:un,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Dt&&qt?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:qt})}):null,Rt&&Tt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:Tt,alt:dt?`${dt} 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,cn&&_e===Je?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation(),children:c.jsx(by,{className:"pointer-events-auto px-1",imageCount:fn,activeIndex:dn,onActiveIndexChange:Mt=>wt(Je,Mt),onIndexClick:Mt=>{wt(Je,Mt),g(Se,Mt,fn)},stepSeconds: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",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}`:Qe||"",Ae].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Le}),Qe?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,Qe?c.jsx("span",{children:Qe}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Ae})]})})]})}),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:[de?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(ze)||"—",children:$r(ze)||"—"})]})}),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",Tt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:Tt?`${dt} (Hover: Model-Preview)`:dt,onMouseEnter:Mt=>{Mt.stopPropagation(),Tt&&me(Je)},onMouseLeave:Mt=>{Mt.stopPropagation(),me(Pn=>Pn===Je?null:Pn)},onMouseDown:Mt=>Mt.stopPropagation(),onClick:Mt=>Mt.stopPropagation(),children:dt||"—"})}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[et?c.jsx(yl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Ze?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Ie?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.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:Se,variant:"table",busy:St,collapseToMenu:!0,compact:!0,isHot:de,isFavorite:Ie,isLiked:Ze,isWatching:et,onToggleWatch:z,onToggleFavorite:he,onToggleLike:ae,onToggleHot:async Mt=>{if(!(ee&&ee(Mt)))return k(Mt)},onKeep:async Mt=>Z&&Z(Mt)?!0:re(Mt),onDelete:async Mt=>P&&P(Mt)?!0:O(Mt),order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation(),children:c.jsx(cd,{rowKey:Je,tags:ft,activeTagSet:V,lower:j,onToggleTagFilter:ne})})]})]},Je)})}),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 q1(n,e,t){return Math.max(e,Math.min(t,n))}function Mm(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function m3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=Mm(a,Math.min(t,l)),h=Mm(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+1t&&_.push(l-t),_.push(...h);const S=new Set;return _.filter(C=>{const D=String(C);return S.has(D)?!1:(S.add(D),!0)})}function g3({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:nn("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=q1(n||1,1,S);if(S<=1)return null;const D=t===0?0:(C-1)*e+1,R=Math.min(C*e,t),E=m3(S,C,l,a),B=G=>i(q1(G,1,S));return c.jsxs("div",{className:nn("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:D})," to"," ",c.jsx("span",{className:"font-medium",children:R})," 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(s3,{"aria-hidden":"true",className:"size-5"})]}),E.map((G,Y)=>G==="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(g3,{active:G===C,onClick:()=>B(G),rounded:"none",children:G},G)),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(o3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Rw=m.createContext(null),jm=220;function y3(n){switch(n){case"success":return{Icon:PA,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:bN,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:qA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:QA,cls:"text-sky-600 dark:text-sky-400"}}}function b3(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 v3(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 x3(n){switch(n){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function _3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function w3({children:n,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[a,l]=m.useState([]),[u,h]=m.useState(!0),f=m.useRef({}),g=m.useRef({}),_=m.useRef({}),S=m.useRef({}),C=m.useRef({}),D=m.useCallback(k=>{const j=f.current[k];j&&(window.clearTimeout(j),delete f.current[k]);const te=g.current[k];te&&(window.clearTimeout(te),delete g.current[k]),delete _.current[k],delete S.current[k],delete C.current[k]},[]),R=m.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{}},[]);m.useEffect(()=>{R();const k=()=>R();return window.addEventListener("recorder-settings-updated",k),()=>window.removeEventListener("recorder-settings-updated",k)},[R]),m.useEffect(()=>{u||(l(j=>j.map(te=>te.type==="error"?te:{...te,open:!1})),a.filter(j=>j.type!=="error").map(j=>j.id).forEach(j=>{D(j),g.current[j]=window.setTimeout(()=>{l(te=>te.filter(V=>V.id!==j)),delete g.current[j]},jm)}))},[u]);const E=m.useCallback(k=>{l(j=>j.map(te=>te.id===k?{...te,open:!1}:te)),D(k),g.current[k]=window.setTimeout(()=>{l(j=>j.filter(te=>te.id!==k)),delete g.current[k]},jm)},[D]),B=m.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([]),jm)},[]),G=m.useCallback((k,j)=>{if(!j||j<=0)return;const te=f.current[k];te&&(window.clearTimeout(te),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=m.useCallback(k=>{if(!u&&k.type!=="error")return"";const j=_3(),te=k.durationMs??t;return l(V=>{const ne=[{...k,id:j,durationMs:te,open:!0},...V],he=Math.max(1,e),ae=ne.slice(0,he);return ne.slice(he).forEach(P=>D(P.id)),ae}),te&&te>0&&G(j,te),j},[t,e,u,D,G]),q=m.useCallback(k=>{if(C.current[k])return;const j=f.current[k];if(!j)return;window.clearTimeout(j),delete f.current[k];const te=_.current[k]??Date.now(),V=S.current[k]??0,ne=Date.now()-te,he=Math.max(0,V-ne);S.current[k]=he,C.current[k]=!0},[]),se=m.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]);m.useEffect(()=>()=>{Object.values(f.current).forEach(k=>window.clearTimeout(k)),Object.values(g.current).forEach(k=>window.clearTimeout(k))},[]);const Q=m.useMemo(()=>({push:Y,remove:E,clear:B}),[Y,E,B]),K=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",O=i.endsWith("left")?"sm:items-start":"sm:items-end",re=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return c.jsxs(Rw.Provider,{value:Q,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",re].join(" "),children:c.jsx("div",{className:["flex w-full px-3 py-4 sm:px-6 sm:py-6",K].join(" "),children:c.jsx("div",{className:["flex w-full flex-col gap-2.5 sm:gap-3",O].join(" "),children:a.map(k=>{const{Icon:j,cls:te}=y3(k.type),V=v3(k.type),ne=(k.title||"").trim()||x3(k.type),he=(k.message||"").trim(),ae=(k.imageUrl||"").trim(),z=(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]":"",b3(k.type)].join(" "),onMouseEnter:()=>q(k.id),onMouseLeave:()=>se(k.id),onFocus:()=>q(k.id),onBlur:()=>se(k.id),onClick:()=>{k.onClick&&(k.onClick(),k.closeOnClick!==!1&&E(k.id))},onKeyDown:Z=>{k.onClick&&(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),k.onClick(),k.closeOnClick!==!1&&E(k.id))},tabIndex:P?0:void 0,"aria-label":P?`${ne} öffnen`:void 0,children:ae?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:ae,alt:z,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}),he?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:he}):null]})]}),c.jsxs("button",{type:"button",onClick:Z=>{Z.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(P1,{"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",te].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}),he?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:he}):null]})]}),c.jsxs("button",{type:"button",onClick:Z=>{Z.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(P1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]})})},k.id)})})})})]})}function T3(){const n=m.useContext(Rw);if(!n)throw new Error("useToast must be used within ");return n}function Ow(){const{push:n,remove:e,clear:t}=T3(),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 S3(n){return typeof n=="number"?n:n==="xs"?12:n==="sm"?16:n==="lg"?28:20}function V1(...n){return n.filter(Boolean).join(" ")}function G1({size:n="md",className:e,label:t,srLabel:i="Lädt…",center:a=!1}){const l=S3(n);return c.jsxs("span",{className:V1("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:V1("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 vy=n=>(n||"").replaceAll("\\","/"),rr=n=>{const t=vy(n).split("/");return t[t.length-1]||""},bi=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):rr(n.output||"")||String(n?.output||"")},k3=n=>{const e=vy(String(n??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function K1(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 Rm(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=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function W1(n){const[e,t]=m.useState(!1);return m.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=rr(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},ns=n=>(n||"").trim().toLowerCase(),E3=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},Om=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 X1(n){return new Promise(e=>window.setTimeout(e,n))}function C3(n){return n instanceof Error?n.message||String(n):String(n??"")}function Y1(n){const e=C3(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 Lm(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 A3(){const n=m.useRef([]),e=m.useRef(!1),t=m.useRef(!1),i=m.useRef(new Set),a=m.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=m.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=m.useCallback((f,g)=>!f||i.current.has(f)?!1:(i.current.add(f),n.current.push({id:f,run:g}),a(),!0),[a]),h=m.useCallback(f=>i.current.has(f),[]);return{enqueue:u,isQueued:h}}function N3({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:D,pageSize:R,onPageChange:E,assetNonce:B,sortMode:G,onSortModeChange:Y,modelsByKey:q,loadMode:se="paged"}){const Q=se==="all",K=i??"hover",O=W1("(hover: hover) and (pointer: fine)"),re=Ow(),k=A3(),j=m.useRef(new Map),[te,V]=m.useState(null),[ne,he]=m.useState(null),ae=m.useRef(null),z=m.useRef(new WeakMap),[P,Z]=m.useState(()=>new Set),[ee,fe]=m.useState(()=>new Set),[I,pe]=m.useState(!1),ke=m.useRef(!1),ye=m.useRef(!1),me=m.useRef(0),pt="finishedDownloads_lastUndo_v1",[We,_e]=m.useState(()=>{if(typeof window>"u")return null;try{const U=localStorage.getItem(pt);if(!U)return null;const W=JSON.parse(U);if(!W||W.v!==1||!W.action)return null;const le=Date.now()-Number(W.ts||0);return!Number.isFinite(le)||le<0||le>1800*1e3?(localStorage.removeItem(pt),null):W.action}catch{return null}}),[Ye,wt]=m.useState(!1);m.useEffect(()=>{try{if(!We){localStorage.removeItem(pt);return}const U={v:1,action:We,ts:Date.now()};localStorage.setItem(pt,JSON.stringify(U))}catch{}},[We]);const[je,Se]=m.useState({}),[Je,tt]=m.useState(null),[ot,dt]=m.useState(null),[Ut,Ge]=m.useState(0),Ie=m.useRef(null),Ze=m.useRef({pending:0,t:0,timer:0}),et=m.useCallback(U=>{!U||!Number.isFinite(U)||(Ze.current.pending+=U,!Ze.current.timer&&(Ze.current.timer=window.setTimeout(()=>{Ze.current.timer=0;const W=Ze.current.pending;Ze.current.pending=0,W&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:W}}))},120)))},[]),ft="finishedDownloads_view",mt="finishedDownloads_includeKeep_v2",de="finishedDownloads_mobileOptionsOpen_v1",[ze,Le]=m.useState("table"),[Ae,Pe]=m.useState(!1),[Qe,St]=m.useState(!1),Ot=m.useRef(new Map),[Tt,an]=m.useState([]),Nt=m.useMemo(()=>new Set(Tt.map(ns)),[Tt]),Lt=m.useMemo(()=>{const U={},W={};for(const[le,be]of Object.entries(q??{})){const Ce=ns(le),Oe=E3(be?.tags);U[Ce]=Oe,W[Ce]=new Set(Oe.map(ns))}return{tagsByModelKey:U,tagSetByModelKey:W}},[q]),[vt,It]=m.useState(""),yn=m.useDeferredValue(vt),$n=m.useMemo(()=>ns(yn).split(/\s+/g).map(U=>U.trim()).filter(Boolean),[yn]),kt=m.useCallback(()=>It(""),[]),Bn=m.useCallback(U=>{const W=ns(U);an(le=>le.some(Ce=>ns(Ce)===W)?le.filter(Ce=>ns(Ce)!==W):[...le,U])},[]),N=Nt.size>0||$n.some(U=>U.length>=2),F=N||Q,ie=m.useCallback(async U=>{const W=Je==null;W&&pe(!0);try{const le=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(G)}&withCount=1${Ae?"&includeKeep=1":""}`,{cache:"no-store",signal:U});if(!le.ok)return;const be=await le.json().catch(()=>null),Ce=Array.isArray(be?.items)?be.items:[],Oe=Number(be?.count??be?.totalCount??Ce.length);tt(Ce),dt(Number.isFinite(Oe)?Oe:Ce.length)}finally{W&&pe(!1)}},[G,Ae]),Me=m.useCallback(()=>an([]),[]);m.useEffect(()=>{try{const U=localStorage.getItem("finishedDownloads_pendingTags");if(!U)return;const W=JSON.parse(U),le=Array.isArray(W)?W.map(be=>String(be||"").trim()).filter(Boolean):[];if(le.length===0)return;yu.flushSync(()=>an(le)),D!==1&&E(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const He=m.useCallback(()=>{Ie.current==null&&(Ie.current=window.setTimeout(()=>{Ie.current=null,Ge(U=>U+1)},80))},[D,R,G,Ae]);m.useEffect(()=>{if(!F)return;const U=new AbortController,W=window.setTimeout(()=>{ie(U.signal).catch(()=>{})},250);return()=>{window.clearTimeout(W),U.abort()}},[F,ie]),m.useEffect(()=>{if(Ut===0)return;const U=new AbortController;let W=!0,le=!1;const be=++me.current,Ce=()=>{le||(le=!0,me.current===be&&(ke.current=!1,ye.current&&(ye.current=!1,He())))};return me.current===be&&(ke.current=!0),F?((async()=>{try{await ie(U.signal),W&&(cn.current=0)}catch{}finally{W&&Ce()}})(),()=>{W=!1,U.abort(),Ce()}):(pe(!0),(async()=>{try{const Oe=await fetch(`/api/record/done?page=${D}&pageSize=${R}&sort=${encodeURIComponent(G)}&withCount=1${Ae?"&includeKeep=1":""}`,{cache:"no-store",signal:U.signal});if(!W||U.signal.aborted)return;const ht=Oe.ok;if(Oe.ok){const At=await Oe.json().catch(()=>null);if(!W||U.signal.aborted)return;const yt=Array.isArray(At?.items)?At.items:Array.isArray(At)?At:[];tt(yt);const rn=Number(At?.count??At?.totalCount??yt.length),Yt=Number.isFinite(rn)&&rn>=0?rn:0;dt(Yt);const Rn=Math.max(1,Math.ceil(Yt/R));if(D>Rn){E(Rn),tt(null);return}}if(ht)cn.current=0;else if(W&&!U.signal.aborted&&cn.current<2){cn.current+=1;const At=cn.current;window.setTimeout(()=>{U.signal.aborted||Ge(yt=>yt+1)},400*At)}}catch{}finally{W&&(pe(!1),Ce())}})(),()=>{W=!1,U.abort(),Ce()})},[Ut,F,ie,D,R,G,Ae,E]),m.useEffect(()=>{F||(tt(null),dt(null))},[D,R,G,Ae,F]),m.useEffect(()=>{if(!Ae){N||(tt(null),dt(null));return}if(N)return;const U=new AbortController;return(async()=>{try{const W=await fetch(`/api/record/done?page=${D}&pageSize=${R}&sort=${encodeURIComponent(G)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:U.signal});if(!W.ok)return;const le=await W.json().catch(()=>null),be=Array.isArray(le?.items)?le.items:[],Ce=Number(le?.count??le?.totalCount??be.length);tt(be),dt(Number.isFinite(Ce)?Ce:be.length)}catch{}})(),()=>U.abort()},[Ae,N,D,R,G]),m.useEffect(()=>{try{const U=localStorage.getItem(ft);Le(U==="table"||U==="cards"||U==="gallery"?U:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Le("table")}},[]),m.useEffect(()=>{try{localStorage.setItem(ft,ze)}catch{}},[ze]),m.useEffect(()=>{try{const U=localStorage.getItem(mt);Pe(U==="1"||U==="true"||U==="yes")}catch{Pe(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(mt,Ae?"1":"0")}catch{}},[Ae]),m.useEffect(()=>{try{const U=localStorage.getItem(de);St(U==="1"||U==="true"||U==="yes")}catch{St(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(de,Qe?"1":"0")}catch{}},[Qe]);const[gt,zt]=m.useState({}),Jt=m.useRef({}),un=m.useRef(null),[Xt,pn]=m.useState({}),fn=m.useRef({}),Kt=m.useRef(null),cn=m.useRef(0);m.useEffect(()=>{fn.current=Xt},[Xt]);const dn=m.useCallback(()=>{Kt.current==null&&(Kt.current=window.setTimeout(()=>{Kt.current=null,pn({...fn.current})},200))},[]);m.useEffect(()=>()=>{Kt.current!=null&&(window.clearTimeout(Kt.current),Kt.current=null)},[]),m.useEffect(()=>{Jt.current=gt},[gt]);const ln=m.useCallback(()=>{un.current==null&&(un.current=window.setTimeout(()=>{un.current=null,zt({...Jt.current})},200))},[]);m.useEffect(()=>()=>{un.current!=null&&(window.clearTimeout(un.current),un.current=null)},[]);const[qt,Rt]=m.useState(null),Dt=!a,Cn=m.useCallback(U=>{const le=document.getElementById(U)?.querySelector("video");if(!le)return!1;ud(le,{muted:Dt});const be=le.play?.();return be&&typeof be.catch=="function"&&be.catch(()=>{}),!0},[Dt]),Mt=m.useCallback(U=>{Rt(W=>W?.key===U?{key:U,nonce:W.nonce+1}:{key:U,nonce:1})},[]),Pn=m.useCallback((U,W,le)=>{const be=Number.isFinite(W)&&W>0?W:0;Rt(Oe=>Oe?.key===U?{key:U,nonce:Oe.nonce+1}:{key:U,nonce:1});const Ce=Oe=>{const At=document.getElementById(le)?.querySelector("video");if(!At){Oe>0&&requestAnimationFrame(()=>Ce(Oe-1));return}ud(At,{muted:Dt});const yt=()=>{try{const ui=Number(At.duration),Kr=Number.isFinite(ui)&&ui>0?Math.max(0,ui-.05):be;At.currentTime=Math.max(0,Math.min(be,Kr))}catch{}const Rn=At.play?.();Rn&&typeof Rn.catch=="function"&&Rn.catch(()=>{})};if(At.readyState>=1){yt();return}const rn=()=>{At.removeEventListener("loadedmetadata",rn),yt()};At.addEventListener("loadedmetadata",rn,{once:!0});const Yt=At.play?.();Yt&&typeof Yt.catch=="function"&&Yt.catch(()=>{})};requestAnimationFrame(()=>Ce(8))},[Dt]),Dn=m.useCallback(U=>{Rt(null),l(U)},[l]),Mn=m.useCallback((U,W)=>{const le=Number.isFinite(W)&&W>=0?W:0;Rt(null),l(U,le)},[l]),Wt=m.useCallback((U,W,le)=>{const be=Number.isFinite(W)?Math.floor(W):0,Ce=Number.isFinite(le)?Math.floor(le):0;if(Ce<=0){Dn(U);return}const Oe=bi(U),ht=gt[Oe]??U?.durationSeconds??0;if(!Number.isFinite(ht)||ht<=0){Dn(U);return}const At=Math.max(0,Math.min(be,Ce-1)),yt=ht/Ce,rn=At*yt;Mn(U,rn)},[gt,bi,Dn,Mn]),Vn=m.useCallback((U,W)=>{fe(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Yn=m.useCallback(U=>{Z(W=>{const le=new Set(W);return le.add(U),le})},[]),[jn,Qn]=m.useState(()=>new Set),mn=m.useCallback((U,W)=>{Qn(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),[Ri,Zn]=m.useState(()=>new Set),Kn=m.useRef(new Map);m.useEffect(()=>()=>{for(const U of Kn.current.values())window.clearTimeout(U);Kn.current.clear()},[]);const ni=m.useCallback((U,W)=>{Zn(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Si=m.useCallback(U=>{const W=Kn.current.get(U);W!=null&&(window.clearTimeout(W),Kn.current.delete(U))},[]),An=m.useCallback(U=>{Si(U),Z(W=>{const le=new Set(W);return le.delete(U),le}),Zn(W=>{const le=new Set(W);return le.delete(U),le}),fe(W=>{const le=new Set(W);return le.delete(U),le}),Qn(W=>{const le=new Set(W);return le.delete(U),le})},[Si]),Fn=m.useCallback(U=>{ni(U,!0),Si(U);const W=window.setTimeout(()=>{Kn.current.delete(U),Yn(U),ni(U,!1)},320);Kn.current.set(U,W)},[Yn,ni,Si]),Hn=m.useCallback(async(U,W)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),W?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:U}})),await new Promise(le=>requestAnimationFrame(()=>le())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),await new Promise(le=>window.setTimeout(le,260))},[]),ve=m.useCallback(async(U,W,le)=>{const be=Math.max(1,le?.attempts??4),Ce=Math.max(50,le?.baseDelayMs??220);let Oe;for(let ht=1;ht<=be;ht++)try{return await Hn(U,{close:le?.close??!0}),ht>1?await X1(Ce*ht):await X1(80),await W()}catch(At){if(Oe=At,!Y1(At)||ht>=be)throw At;continue}throw Oe instanceof Error?Oe:new Error(String(Oe??"Unbekannter Fehler"))},[Hn]),rt=m.useCallback(async U=>{const{file:W,rowKey:le,setBusy:be,isBusyNow:Ce,optimisticRemove:Oe,alreadyRemoved:ht,run:At,onSuccess:yt,onError:rn,labels:Yt}=U;if(!W)return re.error(Yt.invalidTitle,Yt.invalidBody),{ok:!1};if(Ce?.())return{ok:!1};be?.(!0);try{Oe&&!ht&&Fn(le);const Rn=await At();return await yt?.(Rn),{ok:!0,result:Rn}}catch(Rn){if(Oe&&An(le),await rn?.(Rn),Y1(Rn))re.error(Yt.inUseTitle,`${W} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const ui=Rn?.message?` — ${String(Rn.message)}`:"";re.error(Yt.failTitle,`${Yt.failPrefix??W}${ui}`)}return{ok:!1}}finally{be?.(!1)}},[re,Fn,An]),ct=m.useCallback(async(U,W)=>{const le=rr(U.output||""),be=bi(U);return(await rt({kind:"delete",job:U,file:le,rowKey:be,setBusy:Oe=>Vn(be,Oe),isBusyNow:()=>ee.has(be),optimisticRemove:!0,alreadyRemoved:W?.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:le},run:async()=>u?await ve(le,async()=>await u(U),{close:!0,attempts:4,baseDelayMs:220}):await(await ve(le,async()=>await Lm(`/api/record/delete?file=${encodeURIComponent(le)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Oe=>{if(u){const yt=typeof Oe?.undoToken=="string"?Oe.undoToken:"";_e(yt?{kind:"delete",undoToken:yt,originalFile:le,rowKey:be}:null);return}const ht=Oe?.from==="keep"?"keep":"done",At=typeof Oe?.undoToken=="string"?Oe.undoToken:"";_e(At?{kind:"delete",undoToken:At,originalFile:le,rowKey:be,from:ht}:null),He(),et(-1)}})).ok},[rr,bi,ee,Vn,u,ve,rt,He,et]),jt=m.useCallback(async(U,W)=>{const le=rr(U.output||""),be=bi(U);return(await rt({kind:"keep",job:U,file:le,rowKey:be,setBusy:Oe=>mn(be,Oe),isBusyNow:()=>jn.has(be)||ee.has(be),optimisticRemove:!0,alreadyRemoved:W?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:le},run:async()=>S?await ve(le,async()=>await S(U),{close:!0,attempts:4,baseDelayMs:220}):await(await ve(le,async()=>await Lm(`/api/record/keep?file=${encodeURIComponent(le)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Oe=>{const ht=typeof Oe?.newFile=="string"&&Oe.newFile?Oe.newFile:le;_e({kind:"keep",keptFile:ht,originalFile:le,rowKey:be}),He(),et(Ae?0:-1)}})).ok},[rr,bi,mn,jn,ee,ve,rt,He,et,Ae]),De=m.useCallback((U,W)=>{!U||!W||U===W||Se(le=>{const be={...le};for(const[Ce,Oe]of Object.entries(be))(Ce===U||Ce===W||Oe===U||Oe===W)&&delete be[Ce];return be[U]=W,be})},[]),bt=m.useCallback((U,W)=>{!U&&!W||Se(le=>{const be={...le};for(const[Ce,Oe]of Object.entries(be))(Ce===U||Ce===W||Oe===U||Oe===W)&&delete be[Ce];return be})},[]),xt=m.useCallback(async()=>{if(!We||Ye)return;wt(!0);const U=W=>{Z(le=>{const be=new Set(le);return be.delete(W),be}),fe(le=>{const be=new Set(le);return be.delete(W),be}),Qn(le=>{const be=new Set(le);return be.delete(W),be}),Zn(le=>{const be=new Set(le);return be.delete(W),be})};try{if(We.kind==="delete"){const W=await fetch(`/api/record/restore?token=${encodeURIComponent(We.undoToken)}`,{method:"POST"});if(!W.ok){const Oe=await W.text().catch(()=>"");throw new Error(Oe||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.restoredFile||We.originalFile);We.rowKey&&U(We.rowKey),U(We.originalFile),U(be);const Ce=We.from==="keep"&&!Ae?0:1;et(Ce),He(),_e(null);return}if(We.kind==="keep"){const W=await fetch(`/api/record/unkeep?file=${encodeURIComponent(We.keptFile)}`,{method:"POST"});if(!W.ok){const Ce=await W.text().catch(()=>"");throw new Error(Ce||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.newFile||We.originalFile);We.rowKey&&U(We.rowKey),U(We.originalFile),U(be),et(1),He(),_e(null);return}if(We.kind==="hot"){const W=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(We.currentFile)}`,{method:"POST"});if(!W.ok){const Oe=await W.text().catch(()=>"");throw new Error(Oe||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.oldFile||We.currentFile),Ce=String(le?.newFile||"");Ce&&De(be,Ce),He(),_e(null);return}}catch(W){re.error("Undo fehlgeschlagen",String(W?.message||W))}finally{wt(!1)}},[We,Ye,re,He,Ae,et,De]),[Et,Ft]=m.useState(()=>new Set),$t=m.useCallback((U,W)=>{Ft(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Vt=m.useCallback(async U=>{const W=rr(U.output||""),le=bi(U),be=ht=>ou(ht)?$r(ht):`HOT ${ht}`,Ce=W,Oe=be(Ce);await rt({kind:"rename",job:U,file:W,rowKey:le,setBusy:ht=>$t(le,ht),isBusyNow:()=>Et.has(le),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:Ce},run:async()=>(De(Ce,Oe),h?await h(U):await(await ve(Ce,async()=>await Lm(`/api/record/toggle-hot?file=${encodeURIComponent(Ce)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async ht=>{const At=typeof ht?.oldFile=="string"&&ht.oldFile?ht.oldFile:Ce,yt=typeof ht?.newFile=="string"&&ht.newFile?ht.newFile:Oe;At&&yt&&At!==yt&&De(At,yt),_e({kind:"hot",currentFile:yt}),(!h||G==="file_asc"||G==="file_desc")&&He()},onError:async()=>{bt(Ce,Oe),_e(null)}})},[rr,bi,Et,$t,rt,De,bt,h,ve,He,G]),vn=m.useCallback(U=>{const W=bi(U),le=rr(U.output||"");if(!W||!le||ee.has(W)||jn.has(W))return!1;Vn(W,!0),Fn(W);const be=`delete:${W}`,Ce=k.enqueue(be,async()=>{await ct(U,{alreadyRemoved:!0})});return Ce||An(W),Ce},[k,bi,rr,ee,jn,Vn,ct]),qn=m.useCallback(U=>{const W=bi(U),le=rr(U.output||"");if(!W||!le||jn.has(W)||ee.has(W))return!1;mn(W,!0),Fn(W);const be=`keep:${W}`,Ce=k.enqueue(be,async()=>{await jt(U,{alreadyRemoved:!0})});return Ce||An(W),Ce},[k,bi,rr,jn,ee,mn,jt]),Yi=m.useCallback(U=>{const W=bi(U);if(!W||Et.has(W))return!1;const le=`hot:${W}`;return k.enqueue(le,async()=>{await Vt(U)})},[k,bi,Vt,Et]),Gn=m.useCallback(U=>{const W=vy(U.output||""),le=rr(W),be=je[le];if(!be)return U;const Ce=W.lastIndexOf("/"),Oe=Ce>=0?W.slice(0,Ce+1):"";return{...U,output:Oe+be}},[je]),ki=Je??e,Ei=ot??C,mi=m.useMemo(()=>{const U=new Map;for(const le of ki){const be=Gn(le);U.set(bi(be),be)}for(const le of n){const be=Gn(le),Ce=bi(be);U.has(Ce)&&U.set(Ce,{...U.get(Ce),...be})}return Array.from(U.values()).filter(le=>P.has(bi(le))||k3(le.output)?!1:le.status==="finished"||le.status==="failed"||le.status==="stopped")},[n,ki,P,Gn]),Pi=m.useRef(new Map);m.useEffect(()=>{const U=new Map;for(const W of mi){const le=rr(W.output||"");le&&U.set(le,bi(W))}Pi.current=U},[mi]),m.useEffect(()=>{const U=W=>{const le=W.detail;if(!le?.file)return;const be=Pi.current.get(le.file)||le.file;if(le.phase==="start"){Vn(be,!0),Fn(be);return}if(le.phase==="error"){An(be),Ot.current.get(be)?.reset();return}if(le.phase==="success"){Vn(be,!1);return}};return window.addEventListener("finished-downloads:delete",U),()=>window.removeEventListener("finished-downloads:delete",U)},[Fn,Vn,He,An]),m.useEffect(()=>{const U=()=>{if(ke.current){ye.current||(ye.current=!0);return}Ie.current==null&&He()};return window.addEventListener("finished-downloads:reload",U),()=>window.removeEventListener("finished-downloads:reload",U)},[He]),m.useEffect(()=>{const U=W=>{const le=W.detail,be=String(le?.oldFile??"").trim(),Ce=String(le?.newFile??"").trim();!be||!Ce||be===Ce||De(be,Ce)};return window.addEventListener("finished-downloads:rename",U),()=>window.removeEventListener("finished-downloads:rename",U)},[De]);const Sn=m.useMemo(()=>{const U=mi.filter(le=>!P.has(bi(le))),W=$n.length?U.filter(le=>{const be=rr(le.output||""),Ce=Lc(le.output),Oe=ns(Ce),ht=Lt.tagsByModelKey[Oe]??[],At=ns([be,$r(be),Ce,le.id,ht.join(" ")].join(" "));for(const yt of $n)if(!At.includes(yt))return!1;return!0}):U;return Nt.size===0?W:W.filter(le=>{const be=ns(Lc(le.output)),Ce=Lt.tagSetByModelKey[be];if(!Ce||Ce.size===0)return!1;for(const Oe of Nt)if(!Ce.has(Oe))return!1;return!0})},[mi,P,Nt,Lt,$n]),Jn=F?Sn.length:Ei,wn=m.useMemo(()=>{if(!F)return Sn;const U=(D-1)*R,W=U+R;return Sn.slice(Math.max(0,U),Math.max(0,W))},[F,Sn,D,R]),Ci=!F&&Jn===0,Oi=N&&Sn.length===0,ei=Q&&Sn.length===0,Li=I&&(Ci||ei||Oi);m.useEffect(()=>{if(!N)return;const U=Math.max(1,Math.ceil(Sn.length/R));D>U&&E(U)},[N,Sn.length,D,R,E]),m.useEffect(()=>{if(!(K==="hover"&&!O&&(ze==="cards"||ze==="gallery"||ze==="table"))){V(null),ae.current?.disconnect(),ae.current=null;return}if(ze==="cards"&&qt?.key){V(qt.key);return}ae.current?.disconnect();const W=new IntersectionObserver(le=>{let be=null,Ce=0;for(const Oe of le){if(!Oe.isIntersecting)continue;const ht=z.current.get(Oe.target);ht&&Oe.intersectionRatio>Ce&&(Ce=Oe.intersectionRatio,be=ht)}be&&V(Oe=>Oe===be?Oe:be)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});ae.current=W;for(const[le,be]of j.current)z.current.set(be,le),W.observe(be);return()=>{W.disconnect(),ae.current===W&&(ae.current=null)}},[ze,K,O,qt?.key]);const we=U=>{const W=bi(U),le=gt[W]??U?.durationSeconds;if(typeof le=="number"&&Number.isFinite(le)&&le>0)return K1(le*1e3);const be=Date.parse(String(U.startedAt||"")),Ce=Date.parse(String(U.endedAt||""));return Number.isFinite(be)&&Number.isFinite(Ce)&&Ce>be?K1(Ce-be):"—"},L=m.useCallback(U=>W=>{const le=j.current.get(U);le&&ae.current&&ae.current.unobserve(le),W?(j.current.set(U,W),z.current.set(W,U),ae.current?.observe(W)):j.current.delete(U)},[]),$=m.useCallback((U,W)=>{if(!Number.isFinite(W)||W<=0)return;const le=bi(U),be=Jt.current[le];typeof be=="number"&&Math.abs(be-W)<.5||(Jt.current={...Jt.current,[le]:W},ln())},[ln]),xe=m.useCallback((U,W,le)=>{if(!Number.isFinite(W)||!Number.isFinite(le)||W<=0||le<=0)return;const be=bi(U),Ce=fn.current[be];Ce&&Ce.w===W&&Ce.h===le||(fn.current={...fn.current,[be]:{w:W,h:le}},dn())},[dn]),Te=W1("(max-width: 639px)"),Ve="mt-10",qe="mb-2";return m.useEffect(()=>{if(!Te||ze!=="cards")return;const U=wn[0];if(!U){V(null);return}const W=bi(U);V(be=>be===W?be:null);const le=window.setTimeout(()=>{V(be=>be===W?be:W)},140);return()=>window.clearTimeout(le)},[Te,ze,wn,bi]),m.useEffect(()=>{Te||(Ot.current=new Map)},[Te]),m.useEffect(()=>{Ci&&D!==1&&E(1)},[Ci,D,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:Jn})]}),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:Jn})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[I?c.jsx(G1,{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:vt,onChange:U=>It(U.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 `}),(vt||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:kt,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(Sa,{label:"Behaltene Downloads anzeigen",checked:Ae,onChange:U=>{D!==1&&E(1),Pe(U)}})}),ze!=="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:G,onChange:U=>{const W=U.target.value;Y(W),D!==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(en,{size:"md",variant:"soft",disabled:!We||Ye,onClick:xt,title:We?`Letzte Aktion rückgängig machen (${We.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Ig,{value:ze,onChange:U=>Le(U),size:Te?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(pN,{className:Te?"size-4":"size-5"}),label:Te?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(lN,{className:Te?"size-4":"size-5"}),label:Te?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(dN,{className:Te?"size-4":"size-5"}),label:Te?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:()=>St(U=>!U),"aria-expanded":Qe,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(EA,{className:"size-5"}),N||Ae?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]})]})]}),Tt.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:[Tt.map(U=>c.jsx(ms,{tag:U,active:!0,onClick:Bn},U)),c.jsx(en,{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:Me,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",Qe?"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:vt,onChange:U=>It(U.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 `}),(vt||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:kt,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(Og,{checked:Ae,onChange:U=>{D!==1&&E(1),Pe(U)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),ze!=="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:G,onChange:U=>{const W=U.target.value;Y(W),D!==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]})}),Tt.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:[Tt.map(U=>c.jsx(ms,{tag:U,active:!0,onClick:Bn},U)),c.jsx(en,{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:Me,children:"Zurücksetzen"})]})]})}):null]})]})}),Li?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(G1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):Ci||ei?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."})]})]})}):Oi?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."}),Tt.length>0||(vt||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[Tt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:Me,children:"Tag-Filter zurücksetzen"}):null,(vt||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:kt,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[ze==="cards"&&c.jsx("div",{className:Te?`${Ve} ${qe}`:"",children:c.jsx(t3,{rows:wn,isSmall:Te,isLoading:I,blurPreviews:t,durations:gt,teaserKey:te,teaserPlayback:K,teaserAudio:a,hoverTeaserKey:ne,inlinePlay:qt,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,swipeRefs:Ot,keyFor:bi,baseName:rr,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,lower:ns,onOpenPlayer:l,openPlayer:Dn,onOpenPlayerAt:Mn,handleScrubberClickIndex:Wt,startInlineAt:Pn,startInline:Mt,tryAutoplayInline:Cn,registerTeaserHost:L,handleDuration:$,deleteVideo:ct,keepVideo:jt,releasePlayingFile:Hn,modelsByKey:q,onToggleHot:Vt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Nt,onToggleTagFilter:Bn,onHoverPreviewKeyChange:he,assetNonce:B??0,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi})}),ze==="table"&&c.jsx(c3,{rows:wn,isLoading:I,keyFor:bi,baseName:rr,lower:ns,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,resolutions:Xt,durations:gt,canHover:O,teaserAudio:a,hoverTeaserKey:ne,setHoverTeaserKey:he,teaserPlayback:K,teaserKey:te,registerTeaserHost:L,handleDuration:$,handleResolution:xe,blurPreviews:t,assetNonce:B,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,modelsByKey:q,activeTagSet:Nt,onToggleTagFilter:Bn,onOpenPlayer:l,handleScrubberClickIndex:Wt,onSortModeChange:Y,page:D,onPageChange:E,onToggleHot:Vt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,deleteVideo:ct,keepVideo:jt,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi}),ze==="gallery"&&c.jsx(p3,{rows:wn,isLoading:I,blurPreviews:t,durations:gt,handleDuration:$,teaserKey:te,teaserPlayback:K,teaserAudio:a,hoverTeaserKey:ne,keyFor:bi,baseName:rr,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,deletedKeys:P,registerTeaserHost:L,onOpenPlayer:l,handleScrubberClickIndex:Wt,deleteVideo:ct,keepVideo:jt,onToggleHot:Vt,lower:ns,modelsByKey:q,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Nt,onToggleTagFilter:Bn,onHoverPreviewKeyChange:he,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi}),c.jsx(kf,{page:D,pageSize:R,totalItems:Jn,onPageChange:U=>{yu.flushSync(()=>{Rt(null),V(null),he(null)});for(const W of wn){const le=rr(W.output||"");le&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:le}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:le}})))}window.scrollTo({top:0,behavior:"auto"}),E(U)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Im,Q1;function i0(){if(Q1)return Im;Q1=1;var n;return typeof window<"u"?n=window:typeof gf<"u"?n=gf:typeof self<"u"?n=self:n={},Im=n,Im}var D3=i0();const ue=Du(D3),M3={},j3=Object.freeze(Object.defineProperty({__proto__:null,default:M3},Symbol.toStringTag,{value:"Module"})),R3=KE(j3);var Bm,Z1;function Lw(){if(Z1)return Bm;Z1=1;var n=typeof gf<"u"?gf:typeof window<"u"?window:{},e=R3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Bm=t,Bm}var O3=Lw();const _t=Du(O3);var Kh={exports:{}},Pm={exports:{}},J1;function L3(){return J1||(J1=1,(function(n){function e(){return n.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i=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=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 $m=e,$m}var r2;function U3(){if(r2)return Kh.exports;r2=1;var n=i0(),e=L3(),t=I3(),i=B3(),a=P3();g.httpHandler=F3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(R){var E={};return R&&R.trim().split(` `).forEach(function(B){var G=B.indexOf(":"),Y=B.slice(0,G).trim().toLowerCase(),q=B.slice(G+1).trim();typeof E[Y]>"u"?E[Y]=q:Array.isArray(E[Y])?E[Y].push(q):E[Y]=[E[Y],q]}),E};Kh.exports=g,Kh.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(D){g[D==="delete"?"del":D]=function(R,E,B){return E=f(R,E,B),E.method=D.toUpperCase(),_(E)}});function u(D,R){for(var E=0;E"u")throw new Error("callback argument missing");if(D.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var R={uri:D.uri||D.url,headers:D.headers||{},body:D.body,metadata:D.metadata||{},retry:D.retry,timeout:D.timeout},E=g.requestInterceptorsStorage.execute(D.requestType,R);D.uri=E.uri,D.headers=E.headers,D.body=E.body,D.metadata=E.metadata,D.retry=E.retry,D.timeout=E.timeout}var B=!1,G=function(Z,ee,fe){B||(B=!0,D.callback(Z,ee,fe))};function Y(){K.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(Q,0)}function q(){var P=void 0;if(K.response?P=K.response:P=K.responseText||S(K),he)try{P=JSON.parse(P)}catch{}return P}function se(P){if(clearTimeout(ae),clearTimeout(D.retryTimeout),P instanceof Error||(P=new Error(""+(P||"Unknown XMLHttpRequest Error"))),P.statusCode=0,!re&&g.retryManager.getIsEnabled()&&D.retry&&D.retry.shouldRetry()){D.retryTimeout=setTimeout(function(){D.retry.moveToNextAttempt(),D.xhr=K,_(D)},D.retry.getCurrentFuzzedDelay());return}if(D.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var Z={headers:z.headers||{},body:z.body,responseUrl:K.responseURL,responseType:K.responseType},ee=g.responseInterceptorsStorage.execute(D.requestType,Z);z.body=ee.body,z.headers=ee.headers}return G(P,z)}function Q(){if(!re){var P;clearTimeout(ae),clearTimeout(D.retryTimeout),D.useXDR&&K.status===void 0?P=200:P=K.status===1223?204:K.status;var Z=z,ee=null;if(P!==0?(Z={body:q(),statusCode:P,method:j,headers:{},url:k,rawRequest:K},K.getAllResponseHeaders&&(Z.headers=l(K.getAllResponseHeaders()))):ee=new Error("Internal XMLHttpRequest Error"),D.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var fe={headers:Z.headers||{},body:Z.body,responseUrl:K.responseURL,responseType:K.responseType},I=g.responseInterceptorsStorage.execute(D.requestType,fe);Z.body=I.body,Z.headers=I.headers}return G(ee,Z,Z.body)}}var K=D.xhr||null;K||(D.cors||D.useXDR?K=new g.XDomainRequest:K=new g.XMLHttpRequest);var O,re,k=K.url=D.uri||D.url,j=K.method=D.method||"GET",te=D.body||D.data,V=K.headers=D.headers||{},ne=!!D.sync,he=!1,ae,z={body:void 0,headers:{},statusCode:0,method:j,url:k,rawRequest:K};if("json"in D&&D.json!==!1&&(he=!0,V.accept||V.Accept||(V.Accept="application/json"),j!=="GET"&&j!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),te=JSON.stringify(D.json===!0?te:D.json))),K.onreadystatechange=Y,K.onload=Q,K.onerror=se,K.onprogress=function(){},K.onabort=function(){re=!0,clearTimeout(D.retryTimeout)},K.ontimeout=se,K.open(j,k,!ne,D.username,D.password),ne||(K.withCredentials=!!D.withCredentials),!ne&&D.timeout>0&&(ae=setTimeout(function(){if(!re){re=!0,K.abort("timeout");var P=new Error("XMLHttpRequest timeout");P.code="ETIMEDOUT",se(P)}},D.timeout)),K.setRequestHeader)for(O in V)V.hasOwnProperty(O)&&K.setRequestHeader(O,V[O]);else if(D.headers&&!h(D.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in D&&(K.responseType=D.responseType),"beforeSend"in D&&typeof D.beforeSend=="function"&&D.beforeSend(K),K.send(te||null),K}function S(D){try{if(D.responseType==="document")return D.responseXML;var R=D.responseXML&&D.responseXML.documentElement.nodeName==="parsererror";if(D.responseType===""&&!R)return D.responseXML}catch{}return null}function C(){}return Kh.exports}var z3=U3();const Iw=Du(z3);var Hm={exports:{}},qm,s2;function $3(){if(s2)return qm;s2=1;var n=Lw(),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,he,ae){return(V|0)*3600+(ne|0)*60+(he|0)+(ae|0)/1e3}var te=k.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return te?te[3]?j(te[1],te[2],te[3].replace(":",""),te[4]):te[1]>59?j(te[1],te[2],0,te[4]):j(0,te[1],te[2],te[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,te){return te?this.has(k)?this.values[k]:j[te]:this.has(k)?this.values[k]:j},has:function(k){return k in this.values},alt:function(k,j,te){for(var V=0;V=0&&j<=100)?(this.set(k,j),!0):!1}};function l(k,j,te,V){var ne=V?k.split(V):[k];for(var he in ne)if(typeof ne[he]=="string"){var ae=ne[he].split(te);if(ae.length===2){var z=ae[0].trim(),P=ae[1].trim();j(z,P)}}}function u(k,j,te){var V=k;function ne(){var z=i(k);if(z===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return k=k.replace(/^[^\sa-zA-Z-]+/,""),z}function he(z,P){var Z=new a;l(z,function(ee,fe){switch(ee){case"region":for(var I=te.length-1;I>=0;I--)if(te[I].id===fe){Z.set(ee,te[I].region);break}break;case"vertical":Z.alt(ee,fe,["rl","lr"]);break;case"line":var pe=fe.split(","),ke=pe[0];Z.integer(ee,ke),Z.percent(ee,ke)&&Z.set("snapToLines",!1),Z.alt(ee,ke,["auto"]),pe.length===2&&Z.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=fe.split(","),Z.percent(ee,pe[0]),pe.length===2&&Z.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":Z.percent(ee,fe);break;case"align":Z.alt(ee,fe,["start","center","end","left","right"]);break}},/:/,/\s/),P.region=Z.get("region",null),P.vertical=Z.get("vertical","");try{P.line=Z.get("line","auto")}catch{}P.lineAlign=Z.get("lineAlign","start"),P.snapToLines=Z.get("snapToLines",!0),P.size=Z.get("size",100);try{P.align=Z.get("align","center")}catch{P.align=Z.get("align","middle")}try{P.position=Z.get("position","auto")}catch{P.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},P.align)}P.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},P.align)}function ae(){k=k.replace(/^\s+/,"")}if(ae(),j.startTime=ne(),ae(),k.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);k=k.substr(3),ae(),j.endTime=ne(),ae(),he(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 te(){if(!j)return null;function ke(me){return j=j.substr(me.length),me}var ye=j.match(/^([^<]*)(<[^>]*>?)?/);return ke(ye[1]?ye[1]:ye[2])}function V(ke){return h.innerHTML=ke,ke=h.textContent,h.textContent="",ke}function ne(ke,ye){return!S[ye.localName]||S[ye.localName]===ke.localName}function he(ke,ye){var me=f[ke];if(!me)return null;var pt=k.document.createElement(me),We=_[ke];return We&&ye&&(pt[We]=ye.trim()),pt}for(var ae=k.document.createElement("div"),z=ae,P,Z=[];(P=te())!==null;){if(P[0]==="<"){if(P[1]==="/"){Z.length&&Z[Z.length-1]===P.substr(2).replace(">","")&&(Z.pop(),z=z.parentNode);continue}var ee=i(P.substr(1,P.length-2)),fe;if(ee){fe=k.document.createProcessingInstruction("timestamp",ee),z.appendChild(fe);continue}var I=P.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!I||(fe=he(I[1],I[3]),!fe)||!ne(z,fe))continue;if(I[2]){var pe=I[2].split(".");pe.forEach(function(ke){var ye=/^bg_/.test(ke),me=ye?ke.slice(3):ke;if(g.hasOwnProperty(me)){var pt=ye?"background-color":"color",We=g[me];fe.style[pt]=We}}),fe.className=pe.join(" ")}Z.push(I[1]),z.appendChild(fe),z=fe;continue}z.appendChild(k.document.createTextNode(V(P)))}return ae}var D=[[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 R(k){for(var j=0;j=te[0]&&k<=te[1])return!0}return!1}function E(k){var j=[],te="",V;if(!k||!k.childNodes)return"ltr";function ne(z,P){for(var Z=P.childNodes.length-1;Z>=0;Z--)z.push(P.childNodes[Z])}function he(z){if(!z||!z.length)return null;var P=z.pop(),Z=P.textContent||P.innerText;if(Z){var ee=Z.match(/^.*(\n|\r)/);return ee?(z.length=0,ee[0]):Z}if(P.tagName==="ruby")return he(z);if(P.childNodes)return ne(z,P),he(z)}for(ne(j,k);te=he(j);)for(var ae=0;ae=0&&k.line<=100))return k.line;if(!k.track||!k.track.textTrackList||!k.track.textTrackList.mediaElement)return-1;for(var j=k.track,te=j.textTrackList,V=0,ne=0;nek.left&&this.topk.top},q.prototype.overlapsAny=function(k){for(var j=0;j=k.top&&this.bottom<=k.bottom&&this.left>=k.left&&this.right<=k.right},q.prototype.overlapsOppositeAxis=function(k,j){switch(j){case"+x":return this.leftk.right;case"+y":return this.topk.bottom}},q.prototype.intersectPercentage=function(k){var j=Math.max(0,Math.min(this.right,k.right)-Math.max(this.left,k.left)),te=Math.max(0,Math.min(this.bottom,k.bottom)-Math.max(this.top,k.top)),V=j*te;return V/(this.height*this.width)},q.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}},q.getSimpleBoxPosition=function(k){var j=k.div?k.div.offsetHeight:k.tagName?k.offsetHeight:0,te=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||te};return ne};function se(k,j,te,V){function ne(me,pt){for(var We,_e=new q(me),Ye=1,wt=0;wtje&&(We=new q(me),Ye=je),me=new q(_e)}return We||_e}var he=new q(j),ae=j.cue,z=B(ae),P=[];if(ae.snapToLines){var Z;switch(ae.vertical){case"":P=["+y","-y"],Z="height";break;case"rl":P=["+x","-x"],Z="width";break;case"lr":P=["-x","+x"],Z="width";break}var ee=he.lineHeight,fe=ee*Math.round(z),I=te[Z]+ee,pe=P[0];Math.abs(fe)>I&&(fe=fe<0?-1:1,fe*=Math.ceil(I/ee)*ee),z<0&&(fe+=ae.vertical===""?te.height:te.width,P=P.reverse()),he.move(pe,fe)}else{var ke=he.lineHeight/te.height*100;switch(ae.lineAlign){case"center":z-=ke/2;break;case"end":z-=ke;break}switch(ae.vertical){case"":j.applyStyles({top:j.formatStyle(z,"%")});break;case"rl":j.applyStyles({left:j.formatStyle(z,"%")});break;case"lr":j.applyStyles({right:j.formatStyle(z,"%")});break}P=["+y","-x","+x","-y"],he=new q(j)}var ye=ne(he,P);j.move(ye.toCSSCompatValues(te))}function Q(){}Q.StringDecoder=function(){return{decode:function(k){if(!k)return"";if(typeof k!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(k))}}},Q.convertCueToDOMTree=function(k,j){return!k||!j?null:C(k,j)};var K=.05,O="sans-serif",re="1.5%";return Q.processCues=function(k,j,te){if(!k||!j||!te)return null;for(;te.firstChild;)te.removeChild(te.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=re,te.appendChild(V);function ne(ee){for(var fe=0;fe")===-1){j.cue.id=ae;continue}case"CUE":try{u(ae,j.cue,j.regionList)}catch(ee){j.reportOrThrowError(ee),j.cue=null,j.state="BADCUE";continue}j.state="CUETEXT";continue;case"CUETEXT":var Z=ae.indexOf("-->")!==-1;if(!ae||Z&&(P=!0)){j.oncue&&j.oncue(j.cue),j.cue=null,j.state="ID";continue}j.cue.text&&(j.cue.text+=` `),j.cue.text+=ae.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":ae||(j.state="ID");continue}}}catch(ee){j.reportOrThrowError(ee),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}},qm=Q,qm}var Vm,a2;function H3(){if(a2)return Vm;a2=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,D=f,R=null,E="",B=!0,G="auto",Y="start",q="auto",se="auto",Q=100,K="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(O){g=""+O}},pauseOnExit:{enumerable:!0,get:function(){return _},set:function(O){_=!!O}},startTime:{enumerable:!0,get:function(){return S},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");S=O,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return C},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");C=O,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return D},set:function(O){D=""+O,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return R},set:function(O){R=O,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return E},set:function(O){var re=i(O);if(re===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");E=re,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return B},set:function(O){B=!!O,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return G},set:function(O){if(typeof O!="number"&&O!==n)throw new SyntaxError("Line: an invalid number or illegal string was specified.");G=O,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return Y},set:function(O){var re=a(O);re?(Y=re,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return q},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");q=O,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return se},set:function(O){var re=a(O);re?(se=re,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return Q},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");Q=O,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return K},set:function(O){var re=a(O);if(!re)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");K=re,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Vm=l,Vm}var Gm,o2;function q3(){if(o2)return Gm;o2=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 Gm=i,Gm}var l2;function V3(){if(l2)return Hm.exports;l2=1;var n=i0(),e=Hm.exports={WebVTT:$3(),VTTCue:H3(),VTTRegion:q3()};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(),Hm.exports}var G3=V3();const u2=Du(G3);function Xi(){return Xi=Object.assign?Object.assign.bind():function(n){for(var e=1;e-1},e.trigger=function(i){var a=this.listeners[i];if(a)if(arguments.length===2)for(var l=a.length,u=0;u-1;t=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const X3=" ",Km=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},Y3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Sr=function(n){const e={};if(!n)return e;const t=n.split(Y3());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},d2=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 Q3 extends xy{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;ul),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 Z3=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),po=function(n){const e={};return Object.keys(n).forEach(function(t){e[Z3(t)]=n[t]}),e},Wm=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]{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,G;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 q in E.attributes)typeof E.attributes[q]=="string"&&(E.attributes[q]=E.attributes[q].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:Bw(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"]],G={default:/yes/i.test(E.attributes.DEFAULT)},G.default?G.autoselect=!0:G.autoselect=/yes/i.test(E.attributes.AUTOSELECT),E.attributes.LANGUAGE&&(G.language=E.attributes.LANGUAGE),E.attributes.URI&&(G.uri=E.attributes.URI),E.attributes["INSTREAM-ID"]&&(G.instreamId=E.attributes["INSTREAM-ID"]),E.attributes.CHARACTERISTICS&&(G.characteristics=E.attributes.CHARACTERISTICS),E.attributes.FORCED&&(G.forced=/yes/i.test(E.attributes.FORCED)),B[E.attributes.NAME]=G},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((q,se)=>(se.programDateTime=q-se.duration*1e3,se.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,Wm.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=po(E.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",E.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const Y=this.manifest.segments.length,q=po(E.attributes);a.parts=a.parts||[],a.parts.push(q),q.byterange&&(q.byterange.hasOwnProperty("offset")||(q.byterange.offset=D),D=q.byterange.offset+q.byterange.length);const se=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${se} for segment #${Y}`,E.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Q,K)=>{Q.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${K} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=po(E.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wm.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,q=po(E.attributes),se=q.type&&q.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(q),q.byterange&&(q.byterange.hasOwnProperty("offset")||(q.byterange.offset=se?D:0,se&&(D=q.byterange.offset+q.byterange.length)));const Q=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Q} for segment #${Y}`,E.attributes,["TYPE","URI"]),!!q.type)for(let K=0;KK.id===q.id);this.manifest.dateRanges[Q]=Xi(this.manifest.dateRanges[Q],q),R[q.id]=Xi(R[q.id],q),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=po(E.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",E.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(q,se)=>{if(q in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${q}`});return}this.manifest.definitions[q]=se};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 q=this.params.get(E.attributes.QUERYPARAM);if(!q){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${E.attributes.QUERYPARAM}`});return}Y(E.attributes.QUERYPARAM,decodeURIComponent(q));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),D=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){(eS&&(_-=S,_-=S,_-=mr(2))}return Number(_)},cD=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=mr(e);for(var u=oD(e),h=new Uint8Array(new ArrayBuffer(u)),f=0;f=t.length&&g.call(t,function(_,S){var C=f[S]?f[S]&e[u+S]:e[u+S];return _===C})},hD=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={},wa={},Zo={},p2;function s0(){if(p2)return Zo;p2=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=0&&N=0){for(var He=F.length-1;Me0},lookupPrefix:function(N){for(var F=this;F;){var ie=F._nsMap;if(ie){for(var Me in ie)if(Object.prototype.hasOwnProperty.call(ie,Me)&&ie[Me]===N)return Me}F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},lookupNamespaceURI:function(N){for(var F=this;F;){var ie=F._nsMap;if(ie&&Object.prototype.hasOwnProperty.call(ie,N))return ie[N];F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},isDefaultNamespace:function(N){var F=this.lookupPrefix(N);return F==null}};function pe(N){return N=="<"&&"<"||N==">"&&">"||N=="&"&&"&"||N=='"'&&"""||"&#"+N.charCodeAt()+";"}f(_,I),f(_,I.prototype);function ke(N,F){if(F(N))return!0;if(N=N.firstChild)do if(ke(N,F))return!0;while(N=N.nextSibling)}function ye(){this.ownerDocument=this}function me(N,F,ie){N&&N._inc++;var Me=ie.namespaceURI;Me===t.XMLNS&&(F._nsMap[ie.prefix?ie.localName:""]=ie.value)}function pt(N,F,ie,Me){N&&N._inc++;var He=ie.namespaceURI;He===t.XMLNS&&delete F._nsMap[ie.prefix?ie.localName:""]}function We(N,F,ie){if(N&&N._inc){N._inc++;var Me=F.childNodes;if(ie)Me[Me.length++]=ie;else{for(var He=F.firstChild,gt=0;He;)Me[gt++]=He,He=He.nextSibling;Me.length=gt,delete Me[Me.length]}}}function _e(N,F){var ie=F.previousSibling,Me=F.nextSibling;return ie?ie.nextSibling=Me:N.firstChild=Me,Me?Me.previousSibling=ie:N.lastChild=ie,F.parentNode=null,F.previousSibling=null,F.nextSibling=null,We(N.ownerDocument,N),F}function Ye(N){return N&&(N.nodeType===I.DOCUMENT_NODE||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.ELEMENT_NODE)}function wt(N){return N&&(Se(N)||Je(N)||je(N)||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.COMMENT_NODE||N.nodeType===I.PROCESSING_INSTRUCTION_NODE)}function je(N){return N&&N.nodeType===I.DOCUMENT_TYPE_NODE}function Se(N){return N&&N.nodeType===I.ELEMENT_NODE}function Je(N){return N&&N.nodeType===I.TEXT_NODE}function tt(N,F){var ie=N.childNodes||[];if(e(ie,Se)||je(F))return!1;var Me=e(ie,je);return!(F&&Me&&ie.indexOf(Me)>ie.indexOf(F))}function ot(N,F){var ie=N.childNodes||[];function Me(gt){return Se(gt)&>!==F}if(e(ie,Me))return!1;var He=e(ie,je);return!(F&&He&&ie.indexOf(He)>ie.indexOf(F))}function dt(N,F,ie){if(!Ye(N))throw new V(k,"Unexpected parent node type "+N.nodeType);if(ie&&ie.parentNode!==N)throw new V(j,"child not in parent");if(!wt(F)||je(F)&&N.nodeType!==I.DOCUMENT_NODE)throw new V(k,"Unexpected node type "+F.nodeType+" for parent node type "+N.nodeType)}function Ut(N,F,ie){var Me=N.childNodes||[],He=F.childNodes||[];if(F.nodeType===I.DOCUMENT_FRAGMENT_NODE){var gt=He.filter(Se);if(gt.length>1||e(He,Je))throw new V(k,"More than one element or text in fragment");if(gt.length===1&&!tt(N,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(Se(F)&&!tt(N,ie))throw new V(k,"Only one element can be added and only after doctype");if(je(F)){if(e(Me,je))throw new V(k,"Only one doctype is allowed");var zt=e(Me,Se);if(ie&&Me.indexOf(zt)1||e(He,Je))throw new V(k,"More than one element or text in fragment");if(gt.length===1&&!ot(N,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(Se(F)&&!ot(N,ie))throw new V(k,"Only one element can be added and only after doctype");if(je(F)){let un=function(Xt){return je(Xt)&&Xt!==ie};var Jt=un;if(e(Me,un))throw new V(k,"Only one doctype is allowed");var zt=e(Me,Se);if(ie&&Me.indexOf(zt)0&&ke(ie.documentElement,function(He){if(He!==ie&&He.nodeType===S){var gt=He.getAttribute("class");if(gt){var zt=N===gt;if(!zt){var Jt=u(gt);zt=F.every(h(Jt))}zt&&Me.push(He)}}}),Me})},createElement:function(N){var F=new ft;F.ownerDocument=this,F.nodeName=N,F.tagName=N,F.localName=N,F.childNodes=new ne;var ie=F.attributes=new z;return ie._ownerElement=F,F},createDocumentFragment:function(){var N=new Tt;return N.ownerDocument=this,N.childNodes=new ne,N},createTextNode:function(N){var F=new ze;return F.ownerDocument=this,F.appendData(N),F},createComment:function(N){var F=new Le;return F.ownerDocument=this,F.appendData(N),F},createCDATASection:function(N){var F=new Ae;return F.ownerDocument=this,F.appendData(N),F},createProcessingInstruction:function(N,F){var ie=new an;return ie.ownerDocument=this,ie.tagName=ie.nodeName=ie.target=N,ie.nodeValue=ie.data=F,ie},createAttribute:function(N){var F=new mt;return F.ownerDocument=this,F.name=N,F.nodeName=N,F.localName=N,F.specified=!0,F},createEntityReference:function(N){var F=new Ot;return F.ownerDocument=this,F.nodeName=N,F},createElementNS:function(N,F){var ie=new ft,Me=F.split(":"),He=ie.attributes=new z;return ie.childNodes=new ne,ie.ownerDocument=this,ie.nodeName=F,ie.tagName=F,ie.namespaceURI=N,Me.length==2?(ie.prefix=Me[0],ie.localName=Me[1]):ie.localName=F,He._ownerElement=ie,ie},createAttributeNS:function(N,F){var ie=new mt,Me=F.split(":");return ie.ownerDocument=this,ie.nodeName=F,ie.name=F,ie.namespaceURI=N,ie.specified=!0,Me.length==2?(ie.prefix=Me[0],ie.localName=Me[1]):ie.localName=F,ie}},g(ye,I);function ft(){this._nsMap={}}ft.prototype={nodeType:S,hasAttribute:function(N){return this.getAttributeNode(N)!=null},getAttribute:function(N){var F=this.getAttributeNode(N);return F&&F.value||""},getAttributeNode:function(N){return this.attributes.getNamedItem(N)},setAttribute:function(N,F){var ie=this.ownerDocument.createAttribute(N);ie.value=ie.nodeValue=""+F,this.setAttributeNode(ie)},removeAttribute:function(N){var F=this.getAttributeNode(N);F&&this.removeAttributeNode(F)},appendChild:function(N){return N.nodeType===Q?this.insertBefore(N,null):et(this,N)},setAttributeNode:function(N){return this.attributes.setNamedItem(N)},setAttributeNodeNS:function(N){return this.attributes.setNamedItemNS(N)},removeAttributeNode:function(N){return this.attributes.removeNamedItem(N.nodeName)},removeAttributeNS:function(N,F){var ie=this.getAttributeNodeNS(N,F);ie&&this.removeAttributeNode(ie)},hasAttributeNS:function(N,F){return this.getAttributeNodeNS(N,F)!=null},getAttributeNS:function(N,F){var ie=this.getAttributeNodeNS(N,F);return ie&&ie.value||""},setAttributeNS:function(N,F,ie){var Me=this.ownerDocument.createAttributeNS(N,F);Me.value=Me.nodeValue=""+ie,this.setAttributeNode(Me)},getAttributeNodeNS:function(N,F){return this.attributes.getNamedItemNS(N,F)},getElementsByTagName:function(N){return new he(this,function(F){var ie=[];return ke(F,function(Me){Me!==F&&Me.nodeType==S&&(N==="*"||Me.tagName==N)&&ie.push(Me)}),ie})},getElementsByTagNameNS:function(N,F){return new he(this,function(ie){var Me=[];return ke(ie,function(He){He!==ie&&He.nodeType===S&&(N==="*"||He.namespaceURI===N)&&(F==="*"||He.localName==F)&&Me.push(He)}),Me})}},ye.prototype.getElementsByTagName=ft.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=ft.prototype.getElementsByTagNameNS,g(ft,I);function mt(){}mt.prototype.nodeType=C,g(mt,I);function de(){}de.prototype={data:"",substringData:function(N,F){return this.data.substring(N,N+F)},appendData:function(N){N=this.data+N,this.nodeValue=this.data=N,this.length=N.length},insertData:function(N,F){this.replaceData(N,0,F)},appendChild:function(N){throw new Error(re[k])},deleteData:function(N,F){this.replaceData(N,F,"")},replaceData:function(N,F,ie){var Me=this.data.substring(0,N),He=this.data.substring(N+F);ie=Me+ie+He,this.nodeValue=this.data=ie,this.length=ie.length}},g(de,I);function ze(){}ze.prototype={nodeName:"#text",nodeType:D,splitText:function(N){var F=this.data,ie=F.substring(N);F=F.substring(0,N),this.data=this.nodeValue=F,this.length=F.length;var Me=this.ownerDocument.createTextNode(ie);return this.parentNode&&this.parentNode.insertBefore(Me,this.nextSibling),Me}},g(ze,de);function Le(){}Le.prototype={nodeName:"#comment",nodeType:Y},g(Le,de);function Ae(){}Ae.prototype={nodeName:"#cdata-section",nodeType:R},g(Ae,de);function Pe(){}Pe.prototype.nodeType=se,g(Pe,I);function Qe(){}Qe.prototype.nodeType=K,g(Qe,I);function St(){}St.prototype.nodeType=B,g(St,I);function Ot(){}Ot.prototype.nodeType=E,g(Ot,I);function Tt(){}Tt.prototype.nodeName="#document-fragment",Tt.prototype.nodeType=Q,g(Tt,I);function an(){}an.prototype.nodeType=G,g(an,I);function Nt(){}Nt.prototype.serializeToString=function(N,F,ie){return Lt.call(N,F,ie)},I.prototype.toString=Lt;function Lt(N,F){var ie=[],Me=this.nodeType==9&&this.documentElement||this,He=Me.prefix,gt=Me.namespaceURI;if(gt&&He==null){var He=Me.lookupPrefix(gt);if(He==null)var zt=[{namespace:gt,prefix:null}]}return yn(this,ie,N,F,zt),ie.join("")}function vt(N,F,ie){var Me=N.prefix||"",He=N.namespaceURI;if(!He||Me==="xml"&&He===t.XML||He===t.XMLNS)return!1;for(var gt=ie.length;gt--;){var zt=ie[gt];if(zt.prefix===Me)return zt.namespace!==He}return!0}function It(N,F,ie){N.push(" ",F,'="',ie.replace(/[<>&"\t\n\r]/g,pe),'"')}function yn(N,F,ie,Me,He){if(He||(He=[]),Me)if(N=Me(N),N){if(typeof N=="string"){F.push(N);return}}else return;switch(N.nodeType){case S:var gt=N.attributes,zt=gt.length,Rt=N.firstChild,Jt=N.tagName;ie=t.isHTML(N.namespaceURI)||ie;var un=Jt;if(!ie&&!N.prefix&&N.namespaceURI){for(var Xt,pn=0;pn=0;fn--){var Kt=He[fn];if(Kt.prefix===""&&Kt.namespace===N.namespaceURI){Xt=Kt.namespace;break}}if(Xt!==N.namespaceURI)for(var fn=He.length-1;fn>=0;fn--){var Kt=He[fn];if(Kt.namespace===N.namespaceURI){Kt.prefix&&(un=Kt.prefix+":"+Jt);break}}}F.push("<",un);for(var cn=0;cn"),ie&&/^script$/i.test(Jt))for(;Rt;)Rt.data?F.push(Rt.data):yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;else for(;Rt;)yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;F.push("")}else F.push("/>");return;case q:case Q:for(var Rt=N.firstChild;Rt;)yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;return;case C:return It(F,N.name,N.value);case D:return F.push(N.data.replace(/[<&>]/g,pe));case R:return F.push("");case Y:return F.push("");case se:var Dt=N.publicId,Cn=N.systemId;if(F.push("");else if(Cn&&Cn!=".")F.push(" SYSTEM ",Cn,">");else{var Mt=N.internalSubset;Mt&&F.push(" [",Mt,"]"),F.push(">")}return;case G:return F.push("");case E:return F.push("&",N.nodeName,";");default:F.push("??",N.nodeName)}}function $n(N,F,ie){var Me;switch(F.nodeType){case S:Me=F.cloneNode(!1),Me.ownerDocument=N;case Q:break;case C:ie=!0;break}if(Me||(Me=F.cloneNode(!1)),Me.ownerDocument=N,Me.parentNode=null,ie)for(var He=F.firstChild;He;)Me.appendChild($n(N,He,ie)),He=He.nextSibling;return Me}function kt(N,F,ie){var Me=new F.constructor;for(var He in F)if(Object.prototype.hasOwnProperty.call(F,He)){var gt=F[He];typeof gt!="object"&>!=Me[He]&&(Me[He]=gt)}switch(F.childNodes&&(Me.childNodes=new ne),Me.ownerDocument=N,Me.nodeType){case S:var zt=F.attributes,Jt=Me.attributes=new z,un=zt.length;Jt._ownerElement=Me;for(var Xt=0;Xt",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})(Ym)),Ym}var Wh={},y2;function pD(){if(y2)return Wh;y2=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 D(){}D.prototype={parse:function(k,j,te){var V=this.domBuilder;V.startDocument(),se(j,j={}),R(k,j,te,V,this.errorHandler),V.endDocument()}};function R(k,j,te,V,ne){function he(et){if(et>65535){et-=65536;var ft=55296+(et>>10),mt=56320+(et&1023);return String.fromCharCode(ft,mt)}else return String.fromCharCode(et)}function ae(et){var ft=et.slice(1,-1);return Object.hasOwnProperty.call(te,ft)?te[ft]:ft.charAt(0)==="#"?he(parseInt(ft.substr(1).replace("x","0x"))):(ne.error("entity not found:"+et),et)}function z(et){if(et>ye){var ft=k.substring(ye,et).replace(/&#?\w+;/g,ae);I&&P(ye),V.characters(ft,0,et-ye),ye=et}}function P(et,ft){for(;et>=ee&&(ft=fe.exec(k));)Z=ft.index,ee=Z+ft[0].length,I.lineNumber++;I.columnNumber=et-Z+1}for(var Z=0,ee=0,fe=/.*(?:\r\n?|\n)|.*$/g,I=V.locator,pe=[{currentNSMap:j}],ke={},ye=0;;){try{var me=k.indexOf("<",ye);if(me<0){if(!k.substr(ye).match(/^\s*$/)){var pt=V.doc,We=pt.createTextNode(k.substr(ye));pt.appendChild(We),V.currentElement=We}return}switch(me>ye&&z(me),k.charAt(me+1)){case"/":var dt=k.indexOf(">",me+3),_e=k.substring(me+2,dt).replace(/[ \t\n\r]+$/g,""),Ye=pe.pop();dt<0?(_e=k.substring(me+2).replace(/[\s<].*/,""),ne.error("end tag name: "+_e+" is not complete:"+Ye.tagName),dt=me+1+_e.length):_e.match(/\sye?ye=dt:z(Math.max(me,ye)+1)}}function E(k,j){return j.lineNumber=k.lineNumber,j.columnNumber=k.columnNumber,j}function B(k,j,te,V,ne,he){function ae(I,pe,ke){te.attributeNames.hasOwnProperty(I)&&he.fatalError("Attribute "+I+" redefined"),te.addValue(I,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,ne),ke)}for(var z,P,Z=++j,ee=a;;){var fe=k.charAt(Z);switch(fe){case"=":if(ee===l)z=k.slice(j,Z),ee=h;else if(ee===u)ee=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ee===h||ee===l)if(ee===l&&(he.warning('attribute value must after "="'),z=k.slice(j,Z)),j=Z+1,Z=k.indexOf(fe,j),Z>0)P=k.slice(j,Z),ae(z,P,j-1),ee=g;else throw new Error("attribute value no end '"+fe+"' match");else if(ee==f)P=k.slice(j,Z),ae(z,P,j),he.warning('attribute "'+z+'" missed start quot('+fe+")!!"),j=Z+1,ee=g;else throw new Error('attribute value must after "="');break;case"/":switch(ee){case a:te.setTagName(k.slice(j,Z));case g:case _:case S:ee=S,te.closed=!0;case f:case l:break;case u:te.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return he.error("unexpected end of input"),ee==a&&te.setTagName(k.slice(j,Z)),Z;case">":switch(ee){case a:te.setTagName(k.slice(j,Z));case g:case _:case S:break;case f:case l:P=k.slice(j,Z),P.slice(-1)==="/"&&(te.closed=!0,P=P.slice(0,-1));case u:ee===u&&(P=z),ee==f?(he.warning('attribute "'+P+'" missed quot(")!'),ae(z,P,j)):((!n.isHTML(V[""])||!P.match(/^(?:disabled|checked|selected)$/i))&&he.warning('attribute "'+P+'" missed value!! "'+P+'" instead!!'),ae(P,P,j));break;case h:throw new Error("attribute value missed!!")}return Z;case"€":fe=" ";default:if(fe<=" ")switch(ee){case a:te.setTagName(k.slice(j,Z)),ee=_;break;case l:z=k.slice(j,Z),ee=u;break;case f:var P=k.slice(j,Z);he.warning('attribute "'+P+'" missed quot(")!!'),ae(z,P,j);case g:ee=_;break}else switch(ee){case u:te.tagName,(!n.isHTML(V[""])||!z.match(/^(?:disabled|checked|selected)$/i))&&he.warning('attribute "'+z+'" missed value!! "'+z+'" instead2!!'),ae(z,z,j),j=Z,ee=l;break;case g:he.warning('attribute space is required"'+z+'"!!');case _:ee=l,j=Z;break;case h:ee=f,j=Z;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function G(k,j,te){for(var V=k.tagName,ne=null,fe=k.length;fe--;){var he=k[fe],ae=he.qName,z=he.value,I=ae.indexOf(":");if(I>0)var P=he.prefix=ae.slice(0,I),Z=ae.slice(I+1),ee=P==="xmlns"&&Z;else Z=ae,P=null,ee=ae==="xmlns"&&"";he.localName=Z,ee!==!1&&(ne==null&&(ne={},se(te,te={})),te[ee]=ne[ee]=z,he.uri=n.XMLNS,j.startPrefixMapping(ee,z))}for(var fe=k.length;fe--;){he=k[fe];var P=he.prefix;P&&(P==="xml"&&(he.uri=n.XML),P!=="xmlns"&&(he.uri=te[P||""]))}var I=V.indexOf(":");I>0?(P=k.prefix=V.slice(0,I),Z=k.localName=V.slice(I+1)):(P=null,Z=k.localName=V);var pe=k.uri=te[P||""];if(j.startElement(pe,Z,V,k),k.closed){if(j.endElement(pe,Z,V),ne)for(P in ne)Object.prototype.hasOwnProperty.call(ne,P)&&j.endPrefixMapping(P)}else return k.currentNSMap=te,k.localNSMap=ne,!0}function Y(k,j,te,V,ne){if(/^(?:script|textarea)$/i.test(te)){var he=k.indexOf("",j),ae=k.substring(j+1,he);if(/[&<]/.test(ae))return/^script$/i.test(te)?(ne.characters(ae,0,ae.length),he):(ae=ae.replace(/&#?\w+;/g,V),ne.characters(ae,0,ae.length),he)}return j+1}function q(k,j,te,V){var ne=V[te];return ne==null&&(ne=k.lastIndexOf(""),ne",j+4);return he>j?(te.comment(k,j+4,he-j-4),he+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(j+3,6)=="CDATA["){var he=k.indexOf("]]>",j+9);return te.startCDATA(),te.characters(k,j+9,he-j-9),te.endCDATA(),he+3}var ae=re(k,j),z=ae.length;if(z>1&&/!doctype/i.test(ae[0][0])){var P=ae[1][0],Z=!1,ee=!1;z>3&&(/^public$/i.test(ae[2][0])?(Z=ae[3][0],ee=z>4&&ae[4][0]):/^system$/i.test(ae[2][0])&&(ee=ae[3][0]));var fe=ae[z-1];return te.startDTD(P,Z,ee),te.endDTD(),fe.index+fe[0].length}}return-1}function K(k,j,te){var V=k.indexOf("?>",j);if(V){var ne=k.substring(j,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return ne?(ne[0].length,te.processingInstruction(ne[1],ne[2]),V+2):-1}return-1}function O(){this.attributeNames={}}O.prototype={setTagName:function(k){if(!i.test(k))throw new Error("invalid tagName:"+k);this.tagName=k},addValue:function(k,j,te){if(!i.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:j,offset:te}},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 re(k,j){var te,V=[],ne=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(ne.lastIndex=j,ne.exec(k);te=ne.exec(k);)if(V.push(te),te[1])return V}return Wh.XMLReader=D,Wh.ParseError=C,Wh}var b2;function mD(){if(b2)return Bc;b2=1;var n=s0(),e=Hw(),t=fD(),i=pD(),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,G){var Y=this.options,q=new h,se=Y.domBuilder||new S,Q=Y.errorHandler,K=Y.locator,O=Y.xmlns||{},re=/\/x?html?$/.test(G),k=re?t.HTML_ENTITIES:t.XML_ENTITIES;K&&se.setDocumentLocator(K),q.errorHandler=_(Q,se,K),q.domBuilder=Y.domBuilder||se,re&&(O[""]=l.HTML),O.xml=O.xml||l.XML;var j=Y.normalizeLineEndings||f;return B&&typeof B=="string"?q.parse(j(B),O,k):q.errorHandler.error("invalid doc source"),se.doc};function _(B,G,Y){if(!B){if(G instanceof S)return G;B=G}var q={},se=B instanceof Function;Y=Y||{};function Q(K){var O=B[K];!O&&se&&(O=B.length==2?function(re){B(K,re)}:B),q[K]=O&&function(re){O("[xmldom "+K+"] "+re+D(Y))}||function(){}}return Q("warning"),Q("error"),Q("fatalError"),q}function S(){this.cdata=!1}function C(B,G){G.lineNumber=B.lineNumber,G.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,G,Y,q){var se=this.doc,Q=se.createElementNS(B,Y||G),K=q.length;E(this,Q),this.currentElement=Q,this.locator&&C(this.locator,Q);for(var O=0;O=G+Y||G?new java.lang.String(B,G,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,G){B.currentElement?B.currentElement.appendChild(G):B.doc.appendChild(G)}return Bc.__DOMHandler=S,Bc.normalizeLineEndings=f,Bc.DOMParser=g,Bc}var v2;function gD(){if(v2)return Ic;v2=1;var n=Hw();return Ic.DOMImplementation=n.DOMImplementation,Ic.XMLSerializer=n.XMLSerializer,Ic.DOMParser=mD().DOMParser,Ic}var yD=gD();const x2=n=>!!n&&typeof n=="object",lr=(...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]):x2(e[i])&&x2(t[i])?e[i]=lr(e[i],t[i]):e[i]=t[i]}),e),{}),qw=n=>Object.keys(n).map(e=>n[e]),bD=(n,e)=>{const t=[];for(let i=n;in.reduce((e,t)=>e.concat(t),[]),Vw=n=>{if(!n.length)return[];const e=[];for(let t=0;tn.reduce((t,i,a)=>(i[e]&&t.push(a),t),[]),xD=(n,e)=>qw(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 hd=({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=ue.BigInt?ue.BigInt(u[0]):parseInt(u[0],10),f=ue.BigInt?ue.BigInt(u[1]):parseInt(u[1],10);h{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ue.BigInt(n.offset)+ue.BigInt(n.length)-ue.BigInt(1):e=n.offset+n.length-1,`${n.offset}-${e}`},_2=n=>(n&&typeof n!="number"&&(n=parseInt(n,10)),isNaN(n)?null:n),wD={static(n){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:a}=n,l=_2(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=_2(n.endNumber),_=(e+t)/1e3,S=i+u,D=_+h-S,R=Math.ceil(D*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(R,B)}}},TD=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}},_y=n=>{const{type:e,duration:t,timescale:i=1,periodDuration:a,sourceDuration:l}=n,{start:u,end:h}=wD[e](n),f=bD(u,h).map(TD(n));if(e==="static"){const g=f.length-1,_=typeof a=="number"?a:l;f[g].duration=_-t/i*g}return f},Gw=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=hd({baseUrl:e,source:t.sourceURL,range:t.range}),_=hd({baseUrl:e,source:e,indexRange:a});if(_.map=g,f){const S=_y(n);S.length&&(_.duration=S[0].duration,_.timeline=S[0].timeline)}else i&&(_.duration=i,_.timeline=l);return _.presentationTime=u||l,_.number=h,[_]},wy=(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 D=C,R=n.mediaSequence||0,E;typeof e.firstOffset=="bigint"?E=ue.BigInt(h)+e.firstOffset:E=h+e.firstOffset;for(let B=0;BxD(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),ED=(n,e)=>{for(let t=0;t{let e=[];return hD(n,SD,(t,i,a,l)=>{e=e.concat(t.playlists||[])}),e},T2=({playlist:n,mediaSequence:e})=>{n.mediaSequence=e,n.segments.forEach((t,i)=>{t.number=n.mediaSequence+i})},CD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=ED(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)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--),T2({playlist:i,mediaSequence:a.segments[u].number})})},AD=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(w2(n)),i=e.playlists.concat(w2(e));return e.timelineStarts=Kw([n.timelineStarts,e.timelineStarts]),CD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},a0=n=>n&&n.uri+"-"+_D(n.byterange),Qm=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=qw(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=vD(i.segments||[],"discontinuity"),i))},Ty=(n,e)=>{const t=a0(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&wy(n,i,n.sidx.resolvedUri),n},ND=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=Ty(n[t],e);return n},DD=({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},MD=({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},jD=(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 _=Ty(DD(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},RD=(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(Ty(MD(i),e)),t},{}),OD=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),{}),LD=({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},ID=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",BD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",PD=({attributes:n})=>n.mimeType==="text/vtt"||n.contentType==="text",FD=(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})})},S2=n=>n?Object.keys(n).reduce((e,t)=>{const i=n[t];return e.concat(i.playlists)},[]):[],UD=({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,_=Qm(n.filter(ID)).map(LD),S=Qm(n.filter(BD)),C=Qm(n.filter(PD)),D=n.map(se=>se.attributes.captionServices).filter(Boolean),R={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:ND(_,i)};g>=0&&(R.minimumUpdatePeriod=g*1e3),e&&(R.locations=e),t&&(R.contentSteering=t),h==="dynamic"&&(R.suggestedPresentationDelay=f),l&&l.length>0&&(R.eventStream=l);const E=R.playlists.length===0,B=S.length?jD(S,i,E):null,G=C.length?RD(C,i):null,Y=_.concat(S2(B),S2(G)),q=Y.map(({timelineStarts:se})=>se);return R.timelineStarts=Kw(q),FD(Y,R.timelineStarts),B&&(R.mediaGroups.AUDIO.audio=B),G&&(R.mediaGroups.SUBTITLES.subs=G),D.length&&(R.mediaGroups["CLOSED-CAPTIONS"].cc=OD(D)),a?AD({oldManifest:a,newManifest:R}):R},zD=(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)},Ww=(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);let B;if(R<0){const q=S+1;q===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=zD(n,_,D):B=(l*u-_)/D:B=(e[q].t-_)/D}else B=R+1;const G=h+g.length+B;let Y=h+g.length;for(;Y(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}`},k2=(n,e)=>n.replace($D,HD(e)),qD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?_y(n):Ww(n,e),VD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=hd({baseUrl:n.baseUrl,source:k2(i.sourceURL,t),range:i.range});return qD(n,e).map(u=>{t.Number=u.number,t.Time=u.time;const h=k2(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:_}})},GD=(n,e)=>{const{baseUrl:t,initialization:i={}}=n,a=hd({baseUrl:t,source:i.sourceURL,range:i.range}),l=hd({baseUrl:t,source:e.media,range:e.mediaRange});return l.map=a,l},KD=(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=>GD(n,f));let u;return t&&(u=_y(n)),e&&(u=Ww(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)},WD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=VD,t=lr(n,e.template)):e.base?(i=Gw,t=lr(n,e.base)):e.list&&(i=KD,t=lr(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},XD=n=>n.map(WD),Mi=(n,e)=>Vw(n.childNodes).filter(({tagName:t})=>t===e),_d=n=>n.textContent.trim(),YD=n=>parseFloat(n.split("/").reduce((e,t)=>e/t)),Yl=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,D]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(_||0)*86400+parseFloat(S||0)*3600+parseFloat(C||0)*60+parseFloat(D||0)},QD=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),E2={mediaPresentationDuration(n){return Yl(n)},availabilityStartTime(n){return QD(n)/1e3},minimumUpdatePeriod(n){return Yl(n)},suggestedPresentationDelay(n){return Yl(n)},type(n){return n},timeShiftBufferDepth(n){return Yl(n)},start(n){return Yl(n)},width(n){return parseInt(n,10)},height(n){return parseInt(n,10)},bandwidth(n){return parseInt(n,10)},frameRate(n){return YD(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)?Yl(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}},tr=n=>n&&n.attributes?Vw(n.attributes).reduce((e,t)=>{const i=E2[t.name]||E2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},ZD={"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=_d(i),l=r0(t.baseUrl,a),u=lr(tr(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Sy=n=>{const e=Mi(n,"SegmentTemplate")[0],t=Mi(n,"SegmentList")[0],i=t&&Mi(t,"SegmentURL").map(S=>lr({tag:"SegmentURL"},tr(S))),a=Mi(n,"SegmentBase")[0],l=t||e,u=l&&Mi(l,"SegmentTimeline")[0],h=t||a||e,f=h&&Mi(h,"Initialization")[0],g=e&&tr(e);g&&f?g.initialization=f&&tr(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const _={template:g,segmentTimeline:u&&Mi(u,"S").map(S=>tr(S)),list:t&&lr(tr(t),{segmentUrls:i,initialization:tr(f)}),base:a&&lr(tr(a),{initialization:tr(f)})};return Object.keys(_).forEach(S=>{_[S]||delete _[S]}),_},JD=(n,e,t)=>i=>{const a=Mi(i,"BaseURL"),l=o0(e,a),u=lr(n,tr(i)),h=Sy(i);return l.map(f=>({segmentInfo:lr(t,h),attributes:lr(u,f)}))},e4=n=>n.reduce((e,t)=>{const i=tr(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=ZD[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Mi(t,"cenc:pssh")[0];if(l){const u=_d(l);e[a].pssh=u&&Bw(u)}}return e},{}),t4=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})},n4=n=>wu(Mi(n.node,"EventStream").map(e=>{const t=tr(e),i=t.schemeIdUri;return Mi(e,"Event").map(a=>{const l=tr(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:_d(a)||l.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),i4=(n,e,t)=>i=>{const a=tr(i),l=o0(e,Mi(i,"BaseURL")),u=Mi(i,"Role")[0],h={role:tr(u)};let f=lr(n,a,h);const g=Mi(i,"Accessibility")[0],_=t4(tr(g));_&&(f=lr(f,{captionServices:_}));const S=Mi(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=lr(f,{label:B})}const C=e4(Mi(i,"ContentProtection"));Object.keys(C).length&&(f=lr(f,{contentProtection:C}));const D=Sy(i),R=Mi(i,"Representation"),E=lr(t,D);return wu(R.map(JD(f,l,E)))},r4=(n,e)=>(t,i)=>{const a=o0(e,Mi(t.node,"BaseURL")),l=lr(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Mi(t.node,"AdaptationSet"),h=Sy(t.node);return wu(u.map(i4(l,a,h)))},s4=(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=lr({serverURL:_d(n[0])},tr(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},a4=({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,o4=(n,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:a=0,eventHandler:l=function(){}}=e,u=Mi(n,"Period");if(!u.length)throw new Error(Tu.INVALID_NUMBER_OF_PERIOD);const h=Mi(n,"Location"),f=tr(n),g=o0([{baseUrl:t}],Mi(n,"BaseURL")),_=Mi(n,"ContentSteering");f.type=f.type||"static",f.sourceDuration=f.mediaPresentationDuration||0,f.NOW=i,f.clientOffset=a,h.length&&(f.locations=h.map(_d));const S=[];return u.forEach((C,D)=>{const R=tr(C),E=S[D-1];R.start=a4({attributes:R,priorPeriodAttributes:E?E.attributes:null,mpdType:f.type}),S.push({node:C,attributes:R})}),{locations:f.locations,contentSteeringInfo:s4(_,l),representationInfo:wu(S.map(r4(f,g))),eventStream:wu(S.map(n4))}},Xw=n=>{if(n==="")throw new Error(Tu.DASH_EMPTY_MANIFEST);const e=new yD.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},l4=n=>{const e=Mi(n,"UTCTiming")[0];if(!e)return null;const t=tr(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},u4=(n,e={})=>{const t=o4(Xw(n),e),i=XD(t.representationInfo);return UD({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},c4=n=>l4(Xw(n));var Zm,C2;function d4(){if(C2)return Zm;C2=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),a0;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 Jm=e,Jm}var f4=h4();const p4=Du(f4);var m4=tn([73,68,51]),g4=function(e,t){t===void 0&&(t=0),e=tn(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=tn(e),e.length-t<10||!Di(e,m4,{offset:t})?t:(t+=g4(e,t),n(e,t))},N2=function(e){return typeof e=="string"?$w(e):e},y4=function(e){return Array.isArray(e)?e.map(function(t){return N2(t)}):[N2(e)]},b4=function n(e,t,i){i===void 0&&(i=!1),t=y4(t),e=tn(e);var a=[];if(!t.length)return a;for(var l=0;l>>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);Di(h,t[0])&&(t.length===1?a.push(g):a.push.apply(a,n(g,t.slice(1),i))),l=f}return a},Xh={EBML:tn([26,69,223,163]),DocType:tn([66,130]),Segment:tn([24,83,128,103]),SegmentInfo:tn([21,73,169,102]),Tracks:tn([22,84,174,107]),Track:tn([174]),TrackNumber:tn([215]),DefaultDuration:tn([35,227,131]),TrackEntry:tn([174]),TrackType:tn([131]),FlagDefault:tn([136]),CodecID:tn([134]),CodecPrivate:tn([99,162]),VideoTrack:tn([224]),AudioTrack:tn([225]),Cluster:tn([31,67,182,117]),Timestamp:tn([231]),TimestampScale:tn([42,215,177]),BlockGroup:tn([160]),BlockDuration:tn([155]),Block:tn([161]),SimpleBlock:tn([163])},Pg=[128,64,32,16,8,4,2,1],v4=function(e){for(var t=1,i=0;i=t.length)return t.length;var a=Ef(t,i,!1);if(Di(e.bytes,a.bytes))return i;var l=Ef(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},M2=function n(e,t){t=x4(t),e=tn(e);var i=[];if(!t.length)return i;for(var a=0;ae.length?e.length:h+u.value,g=e.subarray(h,f);Di(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},w4=tn([0,0,0,1]),T4=tn([0,0,1]),S4=tn([0,0,3]),k4=function(e){for(var t=[],i=1;i>1&63),i.indexOf(g)!==-1&&(u=l+f),l+=f+(t==="h264"?1:2)}return e.subarray(0,0)},E4=function(e,t,i){return Yw(e,"h264",t,i)},C4=function(e,t,i){return Yw(e,"h265",t,i)},kr={webm:tn([119,101,98,109]),matroska:tn([109,97,116,114,111,115,107,97]),flac:tn([102,76,97,67]),ogg:tn([79,103,103,83]),ac3:tn([11,119]),riff:tn([82,73,70,70]),avi:tn([65,86,73]),wav:tn([87,65,86,69]),"3gp":tn([102,116,121,112,51,103]),mp4:tn([102,116,121,112]),fmp4:tn([115,116,121,112]),mov:tn([102,116,121,112,113,116]),moov:tn([109,111,111,118]),moof:tn([109,111,111,102])},Su={aac:function(e){var t=Kc(e);return Di(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Kc(e);return Di(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=M2(e,[Xh.EBML,Xh.DocType])[0];return Di(t,kr.webm)},mkv:function(e){var t=M2(e,[Xh.EBML,Xh.DocType])[0];return Di(t,kr.matroska)},mp4:function(e){if(Su["3gp"](e)||Su.mov(e))return!1;if(Di(e,kr.mp4,{offset:4})||Di(e,kr.fmp4,{offset:4})||Di(e,kr.moof,{offset:4})||Di(e,kr.moov,{offset:4}))return!0},mov:function(e){return Di(e,kr.mov,{offset:4})},"3gp":function(e){return Di(e,kr["3gp"],{offset:4})},ac3:function(e){var t=Kc(e);return Di(e,kr.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},eg,j2;function D4(){if(j2)return eg;j2=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 ul=D4();var Ug="8.23.4";const Ca={},Co=function(n,e){return Ca[n]=Ca[n]||[],e&&(Ca[n]=Ca[n].concat(e)),Ca[n]},M4=function(n,e){Co(n,e)},Qw=function(n,e){const t=Co(n).indexOf(e);return t<=-1?!1:(Ca[n]=Ca[n].slice(),Ca[n].splice(t,1),!0)},j4=function(n,e){Co(n,[].concat(e).map(t=>{const i=(...a)=>(Qw(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"]],R2=hf[0];let Wc;for(let n=0;n(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(!ue.console)return;let g=ue.console[i];!g&&i==="debug"&&(g=ue.console.info||ue.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](ue.console,l)};function zg(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=R4(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 zg(S,g,_)},l.createNewLogger=(u,h,f)=>zg(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 En=zg("VIDEOJS"),Zw=En.createLogger,O4=Object.prototype.toString,Jw=function(n){return ta(n)?Object.keys(n):[]};function lu(n,e){Jw(n).forEach(t=>e(n[t],t))}function eT(n,e,t=0){return Jw(n).reduce((i,a)=>e(i,n[a],a),t)}function ta(n){return!!n&&typeof n=="object"}function ku(n){return ta(n)&&O4.call(n)==="[object Object]"&&n.constructor===Object}function pi(...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]=pi(e[a],i)})}),e}function tT(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 L4=Object.freeze({__proto__:null,each:lu,reduce:eT,isObject:ta,isPlain:ku,merge:pi,values:tT,defineLazyProperty:l0});let Ey=!1,nT=null,js=!1,iT,rT=!1,uu=!1,cu=!1,na=!1,Cy=null,u0=null;const I4=!!(ue.cast&&ue.cast.framework&&ue.cast.framework.CastReceiverContext);let sT=null,Af=!1,c0=!1,Nf=!1,d0=!1,Df=!1,Mf=!1,jf=!1;const fd=!!(Mu()&&("ontouchstart"in ue||ue.navigator.maxTouchPoints||ue.DocumentTouch&&ue.document instanceof ue.DocumentTouch)),mo=ue.navigator&&ue.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"),na=!uu&&cu,Cy=u0=(mo.brands.find(n=>n.brand==="Chromium")||{}).version||null,c0=mo.platform==="Windows");if(!cu){const n=ue.navigator&&ue.navigator.userAgent||"";Ey=/iPod/i.test(n),nT=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),js=/Android/i.test(n),iT=(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})(),rT=/Firefox/i.test(n),uu=/Edg/i.test(n),cu=/Chrome/i.test(n)||/CriOS/i.test(n),na=!uu&&cu,Cy=u0=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),sT=(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)&&!na&&!js&&!uu&&!jf,c0=/Windows/i.test(n),Nf=/iPad/i.test(n)||Af&&fd&&!/iPhone/i.test(n),d0=/iPhone/i.test(n)&&!Nf}const vr=d0||Nf||Ey,h0=(Af||vr)&&!na;var aT=Object.freeze({__proto__:null,get IS_IPOD(){return Ey},get IOS_VERSION(){return nT},get IS_ANDROID(){return js},get ANDROID_VERSION(){return iT},get IS_FIREFOX(){return rT},get IS_EDGE(){return uu},get IS_CHROMIUM(){return cu},get IS_CHROME(){return na},get CHROMIUM_VERSION(){return Cy},get CHROME_VERSION(){return u0},IS_CHROMECAST_RECEIVER:I4,get IE_VERSION(){return sT},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:fd,IS_IOS:vr,IS_ANY_SAFARI:h0});function O2(n){return typeof n=="string"&&!!n.trim()}function B4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Mu(){return _t===ue.document}function ju(n){return ta(n)&&n.nodeType===1}function oT(){try{return ue.parent!==ue.self}catch{return!0}}function lT(n){return function(e,t){if(!O2(e))return _t[n](null);O2(t)&&(t=_t.querySelector(t));const i=ju(t)?t:_t;return i[n]&&i[n](e)}}function on(n="div",e={},t={},i){const a=_t.createElement(n);return Object.getOwnPropertyNames(e).forEach(function(l){const u=e[l];l==="textContent"?No(a,u):(a[l]!==u||l==="tabIndex")&&(a[l]=u)}),Object.getOwnPropertyNames(t).forEach(function(l){a.setAttribute(l,t[l])}),i&&Ay(a,i),a}function No(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function $g(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function id(n,e){return B4(e),n.classList.contains(e)}function hl(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):(En.warn("removeClass was called with an element that doesn't exist"),null)}function uT(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 cT(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 xo(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 dT(n,e){return n.getAttribute(e)}function Eu(n,e,t){n.setAttribute(e,t)}function p0(n,e){n.removeAttribute(e)}function hT(){_t.body.focus(),_t.onselectstart=function(){return!1}}function fT(){_t.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!==_t[Cf.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function m0(n,e){const t={x:0,y:0};if(vr){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&&ue.WebKitCSSMatrix){const C=ue.getComputedStyle(_.assignedSlot.parentElement).transform,D=new ue.WebKitCSSMatrix(C);t.x+=D.m41,t.y+=D.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,vr&&(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 pT(n){return ta(n)&&n.nodeType===3}function g0(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function mT(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),ju(e)||pT(e))return e;if(typeof e=="string"&&/\S/.test(e))return _t.createTextNode(e)}).filter(e=>e)}function Ay(n,e){return mT(e).forEach(t=>n.appendChild(t)),n}function gT(n,e){return Ay(g0(n),e)}function md(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 Ao=lT("querySelector"),yT=lT("querySelectorAll");function Au(n,e){if(!n||!e)return"";if(typeof ue.getComputedStyle=="function"){let t;try{t=ue.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function bT(n){[..._t.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(a=>a.cssText).join(""),i=_t.createElement("style");i.textContent=t,n.document.head.appendChild(i)}catch{const i=_t.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,n.document.head.appendChild(i)}})}var vT=Object.freeze({__proto__:null,isReal:Mu,isEl:ju,isInFrame:oT,createEl:on,textContent:No,prependTo:$g,hasClass:id,addClass:hl,removeClass:f0,toggleClass:uT,setAttributes:cT,getAttributes:xo,getAttribute:dT,setAttribute:Eu,removeAttribute:p0,blockTextSelection:hT,unblockTextSelection:fT,getBoundingClientRect:Cu,findPosition:pd,getPointerPosition:m0,isTextNode:pT,emptyEl:g0,normalizeContent:mT,appendContent:Ay,insertContent:gT,isSingleLeftClick:md,$:Ao,$$:yT,computedStyle:Au,copyStyleSheetsToWindow:bT});let xT=!1,Hg;const P4=function(){if(Hg.options.autoSetup===!1)return;const n=Array.prototype.slice.call(_t.getElementsByTagName("video")),e=Array.prototype.slice.call(_t.getElementsByTagName("audio")),t=Array.prototype.slice.call(_t.getElementsByTagName("video-js")),i=n.concat(e,t);if(i&&i.length>0)for(let a=0,l=i.length;a-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function xr(n,e,t){if(!Cr.has(n))return;const i=Cr.get(n);if(!i.handlers)return;if(Array.isArray(e))return Ny(xr,n,e,t);const a=function(u,h){i.handlers[h]=[],L2(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=e&&(n(...a),t=l)}},TT=function(n,e,t,i=ue){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 q4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:bs,bind_:_i,throttle:ia,debounce:TT});let Pc;class os{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},as(this,e,t),this.addEventListener=i}off(e,t){xr(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=()=>{},Dy(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),ue.clearTimeout(a);const l=ue.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Pc.delete(this)),this.trigger(e)},0);i.set(t,l)}}os.prototype.allowedEvents_={};os.prototype.addEventListener=os.prototype.on;os.prototype.removeEventListener=os.prototype.off;os.prototype.dispatchEvent=os.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,Da=n=>n instanceof os||!!n.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof n[e]=="function"),V4=(n,e)=>{Da(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Gg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,Rf=(n,e,t)=>{if(!n||!n.nodeName&&!Da(n))throw new Error(`Invalid target for ${v0(e)}#${t}; must be a DOM node or evented object.`)},ST=(n,e,t)=>{if(!Gg(n))throw new Error(`Invalid event type for ${v0(e)}#${t}; must be a non-empty string or array.`)},kT=(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),ST(l,n,t),kT(u,n,t),u=_i(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},Jo=(n,e,t,i)=>{Rf(n,n,e),n.nodeName?H4[e](n,t,i):n[e](t,i)},G4={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||Gg(n))xr(this.eventBusEl_,n,e);else{const i=n,a=e;Rf(i,this,"off"),ST(a,this,"off"),kT(t,this,"off"),t=_i(this,t),this.off("dispose",t),i.nodeName?(xr(i,a,t),xr(i,"dispose",t)):Da(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(!Gg(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 My(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_=on("span",{className:"vjs-event-bus"});return Object.assign(n,G4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Cr.has(i)&&Cr.delete(i)}),ue.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const K4={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&&Da(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function ET(n,e){return Object.assign(n,K4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Da(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())},CT=function(n,e){return qi(n)===qi(e)};var W4=Object.freeze({__proto__:null,toLowerCase:rd,toTitleCase:qi,titleCaseEquals:CT});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_=pi({},this.options_),t=this.options_=pi(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&&(My(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),ET(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_=pi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return on(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 D=C;return typeof C>"u"&&(D=_),D})),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=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 Ao(e,t||this.contentEl())}$$(e,t){return yT(e,t||this.contentEl())}hasClass(e){return id(this.el_,e)}addClass(...e){hl(this.el_,...e)}removeClass(...e){f0(this.el_,...e)}toggleClass(e,t){uT(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 dT(this.el_,e)}setAttribute(e,t){Eu(this.el_,e,t)}removeAttribute(e){p0(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=ue.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&&ue.performance.now()-e{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),ue.clearTimeout(e)),e}setInterval(e,t){e=_i(this,e),this.clearTimersOnDispose_();const i=ue.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),ue.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=_i(this,e),t=ue.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=_i(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),ue.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=ue.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"||ue.getComputedStyle(l).height==="0px"||ue.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>(_t.documentElement.clientWidth||ue.innerWidth)||u.y<0||u.y>(_t.documentElement.clientHeight||ue.innerHeight))return!1;let h=_t.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;gt)throw new Error(`Failed to execute '${n}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function I2(n,e,t,i){return X4(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:I2.bind(null,"start",0,n),end:I2.bind(null,"end",1,n)},ue.Symbol&&ue.Symbol.iterator&&(e[ue.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 AT=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 jy=AT;function NT(n){jy=n}function DT(){jy=AT}function vl(n,e=n){return jy(n,e)}var Y4=Object.freeze({__proto__:null,createTimeRanges:Ms,createTimeRange:Ms,setFormatTime:NT,resetFormatTime:DT,formatTime:vl});function MT(n,e){let t=0,i,a;if(!e)return 0;(!n||!n.length)&&(n=Ms(0,0));for(let l=0;le&&(a=e),t+=a-i;return t/e}function Bi(n){if(n instanceof Bi)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:ta(n)&&(typeof n.code=="number"&&(this.code=n.code),Object.assign(this,n)),this.message||(this.message=Bi.defaultMessages[this.code]||"")}Bi.prototype.code=0;Bi.prototype.message="";Bi.prototype.status=null;Bi.prototype.metadata=null;Bi.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Bi.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."};Bi.MEDIA_ERR_CUSTOM=0;Bi.prototype.MEDIA_ERR_CUSTOM=0;Bi.MEDIA_ERR_ABORTED=1;Bi.prototype.MEDIA_ERR_ABORTED=1;Bi.MEDIA_ERR_NETWORK=2;Bi.prototype.MEDIA_ERR_NETWORK=2;Bi.MEDIA_ERR_DECODE=3;Bi.prototype.MEDIA_ERR_DECODE=3;Bi.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Bi.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Bi.MEDIA_ERR_ENCRYPTED=5;Bi.prototype.MEDIA_ERR_ENCRYPTED=5;function sd(n){return n!=null&&typeof n.then=="function"}function Ys(n){sd(n)&&n.then(null,e=>{})}const Kg=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}})})},Q4=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=Kg(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(Kg))},Z4=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 Wg={textTracksToJson:Q4,jsonToTextTracks:Z4,trackToJson:Kg};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_=on("div",{className:`${ig}-content`},{role:"document"}),this.descEl_=on("p",{className:`${ig}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),No(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(),gT(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=_t.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 instanceof ue.HTMLAnchorElement||t instanceof ue.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof ue.HTMLInputElement||t instanceof ue.HTMLSelectElement||t instanceof ue.HTMLTextAreaElement||t instanceof ue.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof ue.HTMLIFrameElement||t instanceof ue.HTMLObjectElement||t instanceof ue.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ou.prototype.options_={pauseOnOpen:!0,temporary:!0};nt.registerComponent("ModalDialog",Ou);class xl extends os{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},Da(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,a=this.length;i=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=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.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 Ry extends xl{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 J4{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t0&&(ue.console&&ue.console.groupCollapsed&&ue.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>En.error(a)),ue.console&&ue.console.groupEnd&&ue.console.groupEnd()),t.flush()},F2=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),Iw(t,_i(this,function(l,u,h){if(l)return En.error(l,u);e.loaded_=!0,typeof ue.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],f=>{if(f.type==="vttjserror"){En.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return P2(h,e)}):P2(h,e)}))};class wd extends Oy{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=pi(e,{kind:nM[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=B2[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=_i(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){B2[g]&&i!==g&&(i=g,!this.preload_&&i!=="disabled"&&this.cues.length===0&&F2(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=g&&_.push(D)}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")&&F2(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 ue.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{t=ja.LOADED,this.trigger({type:"load",target:this})})}}ja.prototype.allowedEvents_={load:"load"};ja.NONE=0;ja.LOADING=1;ja.LOADED=2;ja.ERROR=3;const gs={audio:{ListClass:jT,TrackClass:LT,capitalName:"Audio"},video:{ListClass:RT,TrackClass:IT,capitalName:"Video"},text:{ListClass:Ry,TrackClass:wd,capitalName:"Text"}};Object.keys(gs).forEach(function(n){gs[n].getterName=`${n}Tracks`,gs[n].privateName=`${n}Tracks_`});const Nu={remoteText:{ListClass:Ry,TrackClass:wd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:J4,TrackClass:ja,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Er=Object.assign({},gs,Nu);Nu.names=Object.keys(Nu);gs.names=Object.keys(gs);Er.names=[].concat(Nu.names).concat(gs.names);function rM(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 Er.text.TrackClass(a);return l.addTrack(u),u}class bn 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}),Er.names.forEach(i=>{const a=Er[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 Er.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(_i(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 MT(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 Bi(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(!ue.WebVTT)if(_t.body.contains(this.el())){if(!this.options_["vtt.js"]&&ku(u2)&&Object.keys(u2).length>0){this.trigger("vttjsloaded");return}const e=_t.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}),ue.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;hthis.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 bn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof bn||e instanceof bn||e===bn}static registerTech(e,t){if(bn.techs_||(bn.techs_={}),!bn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!bn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!bn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qi(e),bn.techs_[e]=t,bn.techs_[rd(e)]=t,e!=="Tech"&&bn.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(bn.techs_&&bn.techs_[e])return bn.techs_[e];if(e=qi(e),ue&&ue.videojs&&ue.videojs[e])return En.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),ue.videojs[e]}}}Er.names.forEach(function(n){const e=Er[n];bn.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});bn.prototype.featuresVolumeControl=!0;bn.prototype.featuresMuteControl=!0;bn.prototype.featuresFullscreenResize=!1;bn.prototype.featuresPlaybackRate=!1;bn.prototype.featuresProgressEvents=!1;bn.prototype.featuresSourceset=!1;bn.prototype.featuresTimeupdateEvents=!1;bn.prototype.featuresNativeTextTracks=!1;bn.prototype.featuresVideoFrameCallback=!1;bn.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;lil(e,fl[e.type],t,n),1)}function oM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function lM(n,e,t){return n.reduceRight(By(t),e[t]())}function uM(n,e,t,i){return e[t](n.reduce(By(t),i))}function U2(n,e,t,i=null){const a="call"+qi(t),l=n.reduce(By(a),i),u=l===If,h=u?null:e[t](l);return hM(n,t,h,u),h}const cM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},dM={setCurrentTime:1,setMuted:1,setVolume:1},z2={play:1,pause:1};function By(n){return(e,t)=>e===If?If:t[n]?t[n](e):e}function hM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function fM(n){Lf.hasOwnProperty(n.id())&&delete Lf[n.id()]}function pM(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{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 `;const H2=Df?10009:Mf?461:8,Ql={codes:{play:415,pause:19,ff:417,rw:412,back:H2},names:{415:"play",19:"pause",417:"ff",412:"rw",[H2]:"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}},q2=5;class bM extends os{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(Ql.isEventKey(t,"play")||Ql.isEventKey(t,"pause")||Ql.isEventKey(t,"ff")||Ql.isEventKey(t,"rw")){t.preventDefault();const i=Ql.getEventName(t);this.performMediaAction_(i)}else Ql.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()+q2);break;case"rw":this.userSeek_(this.player_.currentTime()-q2);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;a0&&(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=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;ethis.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"&&En.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=on(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=on("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,No(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 Xg 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 on("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(on("picture",{className:"vjs-poster",tabIndex:-1},{},on("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()?Ys(this.player_.play()):this.player_.pause())}}Xg.prototype.crossorigin=Xg.prototype.crossOrigin;nt.registerComponent("PosterImage",Xg);const fs="#222",V2="#ccc",xM={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 Gs(n,e,t){try{n.style[e]=t}catch{return}}function G2(n){return n?`${n}px`:""}class _M 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(_i(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=ue.screen.orientation||ue,h=ue.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;g0&&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()||!ue.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)),Gs(this.el_,"insetInline",G2(l)),Gs(this.el_,"insetBlock",G2(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&&Gs(u.firstChild,"color",ag(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(u.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Gs(u.firstChild,"backgroundColor",ag(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Gs(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 ${V2}, 0 1px ${V2}, -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=ue.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=xM[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof ue.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;ithis.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){Ys(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}}PT.prototype.controlText_="Play Video";nt.registerComponent("BigPlayButton",PT);class TM extends _r{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",TM);class FT extends _r{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()?Ys(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))}}FT.prototype.controlText_="Play";nt.registerComponent("PlayToggle",FT);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=on("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=on("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=vl(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,En.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_=_t.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 Py 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)}}Py.prototype.labelText_="Current Time";Py.prototype.controlText_="Current Time";nt.registerComponent("CurrentTimeDisplay",Py);class Fy 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)}}Fy.prototype.labelText_="Duration";Fy.prototype.controlText_="Duration";nt.registerComponent("DurationDisplay",Fy);class SM 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",SM);class Uy 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(on("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)}}Uy.prototype.labelText_="Remaining Time";Uy.prototype.controlText_="Remaining Time";nt.registerComponent("RemainingTimeDisplay",Uy);class kM 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_=on("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(on("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(_t.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",kM);class UT extends _r{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_=on("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()}}UT.prototype.controlText_="Seek to live, currently playing live";nt.registerComponent("SeekToLive",UT);function Td(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var EM=Object.freeze({__proto__:null,clamp:Td});class zy 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"&&!na&&e.preventDefault(),hT(),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;fT(),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(Td(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=m0(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",zy);const og=(n,e)=>Td(n/e*100,0,100).toFixed(2)+"%";class CM 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=on("span",{className:"vjs-control-text"}),i=on("span",{textContent:this.localize("Loaded")}),a=_t.createTextNode(": ");return this.percentageEl_=on("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,No(this.percentageEl_,h),this.percent_=h);for(let f=0;fi.length;f--)this.el_.removeChild(u[f-1]);u.length=i.length})}}nt.registerComponent("LoadProgressBar",CM);class AM extends nt{constructor(e,t){super(e,t),this.update=ia(_i(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;ha.width&&(g=a.width),g=Math.round(g),this.el_.style.right=`-${g}px`,this.write(i)}write(e){No(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?"":"-")+vl(f,h)}else l=vl(i,u);this.update(e,t,l),a&&a()})}}nt.registerComponent("TimeTooltip",AM);class $y extends nt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ia(_i(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)}}$y.prototype.options_={children:[]};!vr&&!js&&$y.prototype.options_.children.push("timeTooltip");nt.registerComponent("PlayProgressBar",$y);class zT extends nt{constructor(e,t){super(e,t),this.update=ia(_i(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`})}}zT.prototype.options_={children:["timeTooltip"]};nt.registerComponent("MouseTimeDisplay",zT);class w0 extends zy{constructor(e,t){t=pi(w0.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(vr||js)||e.options_.disableSeekWhileScrubbingOnSTV;(!vr&&!js||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=_i(this,this.update),this.update=ia(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 _t&&"visibilityState"in _t&&this.on(_t,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){_t.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(_t.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}",[vl(i,l),vl(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){md(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!md(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?Ys(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 _t&&"visibilityState"in _t&&this.off(_t,"visibilitychange",this.toggleVisibility_),super.dispose()}}w0.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};nt.registerComponent("SeekBar",w0);class $T extends nt{constructor(e,t){super(e,t),this.handleMouseMove=ia(_i(this,this.handleMouseMove),bs),this.throttledHandleMouseSeek=ia(_i(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=m0(l,e).x;h=Td(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&&Ys(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()}}$T.prototype.options_={children:["seekBar"]};nt.registerComponent("ProgressControl",$T);class HT extends _r{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(){_t.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in ue?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 _t.exitPictureInPicture=="function"&&super.show()}}HT.prototype.controlText_="Picture-in-Picture";nt.registerComponent("PictureInPictureToggle",HT);class qT extends _r{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),_t[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()}}qT.prototype.controlText_="Fullscreen";nt.registerComponent("FullscreenToggle",qT);const NM=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 DM 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",DM);class MM extends nt{constructor(e,t){super(e,t),this.update=ia(_i(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){No(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",MM);class VT extends nt{constructor(e,t){super(e,t),this.update=ia(_i(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`})}}VT.prototype.options_={children:["volumeLevelTooltip"]};nt.registerComponent("MouseVolumeLevelDisplay",VT);class T0 extends zy{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){md(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=m0(i,e);u=l?u.y:u.x,u=Td(u,0,1),t.update(a,u,l)}md(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"};!vr&&!js&&T0.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");T0.prototype.playerEvent="volumechange";nt.registerComponent("VolumeBar",T0);class GT 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),NM(this,e),this.throttledHandleMouseMove=ia(_i(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)}}GT.prototype.options_={children:["volumeBar"]};nt.registerComponent("VolumeControl",GT);const jM=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 KT extends _r{constructor(e,t){super(e,t),jM(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"),vr&&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}`,"")),hl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}KT.prototype.controlText_="Mute";nt.registerComponent("MuteToggle",KT);class WT 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"),as(_t,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),xr(_t,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}WT.prototype.options_={children:["muteToggle","volumeControl"]};nt.registerComponent("VolumePanel",WT);class XT extends _r{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]))}}XT.prototype.controlText_="Skip Forward";nt.registerComponent("SkipForward",XT);class YT extends _r{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]))}}YT.prototype.controlText_="Skip Backward";nt.registerComponent("SkipBackward",YT);class QT 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_=on(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_),as(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||_t.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",QT);class Hy extends nt{constructor(e,t={}){super(e,t),this.menuButton_=new _r(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=_r.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(),as(_t,"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 QT(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=on("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.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 ue.Event!="object")try{h=new ue.Event("change")}catch{}h||(h=_t.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-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-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",ZT);class Iu extends qy{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=kd){let i;this.label_&&(i=`${this.label_} off`),e.push(new ZT(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-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 JT extends Sd{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{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-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 Wy(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,eS),e}}Yy.prototype.kinds_=["captions","subtitles"];Yy.prototype.controlText_="Subtitles";nt.registerComponent("SubsCapsButton",Yy);class tS extends Sd{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(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(on("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;ithis.update(l))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Qy.prototype.contentElType="button";nt.registerComponent("PlaybackRateMenuItem",Qy);class iS extends Hy{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_=on("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 Qy(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")}}iS.prototype.controlText_="Playback Rate";nt.registerComponent("PlaybackRateMenuButton",iS);class rS 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",rS);class RM extends rS{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}nt.registerComponent("CustomControlSpacer",RM);class sS extends nt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}sS.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",sS);class aS 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):""}}aS.prototype.options_=Object.assign({},Ou.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});nt.registerComponent("ErrorDisplay",aS);class oS 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(),on("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=on("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",oS);class pl extends nt{constructor(e,t={}){super(e,t);const i=on("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=on("span",{className:h});const C=on("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});C.setAttribute("for",_),g.appendChild(C)}const S=new oS(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 on("fieldset",{className:this.options_.className})}}nt.registerComponent("TextTrackFieldset",pl);class lS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new pl(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 pl(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 pl(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 on("div",{className:"vjs-track-settings-colors"})}}nt.registerComponent("TextTrackSettingsColors",lS);class uS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new pl(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 pl(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 pl(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 on("div",{className:"vjs-track-settings-font"})}}nt.registerComponent("TextTrackSettingsFont",uS);class cS extends nt{constructor(e,t={}){super(e,t);const i=new _r(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 _r(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return on("div",{className:"vjs-track-settings-controls"})}}nt.registerComponent("TrackSettingsControls",cS);const lg="vjs-text-track-settings",K2=["#000","Black"],W2=["#00F","Blue"],X2=["#0FF","Cyan"],Y2=["#0F0","Green"],Q2=["#F0F","Magenta"],Z2=["#F00","Red"],J2=["#FFF","White"],e_=["#FF0","Yellow"],ug=["1","Opaque"],cg=["0.5","Semi-Transparent"],t_=["0","Transparent"],_o={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[K2,J2,Z2,Y2,W2,e_,Q2,X2],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ug,cg,t_],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[J2,K2,Z2,Y2,W2,e_,Q2,X2],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:[t_,cg,ug],className:"vjs-window-opacity vjs-opacity"}};_o.windowColor.options=_o.backgroundColor.options;function dS(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function OM(n,e){const t=n.options[n.options.selectedIndex].value;return dS(t,e)}function LM(n,e,t){if(e){for(let i=0;i{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),lu(_o,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 eT(_o,(e,t,i)=>{const a=OM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){lu(_o,(t,i)=>{LM(this.$(t.selector),e[i],t.parser)})}setDefaults(){lu(_o,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(ue.localStorage.getItem(lg))}catch(t){En.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?ue.localStorage.setItem(lg,JSON.stringify(e)):ue.localStorage.removeItem(lg)}catch(t){En.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}nt.registerComponent("TextTrackSettings",IM);class BM extends nt{constructor(e,t){let i=t.ResizeObserver||ue.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=pi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||ue.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=TT(()=>{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(){xr(this,"resize",l),xr(this,"unload",u),u=null};as(this.el_.contentWindow,"unload",u),as(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",BM);const PM={trackingThreshold:20,liveTolerance:15};class FM extends nt{constructor(e,t){const i=pi(PM,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(ue.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",FM);class UM extends nt{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:on("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ys()}`}),description:on("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ys()}`})},on("div",{className:"vjs-title-bar"},{},tT(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&&No(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",UM);const zM={initialDisplay:4e3,position:[],takeFocus:!1};class $M extends _r{constructor(e,t){t=pi(zM,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=on("button",{},{type:"button",class:this.buildCSSClass()},on("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",$M);const Yg=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{let t={};for(let i=0;ihS([n.el(),ue.HTMLMediaElement.prototype,ue.Element.prototype,HM],"innerHTML"),n_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=qM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Yg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",pi(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_)},VM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?OT(ue.Element.prototype.getAttribute.call(this,"src")):""},set(n){return ue.Element.prototype.setAttribute.call(this,"src",n),n}}),GM=n=>hS([n.el(),ue.HTMLMediaElement.prototype,VM],"src"),KM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=GM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",pi(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 Yg(n)||(n.triggerSourceset(""),n_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Yg(n)||n_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Pt extends bn{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{t=[];for(let l=0;le.removeEventListener("change",i));const a=()=>{for(let l=0;l{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{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),Pt.disposeMediaElement(e),e=i}else{e=_t.createElement("video");const i=this.options_.tag&&xo(this.options_.tag),a=pi({},i);(!fd||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,cT(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=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){En(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&js&&na&&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)Ys(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 En.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const a=on("source",{},i);return this.el_.appendChild(a),!0}removeSourceElement(e){if(!e)return En.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 En.warn(`No matching source element found with src: ${e}`),!1}reset(){Pt.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=_t.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),ue.performance&&(e.creationTime=ue.performance.now()),e}}l0(Pt,"TEST_VID",function(){if(!Mu())return;const n=_t.createElement("video"),e=_t.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Pt.isSupported=function(){try{Pt.TEST_VID.volume=.5}catch{return!1}return!!(Pt.TEST_VID&&Pt.TEST_VID.canPlayType)};Pt.canPlayType=function(n){return Pt.TEST_VID.canPlayType(n)};Pt.canPlaySource=function(n,e){return Pt.canPlayType(n.type)};Pt.canControlVolume=function(){try{const n=Pt.TEST_VID.volume;Pt.TEST_VID.volume=n/2+.1;const e=n!==Pt.TEST_VID.volume;return e&&vr?(ue.setTimeout(()=>{Pt&&Pt.prototype&&(Pt.prototype.featuresVolumeControl=n!==Pt.TEST_VID.volume)}),!1):e}catch{return!1}};Pt.canMuteVolume=function(){try{const n=Pt.TEST_VID.muted;return Pt.TEST_VID.muted=!n,Pt.TEST_VID.muted?Eu(Pt.TEST_VID,"muted","muted"):p0(Pt.TEST_VID,"muted","muted"),n!==Pt.TEST_VID.muted}catch{return!1}};Pt.canControlPlaybackRate=function(){if(js&&na&&u0<58)return!1;try{const n=Pt.TEST_VID.playbackRate;return Pt.TEST_VID.playbackRate=n/2+.1,n!==Pt.TEST_VID.playbackRate}catch{return!1}};Pt.canOverrideAttributes=function(){try{const n=()=>{};Object.defineProperty(_t.createElement("video"),"src",{get:n,set:n}),Object.defineProperty(_t.createElement("audio"),"src",{get:n,set:n}),Object.defineProperty(_t.createElement("video"),"innerHTML",{get:n,set:n}),Object.defineProperty(_t.createElement("audio"),"innerHTML",{get:n,set:n})}catch{return!1}return!0};Pt.supportsNativeTextTracks=function(){return h0||vr&&na};Pt.supportsNativeVideoTracks=function(){return!!(Pt.TEST_VID&&Pt.TEST_VID.videoTracks)};Pt.supportsNativeAudioTracks=function(){return!!(Pt.TEST_VID&&Pt.TEST_VID.audioTracks)};Pt.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(Pt.prototype,n,()=>Pt[e](),!0)});Pt.prototype.featuresVolumeControl=Pt.canControlVolume();Pt.prototype.movingMediaElementInDOM=!vr;Pt.prototype.featuresFullscreenResize=!0;Pt.prototype.featuresProgressEvents=!0;Pt.prototype.featuresTimeupdateEvents=!0;Pt.prototype.featuresVideoFrameCallback=!!(Pt.TEST_VID&&Pt.TEST_VID.requestVideoFrameCallback);Pt.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{}})()}};Pt.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){Pt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Pt.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){Pt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Pt.prototype["set"+qi(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Pt.prototype[n]=function(){return this.el_[n]()}});bn.withSourceHandlers(Pt);Pt.nativeSourceHandler={};Pt.nativeSourceHandler.canPlayType=function(n){try{return Pt.TEST_VID.canPlayType(n)}catch{return""}};Pt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Pt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Iy(n.src);return Pt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Pt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Pt.nativeSourceHandler.dispose=function(){};Pt.registerSourceHandler(Pt.nativeSourceHandler);bn.registerTech("Html5",Pt);const fS=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],dg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Qg=["tiny","xsmall","small","medium","large","xlarge","huge"],ff={};Qg.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;ff[n]=`vjs-layout-${e}`});const WM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let ji=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=Zw(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&&xo(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(),My(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(as(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const a=pi(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 ue.DOMParser().parseFromString(yM,"image/svg+xml");if(h.querySelector("parsererror"))En.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 bM(this),this.addClass("vjs-spatial-navigation-enabled")),fd&&this.addClass("vjs-touch-enabled"),vr||this.addClass("vjs-workinghover"),nu.players[this.id_]=this;const l=Ug.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"),xr(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),xr(_t,"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),fM(this),Er.names.forEach(e=>{const t=Er[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=xo(e);if(a){for(t=this.el_=e,e=this.tag=_t.createElement("video");t.children.length;)e.appendChild(t.firstChild);id(t,"video-js")||hl(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",na&&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=>aT[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),ue.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=_T("vjs-styles-dimensions");const f=Ao(".vjs-styles-defaults"),g=Ao("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"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){En.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)){En.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,Da(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),V4(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(ue.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),wT(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&&(bn.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};Er.names.forEach(f=>{const g=Er[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=bn.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(_i(this,this.handleTechReady_),!0),Wg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),fS.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)&&$g(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Er.names.forEach(e=>{const t=Er[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Wg.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&&En.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":Ug}}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=gM(this,t)),this.cache_.source=pi({},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;fthis.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()?Ys(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()&&!_t.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=_t[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 dM)return uM(this.middleware_,this.tech_,e,t);if(e in z2)return U2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw En(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in cM)return lM(this.middleware_,this.tech_,e);if(e in z2)return U2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(En(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(En(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(En(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Ys){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(h0||vr);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 MT(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=_t[this.fsApi_.exitFullscreen]();return e&&Ys(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=_t.documentElement.style.overflow,as(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow="hidden",hl(_t.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,xr(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow=this.docOrigOverflow,f0(_t.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&&ue.documentPictureInPicture){const e=_t.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(on("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),ue.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(bT(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 _t&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(ue.documentPictureInPicture&&ue.documentPictureInPicture.window)return ue.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in _t)return _t.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");_t[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[h,bn.getTech(h)]).filter(([h,f])=>f?f.isSupported():(En.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=BT(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]),aM(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}oM(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?CT(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();Ys(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}),Da(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(Co("beforeerror").forEach(t=>{const i=t(this,e);if(!(ta(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 Bi(e),this.addClass("vjs-error"),En.error(`(CODE:${this.error_.code} ${Bi.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Co("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=_i(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&&!vr&&!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(),Da(this)&&this.trigger("languagechange"))}languages(){return pi(nu.prototype.options_.languages,this.languages_)}toJSON(){const e=pi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.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 pi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=xo(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){En.error("data-setup",l)}if(Object.assign(t,i),e.hasChildNodes()){const l=e.childNodes;for(let u=0,h=l.length;utypeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};ji.prototype.videoTracks=()=>{};ji.prototype.audioTracks=()=>{};ji.prototype.textTracks=()=>{};ji.prototype.remoteTextTracks=()=>{};ji.prototype.remoteTextTrackEls=()=>{};Er.names.forEach(function(n){const e=Er[n];ji.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});ji.prototype.crossorigin=ji.prototype.crossOrigin;ji.players={};const Fc=ue.navigator;ji.prototype.options_={techOrder:bn.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};fS.forEach(function(n){ji.prototype[`handleTech${qi(n)}_`]=function(){return this.trigger(n)}});nt.registerComponent("Player",ji);const Pf="plugin",du="activePlugins_",iu={},Ff=n=>iu.hasOwnProperty(n),pf=n=>Ff(n)?iu[n]:void 0,pS=(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)},XM=function(n,e){const t=function(){Uf(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return pS(this,n),Uf(this,{name:n,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},i_=(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)),My(this),delete this.trigger,ET(this,this.constructor.defaultState),pS(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]=i_(e,iu[e])}static isBasic(e){const t=typeof e=="string"?pf(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))En.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ji.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)?ji.prototype[e]=XM(e,t):ji.prototype[e]=i_(e,t)),t}static deregisterPlugin(e){if(e===Pf)throw new Error("Cannot de-register base plugin.");Ff(e)&&(delete iu[e],delete ji.prototype[e])}static getPlugins(e=Object.keys(iu)){let t;return e.forEach(i=>{const a=pf(i);a&&(t=t||{},t[i]=a)}),t}static getPluginVersion(e){const t=pf(e);return t&&t.VERSION||""}}Vr.getPlugin=pf;Vr.BASE_PLUGIN_NAME=Pf;Vr.registerPlugin(Pf,Vr);ji.prototype.usingPlugin=function(n){return!!this[du]&&this[du][n]===!0};ji.prototype.hasPlugin=function(n){return!!Ff(n)};function YM(n,e){let t=!1;return function(...i){return t||En.warn(n),t=!0,e.apply(this,i)}}function Rs(n,e,t,i){return YM(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var QM={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 mS=n=>n.indexOf("#")===0?n.slice(1):n;function Be(n,e,t){let i=Be.getPlayer(n);if(i)return e&&En.warn(`Player "${n}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const a=typeof n=="string"?Ao("#"+mS(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 ue.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;(!a.ownerDocument.defaultView||!u.contains(a))&&En.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)),Co("beforesetup").forEach(f=>{const g=f(a,pi(e));if(!ta(g)||Array.isArray(g)){En.error("please return an object in beforesetup hooks");return}e=pi(e,g)});const h=nt.getComponent("Player");return i=new h(a,e,t),Co("setup").forEach(f=>f(i)),i}Be.hooks_=Ca;Be.hooks=Co;Be.hook=M4;Be.hookOnce=j4;Be.removeHook=Qw;if(ue.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Mu()){let n=Ao(".vjs-styles-defaults");if(!n){n=_T("vjs-styles-defaults");const e=Ao("head");e&&e.insertBefore(n,e.firstChild),wT(n,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}qg(1,Be);Be.VERSION=Ug;Be.options=ji.prototype.options_;Be.getPlayers=()=>ji.players;Be.getPlayer=n=>{const e=ji.players;let t;if(typeof n=="string"){const i=mS(n),a=e[i];if(a)return a;t=Ao("#"+i)}else t=n;if(ju(t)){const{player:i,playerId:a}=t;if(i||e[a])return i||e[a]}};Be.getAllPlayers=()=>Object.keys(ji.players).map(n=>ji.players[n]).filter(Boolean);Be.players=ji.players;Be.getComponent=nt.getComponent;Be.registerComponent=(n,e)=>(bn.isTech(e)&&En.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));Be.getTech=bn.getTech;Be.registerTech=bn.registerTech;Be.use=sM;Object.defineProperty(Be,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Be.middleware,"TERMINATOR",{value:If,writeable:!1,enumerable:!0});Be.browser=aT;Be.obj=L4;Be.mergeOptions=Rs(9,"videojs.mergeOptions","videojs.obj.merge",pi);Be.defineLazyProperty=Rs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",l0);Be.bind=Rs(9,"videojs.bind","native Function.prototype.bind",_i);Be.registerPlugin=Vr.registerPlugin;Be.deregisterPlugin=Vr.deregisterPlugin;Be.plugin=(n,e)=>(En.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Vr.registerPlugin(n,e));Be.getPlugins=Vr.getPlugins;Be.getPlugin=Vr.getPlugin;Be.getPluginVersion=Vr.getPluginVersion;Be.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Be.options.languages=pi(Be.options.languages,{[n]:e}),Be.options.languages[n]};Be.log=En;Be.createLogger=Zw;Be.time=Y4;Be.createTimeRange=Rs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ms);Be.createTimeRanges=Rs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ms);Be.formatTime=Rs(9,"videojs.formatTime","videojs.time.formatTime",vl);Be.setFormatTime=Rs(9,"videojs.setFormatTime","videojs.time.setFormatTime",NT);Be.resetFormatTime=Rs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",DT);Be.parseUrl=Rs(9,"videojs.parseUrl","videojs.url.parseUrl",Ly);Be.isCrossOrigin=Rs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",x0);Be.EventTarget=os;Be.any=Dy;Be.on=as;Be.one=b0;Be.off=xr;Be.trigger=Ru;Be.xhr=Iw;Be.TrackList=xl;Be.TextTrack=wd;Be.TextTrackList=Ry;Be.AudioTrack=LT;Be.AudioTrackList=jT;Be.VideoTrack=IT;Be.VideoTrackList=RT;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(n=>{Be[n]=function(){return En.warn(`videojs.${n}() is deprecated; use videojs.dom.${n}() instead`),vT[n].apply(null,arguments)}});Be.computedStyle=Rs(9,"videojs.computedStyle","videojs.dom.computedStyle",Au);Be.dom=vT;Be.fn=q4;Be.num=EM;Be.str=W4;Be.url=iM;Be.Error=QM;class ZM{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 Be.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 ZM(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;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ti,n.qualityLevels.VERSION=gS,i},yS=function(n){return JM(this,Be.obj.merge({},n))};Be.registerPlugin("qualityLevels",yS);yS.VERSION=gS;const zr=r0,$f=(n,e)=>e&&e.responseURL&&n!==e.responseURL?e.responseURL:n,xs=n=>Be.log.debug?Be.log.debug.bind(Be,"VHS:",`${n} >`):function(){};function ri(...n){const e=Be.obj||Be;return(e.merge||e.mergeOptions).apply(e,n)}function ur(...n){const e=Be.time||Be;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function ej(n){if(n.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let t=0;t ${a}. Duration (${a-i}) `}return e}const Qs=1/30,Zs=Qs*3,bS=function(n,e){const t=[];let i;if(n&&n.length)for(i=0;i=e})},Qh=function(n,e){return bS(n,function(t){return t-Qs>=e})},tj=function(n){if(n.length<2)return ur();const e=[];for(let t=1;t{const e=[];if(!n||!n.length)return"";for(let t=0;t "+n.end(t));return e.join(", ")},ij=function(n,e,t=1){return((n.length?n.end(n.length-1):0)-e)/t},cl=n=>{const e=[];for(let t=0;tl)){if(e>a&&e<=l){t+=l-e;continue}t+=l-a}}return t},Jy=(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},Zg=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),[]),xS=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},_S=({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},wS=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=xS(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},sj=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+=Jy(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},aj=function(n,e){let t=0,i,a=e-n.mediaSequence;for(;a"u"&&(e=n.mediaSequence+n.segments.length),e"u"){if(n.totalDuration)return n.totalDuration;if(!n.endList)return ue.Infinity}return TS(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;l0)for(let g=f-1;g>=0;g--){const _=h[g];if(u+=_.duration,l){if(u<0)continue}else if(u+Qs<=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;gQs,C=u===0,D=S&&u+Qs>=0;if(!((C||D)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-Qs>=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}},ES=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},eb=function(n){return n.excludeUntil&&n.excludeUntil===1/0},S0=function(n){const e=ES(n);return!n.disabled&&!e},uj=function(n){return n.disabled},cj=function(n){for(let e=0;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)!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),r_=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},Ed=n=>{if(!n||!n.playlists||!n.playlists.length)return r_(n,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;eFw(l))||r_(n,l=>tb(t,l))))return!1}return!0};var Hr={liveEdgeDelay:wS,duration:SS,seekable:oj,getMediaInfoForTime:lj,isEnabled:S0,isDisabled:uj,isExcluded:ES,isIncompatible:eb,playlistEnd:kS,isAes:cj,hasAttribute:CS,estimateSegmentRequestTime:dj,isLowestEnabledRendition:Jg,isAudioOnly:Ed,playlistMatch:tb,segmentDurationWithParts:Jy};const{log:AS}=Be,hu=(n,e)=>`${n}-${e}`,NS=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,hj=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new J3;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=xS(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}`}),AS.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)}})},DS=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},fj=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];DS({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||AS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},pj=n=>{Bu(n,e=>{e.uri&&(e.resolvedUri=zr(n.uri,e.uri))})},mj=(n,e)=>{const t=hu(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:ue.location.href,resolvedUri:ue.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},MS=(n,e,t=NS)=>{n.uri=e;for(let a=0;a{if(!a.playlists||!a.playlists.length){if(i&&l==="AUDIO"&&!a.uri)for(let f=0;f(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(){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=Be.Error.NetworkRequestFailed;else if(e.aborted)u.errorType=Be.Error.NetworkRequestAborted;else if(e.timedout)u.errorType=Be.Error.NetworkRequestTimeout;else if(h){const f=i?Be.Error.NetworkBodyParserFailed:Be.Error.NetworkBadStatus;u.errorType=f,u.status=e.status,u.headers=e.headers}return u},gj=xs("CodecUtils"),RS=function(n){const e=n.attributes||{};if(e.CODECS)return Ws(e.CODECS)},OS=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},yj=(n,e)=>{if(!OS(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},gd=function(n){const e={};return n.forEach(({mediaType:t,type:i,details:a})=>{e[t]=e[t]||[],e[t].push(Pw(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){gj(`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},a_=function(n){let e=0;return n.audio&&e++,n.video&&e++,e},od=function(n,e){const t=e.attributes||{},i=gd(RS(e)||[]);if(OS(n,e)&&!i.audio&&!yj(n,e)){const a=gd(tD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:bj}=Be,vj=(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=_S(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 ue.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},xj=(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{const i=n.slice(),a=e.slice();t=t||0;const l=[];let u;for(let h=0;h{!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))})},IS=function(n){const e=n.segments||[],t=n.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;in===e||n.segments&&e.segments&&n.segments.length===e.segments.length&&n.endList===e.endList&&n.mediaSequence===e.mediaSequence&&n.preloadSegment===e.preloadSegment,ey=(n,e,t=BS)=>{const i=ri(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=IS(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{LS(u,l.resolvedUri)});for(let u=0;u{if(u.playlists)for(let _=0;_{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},o_=(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 bj{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 s_,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=vj(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=hj({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:Be.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=RS(i)||[];return!!gd(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(),DS({playlist:u,uri:i,id:a});const h=ey(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_(ty(this.media(),!!h)),l.parsedPlaylist=o_(this.main.playlists,l.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:l}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),ue.clearTimeout(this.mediaUpdateTimeout),ue.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new s_,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(ue.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=ue.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_(ty(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&&(ue.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&&(ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=ue.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&&(ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=ue.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=ue.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=o_(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,MS(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=IS(i),i.segments.forEach(a=>{LS(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||ue.location.href;this.main=mj(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,D=S.resolvedUri;delete i.playlists[C],delete i.playlists[D]});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 D=a.playlists[S.id],R=NS(l,t,h),E=hu(t,R);if(D&&!a.playlists[E]){const B=this.createClonePlaylist_(D,E,e),G=B.resolvedUri;a.playlists[E]=B,a.playlists[G]=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 ny=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)},wj=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},Tj=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},PS=function(){const n=function e(t,i){t=ri({timeout:45e3},t);const a=e.beforeRequest||Be.Vhs.xhr.beforeRequest,l=e._requestCallbackSet||Be.Vhs.xhr._requestCallbackSet||new Set,u=e._responseCallbackSet||Be.Vhs.xhr._responseCallbackSet;a&&typeof a=="function"&&(Be.log.warn("beforeRequest is deprecated, use onRequest instead."),l.add(a));const h=Be.Vhs.xhr.original===!0?Be.xhr:Be.Vhs.xhr,f=wj(l,t);l.delete(a);const g=h(f||t,function(S,C){return Tj(u,g,S,C),ny(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},Sj=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ue.BigInt(n.offset)+ue.BigInt(n.length)-ue.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},iy=function(n){const e={};return n.byterange&&(e.Range=Sj(n.byterange)),e},kj=function(n,e){return n.start(e)+"-"+n.end(e)},Ej=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Cj=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},FS=function(n){const e={};return Object.keys(n).forEach(t=>{const i=n[t];zw(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(",")},US=function(n){return n.resolvedUri},zS=n=>{const e=Array.prototype.slice.call(n),t=16;let i="",a,l;for(let u=0;uzS(n),Nj=n=>{let e="",t;for(t=0;t{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)},jj=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,Rj=(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(th?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"})},Oj=(n,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let l=0;lt){if(n>t+a.duration*$S)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Lj=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},Ij=n=>{if(!n.segments||n.segments.length===0)return!1;for(let e=0;e{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=Oj(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=Mj(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},HS=({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(!Ij(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=Rj(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=Lj(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",()=>{HS({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()},Pj=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,C,D,R){return C.abort(),u=!0,t(S,C,D,R)},f=function(S,C){if(u)return;if(S)return S.metadata=ml({requestType:i,request:C,error:S}),h(S,C,"",a);const D=C.responseText.substring(a&&a.byteLength||0,C.responseText.length);if(a=dD(a,$w(D,!0)),l=l||Kc(a),a.length<10||l&&a.lengthh(S,C,"",a));const R=ky(a);return R==="ts"&&a.length<188?fg(C,()=>h(S,C,"",a)):!R&&a.length<376?fg(C,()=>h(S,C,"",a)):h(null,C,R,a)},_=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:C,loaded:D}){return ny(S,null,{statusCode:S.status},f)})}},function(S,C){return ny(_,S,C,f)});return _},{EventTarget:Fj}=Be,l_=function(n,e){if(!BS(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{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},zj=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=u4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return MS(l,e,Uj),l},$j=(n,e)=>{Bu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},Hj=(n,e,t)=>{let i=!0,a=ri(n,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let l=0;l{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,_=ey(a,l.playlists[0],l_);_&&(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)}}),$j(a,e),e.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(i=!1),i?null:a},qj=(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,u_=(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;qj(h,l)&&(t[u]=e[u])}}return t},Vj=(n,e)=>{let i=u_(n.playlists,e);return Bu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ri(i,u_(f,e))}}),i};class ry extends Fj{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]){ue.clearTimeout(this.mediaRequest_),this.mediaRequest_=ue.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=p4(tn(g.response).subarray(8))}catch(D){D.metadata=ml({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(D,g,t);return}return _[a]={sidxInfo:e.sidx,sidx:C},wy(e,C,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=Pj(l,this.vhs_.xhr,(f,g,_,S)=>{if(f)return u(f,g);if(!_||_!=="mp4"){const R=_||"unknown";return u({status:g.status,message:`Unsupported ${R} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:C,length:D}=e.sidx.byterange;if(S.length>=D+C)return u(f,{response:S.subarray(C,C+D),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:iy({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},ue.clearTimeout(this.minimumUpdatePeriodTimeout_),ue.clearTimeout(this.mediaRequest_),ue.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,ue.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(),ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(ue.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=ue.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_){ue.clearTimeout(this.mediaRequest_),this.mediaRequest_=ue.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=c4(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_(){ue.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=zj({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:Be.Error.StreamingDashManifestParserError,error:l},this.trigger("error")}e&&(i=Hj(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_&&(ue.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_=ue.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_=Vj(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=ue.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},ty(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 or={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 Gj=n=>{const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0;t-1):!1},this.trigger=function(v){var w,x,T,A;if(w=p[v],!!w)if(arguments.length===2)for(T=w.length,x=0;x"u")){for(p in ne)ne.hasOwnProperty(p)&&(ne[p]=[p.charCodeAt(0),p.charCodeAt(1),p.charCodeAt(2),p.charCodeAt(3)]);he=new Uint8Array([105,115,111,109]),z=new Uint8Array([97,118,99,49]),ae=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]),Z=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]),ee={video:P,audio:Z},pe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),I=new Uint8Array([0,0,0,0,0,0,0,0]),ke=new Uint8Array([0,0,0,0,0,0,0,0]),ye=ke,me=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),pt=ke,fe=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(p){var v=[],w=0,x,T,A;for(x=1;x>>1,p.samplingfrequencyindex<<7|p.channelcount<<3,6,1,2]))},_=function(){return h(ne.ftyp,he,ae,he,z)},K=function(p){return h(ne.hdlr,ee[p])},S=function(p){return h(ne.mdat,p)},Q=function(p){var v=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,p.duration>>>24&255,p.duration>>>16&255,p.duration>>>8&255,p.duration&255,85,196,0,0]);return p.samplerate&&(v[12]=p.samplerate>>>24&255,v[13]=p.samplerate>>>16&255,v[14]=p.samplerate>>>8&255,v[15]=p.samplerate&255),h(ne.mdhd,v)},se=function(p){return h(ne.mdia,Q(p),K(p.type),D(p))},C=function(p){return h(ne.mfhd,new Uint8Array([0,0,0,0,(p&4278190080)>>24,(p&16711680)>>16,(p&65280)>>8,p&255]))},D=function(p){return h(ne.minf,p.type==="video"?h(ne.vmhd,fe):h(ne.smhd,I),f(),re(p))},R=function(p,v){for(var w=[],x=v.length;x--;)w[x]=j(v[x]);return h.apply(null,[ne.moof,C(p)].concat(w))},E=function(p){for(var v=p.length,w=[];v--;)w[v]=Y(p[v]);return h.apply(null,[ne.moov,G(4294967295)].concat(w).concat(B(p)))},B=function(p){for(var v=p.length,w=[];v--;)w[v]=te(p[v]);return h.apply(null,[ne.mvex].concat(w))},G=function(p){var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(p&4278190080)>>24,(p&16711680)>>16,(p&65280)>>8,p&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)},O=function(p){var v=p.samples||[],w=new Uint8Array(4+v.length),x,T;for(T=0;T>>8),A.push(x[J].byteLength&255),A=A.concat(Array.prototype.slice.call(x[J]));for(J=0;J>>8),X.push(T[J].byteLength&255),X=X.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],X))),h(ne.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],w.sarRatio){var ce=w.sarRatio[0],Ne=w.sarRatio[1];oe.push(h(ne.pasp,new Uint8Array([(ce&4278190080)>>24,(ce&16711680)>>16,(ce&65280)>>8,ce&255,(Ne&4278190080)>>24,(Ne&16711680)>>16,(Ne&65280)>>8,Ne&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))}})(),q=function(p){var v=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,0,(p.duration&4278190080)>>24,(p.duration&16711680)>>16,(p.duration&65280)>>8,p.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,(p.width&65280)>>8,p.width&255,0,0,(p.height&65280)>>8,p.height&255,0,0]);return h(ne.tkhd,v)},j=function(p){var v,w,x,T,A,X,J;return v=h(ne.tfhd,new Uint8Array([0,0,0,58,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),X=Math.floor(p.baseMediaDecodeTime/u),J=Math.floor(p.baseMediaDecodeTime%u),w=h(ne.tfdt,new Uint8Array([1,0,0,0,X>>>24&255,X>>>16&255,X>>>8&255,X&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255])),A=92,p.type==="audio"?(x=V(p,A),h(ne.traf,v,w,x)):(T=O(p),x=V(p,T.length+A),h(ne.traf,v,w,x,T))},Y=function(p){return p.duration=p.duration||4294967295,h(ne.trak,q(p),se(p))},te=function(p){var v=new Uint8Array([0,0,0,0,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return p.type!=="video"&&(v[v.length-1]=0),h(ne.trex,v)},(function(){var p,v,w;w=function(x,T){var A=0,X=0,J=0,oe=0;return x.length&&(x[0].duration!==void 0&&(A=1),x[0].size!==void 0&&(X=2),x[0].flags!==void 0&&(J=4),x[0].compositionTimeOffset!==void 0&&(oe=8)),[0,0,A|X|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,X,J,oe,ce,Ne;for(oe=x.samples||[],T+=20+16*oe.length,J=w(oe,T),X=new Uint8Array(J.length+oe.length*16),X.set(J),A=J.length,Ne=0;Ne>>24,X[A++]=(ce.duration&16711680)>>>16,X[A++]=(ce.duration&65280)>>>8,X[A++]=ce.duration&255,X[A++]=(ce.size&4278190080)>>>24,X[A++]=(ce.size&16711680)>>>16,X[A++]=(ce.size&65280)>>>8,X[A++]=ce.size&255,X[A++]=ce.flags.isLeading<<2|ce.flags.dependsOn,X[A++]=ce.flags.isDependedOn<<6|ce.flags.hasRedundancy<<4|ce.flags.paddingValue<<1|ce.flags.isNonSyncSample,X[A++]=ce.flags.degradationPriority&61440,X[A++]=ce.flags.degradationPriority&15,X[A++]=(ce.compositionTimeOffset&4278190080)>>>24,X[A++]=(ce.compositionTimeOffset&16711680)>>>16,X[A++]=(ce.compositionTimeOffset&65280)>>>8,X[A++]=ce.compositionTimeOffset&255;return h(ne.trun,X)},p=function(x,T){var A,X,J,oe,ce,Ne;for(oe=x.samples||[],T+=20+8*oe.length,J=w(oe,T),A=new Uint8Array(J.length+oe.length*8),A.set(J),X=J.length,Ne=0;Ne>>24,A[X++]=(ce.duration&16711680)>>>16,A[X++]=(ce.duration&65280)>>>8,A[X++]=ce.duration&255,A[X++]=(ce.size&4278190080)>>>24,A[X++]=(ce.size&16711680)>>>16,A[X++]=(ce.size&65280)>>>8,A[X++]=ce.size&255;return h(ne.trun,A)},V=function(x,T){return x.type==="audio"?p(x,T):v(x,T)}})();var We={ftyp:_,mdat:S,moof:R,moov:E,initSegment:function(p){var v=_(),w=E(p),x;return x=new Uint8Array(v.byteLength+w.byteLength),x.set(v),x.set(w,v.byteLength),x}},_e=function(p){var v,w,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v1&&(v=p.shift(),p.byteLength-=v.byteLength,p.nalCount-=v.nalCount,p[0][0].dts=v.dts,p[0][0].pts=v.pts,p[0][0].duration+=v.duration),p},je=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Se=function(p,v){var w=je();return w.dataOffset=v,w.compositionTimeOffset=p.pts-p.dts,w.duration=p.duration,w.size=4*p.length,w.size+=p.byteLength,p.keyFrame&&(w.flags.dependsOn=2,w.flags.isNonSyncSample=0),w},Je=function(p,v){var w,x,T,A,X,J=v||0,oe=[];for(w=0;wNt.ONE_SECOND_IN_TS/2))){for(ce=an()[p.samplerate],ce||(ce=v[0].data),Ne=0;Ne=w?p:(v.minSegmentDts=1/0,p.filter(function(x){return x.dts>=w?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},yn=function(p){var v,w,x=[];for(v=0;v=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(p),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},qt.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},qt.prototype.addText=function(p){this.rows[this.rowIdx]+=p},qt.prototype.backspace=function(){if(!this.isEmpty()){var p=this.rows[this.rowIdx];this.rows[this.rowIdx]=p.substr(0,p.length-1)}};var Rt=function(p,v,w){this.serviceNum=p,this.text="",this.currentWindow=new qt(-1),this.windows=[],this.stream=w,typeof v=="string"&&this.createTextDecoder(v)};Rt.prototype.init=function(p,v){this.startPts=p;for(var w=0;w<8;w++)this.windows[w]=new qt(w),typeof v=="function"&&(this.windows[w].beforeRowOverflow=v)},Rt.prototype.setCurrentWindow=function(p){this.currentWindow=this.windows[p]},Rt.prototype.createTextDecoder=function(p){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(p)}catch(v){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+p+" encoding. "+v})}};var Dt=function(p){p=p||{},Dt.prototype.init.call(this);var v=this,w=p.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))}};Dt.prototype=new pn,Dt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Dt.prototype.add708Bytes=function(p){var v=p.ccData,w=v>>>8,x=v&255;this.current708Packet.ptsVals.push(p.pts),this.current708Packet.data.push(w),this.current708Packet.data.push(x)},Dt.prototype.push708Packet=function(){var p=this.current708Packet,v=p.data,w=null,x=null,T=0,A=v[T++];for(p.seq=A>>6,p.sizeCode=A&63;T>5,x=A&31,w===7&&x>0&&(A=v[T++],w=A),this.pushServiceBlock(w,T,x),x>0&&(T+=x-1)},Dt.prototype.pushServiceBlock=function(p,v,w){var x,T=v,A=this.current708Packet.data,X=this.services[p];for(X||(X=this.initService(p,T));T("0"+(Bt&255).toString(16)).slice(-2)).join("")}if(T?(Ke=[J,oe],p++):Ke=[J],v.textDecoder_&&!x)Ne=v.textDecoder_.decode(new Uint8Array(Ke));else if(T){const it=Ct(Ke);Ne=String.fromCharCode(parseInt(it,16))}else Ne=dn(X|J);return ce.pendingNewLine&&!ce.isEmpty()&&ce.newLine(this.getPts(p)),ce.pendingNewLine=!1,ce.addText(Ne),p},Dt.prototype.multiByteCharacter=function(p,v){var w=this.current708Packet.data,x=w[p+1],T=w[p+2];return ln(x)&&ln(T)&&(p=this.handleText(++p,v,{isMultiByte:!0})),p},Dt.prototype.setCurrentWindow=function(p,v){var w=this.current708Packet.data,x=w[p],T=x&7;return v.setCurrentWindow(T),p},Dt.prototype.defineWindow=function(p,v){var w=this.current708Packet.data,x=w[p],T=x&7;v.setCurrentWindow(T);var A=v.currentWindow;return x=w[++p],A.visible=(x&32)>>5,A.rowLock=(x&16)>>4,A.columnLock=(x&8)>>3,A.priority=x&7,x=w[++p],A.relativePositioning=(x&128)>>7,A.anchorVertical=x&127,x=w[++p],A.anchorHorizontal=x,x=w[++p],A.anchorPoint=(x&240)>>4,A.rowCount=x&15,x=w[++p],A.columnCount=x&63,x=w[++p],A.windowStyle=(x&56)>>3,A.penStyle=x&7,A.virtualRowCount=A.rowCount+1,p},Dt.prototype.setWindowAttributes=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.winAttr;return x=w[++p],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=w[++p],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=w[++p],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[++p],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,p},Dt.prototype.flushDisplayed=function(p,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=p,v.text=w.join(` `),this.pushCaption(v),v.startPts=p},Dt.prototype.pushCaption=function(p){p.text!==""&&(this.trigger("data",{startPts:p.startPts,endPts:p.endPts,text:p.text,stream:"cc708_"+p.serviceNum}),p.text="",p.startPts=p.endPts)},Dt.prototype.displayWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<>4,T.offset=(x&12)>>2,T.penSize=x&3,x=w[++p],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,p},Dt.prototype.setPenColor=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.penColor;return x=w[++p],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=w[++p],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=w[++p],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,p},Dt.prototype.setPenLocation=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=w[++p],T.row=x&15,x=w[++p],T.column=x&63,p},Dt.prototype.reset=function(p,v){var w=this.getPts(p);return this.flushDisplayed(w,v),this.initService(v.serviceNum,p)};var Cn={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},Mt=function(p){return p===null?"":(p=Cn[p]||p,String.fromCharCode(p))},Pn=14,Dn=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Mn=function(){for(var p=[],v=Pn+1;v--;)p.push({text:"",indent:0,offset:0});return p},Wt=function(p,v){Wt.prototype.init.call(this),this.field_=p||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,X,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,X=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,X))A=(A&3)<<8,J=Mt(A|X),this[this.mode_](w.pts,J),this.column_++;else if(this.isExtCharacter(A,X))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=Mt(A|X),this[this.mode_](w.pts,J),this.column_++;else if(this.isMidRowCode(A,X))this.clearFormatting(w.pts),this[this.mode_](w.pts," "),this.column_++,(X&14)===14&&this.addFormatting(w.pts,["i"]),(X&1)===1&&this.addFormatting(w.pts,["u"]);else if(this.isOffsetControlCode(A,X)){const ce=X&3;this.nonDisplayed_[this.row_].offset=ce,this.column_+=ce}else if(this.isPAC(A,X)){var oe=Dn.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),X&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(w.pts,["u"]),(x&16)===16){const ce=(x&14)>>1;this.column_=ce*4,this.nonDisplayed_[this.row_].indent+=ce}this.isColorPAC(X)&&(X&14)===14&&this.addFormatting(w.pts,["i"])}else this.isNormalChar(A)&&(X===0&&(X=null),J=Mt(A),J+=Mt(X),this[this.mode_](w.pts,J),this.column_+=J.length)}};Wt.prototype=new pn,Wt.prototype.flushDisplayed=function(p){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:p,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_=Pn,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(p,v){return p===this.EXT_&&v>=48&&v<=63},Wt.prototype.isExtCharacter=function(p,v){return(p===this.EXT_+1||p===this.EXT_+2)&&v>=32&&v<=63},Wt.prototype.isMidRowCode=function(p,v){return p===this.EXT_&&v>=32&&v<=47},Wt.prototype.isOffsetControlCode=function(p,v){return p===this.OFFSET_&&v>=33&&v<=35},Wt.prototype.isPAC=function(p,v){return p>=this.BASE_&&p=64&&v<=127},Wt.prototype.isColorPAC=function(p){return p>=64&&p<=79||p>=96&&p<=127},Wt.prototype.isNormalChar=function(p){return p>=32&&p<=127},Wt.prototype.setRollUp=function(p,v){if(this.mode_!=="rollUp"&&(this.row_=Pn,this.mode_="rollUp",this.flushDisplayed(p),this.nonDisplayed_=Mn(),this.displayed_=Mn()),v!==void 0&&v!==this.row_)for(var w=0;w"},"");this[this.mode_](p,w)},Wt.prototype.clearFormatting=function(p){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(w,x){return w+""},"");this.formatting_=[],this[this.mode_](p,v)}},Wt.prototype.popOn=function(p,v){var w=this.nonDisplayed_[this.row_].text;w+=v,this.nonDisplayed_[this.row_].text=w},Wt.prototype.rollUp=function(p,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w},Wt.prototype.shiftRowsUp_=function(){var p;for(p=0;pv&&(w=-1);Math.abs(v-p)>mn;)p+=w*Qn;return p},Kn=function(p){var v,w;Kn.prototype.init.call(this),this.type_=p||Ri,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==Ri&&x.type!==this.type_||(w===void 0&&(w=x.dts),x.dts=Zn(x.dts,w),x.pts=Zn(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")}};Kn.prototype=new jn;var ni={TimestampRolloverStream:Kn,handleRollover:Zn},Si=(p,v,w)=>{if(!p)return-1;for(var x=w;x";p.data[0]===Hn.Utf8&&(w=Fn(p.data,0,v),!(w<0)&&(p.mimeType=ct(p.data,v,w),v=w+1,p.pictureType=p.data[v],v++,x=Fn(p.data,0,v),!(x<0)&&(p.description=rt(p.data,v,x),v=x+1,p.mimeType===T?p.url=ct(p.data,v,p.data.length):p.pictureData=p.data.subarray(v,p.data.length))))},"T*":function(p){p.data[0]===Hn.Utf8&&(p.value=rt(p.data,1,p.data.length).replace(/\0*$/,""),p.values=p.value.split("\0"))},TXXX:function(p){var v;p.data[0]===Hn.Utf8&&(v=Fn(p.data,0,1),v!==-1&&(p.description=rt(p.data,1,v),p.value=rt(p.data,v+1,p.data.length).replace(/\0*$/,""),p.data=p.value))},"W*":function(p){p.url=ct(p.data,0,p.data.length).replace(/\0.*$/,"")},WXXX:function(p){var v;p.data[0]===Hn.Utf8&&(v=Fn(p.data,0,1),v!==-1&&(p.description=rt(p.data,1,v),p.url=ct(p.data,v+1,p.data.length).replace(/\0.*$/,"")))},PRIV:function(p){var v;for(v=0;v>>2;Bt*=4,Bt+=it[7]&3,Ne.timeStamp=Bt,J.pts===void 0&&J.dts===void 0&&(J.pts=Ne.timeStamp,J.dts=Ne.timeStamp),this.trigger("timestamp",Ne)}J.frames.push(Ne),oe+=10,oe+=ce}while(oe>>4>1&&(X+=T[X]+1),A.pid===0)A.type="pat",p(T.subarray(X),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",p(T.subarray(X),A),this.trigger("data",A);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,X,A]):this.processPes_(T,X,A)},this.processPes_=function(T,A,X){X.pid===this.programMapTable.video?X.streamType=Gn.H264_STREAM_TYPE:X.pid===this.programMapTable.audio?X.streamType=Gn.ADTS_STREAM_TYPE:X.streamType=this.programMapTable["timed-metadata"][X.pid],X.type="pes",X.data=T.subarray(A),this.trigger("data",X)}},si.prototype=new qn,si.STREAM_TYPES={h264:27,adts:15},mi=function(){var p=this,v=!1,w={data:[],size:0},x={data:[],size:0},T={data:[],size:0},A,X=function(oe,ce){var Ne;const Ke=oe[0]<<16|oe[1]<<8|oe[2];ce.data=new Uint8Array,Ke===1&&(ce.packetLength=6+(oe[4]<<8|oe[5]),ce.dataAlignmentIndicator=(oe[6]&4)!==0,Ne=oe[7],Ne&192&&(ce.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,ce.pts*=4,ce.pts+=(oe[13]&6)>>>1,ce.dts=ce.pts,Ne&64&&(ce.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,ce.dts*=4,ce.dts+=(oe[18]&6)>>>1)),ce.data=oe.subarray(9+oe[8]))},J=function(oe,ce,Ne){var Ke=new Uint8Array(oe.size),Ct={type:ce},it=0,Bt=0,hn=!1,Vi;if(!(!oe.data.length||oe.size<9)){for(Ct.trackId=oe.data[0].pid,it=0;it>5,oe=((v[T+6]&3)+1)*1024,ce=oe*ei/we[(v[T+2]&60)>>>2],v.byteLength-T>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:we[(v[T+2]&60)>>>2],samplingfrequencyindex:(v[T+2]&60)>>>2,samplesize:16,data:v.subarray(T+7+X,T+A)}),w++,T+=A}typeof Ne=="number"&&(this.skipWarn_(Ne,T),Ne=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")}},Li.prototype=new Oi;var L=Li,$;$=function(p){var v=p.byteLength,w=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=p.byteLength-v,A=new Uint8Array(4),X=Math.min(4,v);if(X===0)throw new Error("no bytes available");A.set(p.subarray(T,T+X)),w=new DataView(A.buffer).getUint32(0),x=X*8,v-=X},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),X=w>>>32-A;return x-=A,x>0?w<<=A:v>0&&this.loadWord(),A=T-A,A>0?X<>>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 xe=$,Te=t,Ve=xe,qe,U,W;U=function(){var p=0,v,w;U.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;p3&&this.trigger("data",w.subarray(p+3)),w=null,p=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},U.prototype=new Te,W={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},qe=function(){var p=new U,v,w,x,T,A,X,J;qe.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(w=oe.trackId,x=oe.pts,T=oe.dts,p.push(oe))},p.on("data",function(oe){var ce={trackId:w,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(ce.nalUnitTypeCode){case 5:ce.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:ce.nalUnitType="sei_rbsp",ce.escapedRBSP=A(oe.subarray(1));break;case 7:ce.nalUnitType="seq_parameter_set_rbsp",ce.escapedRBSP=A(oe.subarray(1)),ce.config=X(ce.escapedRBSP);break;case 8:ce.nalUnitType="pic_parameter_set_rbsp";break;case 9:ce.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",ce)}),p.on("done",function(){v.trigger("done")}),p.on("partialdone",function(){v.trigger("partialdone")}),p.on("reset",function(){v.trigger("reset")}),p.on("endedtimeline",function(){v.trigger("endedtimeline")}),this.flush=function(){p.flush()},this.partialFlush=function(){p.partialFlush()},this.reset=function(){p.reset()},this.endTimeline=function(){p.endTimeline()},J=function(oe,ce){var Ne=8,Ke=8,Ct,it;for(Ct=0;Ct>4;return w=w>=0?w:0,T?w+20:w+10},Oe=function(p,v){return p.length-v<10||p[v]!==73||p[v+1]!==68||p[v+2]!==51?v:(v+=Ce(p,v),Oe(p,v))},ht=function(p){var v=Oe(p,0);return p.length>=v+2&&(p[v]&255)===255&&(p[v+1]&240)===240&&(p[v+1]&22)===16},At=function(p){return p[0]<<21|p[1]<<14|p[2]<<7|p[3]},yt=function(p,v,w){var x,T="";for(x=v;x>5,x=p[v+4]<<3,T=p[v+3]&6144;return T|x|w},Rn=function(p,v){return p[v]===73&&p[v+1]===68&&p[v+2]===51?"timed-metadata":p[v]&!0&&(p[v+1]&240)===240?"audio":null},ui=function(p){for(var v=0;v+5>>2]}return null},Kr=function(p){var v,w,x,T;v=10,p[5]&64&&(v+=4,v+=At(p.subarray(10,14)));do{if(w=At(p.subarray(v+4,v+8)),w<1)return null;if(T=String.fromCharCode(p[v],p[v+1],p[v+2],p[v+3]),T==="PRIV"){x=p.subarray(v+10,v+w+10);for(var A=0;A>>2;return oe*=4,oe+=J[7]&3,oe}break}}v+=10,v+=w}while(v=3;){if(p[T]===73&&p[T+1]===68&&p[T+2]===51){if(p.length-T<10||(x=sa.parseId3TagSize(p,T),T+x>p.length))break;X={type:"timed-metadata",data:p.subarray(T,T+x)},this.trigger("data",X),T+=x;continue}else if((p[T]&255)===255&&(p[T+1]&240)===240){if(p.length-T<7||(x=sa.parseAdtsSize(p,T),T+x>p.length))break;J={type:"audio",data:p.subarray(T,T+x),pts:v,dts:v},this.trigger("data",J),T+=x;continue}T++}A=p.length-T,A>0?p=p.subarray(T):p=new Uint8Array},this.reset=function(){p=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){p=new Uint8Array,this.trigger("endedtimeline")}},Ar.prototype=new Os;var ci=Ar,Fi=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],_s=Fi,Do=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],k0=Do,Oa=t,Mo=We,jo=Ut,wl=kt,Wr=ie,ws=Ci,Ro=Tt,Cd=L,E0=le.H264Stream,C0=ci,A0=xn.isLikelyAacData,Pu=Tt.ONE_SECOND_IN_TS,Ad=_s,Nd=k0,Tl,La,Sl,aa,N0=function(p,v){v.stream=p,this.trigger("log",v)},Dd=function(p,v){for(var w=Object.keys(v),x=0;x=-1e4&&Ne<=oe&&(!Ke||ce>Ne)&&(Ke=it,ce=Ne)));return Ke?Ke.gop:null},this.alignGopsAtStart_=function(J){var oe,ce,Ne,Ke,Ct,it,Bt,hn;for(Ct=J.byteLength,it=J.nalCount,Bt=J.duration,oe=ce=0;oeNe.pts){oe++;continue}ce++,Ct-=Ke.byteLength,it-=Ke.nalCount,Bt-=Ke.duration}return ce===0?J:ce===J.length?null:(hn=J.slice(ce),hn.byteLength=Ct,hn.duration=Bt,hn.nalCount=it,hn.pts=hn[0].pts,hn.dts=hn[0].dts,hn)},this.alignGopsAtEnd_=function(J){var oe,ce,Ne,Ke,Ct,it;for(oe=T.length-1,ce=J.length-1,Ct=null,it=!1;oe>=0&&ce>=0;){if(Ne=T[oe],Ke=J[ce],Ne.pts===Ke.pts){it=!0;break}if(Ne.pts>Ke.pts){oe--;continue}oe===T.length-1&&(Ct=ce),ce--}if(!it&&Ct===null)return null;var Bt;if(it?Bt=ce:Bt=Ct,Bt===0)return J;var hn=J.slice(Bt),Vi=hn.reduce(function(wr,$s){return wr.byteLength+=$s.byteLength,wr.duration+=$s.duration,wr.nalCount+=$s.nalCount,wr},{byteLength:0,duration:0,nalCount:0});return hn.byteLength=Vi.byteLength,hn.duration=Vi.duration,hn.nalCount=Vi.nalCount,hn.pts=hn[0].pts,hn.dts=hn[0].dts,hn},this.alignGopsWith=function(J){T=J}},Tl.prototype=new Oa,aa=function(p,v){this.numberOfTracks=0,this.metadataStream=v,p=p||{},typeof p.remux<"u"?this.remuxTracks=!!p.remux:this.remuxTracks=!0,typeof p.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=p.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,aa.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))}},aa.prototype=new Oa,aa.prototype.flush=function(p){var v=0,w={captions:[],captionStreams:{},metadata:[],info:{}},x,T,A,X=0,J;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(X=this.videoTrack.timelineStartInfo.pts,Nd.forEach(function(oe){w.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(X=this.audioTrack.timelineStartInfo.pts,Ad.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.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},aa.prototype.setRemux=function(p){this.remuxTracks=p},Sl=function(p){var v=this,w=!0,x,T;Sl.prototype.init.call(this),p=p||{},this.baseMediaDecodeTime=p.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 Cd,A.coalesceStream=new aa(p,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(X){A.aacStream.setTimestamp(X.timeStamp)}),A.aacStream.on("data",function(X){X.type!=="timed-metadata"&&X.type!=="audio"||A.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:v.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new La(T,p),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")),Dd(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 Cd,A.h264Stream=new E0,A.captionStream=new ws.CaptionStream(p),A.coalesceStream=new aa(p,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(X){var J;if(X.type==="metadata"){for(J=X.tracks.length;J--;)!x&&X.tracks[J].type==="video"?(x=X.tracks[J],x.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime):!T&&X.tracks[J].type==="audio"&&(T=X.tracks[J],T.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime);x&&!A.videoSegmentStream&&(A.coalesceStream.numberOfTracks++,A.videoSegmentStream=new Tl(x,p),A.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!p.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 La(T,p),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(X){X.dispatchType=A.metadataStream.dispatchType,v.trigger("id3Frame",X)}),A.coalesceStream.on("caption",this.trigger.bind(this,"caption")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Dd(this,A)},this.setBaseMediaDecodeTime=function(A){var X=this.transmuxPipeline_;p.keepOriginalTimestamps||(this.baseMediaDecodeTime=A),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Wr.clearDtsInfo(T),X.audioTimestampRolloverStream&&X.audioTimestampRolloverStream.discontinuity()),x&&(X.videoSegmentStream&&(X.videoSegmentStream.gopCache_=[]),x.timelineStartInfo.dts=void 0,x.timelineStartInfo.pts=void 0,Wr.clearDtsInfo(x),X.captionStream.reset()),X.timestampRolloverStream&&X.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(A){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(A)},this.setRemux=function(A){var X=this.transmuxPipeline_;p.remux=A,X&&X.coalesceStream&&X.coalesceStream.setRemux(A)},this.alignGopsWith=function(A){x&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(A)},this.getLogTrigger_=function(A){var X=this;return function(J){J.stream=A,X.trigger("log",J)}},this.push=function(A){if(w){var X=A0(A);X&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!X&&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()}},Sl.prototype=new Oa;var D0={Transmuxer:Sl},M0=function(p){return p>>>0},j0=function(p){return("00"+p.toString(16)).slice(-2)},Ia={toUnsigned:M0,toHexString:j0},Oo=function(p){var v="";return v+=String.fromCharCode(p[0]),v+=String.fromCharCode(p[1]),v+=String.fromCharCode(p[2]),v+=String.fromCharCode(p[3]),v},Rd=Oo,Od=Ia.toUnsigned,Ld=Rd,Fu=function(p,v){var w=[],x,T,A,X,J;if(!v.length)return null;for(x=0;x1?x+T:p.byteLength,A===v[0]&&(v.length===1?w.push(p.subarray(x+8,X)):(J=Fu(p.subarray(x+8,X),v.slice(1)),J.length&&(w=w.concat(J)))),x=X;return w},kl=Fu,Id=Ia.toUnsigned,Ba=l.getUint64,R0=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ba(p.subarray(4)):v.baseMediaDecodeTime=Id(p[4]<<24|p[5]<<16|p[6]<<8|p[7]),v},Uu=R0,O0=function(p){var v=new DataView(p.buffer,p.byteOffset,p.byteLength),w={version:p[0],flags:new Uint8Array(p.subarray(1,4)),trackId:v.getUint32(4)},x=w.flags[2]&1,T=w.flags[2]&2,A=w.flags[2]&8,X=w.flags[2]&16,J=w.flags[2]&32,oe=w.flags[0]&65536,ce=w.flags[0]&131072,Ne;return Ne=8,x&&(Ne+=4,w.baseDataOffset=v.getUint32(12),Ne+=4),T&&(w.sampleDescriptionIndex=v.getUint32(Ne),Ne+=4),A&&(w.defaultSampleDuration=v.getUint32(Ne),Ne+=4),X&&(w.defaultSampleSize=v.getUint32(Ne),Ne+=4),J&&(w.defaultSampleFlags=v.getUint32(Ne)),oe&&(w.durationIsEmpty=!0),!x&&ce&&(w.baseDataOffsetIsMoof=!0),w},zu=O0,Bd=function(p){return{isLeading:(p[0]&12)>>>2,dependsOn:p[0]&3,isDependedOn:(p[1]&192)>>>6,hasRedundancy:(p[1]&48)>>>4,paddingValue:(p[1]&14)>>>1,isNonSyncSample:p[1]&1,degradationPriority:p[2]<<8|p[3]}},Lo=Bd,Pa=Lo,L0=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4)),samples:[]},w=new DataView(p.buffer,p.byteOffset,p.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,A=v.flags[1]&1,X=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,ce=w.getUint32(4),Ne=8,Ke;for(x&&(v.dataOffset=w.getInt32(Ne),Ne+=4),T&&ce&&(Ke={flags:Pa(p.subarray(Ne,Ne+4))},Ne+=4,A&&(Ke.duration=w.getUint32(Ne),Ne+=4),X&&(Ke.size=w.getUint32(Ne),Ne+=4),oe&&(v.version===1?Ke.compositionTimeOffset=w.getInt32(Ne):Ke.compositionTimeOffset=w.getUint32(Ne),Ne+=4),v.samples.push(Ke),ce--);ce--;)Ke={},A&&(Ke.duration=w.getUint32(Ne),Ne+=4),X&&(Ke.size=w.getUint32(Ne),Ne+=4),J&&(Ke.flags=Pa(p.subarray(Ne,Ne+4)),Ne+=4),oe&&(v.version===1?Ke.compositionTimeOffset=w.getInt32(Ne):Ke.compositionTimeOffset=w.getUint32(Ne),Ne+=4),v.samples.push(Ke);return v},Io=L0,$u={tfdt:Uu,trun:Io},Hu={parseTfdt:$u.tfdt,parseTrun:$u.trun},qu=function(p){for(var v=0,w=String.fromCharCode(p[v]),x="";w!=="\0";)x+=w,v++,w=String.fromCharCode(p[v]);return x+=w,x},Vu={uint8ToCString:qu},Bo=Vu.uint8ToCString,Pd=l.getUint64,Fd=function(p){var v=4,w=p[0],x,T,A,X,J,oe,ce,Ne;if(w===0){x=Bo(p.subarray(v)),v+=x.length,T=Bo(p.subarray(v)),v+=T.length;var Ke=new DataView(p.buffer);A=Ke.getUint32(v),v+=4,J=Ke.getUint32(v),v+=4,oe=Ke.getUint32(v),v+=4,ce=Ke.getUint32(v),v+=4}else if(w===1){var Ke=new DataView(p.buffer);A=Ke.getUint32(v),v+=4,X=Pd(p.subarray(v)),v+=8,oe=Ke.getUint32(v),v+=4,ce=Ke.getUint32(v),v+=4,x=Bo(p.subarray(v)),v+=x.length,T=Bo(p.subarray(v)),v+=T.length}Ne=new Uint8Array(p.subarray(v,p.byteLength));var Ct={scheme_id_uri:x,value:T,timescale:A||1,presentation_time:X,presentation_time_delta:J,event_duration:oe,id:ce,message_data:Ne};return B0(w,Ct)?Ct:void 0},I0=function(p,v,w,x){return p||p===0?p/v:x+w/v},B0=function(p,v){var w=v.scheme_id_uri!=="\0",x=p===0&&Ud(v.presentation_time_delta)&&w,T=p===1&&Ud(v.presentation_time)&&w;return!(p>1)&&x||T},Ud=function(p){return p!==void 0||p!==null},P0={parseEmsgBox:Fd,scaleTime:I0},Po;typeof window<"u"?Po=window:typeof n<"u"?Po=n:typeof self<"u"?Po=self:Po={};var gr=Po,Ls=Ia.toUnsigned,Fa=Ia.toHexString,Ai=kl,oa=Rd,El=P0,Gu=zu,F0=Io,Ua=Uu,Ku=l.getUint64,za,Cl,Wu,Is,la,Fo,Xu,Ts=gr,zd=xt.parseId3Frames;za=function(p){var v={},w=Ai(p,["moov","trak"]);return w.reduce(function(x,T){var A,X,J,oe,ce;return A=Ai(T,["tkhd"])[0],!A||(X=A[0],J=X===0?12:20,oe=Ls(A[J]<<24|A[J+1]<<16|A[J+2]<<8|A[J+3]),ce=Ai(T,["mdia","mdhd"])[0],!ce)?null:(X=ce[0],J=X===0?12:20,x[oe]=Ls(ce[J]<<24|ce[J+1]<<16|ce[J+2]<<8|ce[J+3]),x)},v)},Cl=function(p,v){var w;w=Ai(v,["moof","traf"]);var x=w.reduce(function(T,A){var X=Ai(A,["tfhd"])[0],J=Ls(X[4]<<24|X[5]<<16|X[6]<<8|X[7]),oe=p[J]||9e4,ce=Ai(A,["tfdt"])[0],Ne=new DataView(ce.buffer,ce.byteOffset,ce.byteLength),Ke;ce[0]===1?Ke=Ku(ce.subarray(4,12)):Ke=Ne.getUint32(4);let Ct;return typeof Ke=="bigint"?Ct=Ke/Ts.BigInt(oe):typeof Ke=="number"&&!isNaN(Ke)&&(Ct=Ke/oe),Ct11?(T.codec+=".",T.codec+=Fa(it[9]),T.codec+=Fa(it[10]),T.codec+=Fa(it[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(it=Ct.subarray(28),Bt=oa(it.subarray(4,8)),Bt==="esds"&&it.length>20&&it[19]!==0?(T.codec+="."+Fa(it[19]),T.codec+="."+Fa(it[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var hn=Ai(x,["mdia","mdhd"])[0];hn&&(T.timescale=Fo(hn)),w.push(T)}),w},Xu=function(p,v=0){var w=Ai(p,["emsg"]);return w.map(x=>{var T=El.parseEmsgBox(new Uint8Array(x)),A=zd(T.message_data);return{cueTime:El.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,v),duration:El.scaleTime(T.event_duration,T.timescale),frames:A}})};var $a={findBox:Ai,parseType:oa,timescale:za,startTime:Cl,compositionStartTime:Wu,videoTrackIds:Is,tracks:la,getTimescaleFromMediaHeader:Fo,getEmsgID3:Xu};const{parseTrun:$d}=Hu,{findBox:Hd}=$a;var qd=gr,U0=function(p){var v=Hd(p,["moof","traf"]),w=Hd(p,["mdat"]),x=[];return w.forEach(function(T,A){var X=v[A];x.push({mdat:T,traf:X})}),x},Vd=function(p,v,w){var x=v,T=w.defaultSampleDuration||0,A=w.defaultSampleSize||0,X=w.trackId,J=[];return p.forEach(function(oe){var ce=$d(oe),Ne=ce.samples;Ne.forEach(function(Ke){Ke.duration===void 0&&(Ke.duration=T),Ke.size===void 0&&(Ke.size=A),Ke.trackId=X,Ke.dts=x,Ke.compositionTimeOffset===void 0&&(Ke.compositionTimeOffset=0),typeof x=="bigint"?(Ke.pts=x+qd.BigInt(Ke.compositionTimeOffset),x+=qd.BigInt(Ke.duration)):(Ke.pts=x+Ke.compositionTimeOffset,x+=Ke.duration)}),J=J.concat(Ne)}),J},Yu={getMdatTrafPairs:U0,parseSamples:Vd},Qu=Xt.discardEmulationPreventionBytes,Xr=Vn.CaptionStream,Ha=kl,Nr=Uu,qa=zu,{getMdatTrafPairs:Zu,parseSamples:Al}=Yu,Nl=function(p,v){for(var w=p,x=0;x0?Nr(Ne[0]).baseMediaDecodeTime:0,Ct=Ha(X,["trun"]),it,Bt;v===ce&&Ct.length>0&&(it=Al(Ct,Ke,oe),Bt=Ju(A,it,ce),w[ce]||(w[ce]={seiNals:[],logs:[]}),w[ce].seiNals=w[ce].seiNals.concat(Bt.seiNals),w[ce].logs=w[ce].logs.concat(Bt.logs))}),w},Gd=function(p,v,w){var x;if(v===null)return null;x=ua(p,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:w}},Dl=function(){var p=!1,v,w,x,T,A,X;this.isInitialized=function(){return p},this.init=function(J){v=new Xr,p=!0,X=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,ce){var Ne;if(this.isInitialized()){if(!oe||!ce)return null;if(this.isNewInit(oe,ce))x=oe[0],T=ce[x];else if(x===null||!T)return w.push(J),null}else return null;for(;w.length>0;){var Ke=w.shift();this.parse(Ke,oe,ce)}return Ne=Gd(J,x,T),Ne&&Ne.logs&&(A.logs=A.logs.concat(Ne.logs)),Ne===null||!Ne.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ne.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;X?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()},Va=Dl;const{parseTfdt:z0}=Hu,Ui=kl,{getTimescaleFromMediaHeader:ec}=$a,{parseSamples:Ss,getMdatTrafPairs:Kd}=Yu;var Bs=function(){let p=9e4;this.init=function(v){const w=Ui(v,["moov","trak","mdia","mdhd"])[0];w&&(p=ec(w))},this.parseSegment=function(v){const w=[],x=Kd(v);let T=0;return x.forEach(function(A){const X=A.mdat,J=A.traf,oe=Ui(J,["tfdt"])[0],ce=Ui(J,["tfhd"])[0],Ne=Ui(J,["trun"]);if(oe&&(T=z0(oe).baseMediaDecodeTime),Ne.length&&ce){const Ke=Ss(Ne,T,ce);let Ct=0;Ke.forEach(function(it){const Bt="utf-8",hn=new TextDecoder(Bt),Vi=X.slice(Ct,Ct+it.size);if(Ui(Vi,["vtte"])[0]){Ct+=it.size;return}Ui(Vi,["vttc"]).forEach(function(Ho){const xi=Ui(Ho,["payl"])[0],ca=Ui(Ho,["sttg"])[0],ks=it.pts/p,Hs=(it.pts+it.duration)/p;let ai,ls;if(xi)try{ai=hn.decode(xi)}catch(sr){console.error(sr)}if(ca)try{ls=hn.decode(ca)}catch(sr){console.error(sr)}it.duration&&ai&&w.push({cueText:ai,start:ks,end:Hs,settings:ls})}),Ct+=it.size})}}),w}},Uo=Yn,nc=function(p){var v=p[1]&31;return v<<=8,v|=p[2],v},Ga=function(p){return!!(p[1]&64)},zo=function(p){var v=0;return(p[3]&48)>>>4>1&&(v+=p[4]+1),v},Dr=function(p,v){var w=nc(p);return w===0?"pat":w===v?"pmt":v?"pes":null},Ka=function(p){var v=Ga(p),w=4+zo(p);return v&&(w+=p[w]+1),(p[w+10]&31)<<8|p[w+11]},Wa=function(p){var v={},w=Ga(p),x=4+zo(p);if(w&&(x+=p[x]+1),!!(p[x+5]&1)){var T,A,X;T=(p[x+1]&15)<<8|p[x+2],A=3+T-4,X=(p[x+10]&15)<<8|p[x+11];for(var J=12+X;J=p.byteLength)return null;var x=null,T;return T=p[w+7],T&192&&(x={},x.pts=(p[w+9]&14)<<27|(p[w+10]&255)<<20|(p[w+11]&254)<<12|(p[w+12]&255)<<5|(p[w+13]&254)>>>3,x.pts*=4,x.pts+=(p[w+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(p[w+14]&14)<<27|(p[w+15]&255)<<20|(p[w+16]&254)<<12|(p[w+17]&255)<<5|(p[w+18]&254)>>>3,x.dts*=4,x.dts+=(p[w+18]&6)>>>1)),x},yr=function(p){switch(p){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(p){for(var v=4+zo(p),w=p.subarray(v),x=0,T=0,A=!1,X;T3&&(X=yr(w[T+3]&31),X==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},Ps={parseType:Dr,parsePat:Ka,parsePmt:Wa,parsePayloadUnitStartIndicator:Ga,parsePesType:Ml,parsePesTime:$o,videoPacketContainsKeyFrame:Mr},Yr=Yn,cr=ni.handleRollover,kn={};kn.ts=Ps,kn.aac=xn;var Fs=Tt.ONE_SECOND_IN_TS,nr=188,jr=71,Wd=function(p,v){for(var w=0,x=nr,T,A;x=0;){if(p[x]===jr&&(p[T]===jr||T===p.byteLength)){if(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X==="pes"&&(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="audio",w.audio.push(ce),Ne=!0))),Ne)break;x-=nr,T-=nr;continue}x--,T--}},gi=function(p,v,w){for(var x=0,T=nr,A,X,J,oe,ce,Ne,Ke,Ct,it=!1,Bt={data:[],size:0};T=0;){if(p[x]===jr&&p[T]===jr){if(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X==="pes"&&(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&oe&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="video",w.video.push(ce),it=!0))),it)break;x-=nr,T-=nr;continue}x--,T--}},On=function(p,v){if(p.audio&&p.audio.length){var w=v;(typeof w>"u"||isNaN(w))&&(w=p.audio[0].dts),p.audio.forEach(function(A){A.dts=cr(A.dts,w),A.pts=cr(A.pts,w),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs})}if(p.video&&p.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=p.video[0].dts),p.video.forEach(function(A){A.dts=cr(A.dts,x),A.pts=cr(A.pts,x),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs}),p.firstKeyFrame){var T=p.firstKeyFrame;T.dts=cr(T.dts,x),T.pts=cr(T.pts,x),T.dtsTime=T.dts/Fs,T.ptsTime=T.pts/Fs}}},Us=function(p){for(var v=!1,w=0,x=null,T=null,A=0,X=0,J;p.length-X>=3;){var oe=kn.aac.parseType(p,X);switch(oe){case"timed-metadata":if(p.length-X<10){v=!0;break}if(A=kn.aac.parseId3TagSize(p,X),A>p.length){v=!0;break}T===null&&(J=p.subarray(X,X+A),T=kn.aac.parseAacTimestamp(J)),X+=A;break;case"audio":if(p.length-X<7){v=!0;break}if(A=kn.aac.parseAdtsSize(p,X),A>p.length){v=!0;break}x===null&&(J=p.subarray(X,X+A),x=kn.aac.parseSampleRate(J)),w++,X+=A;break;default:X++;break}if(v)return null}if(x===null||T===null)return null;var ce=Fs/x,Ne={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+w*1024*ce,pts:T+w*1024*ce}]};return Ne},Rr=function(p){var v={pid:null,table:null},w={};Wd(p,v);for(var x in v.table)if(v.table.hasOwnProperty(x)){var T=v.table[x];switch(T){case Yr.H264_STREAM_TYPE:w.video=[],gi(p,v,w),w.video.length===0&&delete w.video;break;case Yr.ADTS_STREAM_TYPE:w.audio=[],Qi(p,v,w),w.audio.length===0&&delete w.audio;break}}return w},ic=function(p,v){var w=kn.aac.isLikelyAacData(p),x;return w?x=Us(p):x=Rr(p),!x||!x.audio&&!x.video?null:(On(x,v),x)},zs={inspect:ic,parseAudioPes_:Qi};const Xd=function(p,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,p.postMessage({action:"data",segment:w,byteOffset:T.byteOffset,byteLength:T.byteLength},[w.data])}),v.on("done",function(w){p.postMessage({action:"done"})}),v.on("gopInfo",function(w){p.postMessage({action:"gopInfo",gopInfo:w})}),v.on("videoSegmentTimingInfo",function(w){const x={start:{decode:Tt.videoTsToSeconds(w.start.dts),presentation:Tt.videoTsToSeconds(w.start.pts)},end:{decode:Tt.videoTsToSeconds(w.end.dts),presentation:Tt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:Tt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=Tt.videoTsToSeconds(w.prependedContentDuration)),p.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(w){const x={start:{decode:Tt.videoTsToSeconds(w.start.dts),presentation:Tt.videoTsToSeconds(w.start.pts)},end:{decode:Tt.videoTsToSeconds(w.end.dts),presentation:Tt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:Tt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=Tt.videoTsToSeconds(w.prependedContentDuration)),p.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(w){p.postMessage({action:"id3Frame",id3Frame:w})}),v.on("caption",function(w){p.postMessage({action:"caption",caption:w})}),v.on("trackinfo",function(w){p.postMessage({action:"trackinfo",trackInfo:w})}),v.on("audioTimingInfo",function(w){p.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Tt.videoTsToSeconds(w.start),end:Tt.videoTsToSeconds(w.end)}})}),v.on("videoTimingInfo",function(w){p.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Tt.videoTsToSeconds(w.start),end:Tt.videoTsToSeconds(w.end)}})}),v.on("log",function(w){p.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),Xd(this.self,this.transmuxer)}pushMp4Captions(v){this.captionParser||(this.captionParser=new Va,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 Bs);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.webVttParser.init(w)}getMp4WebVttText(v){this.webVttParser||(this.webVttParser=new Bs);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=$a.startTime(v,w);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:w},[w.buffer])}probeMp4Tracks({data:v}){const w=$a.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:w,data:v},[v.buffer])}probeEmsgID3({data:v,offset:w}){const x=$a.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*Tt.ONE_SECOND_IN_TS:void 0,T=zs.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(Tt.secondsToVideoTs(w)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(Tt.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(p){if(p.data.action==="init"&&p.data.options){this.messageHandlers=new rc(self,p.data.options);return}this.messageHandlers||(this.messageHandlers=new rc(self)),p.data&&p.data.action&&p.data.action!=="init"&&this.messageHandlers[p.data.action]&&this.messageHandlers[p.data.action](p.data)}}));var Xj=VS(Wj);const Yj=(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)},Qj=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},Zj=(n,e)=>{e.gopInfo=n.data.gopInfo},WS=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:D,onDone:R,onEndedTimeline:E,onTransmuxerLog:B,isEndOfTimeline:G,segment:Y,triggerSegmentEventFn:q}=n,se={buffer:[]};let Q=G;const K=re=>{e.currentTransmux===n&&(re.data.action==="data"&&Yj(re,se,u),re.data.action==="trackinfo"&&h(re.data.trackInfo),re.data.action==="gopInfo"&&Zj(re,se),re.data.action==="audioTimingInfo"&&f(re.data.audioTimingInfo),re.data.action==="videoTimingInfo"&&g(re.data.videoTimingInfo),re.data.action==="videoSegmentTimingInfo"&&_(re.data.videoSegmentTimingInfo),re.data.action==="audioSegmentTimingInfo"&&S(re.data.audioSegmentTimingInfo),re.data.action==="id3Frame"&&C([re.data.id3Frame],re.data.id3Frame.dispatchType),re.data.action==="caption"&&D(re.data.caption),re.data.action==="endedtimeline"&&(Q=!1,E()),re.data.action==="log"&&B(re.data.log),re.data.type==="transmuxed"&&(Q||(e.onmessage=null,Qj({transmuxedData:se,callback:R}),XS(e))))},O=()=>{const re={message:"Received an error message from the transmuxer worker",metadata:{errorType:Be.Error.StreamingFailedToTransmuxSegment,segmentInfo:al({segment:Y})}};R(null,re)};if(e.onmessage=K,e.onerror=O,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 re=t instanceof ArrayBuffer?t:t.buffer,k=t instanceof ArrayBuffer?0:t.byteOffset;q({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:re,byteOffset:k,byteLength:t.byteLength},[re])}G&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():WS(n.currentTransmux))},c_=(n,e)=>{n.postMessage({action:e}),XS(n)},YS=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,c_(e,n);return}e.transmuxQueue.push(c_.bind(null,e,n))},Jj=n=>{YS("reset",n)},eR=n=>{YS("endTimeline",n)},QS=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,WS(n);return}n.transmuxer.transmuxQueue.push(n)},tR=n=>{const e=new Xj;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 pg={reset:Jj,endTimeline:eR,transmux:QS,createTransmuxer:tR};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)},Js={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ZS="wvtt",sy=n=>{n.forEach(e=>{e.abort()})},nR=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),iR=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},nb=(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:Js.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Js.ABORTED,xhr:e,metadata:i}:n?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Js.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Js.FAILURE,xhr:e,metadata:i}:null},d_=(n,e,t,i)=>(a,l)=>{const u=l.response,h=nb(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:Js.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===ZS&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},sR=(n,e,t)=>{e===ZS&&fu({action:"getMp4WebVttText",data:n.bytes,transmuxer:n.transmuxer,callback:({data:i,mp4VttCues:a})=>{n.bytes=i,t(null,n,{mp4VttCues:a})}})},JS=(n,e)=>{const t=ky(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:Js.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"&&rR(n,l.codec))}),e(null))})},aR=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=nb(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,JS(n,function(h){if(h)return h.xhr=a,h.status=a.status,e(h,n);e(null,n)})},oR=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=nb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:Gj(l.responseText.substring(n.lastReachedChar||0));return n.stats=nR(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},lR=({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:D})=>{const R=n.map&&n.map.tracks||{},E=!!(R.audio&&R.video);let B=i.bind(null,n,"audio","start");const G=i.bind(null,n,"audio","end");let Y=i.bind(null,n,"video","start");const q=i.bind(null,n,"video","end"),se=()=>QS({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:E,onData:Q=>{Q.type=Q.type==="combined"?"video":Q.type,_(n,Q)},onTrackInfo:Q=>{t&&(E&&(Q.isMuxed=!0),t(n,Q))},onAudioTimingInfo:Q=>{B&&typeof Q.start<"u"&&(B(Q.start),B=null),G&&typeof Q.end<"u"&&G(Q.end)},onVideoTimingInfo:Q=>{Y&&typeof Q.start<"u"&&(Y(Q.start),Y=null),q&&typeof Q.end<"u"&&q(Q.end)},onVideoSegmentTimingInfo:Q=>{const K={pts:{start:Q.start.presentation,end:Q.end.presentation},dts:{start:Q.start.decode,end:Q.end.decode}};D({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:K}),a(Q)},onAudioSegmentTimingInfo:Q=>{const K={pts:{start:Q.start.pts,end:Q.end.pts},dts:{start:Q.start.dts,end:Q.end.dts}};D({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:K}),l(Q)},onId3:(Q,K)=>{u(n,Q,K)},onCaptions:Q=>{h(n,[Q])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:C,onDone:(Q,K)=>{S&&(Q.type=Q.type==="combined"?"video":Q.type,D({type:"segmenttransmuxingcomplete",segment:n}),S(K,n,Q))},segment:n,triggerSegmentEventFn:D});fu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:Q=>{n.bytes=e=Q.data;const K=Q.result;K&&(t(n,{hasAudio:K.hasAudio,hasVideo:K.hasVideo,isMuxed:E}),t=null),se()}})},ek=({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:D})=>{let R=new Uint8Array(e);if(N4(R)){n.isFmp4=!0;const{tracks:E}=n.map;if(E.text&&(!E.audio||!E.video)){_(n,{data:R,type:"text"}),sR(n,E.text.codec,S);return}const G={isFmp4:!0,hasVideo:!!E.video,hasAudio:!!E.audio};E.audio&&E.audio.codec&&E.audio.codec!=="enca"&&(G.audioCodec=E.audio.codec),E.video&&E.video.codec&&E.video.codec!=="encv"&&(G.videoCodec=E.video.codec),E.video&&E.audio&&(G.isMuxed=!0),t(n,G);const Y=(q,se)=>{_(n,{data:R,type:G.hasAudio&&!G.isMuxed?"audio":"video"}),se&&se.length&&u(n,se),q&&q.length&&h(n,q),S(null,n,{})};fu({action:"probeMp4StartTime",timescales:n.map.timescales,data:R,transmuxer:n.transmuxer,callback:({data:q,startTime:se})=>{e=q.buffer,n.bytes=R=q,G.hasAudio&&!G.isMuxed&&i(n,"audio","start",se),G.hasVideo&&i(n,"video","start",se),fu({action:"probeEmsgID3",data:R,transmuxer:n.transmuxer,offset:se,callback:({emsgData:Q,id3Frames:K})=>{if(e=Q.buffer,n.bytes=R=Q,!E.video||!Q.byteLength||!n.transmuxer){Y(void 0,K);return}fu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:R,timescales:n.map.timescales,trackIds:[E.video.id],callback:O=>{e=O.data.buffer,n.bytes=R=O.data,O.logs.forEach(function(re){C(ri(re,{stream:"mp4CaptionParser"}))}),Y(O.captions,K)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=ky(R)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}lR({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:D})},tk=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:Be.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(FS({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},uR=({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:D})=>{D({type:"segmentdecryptionstart"}),tk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},R=>{e.bytes=R,D({type:"segmentdecryptioncomplete",segment:e}),ek({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:D})})},cR=({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:D})=>{let R=0,E=!1;return(B,G)=>{if(!E){if(B)return E=!0,sy(n),S(B,G);if(R+=1,R===n.length){const Y=function(){if(G.encryptedBytes)return uR({decryptionWorker:e,segment:G,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D});ek({segment:G,bytes:G.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})};if(G.endOfAllRequests=Date.now(),G.map&&G.map.encryptedBytes&&!G.map.bytes)return D({type:"segmentdecryptionstart",segment:G}),tk({decryptionWorker:e,id:G.requestId+"-init",encryptedBytes:G.map.encryptedBytes,key:G.map.key,segment:G,doneFn:S},q=>{G.map.bytes=q,D({type:"segmentdecryptioncomplete",segment:G}),JS(G,se=>{if(se)return sy(n),S(se,G);Y()})});Y()}}}},dR=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},hR=({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,iR(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},fR=({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:D,dataFn:R,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G})=>{const Y=[],q=cR({activeXhrs:Y,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:D,dataFn:R,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G});if(i.key&&!i.key.bytes){const re=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&re.push(i.map.key);const k=ri(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),j=d_(i,re,q,G),te={uri:i.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:te});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=d_(i,[i.map.key],q,G),he={uri:i.map.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:he});const ae=n(V,ne);Y.push(ae)}const k=ri(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:iy(i.map),requestType:"segment-media-initialization"}),j=aR({segment:i,finishProcessingFn:q,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const te=n(k,j);Y.push(te)}const se=ri(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:iy(i),requestType:"segment"}),Q=oR({segment:i,finishProcessingFn:q,responseType:se.responseType,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const K=n(se,Q);K.addEventListener("progress",hR({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:D,dataFn:R})),Y.push(K);const O={};return Y.forEach(re=>{re.addEventListener("loadend",dR({loadendState:O,abortFn:a}))}),()=>sy(Y)},Zh=xs("PlaylistSelector"),h_=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||""})},pu=function(n,e){if(!n)return"";const t=ue.getComputedStyle(n);return t?t[e]:""},mu=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})},ib=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||ue.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||ue.Number.MAX_VALUE,t-i},pR=function(n,e){let t,i;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(t=n.attributes.RESOLUTION.width),t=t||ue.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||ue.Number.MAX_VALUE,t===i&&n.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?n.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let nk=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(O=>{let re;const k=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,j=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return re=O.attributes&&O.attributes.BANDWIDTH,re=re||ue.Number.MAX_VALUE,{bandwidth:re,width:k,height:j,playlist:O}});mu(_,(O,re)=>O.bandwidth-re.bandwidth),_=_.filter(O=>!Hr.isIncompatible(O.playlist));let S=_.filter(O=>Hr.isEnabled(O.playlist));S.length||(S=_.filter(O=>!Hr.isDisabled(O.playlist)));const C=S.filter(O=>O.bandwidth*or.BANDWIDTH_VARIANCEO.bandwidth===D.bandwidth)[0];if(u===!1){const O=R||S[0]||_[0];if(O&&O.playlist){let re="sortedPlaylistReps";return R&&(re="bandwidthBestRep"),S[0]&&(re="enabledPlaylistReps"),Zh(`choosing ${h_(O)} using ${re} with options`,f),O.playlist}return Zh("could not choose a playlist with options",f),null}const E=C.filter(O=>O.width&&O.height);mu(E,(O,re)=>O.width-re.width);const B=E.filter(O=>O.width===i&&O.height===a);D=B[B.length-1];const G=B.filter(O=>O.bandwidth===D.bandwidth)[0];let Y,q,se;G||(Y=E.filter(O=>l==="cover"?O.width>i&&O.height>a:O.width>i||O.height>a),q=Y.filter(O=>O.width===Y[0].width&&O.height===Y[0].height),D=q[q.length-1],se=q.filter(O=>O.bandwidth===D.bandwidth)[0]);let Q;if(h.leastPixelDiffSelector){const O=E.map(re=>(re.pixelDiff=Math.abs(re.width-i)+Math.abs(re.height-a),re));mu(O,(re,k)=>re.pixelDiff===k.pixelDiff?k.bandwidth-re.bandwidth:re.pixelDiff-k.pixelDiff),Q=O[0]}const K=Q||se||G||R||S[0]||_[0];if(K&&K.playlist){let O="sortedPlaylistReps";return Q?O="leastPixelDiffRep":se?O="resolutionPlusOneRep":G?O="resolutionBestRep":R?O="bandwidthBestRep":S[0]&&(O="enabledPlaylistReps"),Zh(`choosing ${h_(K)} using ${O} with options`,f),K.playlist}return Zh("could not choose a playlist with options",f),null};const f_=function(){let n=this.useDevicePixelRatio&&ue.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),nk({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(pu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(pu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?pu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},mR=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&&ue.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),nk({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(pu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(pu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?pu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},gR=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(R=>!Hr.isIncompatible(R));let _=g.filter(Hr.isEnabled);_.length||(_=g.filter(R=>!Hr.isDisabled(R)));const C=_.filter(Hr.hasAttribute.bind(null,"BANDWIDTH")).map(R=>{const B=f.getSyncPoint(R,a,h,t)?1:2,Y=Hr.estimateSegmentRequestTime(l,i,R)*B-u;return{playlist:R,rebufferingImpact:Y}}),D=C.filter(R=>R.rebufferingImpact<=0);return mu(D,(R,E)=>ib(E.playlist,R.playlist)),D.length?D[0]:(mu(C,(R,E)=>R.rebufferingImpact-E.rebufferingImpact),C[0]||null)},yR=function(){const n=this.playlists.main.playlists.filter(Hr.isEnabled);return mu(n,(t,i)=>ib(t,i)),n.filter(t=>!!od(this.playlists.main,t).video)[0]||null},bR=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 ik(n){try{return new URL(n).pathname.split("/").slice(-2).join("/")}catch{return""}}const vR=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}}},xR=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=ue.WebKitDataCue||ue.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))})},_R=function(n){Object.defineProperties(n.frame,{id:{get(){return Be.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),n.value.key}},value:{get(){return Be.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),n.value.data}},privateData:{get(){return Be.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),n.value.data}}})},wR=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=ue.WebKitDataCue||ue.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(_=>{const S=_.cueTime+t;typeof S!="number"||ue.isNaN(S)||S<0||!(S<1/0)||!_.frames||!_.frames.length||_.frames.forEach(C=>{const D=new a(S,S,C.value||C.url||C.data||"");D.frame=C,D.value=C,_R(D),l.addCue(D)})}),!l.cues||!l.cues.length))return;const u=l.cues,h=[];for(let _=0;_{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[_],D=isFinite(i)?i:_,R=Number(g[S+1])||D;C.forEach(E=>{E.endTime=R})})},TR={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"},SR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),kR=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=ue.WebKitDataCue||ue.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(SR.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:TR[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()})},p_=(n,e,t)=>{n.metadataTrack_||(n.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Be.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)},ER=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}},CR=(n,e,t)=>{if(typeof e>"u"||e===null||!n.length)return[];const i=Math.ceil((e-t+3)*ul.ONE_SECOND_IN_TS);let a;for(a=0;ai);a++);return n.slice(a)},AR=(n,e,t)=>{if(!e.length)return n;if(t)return e.slice();const i=e[0].pts;let a=0;for(a;a=i);a++);return n.slice(0,a).concat(e)},NR=(n,e,t,i)=>{const a=Math.ceil((e-i)*ul.ONE_SECOND_IN_TS),l=Math.ceil((t-i)*ul.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},DR=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;at))return l}return i.length===0?0:i[i.length-1]},Uc=1,jR=500,m_=n=>typeof n=="number"&&isFinite(n),Jh=1/60,RR=(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,OR=(n,e,t)=>{let i=e-or.BACK_BUFFER_LENGTH;n.length&&(i=Math.max(i,n.start(0)));const a=e-t;return Math.min(a,i)},Zl=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 D=typeof g=="number",R=n.segment.uri?"segment":"pre-segment",E=D?_S({preloadSegment:i})-1:0;return`${R} [${l+f}/${l+S}]`+(D?` part [${g}/${E}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(D?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${_}] selected by [${C}] playlist [${u}]`},g_=n=>`${n}TimingInfo`,LR=({segmentTimeline:n,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:a})=>!a&&n===e?null:n{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},IR=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)},BR=n=>{const e=n.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=n.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to{const e=n.pendingSegment_;if(!e)return;if(ay({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&IR(n.timelineChangeController_)){if(BR(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},PR=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=ue.BigInt(l)-ue.BigInt(a):typeof a=="number"&&typeof l=="number"&&(u=l-a),typeof u<"u"&&u>e&&(e=u)}),typeof e=="bigint"&&en?Math.round(n)>e+Qs:!1,FR=(n,e)=>{if(e!=="hls")return null;const t=PR({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo});if(!t)return null;const i=n.playlist.targetDuration,a=y_({segmentDuration:t,maxDuration:i*2}),l=y_({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 oy extends Be.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_():go(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Xi({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Xi({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():go(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return pg.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_&&ue.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,ue.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_&&pg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ur();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=US(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_&&(ue.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_&&pg.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_=NR(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_&&ue.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ue.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&ue.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ue.setTimeout(this.monitorBufferTick_.bind(this),jR)}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=Zy(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=MR(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],D=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=C.end?C.end:t,C.parts&&C.parts[D+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=D+1):h.mediaIndex=this.mediaIndex+1}else{let C,D,R;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 G="No sync info found while using media sequence sync";return this.error({message:G,metadata:{errorType:Be.Error.StreamingFailedToSelectNextSegment,error:new Error(G)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${B.start} --> ${B.end})`),C=B.segmentIndex,D=B.partIndex,R=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,D=B.partIndex,R=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${E}`:`currentTime ${E}`,h.mediaIndex=C,h.startOfSegment=R,h.partIndex=D,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],D=C.parts&&C.parts.length&&C.parts[C.parts.length-1];D&&D.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},D=typeof f<"u"?f:this.isPendingTimestampOffset_;C.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:_.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:D});const R=hg(this.sourceUpdater_.audioBuffered());return typeof R=="number"&&(C.audioAppendStart=R-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(C.gopsToAlignWith=CR(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),C}timestampOffsetForSegment_(e){return LR(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=ij(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=gR({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<=Qs&&(_=1),!(!h.playlist||h.playlist.uri===this.playlist_.uri||g<_)&&(this.bandwidth=h.playlist.attributes.BANDWIDTH*or.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Zl(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||{},DR(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_():go(this))))}handleTimingInfo_(e,t,i,a){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const l=this.pendingSegment_,u=g_(t);l[u]=l[u]||{},l[u][i]=a,this.logger_(`timinginfo: ${t} - ${i} - ${a}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(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}`),vR(_,this.vhs_.tech_,u),Xc(h,f,_[u]),xR({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_()?!ay({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||ay({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_()){go(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[g_(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: "+cl(l).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+cl(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: ${cl(l).join(", ")}, video buffer: ${cl(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_=ue.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===jS){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:Be.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=bR({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_()){go(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 ${ik(e.uri)} ${Zl(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=fR({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_(`${Zl(e)} logged from transmuxer stream ${g} as a ${f}: ${h}`)},triggerSegmentEventFn:({type:h,segment:f,keyInfo:g,trackInfo:_,timingInfo:S})=>{const D={segmentInfo:al({segment:f})};g&&(D.keyInfo=g),_&&(D.trackInfo=_),S&&(D.timingInfo=S),this.trigger({type:h,metadata:D})}})}trimBackBuffer_(e){const t=OR(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"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=RR(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=FR(e,this.sourceType_);if(t&&(t.severity==="warn"?Be.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 ${Zl(e)}`);return}this.logger_(`Appended ${Zl(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"} ${Zl(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.duratione.toUpperCase())},UR=["video","audio"],ly=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},zR=(n,e)=>{for(let t=0;t{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"||ly(n,e))){if(i.type!==n){if(t=zR(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}}},sk=(n,e)=>{const t=e[`${n}Buffer`],i=rk(n);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[n]=null,e[`${n}Buffer`]=null)},Xs=(n,e)=>n&&e&&Array.prototype.indexOf.call(n.sourceBuffers,e)!==-1,is={appendBuffer:(n,e,t)=>(i,a)=>{const l=a[`${i}Buffer`];if(Xs(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===jS?"(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(Xs(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`];Xs(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){Be.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){Be.log.warn("Failed to set media source duration",t)}},abort:()=>(n,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${n}Buffer`];if(Xs(e.mediaSource,t)){e.logger_(`calling abort on ${n}Buffer`);try{t.abort()}catch(i){Be.log.warn(`Failed to abort on ${n}Buffer`,i)}}},addSourceBuffer:(n,e)=>t=>{const i=rk(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(sk(n,e),!!Xs(e.mediaSource,t)){e.logger_(`Removing ${n}Buffer with codec ${e.codecs[n]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Be.log.warn(`Failed to removeSourceBuffer ${n}Buffer`,i)}}},changeType:n=>(e,t)=>{const i=t[`${e}Buffer`],a=_u(n);if(!Xs(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=Be.Error.StreamingCodecsChangeError,f.error=g,g.metadata=f,t.error_=g,t.trigger("error"),Be.log.warn(`Failed to changeType on ${e}Buffer`,g)}}},rs=({type:n,sourceUpdater:e,action:t,doneFn:i,name:a})=>{e.queue.push({type:n,action:t,doneFn:i,name:a}),gu(n,e)},b_=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=ej(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 ak extends Be.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_=b_("video",this),this.onAudioUpdateEnd_=b_("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){rs({type:"mediaSource",sourceUpdater:this,action:is.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){rs({type:e,sourceUpdater:this,action:is.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Be.log.error("removeSourceBuffer is not supported!");return}rs({type:"mediaSource",sourceUpdater:this,action:is.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Be.browser.IS_FIREFOX&&ue.MediaSource&&ue.MediaSource.prototype&&typeof ue.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return ue.SourceBuffer&&ue.SourceBuffer.prototype&&typeof ue.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Be.log.error("changeType is not supported!");return}rs({type:e,sourceUpdater:this,action:is.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(rs({type:a,sourceUpdater:this,action:is.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 Xs(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ur()}videoBuffered(){return Xs(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ur()}buffered(){const e=Xs(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Xs(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():nj(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Aa){rs({type:"mediaSource",sourceUpdater:this,action:is.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Aa){typeof e!="string"&&(e=void 0),rs({type:"mediaSource",sourceUpdater:this,action:is.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Aa){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}rs({type:"audio",sourceUpdater:this,action:is.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Aa){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}rs({type:"video",sourceUpdater:this,action:is.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(ly("audio",this)||ly("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(rs({type:"audio",sourceUpdater:this,action:is.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(rs({type:"video",sourceUpdater:this,action:is.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&rs({type:"audio",sourceUpdater:this,action:is.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&rs({type:"video",sourceUpdater:this,action:is.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),UR.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>sk(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const v_=n=>decodeURIComponent(escape(String.fromCharCode.apply(null,n))),$R=n=>{const e=new Uint8Array(n);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},x_=new Uint8Array(` `.split("").map(n=>n.charCodeAt(0)));class HR extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qR extends oy{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 ur();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return ur([[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=x_.byteLength+e.bytes.byteLength,u=new Uint8Array(l);u.set(e.bytes),u.set(x_,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===Js.TIMEOUT&&this.handleTimeout_(),e.code===Js.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 ue.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:Be.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 ue.VTTCue(h.startTime,h.endTime,h.text):h)}),ER(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 ue.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 ue.WebVTT!="function")throw new HR;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof ue.TextDecoder=="function"?t=new ue.TextDecoder("utf8"):(t=ue.WebVTT.StringDecoder(),i=!0);const a=new ue.WebVTT.Parser(ue,ue.vttjs,t);if(a.oncue=e.cues.push.bind(e.cues),a.ontimestampmap=u=>{e.timestampmap=u},a.onparsingerror=u=>{Be.log.warn("Error encountered when parsing cues: "+u.message)},e.segment.map){let u=e.segment.map.bytes;i&&(u=v_(u)),a.parse(u)}let l=e.bytes;i&&(l=v_(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/ul.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*ul.ONE_SECOND_IN_TS;const a=t*ul.ONE_SECOND_IN_TS;let l;for(a4294967296;)i+=l;return i/ul.ONE_SECOND_IN_TS}}const VR=function(n,e){const t=n.cues;for(let i=0;i=a.adStartTime&&e<=a.adEndTime)return a}return null},GR=function(n,e,t=0){if(!n.segments)return;let i=t,a;for(let l=0;l=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class ok{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,D=!!(_&&_.segmentSyncInfo&&_.segmentSyncInfo.isAppended),R=new __({start:S,end:C,appended:D,segmentIndex:g});f.syncInfo=R;let E=u;const B=(f.parts||[]).map((G,Y)=>{const q=E,se=E+G.duration,Q=!!(_&&_.partsSyncInfo&&_.partsSyncInfo[Y]&&_.partsSyncInfo[Y].isAppended),K=new __({start:q,end:se,appended:Q,segmentIndex:g,partIndex:Y});return E=se,l+=`Media Sequence: ${h}.${Y} | Range: ${q} --> ${se} | Appended: ${Q} `,G.syncInfo=K,K});a.set(h,new KR(R,B)),l+=`${ik(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${C} | Appended: ${D} `,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(et!==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=Zg(e);a=a||0;for(let f=0;f{let l=null,u=null;a=a||0;const h=Zg(e);for(let f=0;f=D)&&(u=D,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=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 XR extends Be.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new ok,i=new w_(t),a=new w_(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 mg.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[_],D=S,R=D+C.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${_}. Time: [${D} -> ${R}]}`),a>=D&&a0&&(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;hWR){Be.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||hf){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 YR extends Be.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 QR=GS(KS(function(){var n=(function(){function E(){this.listeners={}}var B=E.prototype;return B.on=function(Y,q){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push(q)},B.off=function(Y,q){if(!this.listeners[Y])return!1;var se=this.listeners[Y].indexOf(q);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(se,1),se>-1},B.trigger=function(Y){var q=this.listeners[Y];if(q)if(arguments.length===2)for(var se=q.length,Q=0;Q>7)*283)^se]=se;for(Q=K=0;!Y[Q];Q^=k||1,K=re[K]||1)for(V=K^K<<1^K<<2^K<<3^K<<4,V=V>>8^V&255^99,Y[Q]=V,q[V]=Q,te=O[j=O[k=O[Q]]],he=te*16843009^j*65537^k*257^Q*16843008,ne=O[V]*257^V*16843008,se=0;se<4;se++)B[se][Q]=ne=ne<<24^ne>>>8,G[se][V]=he=he<<24^he>>>8;for(se=0;se<5;se++)B[se]=B[se].slice(0),G[se]=G[se].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 G,Y,q;const se=this._tables[0][4],Q=this._tables[1],K=B.length;let O=1;if(K!==4&&K!==6&&K!==8)throw new Error("Invalid aes key size");const re=B.slice(0),k=[];for(this._key=[re,k],G=K;G<4*K+28;G++)q=re[G-1],(G%K===0||K===8&&G%K===4)&&(q=se[q>>>24]<<24^se[q>>16&255]<<16^se[q>>8&255]<<8^se[q&255],G%K===0&&(q=q<<8^q>>>24^O<<24,O=O<<1^(O>>7)*283)),re[G]=re[G-K]^q;for(Y=0;G;Y++,G--)q=re[Y&3?G:G-4],G<=4||Y<4?k[Y]=q:k[Y]=Q[0][se[q>>>24]]^Q[1][se[q>>16&255]]^Q[2][se[q>>8&255]]^Q[3][se[q&255]]}decrypt(B,G,Y,q,se,Q){const K=this._key[1];let O=B^K[0],re=q^K[1],k=Y^K[2],j=G^K[3],te,V,ne;const he=K.length/4-2;let ae,z=4;const P=this._tables[1],Z=P[0],ee=P[1],fe=P[2],I=P[3],pe=P[4];for(ae=0;ae>>24]^ee[re>>16&255]^fe[k>>8&255]^I[j&255]^K[z],V=Z[re>>>24]^ee[k>>16&255]^fe[j>>8&255]^I[O&255]^K[z+1],ne=Z[k>>>24]^ee[j>>16&255]^fe[O>>8&255]^I[re&255]^K[z+2],j=Z[j>>>24]^ee[O>>16&255]^fe[re>>8&255]^I[k&255]^K[z+3],z+=4,O=te,re=V,k=ne;for(ae=0;ae<4;ae++)se[(3&-ae)+Q]=pe[O>>>24]<<24^pe[re>>16&255]<<16^pe[k>>8&255]<<8^pe[j&255]^K[z++],te=O,O=re,re=k,k=j,j=te}}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,G){const Y=new Int32Array(E.buffer,E.byteOffset,E.byteLength>>2),q=new a(Array.prototype.slice.call(B)),se=new Uint8Array(E.byteLength),Q=new Int32Array(se.buffer);let K,O,re,k,j,te,V,ne,he;for(K=G[0],O=G[1],re=G[2],k=G[3],he=0;he{const Y=E[G];C(Y)?B[G]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:B[G]=Y}),B};self.onmessage=function(E){const B=E.data,G=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),Y=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),q=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(G,Y,q,function(se,Q){self.postMessage(R({source:B.source,decrypted:Q}),[Q.buffer])})}}));var ZR=VS(QR);const JR=n=>{let e=n.default?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},lk=(n,e)=>{n.abort(),n.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},uy=(n,e)=>{e.activePlaylistLoader=n,n.load()},e8=(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,lk(t,a),!(!u||u.isMainPlaylist))){if(!u.playlistLoader){h&&i.resetEverything();return}t.resyncLoader(),uy(u.playlistLoader,a)}},t8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},n8=(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,lk(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){uy(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),uy(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}Be.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;Be.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},T_={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))}},i8={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=Ed(_.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 D in u[n][C]){let R=u[n][C][D],E;if(S?(g(`AUDIO group '${C}' label '${D}' is a main playlist`),R.isMainPlaylist=!0,E=null):i==="vhs-json"&&R.playlists?E=new su(R.playlists[0],t,l):R.resolvedUri?E=new su(R.resolvedUri,t,l):R.playlists&&i==="dash"?E=new ry(R.playlists[0],t,l,_):E=null,R=ri({id:D,playlistLoader:E},R),T_[n](n,R.playlistLoader,e),h[C].push(R),typeof f[D]>"u"){const B=new Be.AudioTrack({id:D,kind:JR(R),enabled:!1,language:R.language,default:R.default,label:D});f[D]=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 D=h[n][S][C],R;if(a==="hls")R=new su(D.resolvedUri,i,u);else if(a==="dash"){if(!D.playlists.filter(B=>B.excludeUntil!==1/0).length)return;R=new ry(D.playlists[0],i,u,_)}else a==="vhs-json"&&(R=new su(D.playlists?D.playlists[0]:D.resolvedUri,i,u));if(D=ri({id:C,playlistLoader:R},D),T_[n](n,D.playlistLoader,e),f[S].push(D),typeof g[C]>"u"){const E=t.addRemoteTextTrack({id:C,kind:"subtitles",default:D.default&&D.autoselect,language:D.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}}}}},uk=(n,e)=>{for(let t=0;tt=>{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&&Ed(e.main))for(let f=0;f"u"?u:t===null||!u?null:u.filter(f=>f.id===t.id)[0]||null},s8={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}},a8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},o8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{i8[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=r8(g,n),e[g].activeTrack=s8[g](g,n),e[g].onGroupChanged=e8(g,n),e[g].onGroupChanging=t8(g,n),e[g].onTrackChanged=n8(g,n),e[g].getActiveGroup=a8(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])},l8=()=>{const n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{n[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Aa,activeTrack:Aa,getActiveGroup:Aa,onGroupChanged:Aa,onTrackChanged:Aa,lastTrack_:null,logger_:xs(`MediaGroups[${e}]`)}}),n};class S_{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 u8 extends Be.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new S_,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:Be.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 ue.URL(e),i=new ue.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(ue.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new ue.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_=ue.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){ue.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 S_}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 c8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},d8=10;let yo;const h8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],f8=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},p8=function({currentPlaylist:n,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:u,bufferBasedABR:h,log:f}){if(!i)return Be.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=Zy(e,t),C=h?or.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:or.MAX_BUFFER_LOW_WATER_LINE;if(uR)&&S>=a){let E=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(E+=` and next bandwidth > current bandwidth (${D} > ${R})`),f(E),!0}return f(`not ${g} as no switching criteria met`),!1};class m8 extends Be.EventTarget{constructor(e){super(),this.fastQualityChange_=c8(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:D,captionServices:R,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),yo=u,this.bufferBasedABR=!!C,this.leastPixelDiffSelector=!!D,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_=l8(),E&&ue.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new ue.ManagedMediaSource,this.usingManagedMediaSource_=!0,Be.log("Using ManagedMediaSource")):ue.MediaSource&&(this.mediaSource=new ue.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_=ur(),this.hasPlayed_=!1,this.syncController_=new XR(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ZR,this.sourceUpdater_=new ak(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new YR,this.keyStatusMap_=new Map;const G={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:R,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 ry(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 oy(ri(G,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new oy(ri(G,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qR(ri(G,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((se,Q)=>{function K(){a.off("vttjserror",O),se()}function O(){a.off("vttjsloaded",K),Q()}a.one("vttjsloaded",K),a.one("vttjserror",O),a.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new u8(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_())),h8.forEach(se=>{this[se+"_"]=f8.bind(this,se)}),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 q=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(q,()=>{const se=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-se,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_=ue.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(ue.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{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Jg(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()),o8({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;Jg(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"}),yo.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 p8({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:d8}))});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(){})}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=yo.Playlist.playlistEnd(e,i),l=this.tech_.currentTime(),u=this.tech_.buffered();if(!u.length)return a-l<=Zs;const h=u.end(u.length-1);return h-l<=Zs&&a-h<=Zs}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 Be.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 R=this.pathwayAttribute_(e),E=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(R),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(R)},E);return}let D=!1;a.forEach(R=>{if(R===e)return;const E=R.excludeUntil;typeof E<"u"&&E!==1/0&&(D=!0,delete R.excludeUntil)}),D&&(Be.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_:Be.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:yo.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=yo.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),_=Math.max(h,f-g);return ur([[h,_]])}const l=this.syncController_.getExpiredTime(i,this.duration());if(l===null)return null;const u=yo.Playlist.seekable(i,l,yo.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:ur([[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 [${vS(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.duration0&&(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||iD),e.main.isMuxed&&(a.video+=`,${i.audio||e.main.audioCodec||f2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||l)&&(a.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||f2,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_):Xm(_),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=(Ws(this.sourceUpdater_.codecs[_]||"")[0]||{}).type,C=(Ws(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&&!Xm(l.audio)&&!nd(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!Xm(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=gd(Ws(e)),l=a_(a),u=a.video&&Ws(a.video)[0]||null,h=a.audio&&Ws(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=a_(S);if(!(!S.audio&&!S.video)){if(C!==l&&_.push(`codec count "${C}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const D=S.video&&Ws(S.video)[0]||null,R=S.audio&&Ws(S.audio)[0]||null;D&&u&&D.type.toLowerCase()!==u.type.toLowerCase()&&_.push(`video codec "${D.type}" !== "${u.type}"`),R&&h&&R.type.toLowerCase()!==h.type.toLowerCase()&&_.push(`audio codec "${R.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)),GR(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=or.GOAL_BUFFER_LENGTH,i=or.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,or.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=or.BUFFER_LOW_WATER_LINE,i=or.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,or.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,or.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return or.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){p_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),kR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();p_(this.inbandTextTracks_,e,this.tech_),wR({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,Be.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:$R(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 g8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=eb(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 y8{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=g8(e.playlists,t.id,l)}}const b8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=Ed(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!eb(i)).map((i,a)=>new y8(n,i,i.id)):[]}},k_=["seeking","seeked","pause","playing","error"];class v8 extends Be.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(k_,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(k_,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_&&ue.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&ue.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=ue.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=rj(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:cl(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+Zs>=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(ur([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 R=t.start(0);l=R+(R===t.end(0)?0:Zs)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${vS(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-Qs)*2,C=[f,g];for(let R=0;R ${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=Qh(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)+Zs;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&&t2)return{start:l,end:u}}return null}}const x8={errorInterval:30,getSource(n){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return n(t)}},ck=function(n,e){let t=0,i=0;const a=ri(x8,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{Object.defineProperty(Ii,n,{get(){return Be.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),or[n]},set(e){if(Be.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Be.log.warn(`value of Vhs.${n} must be greater than or equal to 0`);return}or[n]=e}})});const hk="videojs-vhs",fk=function(n,e){const t=e.media();let i=-1;for(let a=0;a{n.addQualityLevel(t)}),fk(n,e.playlists)};Ii.canPlaySource=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const C8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=gd(Ws(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)},A8=(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},[]),N8=({player:n,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!n.eme.initializeMediaKeys)return Promise.resolve();const a=t?i.concat([t]):i,l=A8(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)])},D8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=C8(e,t,i);return a?(n.currentSource().keySystems=a,a&&!n.eme?(Be.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},pk=()=>{if(!ue.localStorage)return null;const n=ue.localStorage.getItem(hk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},M8=n=>{if(!ue.localStorage)return!1;let e=pk();e=e?ri(e,n):n;try{ue.localStorage.setItem(hk,JSON.stringify(e))}catch{return!1}return e},j8=n=>n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n,mk=(n,e)=>{n._requestCallbackSet||(n._requestCallbackSet=new Set),n._requestCallbackSet.add(e)},gk=(n,e)=>{n._responseCallbackSet||(n._responseCallbackSet=new Set),n._responseCallbackSet.add(e)},yk=(n,e)=>{n._requestCallbackSet&&(n._requestCallbackSet.delete(e),n._requestCallbackSet.size||delete n._requestCallbackSet)},bk=(n,e)=>{n._responseCallbackSet&&(n._responseCallbackSet.delete(e),n._responseCallbackSet.size||delete n._responseCallbackSet)};Ii.supportsNativeHls=(function(){if(!_t||!_t.createElement)return!1;const n=_t.createElement("video");return Be.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})();Ii.supportsNativeDash=(function(){return!_t||!_t.createElement||!Be.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(_t.createElement("video").canPlayType("application/dash+xml"))})();Ii.supportsTypeNatively=n=>n==="hls"?Ii.supportsNativeHls:n==="dash"?Ii.supportsNativeDash:!1;Ii.isSupported=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ii.xhr.onRequest=function(n){mk(Ii.xhr,n)};Ii.xhr.onResponse=function(n){gk(Ii.xhr,n)};Ii.xhr.offRequest=function(n){yk(Ii.xhr,n)};Ii.xhr.offResponse=function(n){bk(Ii.xhr,n)};const R8=Be.getComponent("Component");class vk extends R8{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=Be.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(_t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],a=>{const l=_t.fullscreenElement||_t.webkitFullscreenElement||_t.mozFullScreenElement||_t.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=pk();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=or.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===or.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=j8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ii,this.options_.sourceType=Uw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new m8(this.options_);const i=ri({liveRangeSafeTimeDelta:Zs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new v8(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const l=Be.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?Ii.movingAverageBandwidthSelector(.55):Ii.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Ii.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=ue.navigator.connection||ue.navigator.mozConnection||ue.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(){Be.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:()=>cl(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:()=>cl(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&&M8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{b8(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_=ue.URL.createObjectURL(this.playlistController_.mediaSource),(Be.browser.IS_ANY_SAFARI||Be.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"),N8({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=D8({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=Be.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{E8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{fk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":dk,"mux.js":w8,"mpd-parser":T8,"m3u8-parser":S8,"aes-decrypter":k8}}version(){return this.constructor.version()}canChangeType(){return ak.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_&&ue.URL.revokeObjectURL&&(ue.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Bj({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return HS({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=>{mk(this.xhr,e)},this.xhr.onResponse=e=>{gk(this.xhr,e)},this.xhr.offRequest=e=>{yk(this.xhr,e)},this.xhr.offResponse=e=>{bk(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:dk,canHandleSource(n,e={}){const t=ri(Be.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(Be.options,t);return e.vhs=new vk(n,e,i),e.vhs.xhr=PS(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=Uw(n);if(!t)return"";const i=Vf.getOverrideNative(e);return!Ii.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(n={}){const{vhs:e={}}=n,t=!(Be.browser.IS_ANY_SAFARI||Be.browser.IS_IOS),{overrideNative:i=t}=e;return i}},O8=()=>nd("avc1.4d400d,mp4a.40.2",!0);O8()&&Be.getTech("Html5").registerSourceHandler(Vf,0);Be.VhsHandler=vk;Be.VhsSourceHandler=Vf;Be.Vhs=Ii;Be.use||Be.registerComponent("Vhs",Ii);Be.options.vhs=Be.options.vhs||{};(!Be.getPlugin||!Be.getPlugin("reloadSourceOnError"))&&Be.registerPlugin("reloadSourceOnError",_8);const L8="",rl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${L8}${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 rb({src:n,muted:e=Sf,className:t}){const i=m.useRef(null),[a,l]=m.useState(!1),[u,h]=m.useState(null);return m.useEffect(()=>{let f=!1,g=null;const _=i.current;if(!_)return;l(!1),h(null),ud(_,{muted:e});const S=()=>{try{_.pause(),_.removeAttribute("src"),_.load()}catch{}};S(),_.src=n,_.load(),_.play().catch(()=>{});let C=Date.now();const D=()=>{C=Date.now()};_.addEventListener("timeupdate",D),g=window.setInterval(()=>{f||!_.paused&&Date.now()-C>12e3&&(S(),_.src=n,_.load(),_.play().catch(()=>{}),C=Date.now())},4e3);const R=()=>{l(!0)};return _.addEventListener("error",R),()=>{f=!0,g&&window.clearInterval(g),g=null,_.removeEventListener("timeupdate",D),_.removeEventListener("error",R),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 ps=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",sb=n=>n.startsWith("HOT ")?n.slice(4):n,I8=n=>(n||"").trim().toLowerCase(),B8=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 P8(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 F8(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=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function E_(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 ef=(...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 U8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function z8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function $8(n){const e=ps(n||""),t=sb(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 H8=n=>{const e=ps(n||""),t=sb(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},q8=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 Ta(...n){return n.filter(Boolean).join(" ")}function V8(n){const[e,t]=m.useState(!1);return m.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 G8(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 K8({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:D,onToggleLike:R,onToggleWatch:E,onStopJob:B,startMuted:G=HN,startAtSec:Y=0}){const q=m.useMemo(()=>ps(n.output?.trim()||"")||n.id,[n.output,n.id]),se=m.useMemo(()=>ps(n.output?.trim()||""),[n.output]),Q=m.useMemo(()=>ps(n.output?.trim()||""),[n.output]),K=m.useMemo(()=>F8(q8(n)),[n]),O=n,[re,k]=m.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[j,te]=m.useState(()=>n.status==="running"),[V,ne]=m.useState(()=>({h:0,fps:null})),he=n.status==="running",[ae,z]=m.useState(!1),P=he&&ae,Z=m.useMemo(()=>(Q||"").replace(/\.[^.]+$/,""),[Q]),ee=m.useMemo(()=>he?n.id:Z||n.id,[he,n.id,Z]);m.useEffect(()=>{if(he||re>0)return;const L=ps(n.output?.trim()||"");if(!L)return;let $=!0;const xe=new AbortController;return(async()=>{try{const Te=rl(`/api/record/done/meta?file=${encodeURIComponent(L)}`),Ve=await gg(Te,{signal:xe.signal,cache:"no-store"});if(!Ve.ok)return;const qe=await Ve.json(),U=Number(qe?.durationSeconds||qe?.meta?.durationSeconds||0)||0;if(!$||U<=0)return;k(U);const W=et.current;if(W&&!W.isDisposed?.())try{W.__fullDurationSec=U,W.trigger?.("durationchange"),W.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{$=!1,xe.abort()}},[he,re,n.output]);const fe=se.startsWith("HOT "),I=m.useMemo(()=>{const L=(a||"").trim();return L||H8(n.output)},[a,n.output]),pe=m.useMemo(()=>sb(se),[se]),ke=m.useMemo(()=>{const L=Number(re||0)||0;return L>0?P8(L*1e3):"—"},[re]),ye=m.useMemo(()=>{const L=$8(n.output);if(L)return E_(L);const $=O.startedAt??O.endedAt??O.createdAt??O.fileCreatedAt??O.ctime??null,xe=$?new Date($):null;return E_(xe&&Number.isFinite(xe.getTime())?xe:null)},[n.output,O.startedAt,O.endedAt,O.createdAt,O.fileCreatedAt,O.ctime]),me=m.useMemo(()=>I8((a||I||"").trim()),[a,I]),pt=m.useMemo(()=>{const L=l?.[me];return B8(L?.tags)},[l,me]),We=m.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(ee)}&file=preview.webp`),[ee]),_e=m.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(ee)}&play=1&file=index_hq.m3u8`),[ee]),[Ye,wt]=m.useState(We);m.useEffect(()=>{wt(We)},[We]);const je=m.useMemo(()=>ef(V.h,O.videoHeight,O.height,O.meta?.height),[V.h,O.videoHeight,O.height,O.meta?.height]),Se=m.useMemo(()=>ef(V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate),[V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate]),[Je,tt]=m.useState(null),ot=m.useMemo(()=>z8(Je??je),[Je,je]),dt=m.useMemo(()=>U8(Se),[Se]);m.useEffect(()=>{const L=$=>$.key==="Escape"&&t();return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t]);const Ut=m.useMemo(()=>{const L=`/api/preview?id=${encodeURIComponent(ee)}&file=index_hq.m3u8&play=1`;return rl(he?`${L}&t=${Date.now()}`:L)},[ee,he]);m.useEffect(()=>{if(!he){z(!1);return}let L=!0;const $=new AbortController;return z(!1),(async()=>{for(let Te=0;Te<120&&L&&!$.signal.aborted;Te++){try{const Ve=await gg(Ut,{method:"GET",cache:"no-store",signal:$.signal,headers:{"cache-control":"no-cache"}});if(Ve.ok){const qe=await Ve.text(),U=qe.includes("#EXTM3U"),W=/#EXTINF:/i.test(qe)||/\.ts(\?|$)/i.test(qe)||/\.m4s(\?|$)/i.test(qe);if(U&&W){L&&z(!0);return}}}catch{}await new Promise(Ve=>setTimeout(Ve,500))}})(),()=>{L=!1,$.abort()}},[he,Ut]);const Ge=m.useCallback(L=>{const $=new URLSearchParams;return L.file&&$.set("file",L.file),L.id&&$.set("id",L.id),rl(`/api/record/video?${$.toString()}`)},[]),Ie=m.useMemo(()=>{if(he)return{src:"",type:""};if(!j)return{src:"",type:""};const L=ps(n.output?.trim()||"");if(L){const $=L.toLowerCase().split(".").pop(),xe=$==="mp4"?"video/mp4":$==="ts"?"video/mp2t":"application/octet-stream";return{src:Ge({file:L}),type:xe}}return{src:Ge({id:n.id}),type:"video/mp4"}},[he,j,n.output,n.id,Ge]),Ze=m.useRef(null),et=m.useRef(null),ft=m.useRef(null),[mt,de]=m.useState(!1),ze=m.useCallback(()=>{const L=et.current;if(!L||L.isDisposed?.())return;const $=typeof L.videoHeight=="function"?L.videoHeight():0;typeof $=="number"&&$>0&&Number.isFinite($)&&tt($)},[]),Le=m.useCallback(()=>{try{const L=et.current?.tech?.(!0)?.el?.()||et.current?.el?.()?.querySelector?.("video.vjs-tech")||ft.current;if(!L||!(L instanceof HTMLVideoElement))return null;const $=Number(L.videoWidth||0),xe=Number(L.videoHeight||0);if(!Number.isFinite($)||!Number.isFinite(xe)||$<=0||xe<=0)return null;let Te=Mn.current;Te||(Te=document.createElement("canvas"),Mn.current=Te);const qe=Math.min(1,640/$),U=Math.max(1,Math.round($*qe)),W=Math.max(1,Math.round(xe*qe));Te.width!==U&&(Te.width=U),Te.height!==W&&(Te.height=W);const le=Te.getContext("2d",{alpha:!1});return le?(le.drawImage(L,0,0,U,W),Te.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),Ae=m.useMemo(()=>ps(n.output?.trim()||"")||n.id,[n.output,n.id]),Pe=m.useMemo(()=>{const L=Number(Y);return Number.isFinite(L)&&L>=0?L:0},[Y]),Qe=m.useRef("");m.useEffect(()=>{if(he){te(!0);return}const L=ps(n.output?.trim()||"");if(!L){te(!0);return}let $=!0;const xe=new AbortController;return te(!1),(async()=>{for(let Te=0;Te<80&&$&&!xe.signal.aborted;Te++){try{const Ve=rl(`/api/record/done/meta?file=${encodeURIComponent(L)}`),qe=await gg(Ve,{signal:xe.signal,cache:"no-store"});if(qe.ok){const U=await qe.json(),W=!!U?.metaExists,le=Number(U?.durationSeconds||0)||0,be=Number(U?.height||0)||0,Ce=Number(U?.fps||0)||0;if(le>0){k(le);const Oe=et.current;if(Oe&&!Oe.isDisposed?.())try{Oe.__fullDurationSec=le,Oe.trigger?.("durationchange"),Oe.trigger?.("timeupdate")}catch{}}if(be>0&&ne({h:be,fps:Ce>0?Ce:null}),W){te(!0);return}}}catch{}await new Promise(Ve=>setTimeout(Ve,250))}$&&te(!0)})(),()=>{$=!1,xe.abort()}},[he,Ae,n.output]);const[,St]=m.useState(0);m.useEffect(()=>{if(typeof window>"u")return;const L=window.visualViewport;if(!L)return;const $=()=>St(xe=>xe+1);return $(),L.addEventListener("resize",$),L.addEventListener("scroll",$),window.addEventListener("resize",$),window.addEventListener("orientationchange",$),()=>{L.removeEventListener("resize",$),L.removeEventListener("scroll",$),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$)}},[]);const[Ot,Tt]=m.useState(30),[an,Nt]=m.useState(null),Lt=!e,vt=V8("(min-width: 640px)"),It=Lt&&vt,yn=e||It,$n="player_window_v1",kt=420,Bn=280,at=12,N=320,F=200;m.useEffect(()=>{if(!mt)return;const L=et.current;if(!L||L.isDisposed?.())return;const $=L.el();if(!$)return;const xe=$.querySelector(".vjs-control-bar");if(!xe)return;const Te=()=>{const qe=Math.round(xe.getBoundingClientRect().height||0);qe>0&&Tt(qe)};Te();let Ve=null;return typeof ResizeObserver<"u"&&(Ve=new ResizeObserver(Te),Ve.observe(xe)),window.addEventListener("resize",Te),()=>{window.removeEventListener("resize",Te),Ve?.disconnect()}},[mt,e]),m.useEffect(()=>de(!0),[]),m.useEffect(()=>{if(!yn){Nt(null);return}let L=document.getElementById("player-root");L||(L=document.createElement("div"),L.id="player-root");let $=null;if(vt){const xe=Array.from(document.querySelectorAll("dialog[open]"));$=xe.length?xe[xe.length-1]:null}$=$??document.body,$.appendChild(L),L.style.position="relative",L.style.zIndex="2147483647",Nt(L)},[vt,yn]),m.useEffect(()=>{const L=et.current;if(!L||L.isDisposed?.()||he||(G8(L),!ps(n.output?.trim()||"")))return;const xe=Number(re||0)||0;return xe>0&&(L.__fullDurationSec=xe),L.__serverSeekAbs=Te=>{const Ve=Math.max(0,Number(Te)||0);try{L.__origCurrentTime?.(Ve);try{L.trigger?.("timeupdate")}catch{}}catch{try{L.currentTime?.(Ve)}catch{}}},()=>{try{delete L.__serverSeekAbs}catch{}}},[n.output,he]),m.useLayoutEffect(()=>{if(!mt||!Ze.current||et.current||he||!j)return;const L=document.createElement("video");L.className="video-js vjs-big-play-centered w-full h-full",L.setAttribute("playsinline","true"),Ze.current.appendChild(L),ft.current=L;const $=Be(L,{autoplay:!0,muted:G,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 et.current=$,$.one("loadedmetadata",()=>{ze()}),$.userActive(!0),$.on("userinactive",()=>$.userActive(!0)),()=>{try{et.current&&(et.current.dispose(),et.current=null)}finally{ft.current&&(ft.current.remove(),ft.current=null)}}},[mt,G,he,j,je,ze]),m.useEffect(()=>{const L=et.current;if(!L||L.isDisposed?.())return;const $=L.el();$&&$.classList.toggle("is-live-download",!!P)},[P]);const ie=m.useCallback(()=>{const L=et.current;if(!(!L||L.isDisposed?.())){try{L.pause(),L.reset?.()}catch{}try{L.src({src:"",type:"video/mp4"}),L.load?.()}catch{}}},[]),Me=m.useCallback(L=>{const $=et.current;if(!$||$.isDisposed?.())return;const xe=Math.max(0,Number(L)||0);try{const Te=Number($.duration?.()??0),Ve=Number.isFinite(Te)&&Te>0?Math.max(0,Te-.05):xe;$.currentTime(Math.min(xe,Ve)),$.trigger?.("timeupdate")}catch{try{$.currentTime(xe)}catch{}}},[]);m.useEffect(()=>{if(!mt)return;if(!he&&!j){ie();return}const L=et.current;if(!L||L.isDisposed?.())return;const $=L.currentTime()||0;if(L.muted(G),!Ie.src){try{L.pause(),L.reset?.(),L.error(null)}catch{}return}L.__timeOffsetSec=0;const xe=Number(re||0)||0;L.__fullDurationSec=xe;const Te=String(L.currentSrc?.()||"");if(Qe.current="",Te&&Te===Ie.src){const qe=L.play?.();qe&&typeof qe.catch=="function"&&qe.catch(()=>{});return}L.src({src:Ie.src,type:Ie.type});const Ve=()=>{const qe=L.play?.();qe&&typeof qe.catch=="function"&&qe.catch(()=>{})};L.one("loadedmetadata",()=>{if(L.isDisposed?.())return;ze();try{const U=Number(re||0)||0;U>0&&(L.__fullDurationSec=U)}catch{}try{L.playbackRate(1)}catch{}const qe=/mpegurl/i.test(Ie.type);if($>0&&!qe)try{const U=Number(L.__timeOffsetSec??0)||0,W=Math.max(0,$-U);L.__setRelativeTime?.(W)}catch{}try{L.trigger?.("timeupdate")}catch{}Ve()}),Ve()},[mt,he,j,Ie.src,Ie.type,G,ze,re,ie]),m.useEffect(()=>{if(!mt||he||!j||!Ie.src)return;const L=et.current;if(!L||L.isDisposed?.())return;if(!(Pe>0)){Qe.current="";return}const $=`${Ae}|${Ie.src}|${Pe.toFixed(3)}`;if(Qe.current===$)return;let xe=!1;const Te=()=>{if(xe)return;const W=et.current;if(!W||W.isDisposed?.())return;const le=String(W.currentSrc?.()||"");if(!le||le!==Ie.src)return;const be=W.tech?.(!0)?.el?.()||W.el?.()?.querySelector?.("video.vjs-tech");if(!((be instanceof HTMLVideoElement?Number(be.readyState||0):0)<1)){Me(Pe),Qe.current=$;try{const Oe=W.play?.();Oe&&typeof Oe.catch=="function"&&Oe.catch(()=>{})}catch{}}};if(Te(),Qe.current===$)return;const Ve=()=>Te();L.one?.("loadedmetadata",Ve),L.one?.("canplay",Ve),L.one?.("durationchange",Ve);const qe=window.setTimeout(Te,0),U=window.setTimeout(Te,120);return()=>{xe=!0,window.clearTimeout(qe),window.clearTimeout(U);try{L.off?.("loadedmetadata",Ve)}catch{}try{L.off?.("canplay",Ve)}catch{}try{L.off?.("durationchange",Ve)}catch{}}},[mt,he,j,Ie.src,Ae,Pe,Me]),m.useEffect(()=>{if(!mt)return;const L=et.current;if(!L||L.isDisposed?.())return;const $=()=>{n.status==="running"&&z(!1)};return L.on("error",$),()=>{try{L.off("error",$)}catch{}}},[mt,n.status]),m.useEffect(()=>{const L=et.current;!L||L.isDisposed?.()||queueMicrotask(()=>L.trigger("resize"))},[e]),m.useEffect(()=>{const L=$=>{const Te=($.detail?.file??"").trim();if(!Te)return;const Ve=ps(n.output?.trim()||"");Ve&&Ve===Te&&ie()};return window.addEventListener("player:release",L),()=>window.removeEventListener("player:release",L)},[n.output,ie]),m.useEffect(()=>{const L=$=>{const Te=($.detail?.file??"").trim();if(!Te)return;const Ve=ps(n.output?.trim()||"");Ve&&Ve===Te&&(ie(),t())};return window.addEventListener("player:close",L),()=>window.removeEventListener("player:close",L)},[n.output,ie,t]);const He=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const L=window.visualViewport;if(L&&Number.isFinite(L.width)&&Number.isFinite(L.height)){const Ve=Math.floor(L.width),qe=Math.floor(L.height),U=Math.floor(L.offsetLeft||0),W=Math.floor(L.offsetTop||0),le=Math.max(0,Math.floor(window.innerHeight-(L.height+L.offsetTop)));return{w:Ve,h:qe,ox:U,oy:W,bottomInset:le}}const $=document.documentElement,xe=$?.clientWidth||window.innerWidth,Te=$?.clientHeight||window.innerHeight;return{w:xe,h:Te,ox:0,oy:0,bottomInset:0}},gt=m.useRef(null);m.useEffect(()=>{if(typeof window>"u")return;const{w:L,h:$}=He();gt.current={w:L,h:$}},[]);const zt=m.useCallback(()=>{const L=n,$=ef(et.current?.videoWidth?.(),L.videoWidth,L.width,L.meta?.width)??0,xe=ef(Je,et.current?.videoHeight?.(),L.videoHeight,L.height,L.meta?.height)??0;return $>0&&xe>0?$/xe:16/9},[n,Je]),Jt=m.useCallback(L=>{if(typeof window>"u")return L;const $=zt(),xe=30,{w:Te,h:Ve}=He(),qe=Te-at*2,U=Math.max(1,Ve-at*2-xe),W=Math.max(1,F-xe);let le=Math.max(N,Math.min(L.w,qe)),be=le/$;beU&&(be=U,le=be*$),le>qe&&(le=qe,be=le/$);const Ce=Math.round(be+xe),Oe=Math.max(at,Math.min(L.x,Te-le-at)),ht=Math.max(at,Math.min(L.y,Ve-Ce-at));return{x:Oe,y:ht,w:Math.round(le),h:Ce}},[zt]),un=m.useCallback(()=>{if(typeof window>"u")return{x:at,y:at,w:kt,h:Bn};try{const U=window.localStorage.getItem($n);if(U){const W=JSON.parse(U);if(typeof W.x=="number"&&typeof W.y=="number"&&typeof W.w=="number"&&typeof W.h=="number")return Jt({x:W.x,y:W.y,w:W.w,h:W.h})}}catch{}const{w:L,h:$}=He(),xe=kt,Te=Bn,Ve=Math.max(at,L-xe-at),qe=Math.max(at,$-Te-at);return Jt({x:Ve,y:qe,w:xe,h:Te})},[Jt]),[Xt,pn]=m.useState(()=>un()),fn=It&&Xt.w<380,Kt=m.useCallback(L=>{if(!(typeof window>"u"))try{window.localStorage.setItem($n,JSON.stringify(L))}catch{}},[]),cn=m.useRef(Xt);m.useEffect(()=>{cn.current=Xt},[Xt]),m.useEffect(()=>{It&&pn(un())},[It,un]),m.useEffect(()=>{if(!It)return;const L=()=>{const $=gt.current,{w:xe,h:Te}=He();pn(Ve=>{if(!$)return Jt(Ve);const qe=24,U=Ve.x-at,W=$.w-at-(Ve.x+Ve.w),le=$.h-at-(Ve.y+Ve.h),be=Math.abs(U)<=qe,Ce=Math.abs(W)<=qe,Oe=Math.abs(le)<=qe;let ht=Jt(Ve);return Oe&&(ht={...ht,y:Math.max(at,Te-ht.h-at)}),Ce?ht={...ht,x:Math.max(at,xe-ht.w-at)}:be&&(ht={...ht,x:at}),Jt(ht)}),gt.current={w:xe,h:Te}};return gt.current=(()=>{const{w:$,h:xe}=He();return{w:$,h:xe}})(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[It,Jt]);const dn=m.useRef(null);m.useEffect(()=>{const L=et.current;if(!(!L||L.isDisposed?.()))return dn.current!=null&&cancelAnimationFrame(dn.current),dn.current=requestAnimationFrame(()=>{dn.current=null;try{L.trigger("resize")}catch{}}),()=>{dn.current!=null&&(cancelAnimationFrame(dn.current),dn.current=null)}},[It,Xt.w,Xt.h]);const[ln,qt]=m.useState(!1),[Rt,Dt]=m.useState(!1),[Cn,Mt]=m.useState(null),[Pn,Dn]=m.useState(null),Mn=m.useRef(null),Wt=m.useRef(null),Vn=m.useRef(null),Yn=m.useRef(null),jn=m.useCallback(L=>{const{w:$,h:xe}=He(),Te=at,Ve=$-L.w-at,qe=xe-L.h-at,W=L.x+L.w/2<$/2;return{...L,x:W?Te:Ve,y:qe}},[]),Qn=m.useCallback(L=>{const $=Yn.current;if(!$)return;const xe=L.clientX-$.sx,Te=L.clientY-$.sy,Ve=$.start,qe=Jt({x:Ve.x+xe,y:Ve.y+Te,w:Ve.w,h:Ve.h});Vn.current={x:qe.x,y:qe.y},Mt(jn(qe)),Wt.current==null&&(Wt.current=requestAnimationFrame(()=>{Wt.current=null;const U=Vn.current;U&&pn(W=>({...W,x:U.x,y:U.y}))}))},[Jt,jn]),mn=m.useCallback(()=>{Yn.current&&(Dt(!1),Mt(null),Wt.current!=null&&(cancelAnimationFrame(Wt.current),Wt.current=null),Yn.current=null,window.removeEventListener("pointermove",Qn),window.removeEventListener("pointerup",mn),pn(L=>{const $=jn(Jt(L));return queueMicrotask(()=>Kt($)),$}))},[Qn,jn,Jt,Kt]),Ri=m.useCallback(L=>{if(!It||ln||L.button!==0)return;L.preventDefault(),L.stopPropagation();const $=cn.current;Yn.current={sx:L.clientX,sy:L.clientY,start:$},Dt(!0);const xe=Le();Dn(xe),Mt(jn($)),window.addEventListener("pointermove",Qn),window.addEventListener("pointerup",mn)},[It,ln,Qn,mn,jn,Le]),Zn=m.useRef(null),Kn=m.useRef(null),ni=m.useRef(null),Si=m.useCallback(L=>{const $=ni.current;if(!$)return;const xe=L.clientX-$.sx,Te=L.clientY-$.sy,Ve=$.ratio,qe=$.dir.includes("w"),U=$.dir.includes("e"),W=$.dir.includes("n"),le=$.dir.includes("s");let be=$.start.w,Ce=$.start.h,Oe=$.start.x,ht=$.start.y;const{w:At,h:yt}=He(),rn=24,Yt=$.start.x+$.start.w,Rn=$.start.y+$.start.h,ui=Math.abs(At-at-Yt)<=rn,Kr=Math.abs(yt-at-Rn)<=rn,xn=ci=>{ci=Math.max(N,ci);let Fi=ci/Ve;return Fi{ci=Math.max(F,ci);let Fi=ci*Ve;return Fi=Math.abs(Te)){const Fi=U?$.start.w+xe:$.start.w-xe,{newW:_s,newH:Do}=xn(Fi);be=_s,Ce=Do}else{const Fi=le?$.start.h+Te:$.start.h-Te,{newW:_s,newH:Do}=Os(Fi);be=_s,Ce=Do}qe&&(Oe=$.start.x+($.start.w-be)),W&&(ht=$.start.y+($.start.h-Ce))}else if(U||qe){const ci=U?$.start.w+xe:$.start.w-xe,{newW:Fi,newH:_s}=xn(ci);be=Fi,Ce=_s,qe&&(Oe=$.start.x+($.start.w-be)),ht=Kr?$.start.y+($.start.h-Ce):$.start.y}else if(W||le){const ci=le?$.start.h+Te:$.start.h-Te,{newW:Fi,newH:_s}=Os(ci);be=Fi,Ce=_s,W&&(ht=$.start.y+($.start.h-Ce)),ui?Oe=$.start.x+($.start.w-be):Oe=$.start.x}const Ar=Jt({x:Oe,y:ht,w:be,h:Ce});Kn.current=Ar,Zn.current==null&&(Zn.current=requestAnimationFrame(()=>{Zn.current=null;const ci=Kn.current;ci&&pn(ci)}))},[Jt]),An=m.useCallback(()=>{ni.current&&(qt(!1),Mt(null),Dn(null),Zn.current!=null&&(cancelAnimationFrame(Zn.current),Zn.current=null),ni.current=null,window.removeEventListener("pointermove",Si),window.removeEventListener("pointerup",An),Kt(cn.current))},[Si,Kt]),Fn=m.useCallback(L=>$=>{if(!It||$.button!==0)return;$.preventDefault(),$.stopPropagation();const xe=cn.current;ni.current={dir:L,sx:$.clientX,sy:$.clientY,start:xe,ratio:xe.w/xe.h},qt(!0),window.addEventListener("pointermove",Si),window.addEventListener("pointerup",An)},[It,Si,An]),[Hn,ve]=m.useState(!1),[rt,ct]=m.useState(!1);m.useEffect(()=>{const L=window.matchMedia?.("(hover: hover) and (pointer: fine)"),$=()=>ve(!!L?.matches);return $(),L?.addEventListener?.("change",$),()=>L?.removeEventListener?.("change",$)},[]);const jt=It&&(rt||Rt||ln),[De,bt]=m.useState(!1);if(m.useEffect(()=>{n.status!=="running"&&bt(!1)},[n.id,n.status]),!mt||yn&&!an)return null;const xt="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",Ft=String(n.phase??"").toLowerCase(),$t=Ft==="stopping"||Ft==="remuxing"||Ft==="moving",Vt=!B||!he||$t||De,vn=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:he?c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Vt,title:$t||De?"Stoppe…":"Stop","aria-label":$t||De?"Stoppe…":"Stop",onClick:async L=>{if(L.preventDefault(),L.stopPropagation(),!Vt)try{bt(!0),await B?.(n.id)}finally{bt(!1)}},className:Ta("shadow-none shrink-0",It&&fn&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:$t||De?"Stoppe…":It&&fn?"Stop":"Stoppen"})}),c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,busy:$t||De,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):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||fe,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):void 0,onToggleHot:C?async L=>{ie(),await new Promise(xe=>setTimeout(xe,150)),await C(L),await new Promise(xe=>setTimeout(xe,0));const $=et.current;if($&&!$.isDisposed?.()){const xe=$.play?.();xe&&typeof xe.catch=="function"&&xe.catch(()=>{})}}:void 0,onKeep:_?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await _(L)}:void 0,onDelete:S?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await S(L)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),qn=e||It,Yi=he?"calc(4px + env(safe-area-inset-bottom))":`calc(${Ot+2}px + env(safe-area-inset-bottom))`,Gn="top-2",ki=e&&vt,Ei=c.jsx("div",{className:Ta("relative overflow-visible",e||It?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!It||!Hn||ct(!0)},onMouseLeave:()=>{!It||!Hn||ct(!1)},children:c.jsxs("div",{className:Ta("relative w-full h-full",It&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Ot}px`},children:[he?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(rb,{src:_e,muted:G,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:Ze,className:"absolute inset-0"}),c.jsxs("div",{className:Ta("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:Ta("absolute inset-x-2",Gn),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:ki?null:vn}),It?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:Ri,onClick:L=>{L.preventDefault(),L.stopPropagation()},className:Ta(xt,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",jt?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",Rt&&"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:xt,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(jA,{className:"h-5 w-5"}):c.jsx(OA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:xt,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"h-5 w-5"})})]})]})})]}),c.jsxs("div",{className:Ta("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:Yi},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white",children:I}),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:pe||q}),u||fe?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:[ot!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:ot}):null,he?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:ke}),K!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:K}):null]})]})]})}),si=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:Ye,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:I}),c.jsx("div",{className:"text-xs text-white/70 break-all",children:pe||q})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[he?c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Vt,title:$t||De?"Stoppe…":"Stop","aria-label":$t||De?"Stoppe…":"Stop",onClick:async L=>{if(L.preventDefault(),L.stopPropagation(),!Vt)try{bt(!0),await B?.(n.id)}finally{bt(!1)}},className:"shadow-none",children:$t||De?"Stoppe…":"Stoppen"}):null,c.jsx(Ds,{job:n,variant:"table",collapseToMenu:!1,busy:$t||De,isHot:u||fe,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):void 0,onToggleHot:C?async L=>{ie(),await new Promise(xe=>setTimeout(xe,150)),await C(L),await new Promise(xe=>setTimeout(xe,0));const $=et.current;if($&&!$.isDisposed?.()){const xe=$.play?.();xe&&typeof xe.catch=="function"&&xe.catch(()=>{})}}:void 0,onKeep:_?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await _(L)}:void 0,onDelete:S?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await S(L)}:void 0,order:he?["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:ot}),c.jsx("div",{className:"text-white/60",children:"FPS"}),c.jsx("div",{className:"font-medium",children:dt}),c.jsx("div",{className:"text-white/60",children:"Laufzeit"}),c.jsx("div",{className:"font-medium",children:ke}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:K}),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:pt.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:pt.map(L=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:L},L))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),mi=It&&Rt&&Cn?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:Cn.x-Xt.x,top:Cn.y-Xt.y,width:Cn.w,height:Cn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:Pn||Ye,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:I}),c.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[pe||q,u||fe?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:[ot!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:ot}):null,!he&&ke!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:ke}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,Pi=c.jsx(Ns,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:Ta("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",qn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":It?"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:[ki?si:null,Ei]})}),{w:Sn,h:Jn,ox:wn,oy:Ci,bottomInset:Oi}=He(),ei={left:wn+16,top:Ci+16,width:Math.max(0,Sn-32),height:Math.max(0,Jn-32)},Li=e?ei:It?{left:Xt.x,top:Xt.y,width:Xt.w,height:Xt.h}:void 0,we=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 (